app.js 1.8 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080
  1. /******/ (function(modules) { // webpackBootstrap
  2. /******/ // The module cache
  3. /******/ var installedModules = {};
  4. /******/
  5. /******/ // The require function
  6. /******/ function __webpack_require__(moduleId) {
  7. /******/
  8. /******/ // Check if module is in cache
  9. /******/ if(installedModules[moduleId]) {
  10. /******/ return installedModules[moduleId].exports;
  11. /******/ }
  12. /******/ // Create a new module (and put it into the cache)
  13. /******/ var module = installedModules[moduleId] = {
  14. /******/ i: moduleId,
  15. /******/ l: false,
  16. /******/ exports: {}
  17. /******/ };
  18. /******/
  19. /******/ // Execute the module function
  20. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  21. /******/
  22. /******/ // Flag the module as loaded
  23. /******/ module.l = true;
  24. /******/
  25. /******/ // Return the exports of the module
  26. /******/ return module.exports;
  27. /******/ }
  28. /******/
  29. /******/
  30. /******/ // expose the modules object (__webpack_modules__)
  31. /******/ __webpack_require__.m = modules;
  32. /******/
  33. /******/ // expose the module cache
  34. /******/ __webpack_require__.c = installedModules;
  35. /******/
  36. /******/ // define getter function for harmony exports
  37. /******/ __webpack_require__.d = function(exports, name, getter) {
  38. /******/ if(!__webpack_require__.o(exports, name)) {
  39. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  40. /******/ }
  41. /******/ };
  42. /******/
  43. /******/ // define __esModule on exports
  44. /******/ __webpack_require__.r = function(exports) {
  45. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  46. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  47. /******/ }
  48. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  49. /******/ };
  50. /******/
  51. /******/ // create a fake namespace object
  52. /******/ // mode & 1: value is a module id, require it
  53. /******/ // mode & 2: merge all properties of value into the ns
  54. /******/ // mode & 4: return value when already ns object
  55. /******/ // mode & 8|1: behave like require
  56. /******/ __webpack_require__.t = function(value, mode) {
  57. /******/ if(mode & 1) value = __webpack_require__(value);
  58. /******/ if(mode & 8) return value;
  59. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  60. /******/ var ns = Object.create(null);
  61. /******/ __webpack_require__.r(ns);
  62. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  63. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  64. /******/ return ns;
  65. /******/ };
  66. /******/
  67. /******/ // getDefaultExport function for compatibility with non-harmony modules
  68. /******/ __webpack_require__.n = function(module) {
  69. /******/ var getter = module && module.__esModule ?
  70. /******/ function getDefault() { return module['default']; } :
  71. /******/ function getModuleExports() { return module; };
  72. /******/ __webpack_require__.d(getter, 'a', getter);
  73. /******/ return getter;
  74. /******/ };
  75. /******/
  76. /******/ // Object.prototype.hasOwnProperty.call
  77. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  78. /******/
  79. /******/ // __webpack_public_path__
  80. /******/ __webpack_require__.p = "/";
  81. /******/
  82. /******/
  83. /******/ // Load entry module and return exports
  84. /******/ return __webpack_require__(__webpack_require__.s = 0);
  85. /******/ })
  86. /************************************************************************/
  87. /******/ ({
  88. /***/ "./node_modules/axios/index.js":
  89. /*!*************************************!*\
  90. !*** ./node_modules/axios/index.js ***!
  91. \*************************************/
  92. /*! no static exports found */
  93. /***/ (function(module, exports, __webpack_require__) {
  94. module.exports = __webpack_require__(/*! ./lib/axios */ "./node_modules/axios/lib/axios.js");
  95. /***/ }),
  96. /***/ "./node_modules/axios/lib/adapters/xhr.js":
  97. /*!************************************************!*\
  98. !*** ./node_modules/axios/lib/adapters/xhr.js ***!
  99. \************************************************/
  100. /*! no static exports found */
  101. /***/ (function(module, exports, __webpack_require__) {
  102. "use strict";
  103. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  104. var settle = __webpack_require__(/*! ./../core/settle */ "./node_modules/axios/lib/core/settle.js");
  105. var buildURL = __webpack_require__(/*! ./../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js");
  106. var buildFullPath = __webpack_require__(/*! ../core/buildFullPath */ "./node_modules/axios/lib/core/buildFullPath.js");
  107. var parseHeaders = __webpack_require__(/*! ./../helpers/parseHeaders */ "./node_modules/axios/lib/helpers/parseHeaders.js");
  108. var isURLSameOrigin = __webpack_require__(/*! ./../helpers/isURLSameOrigin */ "./node_modules/axios/lib/helpers/isURLSameOrigin.js");
  109. var createError = __webpack_require__(/*! ../core/createError */ "./node_modules/axios/lib/core/createError.js");
  110. module.exports = function xhrAdapter(config) {
  111. return new Promise(function dispatchXhrRequest(resolve, reject) {
  112. var requestData = config.data;
  113. var requestHeaders = config.headers;
  114. if (utils.isFormData(requestData)) {
  115. delete requestHeaders['Content-Type']; // Let the browser set it
  116. }
  117. var request = new XMLHttpRequest();
  118. // HTTP basic authentication
  119. if (config.auth) {
  120. var username = config.auth.username || '';
  121. var password = config.auth.password || '';
  122. requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
  123. }
  124. var fullPath = buildFullPath(config.baseURL, config.url);
  125. request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
  126. // Set the request timeout in MS
  127. request.timeout = config.timeout;
  128. // Listen for ready state
  129. request.onreadystatechange = function handleLoad() {
  130. if (!request || request.readyState !== 4) {
  131. return;
  132. }
  133. // The request errored out and we didn't get a response, this will be
  134. // handled by onerror instead
  135. // With one exception: request that using file: protocol, most browsers
  136. // will return status as 0 even though it's a successful request
  137. if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
  138. return;
  139. }
  140. // Prepare the response
  141. var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
  142. var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
  143. var response = {
  144. data: responseData,
  145. status: request.status,
  146. statusText: request.statusText,
  147. headers: responseHeaders,
  148. config: config,
  149. request: request
  150. };
  151. settle(resolve, reject, response);
  152. // Clean up request
  153. request = null;
  154. };
  155. // Handle browser request cancellation (as opposed to a manual cancellation)
  156. request.onabort = function handleAbort() {
  157. if (!request) {
  158. return;
  159. }
  160. reject(createError('Request aborted', config, 'ECONNABORTED', request));
  161. // Clean up request
  162. request = null;
  163. };
  164. // Handle low level network errors
  165. request.onerror = function handleError() {
  166. // Real errors are hidden from us by the browser
  167. // onerror should only fire if it's a network error
  168. reject(createError('Network Error', config, null, request));
  169. // Clean up request
  170. request = null;
  171. };
  172. // Handle timeout
  173. request.ontimeout = function handleTimeout() {
  174. var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
  175. if (config.timeoutErrorMessage) {
  176. timeoutErrorMessage = config.timeoutErrorMessage;
  177. }
  178. reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',
  179. request));
  180. // Clean up request
  181. request = null;
  182. };
  183. // Add xsrf header
  184. // This is only done if running in a standard browser environment.
  185. // Specifically not if we're in a web worker, or react-native.
  186. if (utils.isStandardBrowserEnv()) {
  187. var cookies = __webpack_require__(/*! ./../helpers/cookies */ "./node_modules/axios/lib/helpers/cookies.js");
  188. // Add xsrf header
  189. var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
  190. cookies.read(config.xsrfCookieName) :
  191. undefined;
  192. if (xsrfValue) {
  193. requestHeaders[config.xsrfHeaderName] = xsrfValue;
  194. }
  195. }
  196. // Add headers to the request
  197. if ('setRequestHeader' in request) {
  198. utils.forEach(requestHeaders, function setRequestHeader(val, key) {
  199. if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
  200. // Remove Content-Type if data is undefined
  201. delete requestHeaders[key];
  202. } else {
  203. // Otherwise add header to the request
  204. request.setRequestHeader(key, val);
  205. }
  206. });
  207. }
  208. // Add withCredentials to request if needed
  209. if (!utils.isUndefined(config.withCredentials)) {
  210. request.withCredentials = !!config.withCredentials;
  211. }
  212. // Add responseType to request if needed
  213. if (config.responseType) {
  214. try {
  215. request.responseType = config.responseType;
  216. } catch (e) {
  217. // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
  218. // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
  219. if (config.responseType !== 'json') {
  220. throw e;
  221. }
  222. }
  223. }
  224. // Handle progress if needed
  225. if (typeof config.onDownloadProgress === 'function') {
  226. request.addEventListener('progress', config.onDownloadProgress);
  227. }
  228. // Not all browsers support upload events
  229. if (typeof config.onUploadProgress === 'function' && request.upload) {
  230. request.upload.addEventListener('progress', config.onUploadProgress);
  231. }
  232. if (config.cancelToken) {
  233. // Handle cancellation
  234. config.cancelToken.promise.then(function onCanceled(cancel) {
  235. if (!request) {
  236. return;
  237. }
  238. request.abort();
  239. reject(cancel);
  240. // Clean up request
  241. request = null;
  242. });
  243. }
  244. if (requestData === undefined) {
  245. requestData = null;
  246. }
  247. // Send the request
  248. request.send(requestData);
  249. });
  250. };
  251. /***/ }),
  252. /***/ "./node_modules/axios/lib/axios.js":
  253. /*!*****************************************!*\
  254. !*** ./node_modules/axios/lib/axios.js ***!
  255. \*****************************************/
  256. /*! no static exports found */
  257. /***/ (function(module, exports, __webpack_require__) {
  258. "use strict";
  259. var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js");
  260. var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js");
  261. var Axios = __webpack_require__(/*! ./core/Axios */ "./node_modules/axios/lib/core/Axios.js");
  262. var mergeConfig = __webpack_require__(/*! ./core/mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js");
  263. var defaults = __webpack_require__(/*! ./defaults */ "./node_modules/axios/lib/defaults.js");
  264. /**
  265. * Create an instance of Axios
  266. *
  267. * @param {Object} defaultConfig The default config for the instance
  268. * @return {Axios} A new instance of Axios
  269. */
  270. function createInstance(defaultConfig) {
  271. var context = new Axios(defaultConfig);
  272. var instance = bind(Axios.prototype.request, context);
  273. // Copy axios.prototype to instance
  274. utils.extend(instance, Axios.prototype, context);
  275. // Copy context to instance
  276. utils.extend(instance, context);
  277. return instance;
  278. }
  279. // Create the default instance to be exported
  280. var axios = createInstance(defaults);
  281. // Expose Axios class to allow class inheritance
  282. axios.Axios = Axios;
  283. // Factory for creating new instances
  284. axios.create = function create(instanceConfig) {
  285. return createInstance(mergeConfig(axios.defaults, instanceConfig));
  286. };
  287. // Expose Cancel & CancelToken
  288. axios.Cancel = __webpack_require__(/*! ./cancel/Cancel */ "./node_modules/axios/lib/cancel/Cancel.js");
  289. axios.CancelToken = __webpack_require__(/*! ./cancel/CancelToken */ "./node_modules/axios/lib/cancel/CancelToken.js");
  290. axios.isCancel = __webpack_require__(/*! ./cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js");
  291. // Expose all/spread
  292. axios.all = function all(promises) {
  293. return Promise.all(promises);
  294. };
  295. axios.spread = __webpack_require__(/*! ./helpers/spread */ "./node_modules/axios/lib/helpers/spread.js");
  296. module.exports = axios;
  297. // Allow use of default import syntax in TypeScript
  298. module.exports.default = axios;
  299. /***/ }),
  300. /***/ "./node_modules/axios/lib/cancel/Cancel.js":
  301. /*!*************************************************!*\
  302. !*** ./node_modules/axios/lib/cancel/Cancel.js ***!
  303. \*************************************************/
  304. /*! no static exports found */
  305. /***/ (function(module, exports, __webpack_require__) {
  306. "use strict";
  307. /**
  308. * A `Cancel` is an object that is thrown when an operation is canceled.
  309. *
  310. * @class
  311. * @param {string=} message The message.
  312. */
  313. function Cancel(message) {
  314. this.message = message;
  315. }
  316. Cancel.prototype.toString = function toString() {
  317. return 'Cancel' + (this.message ? ': ' + this.message : '');
  318. };
  319. Cancel.prototype.__CANCEL__ = true;
  320. module.exports = Cancel;
  321. /***/ }),
  322. /***/ "./node_modules/axios/lib/cancel/CancelToken.js":
  323. /*!******************************************************!*\
  324. !*** ./node_modules/axios/lib/cancel/CancelToken.js ***!
  325. \******************************************************/
  326. /*! no static exports found */
  327. /***/ (function(module, exports, __webpack_require__) {
  328. "use strict";
  329. var Cancel = __webpack_require__(/*! ./Cancel */ "./node_modules/axios/lib/cancel/Cancel.js");
  330. /**
  331. * A `CancelToken` is an object that can be used to request cancellation of an operation.
  332. *
  333. * @class
  334. * @param {Function} executor The executor function.
  335. */
  336. function CancelToken(executor) {
  337. if (typeof executor !== 'function') {
  338. throw new TypeError('executor must be a function.');
  339. }
  340. var resolvePromise;
  341. this.promise = new Promise(function promiseExecutor(resolve) {
  342. resolvePromise = resolve;
  343. });
  344. var token = this;
  345. executor(function cancel(message) {
  346. if (token.reason) {
  347. // Cancellation has already been requested
  348. return;
  349. }
  350. token.reason = new Cancel(message);
  351. resolvePromise(token.reason);
  352. });
  353. }
  354. /**
  355. * Throws a `Cancel` if cancellation has been requested.
  356. */
  357. CancelToken.prototype.throwIfRequested = function throwIfRequested() {
  358. if (this.reason) {
  359. throw this.reason;
  360. }
  361. };
  362. /**
  363. * Returns an object that contains a new `CancelToken` and a function that, when called,
  364. * cancels the `CancelToken`.
  365. */
  366. CancelToken.source = function source() {
  367. var cancel;
  368. var token = new CancelToken(function executor(c) {
  369. cancel = c;
  370. });
  371. return {
  372. token: token,
  373. cancel: cancel
  374. };
  375. };
  376. module.exports = CancelToken;
  377. /***/ }),
  378. /***/ "./node_modules/axios/lib/cancel/isCancel.js":
  379. /*!***************************************************!*\
  380. !*** ./node_modules/axios/lib/cancel/isCancel.js ***!
  381. \***************************************************/
  382. /*! no static exports found */
  383. /***/ (function(module, exports, __webpack_require__) {
  384. "use strict";
  385. module.exports = function isCancel(value) {
  386. return !!(value && value.__CANCEL__);
  387. };
  388. /***/ }),
  389. /***/ "./node_modules/axios/lib/core/Axios.js":
  390. /*!**********************************************!*\
  391. !*** ./node_modules/axios/lib/core/Axios.js ***!
  392. \**********************************************/
  393. /*! no static exports found */
  394. /***/ (function(module, exports, __webpack_require__) {
  395. "use strict";
  396. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  397. var buildURL = __webpack_require__(/*! ../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js");
  398. var InterceptorManager = __webpack_require__(/*! ./InterceptorManager */ "./node_modules/axios/lib/core/InterceptorManager.js");
  399. var dispatchRequest = __webpack_require__(/*! ./dispatchRequest */ "./node_modules/axios/lib/core/dispatchRequest.js");
  400. var mergeConfig = __webpack_require__(/*! ./mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js");
  401. /**
  402. * Create a new instance of Axios
  403. *
  404. * @param {Object} instanceConfig The default config for the instance
  405. */
  406. function Axios(instanceConfig) {
  407. this.defaults = instanceConfig;
  408. this.interceptors = {
  409. request: new InterceptorManager(),
  410. response: new InterceptorManager()
  411. };
  412. }
  413. /**
  414. * Dispatch a request
  415. *
  416. * @param {Object} config The config specific for this request (merged with this.defaults)
  417. */
  418. Axios.prototype.request = function request(config) {
  419. /*eslint no-param-reassign:0*/
  420. // Allow for axios('example/url'[, config]) a la fetch API
  421. if (typeof config === 'string') {
  422. config = arguments[1] || {};
  423. config.url = arguments[0];
  424. } else {
  425. config = config || {};
  426. }
  427. config = mergeConfig(this.defaults, config);
  428. // Set config.method
  429. if (config.method) {
  430. config.method = config.method.toLowerCase();
  431. } else if (this.defaults.method) {
  432. config.method = this.defaults.method.toLowerCase();
  433. } else {
  434. config.method = 'get';
  435. }
  436. // Hook up interceptors middleware
  437. var chain = [dispatchRequest, undefined];
  438. var promise = Promise.resolve(config);
  439. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  440. chain.unshift(interceptor.fulfilled, interceptor.rejected);
  441. });
  442. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  443. chain.push(interceptor.fulfilled, interceptor.rejected);
  444. });
  445. while (chain.length) {
  446. promise = promise.then(chain.shift(), chain.shift());
  447. }
  448. return promise;
  449. };
  450. Axios.prototype.getUri = function getUri(config) {
  451. config = mergeConfig(this.defaults, config);
  452. return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
  453. };
  454. // Provide aliases for supported request methods
  455. utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
  456. /*eslint func-names:0*/
  457. Axios.prototype[method] = function(url, config) {
  458. return this.request(utils.merge(config || {}, {
  459. method: method,
  460. url: url
  461. }));
  462. };
  463. });
  464. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  465. /*eslint func-names:0*/
  466. Axios.prototype[method] = function(url, data, config) {
  467. return this.request(utils.merge(config || {}, {
  468. method: method,
  469. url: url,
  470. data: data
  471. }));
  472. };
  473. });
  474. module.exports = Axios;
  475. /***/ }),
  476. /***/ "./node_modules/axios/lib/core/InterceptorManager.js":
  477. /*!***********************************************************!*\
  478. !*** ./node_modules/axios/lib/core/InterceptorManager.js ***!
  479. \***********************************************************/
  480. /*! no static exports found */
  481. /***/ (function(module, exports, __webpack_require__) {
  482. "use strict";
  483. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  484. function InterceptorManager() {
  485. this.handlers = [];
  486. }
  487. /**
  488. * Add a new interceptor to the stack
  489. *
  490. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  491. * @param {Function} rejected The function to handle `reject` for a `Promise`
  492. *
  493. * @return {Number} An ID used to remove interceptor later
  494. */
  495. InterceptorManager.prototype.use = function use(fulfilled, rejected) {
  496. this.handlers.push({
  497. fulfilled: fulfilled,
  498. rejected: rejected
  499. });
  500. return this.handlers.length - 1;
  501. };
  502. /**
  503. * Remove an interceptor from the stack
  504. *
  505. * @param {Number} id The ID that was returned by `use`
  506. */
  507. InterceptorManager.prototype.eject = function eject(id) {
  508. if (this.handlers[id]) {
  509. this.handlers[id] = null;
  510. }
  511. };
  512. /**
  513. * Iterate over all the registered interceptors
  514. *
  515. * This method is particularly useful for skipping over any
  516. * interceptors that may have become `null` calling `eject`.
  517. *
  518. * @param {Function} fn The function to call for each interceptor
  519. */
  520. InterceptorManager.prototype.forEach = function forEach(fn) {
  521. utils.forEach(this.handlers, function forEachHandler(h) {
  522. if (h !== null) {
  523. fn(h);
  524. }
  525. });
  526. };
  527. module.exports = InterceptorManager;
  528. /***/ }),
  529. /***/ "./node_modules/axios/lib/core/buildFullPath.js":
  530. /*!******************************************************!*\
  531. !*** ./node_modules/axios/lib/core/buildFullPath.js ***!
  532. \******************************************************/
  533. /*! no static exports found */
  534. /***/ (function(module, exports, __webpack_require__) {
  535. "use strict";
  536. var isAbsoluteURL = __webpack_require__(/*! ../helpers/isAbsoluteURL */ "./node_modules/axios/lib/helpers/isAbsoluteURL.js");
  537. var combineURLs = __webpack_require__(/*! ../helpers/combineURLs */ "./node_modules/axios/lib/helpers/combineURLs.js");
  538. /**
  539. * Creates a new URL by combining the baseURL with the requestedURL,
  540. * only when the requestedURL is not already an absolute URL.
  541. * If the requestURL is absolute, this function returns the requestedURL untouched.
  542. *
  543. * @param {string} baseURL The base URL
  544. * @param {string} requestedURL Absolute or relative URL to combine
  545. * @returns {string} The combined full path
  546. */
  547. module.exports = function buildFullPath(baseURL, requestedURL) {
  548. if (baseURL && !isAbsoluteURL(requestedURL)) {
  549. return combineURLs(baseURL, requestedURL);
  550. }
  551. return requestedURL;
  552. };
  553. /***/ }),
  554. /***/ "./node_modules/axios/lib/core/createError.js":
  555. /*!****************************************************!*\
  556. !*** ./node_modules/axios/lib/core/createError.js ***!
  557. \****************************************************/
  558. /*! no static exports found */
  559. /***/ (function(module, exports, __webpack_require__) {
  560. "use strict";
  561. var enhanceError = __webpack_require__(/*! ./enhanceError */ "./node_modules/axios/lib/core/enhanceError.js");
  562. /**
  563. * Create an Error with the specified message, config, error code, request and response.
  564. *
  565. * @param {string} message The error message.
  566. * @param {Object} config The config.
  567. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  568. * @param {Object} [request] The request.
  569. * @param {Object} [response] The response.
  570. * @returns {Error} The created error.
  571. */
  572. module.exports = function createError(message, config, code, request, response) {
  573. var error = new Error(message);
  574. return enhanceError(error, config, code, request, response);
  575. };
  576. /***/ }),
  577. /***/ "./node_modules/axios/lib/core/dispatchRequest.js":
  578. /*!********************************************************!*\
  579. !*** ./node_modules/axios/lib/core/dispatchRequest.js ***!
  580. \********************************************************/
  581. /*! no static exports found */
  582. /***/ (function(module, exports, __webpack_require__) {
  583. "use strict";
  584. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  585. var transformData = __webpack_require__(/*! ./transformData */ "./node_modules/axios/lib/core/transformData.js");
  586. var isCancel = __webpack_require__(/*! ../cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js");
  587. var defaults = __webpack_require__(/*! ../defaults */ "./node_modules/axios/lib/defaults.js");
  588. /**
  589. * Throws a `Cancel` if cancellation has been requested.
  590. */
  591. function throwIfCancellationRequested(config) {
  592. if (config.cancelToken) {
  593. config.cancelToken.throwIfRequested();
  594. }
  595. }
  596. /**
  597. * Dispatch a request to the server using the configured adapter.
  598. *
  599. * @param {object} config The config that is to be used for the request
  600. * @returns {Promise} The Promise to be fulfilled
  601. */
  602. module.exports = function dispatchRequest(config) {
  603. throwIfCancellationRequested(config);
  604. // Ensure headers exist
  605. config.headers = config.headers || {};
  606. // Transform request data
  607. config.data = transformData(
  608. config.data,
  609. config.headers,
  610. config.transformRequest
  611. );
  612. // Flatten headers
  613. config.headers = utils.merge(
  614. config.headers.common || {},
  615. config.headers[config.method] || {},
  616. config.headers
  617. );
  618. utils.forEach(
  619. ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
  620. function cleanHeaderConfig(method) {
  621. delete config.headers[method];
  622. }
  623. );
  624. var adapter = config.adapter || defaults.adapter;
  625. return adapter(config).then(function onAdapterResolution(response) {
  626. throwIfCancellationRequested(config);
  627. // Transform response data
  628. response.data = transformData(
  629. response.data,
  630. response.headers,
  631. config.transformResponse
  632. );
  633. return response;
  634. }, function onAdapterRejection(reason) {
  635. if (!isCancel(reason)) {
  636. throwIfCancellationRequested(config);
  637. // Transform response data
  638. if (reason && reason.response) {
  639. reason.response.data = transformData(
  640. reason.response.data,
  641. reason.response.headers,
  642. config.transformResponse
  643. );
  644. }
  645. }
  646. return Promise.reject(reason);
  647. });
  648. };
  649. /***/ }),
  650. /***/ "./node_modules/axios/lib/core/enhanceError.js":
  651. /*!*****************************************************!*\
  652. !*** ./node_modules/axios/lib/core/enhanceError.js ***!
  653. \*****************************************************/
  654. /*! no static exports found */
  655. /***/ (function(module, exports, __webpack_require__) {
  656. "use strict";
  657. /**
  658. * Update an Error with the specified config, error code, and response.
  659. *
  660. * @param {Error} error The error to update.
  661. * @param {Object} config The config.
  662. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  663. * @param {Object} [request] The request.
  664. * @param {Object} [response] The response.
  665. * @returns {Error} The error.
  666. */
  667. module.exports = function enhanceError(error, config, code, request, response) {
  668. error.config = config;
  669. if (code) {
  670. error.code = code;
  671. }
  672. error.request = request;
  673. error.response = response;
  674. error.isAxiosError = true;
  675. error.toJSON = function() {
  676. return {
  677. // Standard
  678. message: this.message,
  679. name: this.name,
  680. // Microsoft
  681. description: this.description,
  682. number: this.number,
  683. // Mozilla
  684. fileName: this.fileName,
  685. lineNumber: this.lineNumber,
  686. columnNumber: this.columnNumber,
  687. stack: this.stack,
  688. // Axios
  689. config: this.config,
  690. code: this.code
  691. };
  692. };
  693. return error;
  694. };
  695. /***/ }),
  696. /***/ "./node_modules/axios/lib/core/mergeConfig.js":
  697. /*!****************************************************!*\
  698. !*** ./node_modules/axios/lib/core/mergeConfig.js ***!
  699. \****************************************************/
  700. /*! no static exports found */
  701. /***/ (function(module, exports, __webpack_require__) {
  702. "use strict";
  703. var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js");
  704. /**
  705. * Config-specific merge-function which creates a new config-object
  706. * by merging two configuration objects together.
  707. *
  708. * @param {Object} config1
  709. * @param {Object} config2
  710. * @returns {Object} New object resulting from merging config2 to config1
  711. */
  712. module.exports = function mergeConfig(config1, config2) {
  713. // eslint-disable-next-line no-param-reassign
  714. config2 = config2 || {};
  715. var config = {};
  716. var valueFromConfig2Keys = ['url', 'method', 'params', 'data'];
  717. var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy'];
  718. var defaultToConfig2Keys = [
  719. 'baseURL', 'url', 'transformRequest', 'transformResponse', 'paramsSerializer',
  720. 'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
  721. 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress',
  722. 'maxContentLength', 'validateStatus', 'maxRedirects', 'httpAgent',
  723. 'httpsAgent', 'cancelToken', 'socketPath'
  724. ];
  725. utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
  726. if (typeof config2[prop] !== 'undefined') {
  727. config[prop] = config2[prop];
  728. }
  729. });
  730. utils.forEach(mergeDeepPropertiesKeys, function mergeDeepProperties(prop) {
  731. if (utils.isObject(config2[prop])) {
  732. config[prop] = utils.deepMerge(config1[prop], config2[prop]);
  733. } else if (typeof config2[prop] !== 'undefined') {
  734. config[prop] = config2[prop];
  735. } else if (utils.isObject(config1[prop])) {
  736. config[prop] = utils.deepMerge(config1[prop]);
  737. } else if (typeof config1[prop] !== 'undefined') {
  738. config[prop] = config1[prop];
  739. }
  740. });
  741. utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
  742. if (typeof config2[prop] !== 'undefined') {
  743. config[prop] = config2[prop];
  744. } else if (typeof config1[prop] !== 'undefined') {
  745. config[prop] = config1[prop];
  746. }
  747. });
  748. var axiosKeys = valueFromConfig2Keys
  749. .concat(mergeDeepPropertiesKeys)
  750. .concat(defaultToConfig2Keys);
  751. var otherKeys = Object
  752. .keys(config2)
  753. .filter(function filterAxiosKeys(key) {
  754. return axiosKeys.indexOf(key) === -1;
  755. });
  756. utils.forEach(otherKeys, function otherKeysDefaultToConfig2(prop) {
  757. if (typeof config2[prop] !== 'undefined') {
  758. config[prop] = config2[prop];
  759. } else if (typeof config1[prop] !== 'undefined') {
  760. config[prop] = config1[prop];
  761. }
  762. });
  763. return config;
  764. };
  765. /***/ }),
  766. /***/ "./node_modules/axios/lib/core/settle.js":
  767. /*!***********************************************!*\
  768. !*** ./node_modules/axios/lib/core/settle.js ***!
  769. \***********************************************/
  770. /*! no static exports found */
  771. /***/ (function(module, exports, __webpack_require__) {
  772. "use strict";
  773. var createError = __webpack_require__(/*! ./createError */ "./node_modules/axios/lib/core/createError.js");
  774. /**
  775. * Resolve or reject a Promise based on response status.
  776. *
  777. * @param {Function} resolve A function that resolves the promise.
  778. * @param {Function} reject A function that rejects the promise.
  779. * @param {object} response The response.
  780. */
  781. module.exports = function settle(resolve, reject, response) {
  782. var validateStatus = response.config.validateStatus;
  783. if (!validateStatus || validateStatus(response.status)) {
  784. resolve(response);
  785. } else {
  786. reject(createError(
  787. 'Request failed with status code ' + response.status,
  788. response.config,
  789. null,
  790. response.request,
  791. response
  792. ));
  793. }
  794. };
  795. /***/ }),
  796. /***/ "./node_modules/axios/lib/core/transformData.js":
  797. /*!******************************************************!*\
  798. !*** ./node_modules/axios/lib/core/transformData.js ***!
  799. \******************************************************/
  800. /*! no static exports found */
  801. /***/ (function(module, exports, __webpack_require__) {
  802. "use strict";
  803. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  804. /**
  805. * Transform the data for a request or a response
  806. *
  807. * @param {Object|String} data The data to be transformed
  808. * @param {Array} headers The headers for the request or response
  809. * @param {Array|Function} fns A single function or Array of functions
  810. * @returns {*} The resulting transformed data
  811. */
  812. module.exports = function transformData(data, headers, fns) {
  813. /*eslint no-param-reassign:0*/
  814. utils.forEach(fns, function transform(fn) {
  815. data = fn(data, headers);
  816. });
  817. return data;
  818. };
  819. /***/ }),
  820. /***/ "./node_modules/axios/lib/defaults.js":
  821. /*!********************************************!*\
  822. !*** ./node_modules/axios/lib/defaults.js ***!
  823. \********************************************/
  824. /*! no static exports found */
  825. /***/ (function(module, exports, __webpack_require__) {
  826. "use strict";
  827. /* WEBPACK VAR INJECTION */(function(process) {
  828. var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js");
  829. var normalizeHeaderName = __webpack_require__(/*! ./helpers/normalizeHeaderName */ "./node_modules/axios/lib/helpers/normalizeHeaderName.js");
  830. var DEFAULT_CONTENT_TYPE = {
  831. 'Content-Type': 'application/x-www-form-urlencoded'
  832. };
  833. function setContentTypeIfUnset(headers, value) {
  834. if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
  835. headers['Content-Type'] = value;
  836. }
  837. }
  838. function getDefaultAdapter() {
  839. var adapter;
  840. if (typeof XMLHttpRequest !== 'undefined') {
  841. // For browsers use XHR adapter
  842. adapter = __webpack_require__(/*! ./adapters/xhr */ "./node_modules/axios/lib/adapters/xhr.js");
  843. } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
  844. // For node use HTTP adapter
  845. adapter = __webpack_require__(/*! ./adapters/http */ "./node_modules/axios/lib/adapters/xhr.js");
  846. }
  847. return adapter;
  848. }
  849. var defaults = {
  850. adapter: getDefaultAdapter(),
  851. transformRequest: [function transformRequest(data, headers) {
  852. normalizeHeaderName(headers, 'Accept');
  853. normalizeHeaderName(headers, 'Content-Type');
  854. if (utils.isFormData(data) ||
  855. utils.isArrayBuffer(data) ||
  856. utils.isBuffer(data) ||
  857. utils.isStream(data) ||
  858. utils.isFile(data) ||
  859. utils.isBlob(data)
  860. ) {
  861. return data;
  862. }
  863. if (utils.isArrayBufferView(data)) {
  864. return data.buffer;
  865. }
  866. if (utils.isURLSearchParams(data)) {
  867. setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
  868. return data.toString();
  869. }
  870. if (utils.isObject(data)) {
  871. setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
  872. return JSON.stringify(data);
  873. }
  874. return data;
  875. }],
  876. transformResponse: [function transformResponse(data) {
  877. /*eslint no-param-reassign:0*/
  878. if (typeof data === 'string') {
  879. try {
  880. data = JSON.parse(data);
  881. } catch (e) { /* Ignore */ }
  882. }
  883. return data;
  884. }],
  885. /**
  886. * A timeout in milliseconds to abort a request. If set to 0 (default) a
  887. * timeout is not created.
  888. */
  889. timeout: 0,
  890. xsrfCookieName: 'XSRF-TOKEN',
  891. xsrfHeaderName: 'X-XSRF-TOKEN',
  892. maxContentLength: -1,
  893. validateStatus: function validateStatus(status) {
  894. return status >= 200 && status < 300;
  895. }
  896. };
  897. defaults.headers = {
  898. common: {
  899. 'Accept': 'application/json, text/plain, */*'
  900. }
  901. };
  902. utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
  903. defaults.headers[method] = {};
  904. });
  905. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  906. defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
  907. });
  908. module.exports = defaults;
  909. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ "./node_modules/process/browser.js")))
  910. /***/ }),
  911. /***/ "./node_modules/axios/lib/helpers/bind.js":
  912. /*!************************************************!*\
  913. !*** ./node_modules/axios/lib/helpers/bind.js ***!
  914. \************************************************/
  915. /*! no static exports found */
  916. /***/ (function(module, exports, __webpack_require__) {
  917. "use strict";
  918. module.exports = function bind(fn, thisArg) {
  919. return function wrap() {
  920. var args = new Array(arguments.length);
  921. for (var i = 0; i < args.length; i++) {
  922. args[i] = arguments[i];
  923. }
  924. return fn.apply(thisArg, args);
  925. };
  926. };
  927. /***/ }),
  928. /***/ "./node_modules/axios/lib/helpers/buildURL.js":
  929. /*!****************************************************!*\
  930. !*** ./node_modules/axios/lib/helpers/buildURL.js ***!
  931. \****************************************************/
  932. /*! no static exports found */
  933. /***/ (function(module, exports, __webpack_require__) {
  934. "use strict";
  935. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  936. function encode(val) {
  937. return encodeURIComponent(val).
  938. replace(/%40/gi, '@').
  939. replace(/%3A/gi, ':').
  940. replace(/%24/g, '$').
  941. replace(/%2C/gi, ',').
  942. replace(/%20/g, '+').
  943. replace(/%5B/gi, '[').
  944. replace(/%5D/gi, ']');
  945. }
  946. /**
  947. * Build a URL by appending params to the end
  948. *
  949. * @param {string} url The base of the url (e.g., http://www.google.com)
  950. * @param {object} [params] The params to be appended
  951. * @returns {string} The formatted url
  952. */
  953. module.exports = function buildURL(url, params, paramsSerializer) {
  954. /*eslint no-param-reassign:0*/
  955. if (!params) {
  956. return url;
  957. }
  958. var serializedParams;
  959. if (paramsSerializer) {
  960. serializedParams = paramsSerializer(params);
  961. } else if (utils.isURLSearchParams(params)) {
  962. serializedParams = params.toString();
  963. } else {
  964. var parts = [];
  965. utils.forEach(params, function serialize(val, key) {
  966. if (val === null || typeof val === 'undefined') {
  967. return;
  968. }
  969. if (utils.isArray(val)) {
  970. key = key + '[]';
  971. } else {
  972. val = [val];
  973. }
  974. utils.forEach(val, function parseValue(v) {
  975. if (utils.isDate(v)) {
  976. v = v.toISOString();
  977. } else if (utils.isObject(v)) {
  978. v = JSON.stringify(v);
  979. }
  980. parts.push(encode(key) + '=' + encode(v));
  981. });
  982. });
  983. serializedParams = parts.join('&');
  984. }
  985. if (serializedParams) {
  986. var hashmarkIndex = url.indexOf('#');
  987. if (hashmarkIndex !== -1) {
  988. url = url.slice(0, hashmarkIndex);
  989. }
  990. url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
  991. }
  992. return url;
  993. };
  994. /***/ }),
  995. /***/ "./node_modules/axios/lib/helpers/combineURLs.js":
  996. /*!*******************************************************!*\
  997. !*** ./node_modules/axios/lib/helpers/combineURLs.js ***!
  998. \*******************************************************/
  999. /*! no static exports found */
  1000. /***/ (function(module, exports, __webpack_require__) {
  1001. "use strict";
  1002. /**
  1003. * Creates a new URL by combining the specified URLs
  1004. *
  1005. * @param {string} baseURL The base URL
  1006. * @param {string} relativeURL The relative URL
  1007. * @returns {string} The combined URL
  1008. */
  1009. module.exports = function combineURLs(baseURL, relativeURL) {
  1010. return relativeURL
  1011. ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
  1012. : baseURL;
  1013. };
  1014. /***/ }),
  1015. /***/ "./node_modules/axios/lib/helpers/cookies.js":
  1016. /*!***************************************************!*\
  1017. !*** ./node_modules/axios/lib/helpers/cookies.js ***!
  1018. \***************************************************/
  1019. /*! no static exports found */
  1020. /***/ (function(module, exports, __webpack_require__) {
  1021. "use strict";
  1022. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1023. module.exports = (
  1024. utils.isStandardBrowserEnv() ?
  1025. // Standard browser envs support document.cookie
  1026. (function standardBrowserEnv() {
  1027. return {
  1028. write: function write(name, value, expires, path, domain, secure) {
  1029. var cookie = [];
  1030. cookie.push(name + '=' + encodeURIComponent(value));
  1031. if (utils.isNumber(expires)) {
  1032. cookie.push('expires=' + new Date(expires).toGMTString());
  1033. }
  1034. if (utils.isString(path)) {
  1035. cookie.push('path=' + path);
  1036. }
  1037. if (utils.isString(domain)) {
  1038. cookie.push('domain=' + domain);
  1039. }
  1040. if (secure === true) {
  1041. cookie.push('secure');
  1042. }
  1043. document.cookie = cookie.join('; ');
  1044. },
  1045. read: function read(name) {
  1046. var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
  1047. return (match ? decodeURIComponent(match[3]) : null);
  1048. },
  1049. remove: function remove(name) {
  1050. this.write(name, '', Date.now() - 86400000);
  1051. }
  1052. };
  1053. })() :
  1054. // Non standard browser env (web workers, react-native) lack needed support.
  1055. (function nonStandardBrowserEnv() {
  1056. return {
  1057. write: function write() {},
  1058. read: function read() { return null; },
  1059. remove: function remove() {}
  1060. };
  1061. })()
  1062. );
  1063. /***/ }),
  1064. /***/ "./node_modules/axios/lib/helpers/isAbsoluteURL.js":
  1065. /*!*********************************************************!*\
  1066. !*** ./node_modules/axios/lib/helpers/isAbsoluteURL.js ***!
  1067. \*********************************************************/
  1068. /*! no static exports found */
  1069. /***/ (function(module, exports, __webpack_require__) {
  1070. "use strict";
  1071. /**
  1072. * Determines whether the specified URL is absolute
  1073. *
  1074. * @param {string} url The URL to test
  1075. * @returns {boolean} True if the specified URL is absolute, otherwise false
  1076. */
  1077. module.exports = function isAbsoluteURL(url) {
  1078. // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
  1079. // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
  1080. // by any combination of letters, digits, plus, period, or hyphen.
  1081. return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
  1082. };
  1083. /***/ }),
  1084. /***/ "./node_modules/axios/lib/helpers/isURLSameOrigin.js":
  1085. /*!***********************************************************!*\
  1086. !*** ./node_modules/axios/lib/helpers/isURLSameOrigin.js ***!
  1087. \***********************************************************/
  1088. /*! no static exports found */
  1089. /***/ (function(module, exports, __webpack_require__) {
  1090. "use strict";
  1091. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1092. module.exports = (
  1093. utils.isStandardBrowserEnv() ?
  1094. // Standard browser envs have full support of the APIs needed to test
  1095. // whether the request URL is of the same origin as current location.
  1096. (function standardBrowserEnv() {
  1097. var msie = /(msie|trident)/i.test(navigator.userAgent);
  1098. var urlParsingNode = document.createElement('a');
  1099. var originURL;
  1100. /**
  1101. * Parse a URL to discover it's components
  1102. *
  1103. * @param {String} url The URL to be parsed
  1104. * @returns {Object}
  1105. */
  1106. function resolveURL(url) {
  1107. var href = url;
  1108. if (msie) {
  1109. // IE needs attribute set twice to normalize properties
  1110. urlParsingNode.setAttribute('href', href);
  1111. href = urlParsingNode.href;
  1112. }
  1113. urlParsingNode.setAttribute('href', href);
  1114. // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
  1115. return {
  1116. href: urlParsingNode.href,
  1117. protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
  1118. host: urlParsingNode.host,
  1119. search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
  1120. hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
  1121. hostname: urlParsingNode.hostname,
  1122. port: urlParsingNode.port,
  1123. pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
  1124. urlParsingNode.pathname :
  1125. '/' + urlParsingNode.pathname
  1126. };
  1127. }
  1128. originURL = resolveURL(window.location.href);
  1129. /**
  1130. * Determine if a URL shares the same origin as the current location
  1131. *
  1132. * @param {String} requestURL The URL to test
  1133. * @returns {boolean} True if URL shares the same origin, otherwise false
  1134. */
  1135. return function isURLSameOrigin(requestURL) {
  1136. var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
  1137. return (parsed.protocol === originURL.protocol &&
  1138. parsed.host === originURL.host);
  1139. };
  1140. })() :
  1141. // Non standard browser envs (web workers, react-native) lack needed support.
  1142. (function nonStandardBrowserEnv() {
  1143. return function isURLSameOrigin() {
  1144. return true;
  1145. };
  1146. })()
  1147. );
  1148. /***/ }),
  1149. /***/ "./node_modules/axios/lib/helpers/normalizeHeaderName.js":
  1150. /*!***************************************************************!*\
  1151. !*** ./node_modules/axios/lib/helpers/normalizeHeaderName.js ***!
  1152. \***************************************************************/
  1153. /*! no static exports found */
  1154. /***/ (function(module, exports, __webpack_require__) {
  1155. "use strict";
  1156. var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js");
  1157. module.exports = function normalizeHeaderName(headers, normalizedName) {
  1158. utils.forEach(headers, function processHeader(value, name) {
  1159. if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
  1160. headers[normalizedName] = value;
  1161. delete headers[name];
  1162. }
  1163. });
  1164. };
  1165. /***/ }),
  1166. /***/ "./node_modules/axios/lib/helpers/parseHeaders.js":
  1167. /*!********************************************************!*\
  1168. !*** ./node_modules/axios/lib/helpers/parseHeaders.js ***!
  1169. \********************************************************/
  1170. /*! no static exports found */
  1171. /***/ (function(module, exports, __webpack_require__) {
  1172. "use strict";
  1173. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1174. // Headers whose duplicates are ignored by node
  1175. // c.f. https://nodejs.org/api/http.html#http_message_headers
  1176. var ignoreDuplicateOf = [
  1177. 'age', 'authorization', 'content-length', 'content-type', 'etag',
  1178. 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
  1179. 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
  1180. 'referer', 'retry-after', 'user-agent'
  1181. ];
  1182. /**
  1183. * Parse headers into an object
  1184. *
  1185. * ```
  1186. * Date: Wed, 27 Aug 2014 08:58:49 GMT
  1187. * Content-Type: application/json
  1188. * Connection: keep-alive
  1189. * Transfer-Encoding: chunked
  1190. * ```
  1191. *
  1192. * @param {String} headers Headers needing to be parsed
  1193. * @returns {Object} Headers parsed into an object
  1194. */
  1195. module.exports = function parseHeaders(headers) {
  1196. var parsed = {};
  1197. var key;
  1198. var val;
  1199. var i;
  1200. if (!headers) { return parsed; }
  1201. utils.forEach(headers.split('\n'), function parser(line) {
  1202. i = line.indexOf(':');
  1203. key = utils.trim(line.substr(0, i)).toLowerCase();
  1204. val = utils.trim(line.substr(i + 1));
  1205. if (key) {
  1206. if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
  1207. return;
  1208. }
  1209. if (key === 'set-cookie') {
  1210. parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
  1211. } else {
  1212. parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
  1213. }
  1214. }
  1215. });
  1216. return parsed;
  1217. };
  1218. /***/ }),
  1219. /***/ "./node_modules/axios/lib/helpers/spread.js":
  1220. /*!**************************************************!*\
  1221. !*** ./node_modules/axios/lib/helpers/spread.js ***!
  1222. \**************************************************/
  1223. /*! no static exports found */
  1224. /***/ (function(module, exports, __webpack_require__) {
  1225. "use strict";
  1226. /**
  1227. * Syntactic sugar for invoking a function and expanding an array for arguments.
  1228. *
  1229. * Common use case would be to use `Function.prototype.apply`.
  1230. *
  1231. * ```js
  1232. * function f(x, y, z) {}
  1233. * var args = [1, 2, 3];
  1234. * f.apply(null, args);
  1235. * ```
  1236. *
  1237. * With `spread` this example can be re-written.
  1238. *
  1239. * ```js
  1240. * spread(function(x, y, z) {})([1, 2, 3]);
  1241. * ```
  1242. *
  1243. * @param {Function} callback
  1244. * @returns {Function}
  1245. */
  1246. module.exports = function spread(callback) {
  1247. return function wrap(arr) {
  1248. return callback.apply(null, arr);
  1249. };
  1250. };
  1251. /***/ }),
  1252. /***/ "./node_modules/axios/lib/utils.js":
  1253. /*!*****************************************!*\
  1254. !*** ./node_modules/axios/lib/utils.js ***!
  1255. \*****************************************/
  1256. /*! no static exports found */
  1257. /***/ (function(module, exports, __webpack_require__) {
  1258. "use strict";
  1259. var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js");
  1260. /*global toString:true*/
  1261. // utils is a library of generic helper functions non-specific to axios
  1262. var toString = Object.prototype.toString;
  1263. /**
  1264. * Determine if a value is an Array
  1265. *
  1266. * @param {Object} val The value to test
  1267. * @returns {boolean} True if value is an Array, otherwise false
  1268. */
  1269. function isArray(val) {
  1270. return toString.call(val) === '[object Array]';
  1271. }
  1272. /**
  1273. * Determine if a value is undefined
  1274. *
  1275. * @param {Object} val The value to test
  1276. * @returns {boolean} True if the value is undefined, otherwise false
  1277. */
  1278. function isUndefined(val) {
  1279. return typeof val === 'undefined';
  1280. }
  1281. /**
  1282. * Determine if a value is a Buffer
  1283. *
  1284. * @param {Object} val The value to test
  1285. * @returns {boolean} True if value is a Buffer, otherwise false
  1286. */
  1287. function isBuffer(val) {
  1288. return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
  1289. && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
  1290. }
  1291. /**
  1292. * Determine if a value is an ArrayBuffer
  1293. *
  1294. * @param {Object} val The value to test
  1295. * @returns {boolean} True if value is an ArrayBuffer, otherwise false
  1296. */
  1297. function isArrayBuffer(val) {
  1298. return toString.call(val) === '[object ArrayBuffer]';
  1299. }
  1300. /**
  1301. * Determine if a value is a FormData
  1302. *
  1303. * @param {Object} val The value to test
  1304. * @returns {boolean} True if value is an FormData, otherwise false
  1305. */
  1306. function isFormData(val) {
  1307. return (typeof FormData !== 'undefined') && (val instanceof FormData);
  1308. }
  1309. /**
  1310. * Determine if a value is a view on an ArrayBuffer
  1311. *
  1312. * @param {Object} val The value to test
  1313. * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
  1314. */
  1315. function isArrayBufferView(val) {
  1316. var result;
  1317. if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
  1318. result = ArrayBuffer.isView(val);
  1319. } else {
  1320. result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
  1321. }
  1322. return result;
  1323. }
  1324. /**
  1325. * Determine if a value is a String
  1326. *
  1327. * @param {Object} val The value to test
  1328. * @returns {boolean} True if value is a String, otherwise false
  1329. */
  1330. function isString(val) {
  1331. return typeof val === 'string';
  1332. }
  1333. /**
  1334. * Determine if a value is a Number
  1335. *
  1336. * @param {Object} val The value to test
  1337. * @returns {boolean} True if value is a Number, otherwise false
  1338. */
  1339. function isNumber(val) {
  1340. return typeof val === 'number';
  1341. }
  1342. /**
  1343. * Determine if a value is an Object
  1344. *
  1345. * @param {Object} val The value to test
  1346. * @returns {boolean} True if value is an Object, otherwise false
  1347. */
  1348. function isObject(val) {
  1349. return val !== null && typeof val === 'object';
  1350. }
  1351. /**
  1352. * Determine if a value is a Date
  1353. *
  1354. * @param {Object} val The value to test
  1355. * @returns {boolean} True if value is a Date, otherwise false
  1356. */
  1357. function isDate(val) {
  1358. return toString.call(val) === '[object Date]';
  1359. }
  1360. /**
  1361. * Determine if a value is a File
  1362. *
  1363. * @param {Object} val The value to test
  1364. * @returns {boolean} True if value is a File, otherwise false
  1365. */
  1366. function isFile(val) {
  1367. return toString.call(val) === '[object File]';
  1368. }
  1369. /**
  1370. * Determine if a value is a Blob
  1371. *
  1372. * @param {Object} val The value to test
  1373. * @returns {boolean} True if value is a Blob, otherwise false
  1374. */
  1375. function isBlob(val) {
  1376. return toString.call(val) === '[object Blob]';
  1377. }
  1378. /**
  1379. * Determine if a value is a Function
  1380. *
  1381. * @param {Object} val The value to test
  1382. * @returns {boolean} True if value is a Function, otherwise false
  1383. */
  1384. function isFunction(val) {
  1385. return toString.call(val) === '[object Function]';
  1386. }
  1387. /**
  1388. * Determine if a value is a Stream
  1389. *
  1390. * @param {Object} val The value to test
  1391. * @returns {boolean} True if value is a Stream, otherwise false
  1392. */
  1393. function isStream(val) {
  1394. return isObject(val) && isFunction(val.pipe);
  1395. }
  1396. /**
  1397. * Determine if a value is a URLSearchParams object
  1398. *
  1399. * @param {Object} val The value to test
  1400. * @returns {boolean} True if value is a URLSearchParams object, otherwise false
  1401. */
  1402. function isURLSearchParams(val) {
  1403. return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
  1404. }
  1405. /**
  1406. * Trim excess whitespace off the beginning and end of a string
  1407. *
  1408. * @param {String} str The String to trim
  1409. * @returns {String} The String freed of excess whitespace
  1410. */
  1411. function trim(str) {
  1412. return str.replace(/^\s*/, '').replace(/\s*$/, '');
  1413. }
  1414. /**
  1415. * Determine if we're running in a standard browser environment
  1416. *
  1417. * This allows axios to run in a web worker, and react-native.
  1418. * Both environments support XMLHttpRequest, but not fully standard globals.
  1419. *
  1420. * web workers:
  1421. * typeof window -> undefined
  1422. * typeof document -> undefined
  1423. *
  1424. * react-native:
  1425. * navigator.product -> 'ReactNative'
  1426. * nativescript
  1427. * navigator.product -> 'NativeScript' or 'NS'
  1428. */
  1429. function isStandardBrowserEnv() {
  1430. if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
  1431. navigator.product === 'NativeScript' ||
  1432. navigator.product === 'NS')) {
  1433. return false;
  1434. }
  1435. return (
  1436. typeof window !== 'undefined' &&
  1437. typeof document !== 'undefined'
  1438. );
  1439. }
  1440. /**
  1441. * Iterate over an Array or an Object invoking a function for each item.
  1442. *
  1443. * If `obj` is an Array callback will be called passing
  1444. * the value, index, and complete array for each item.
  1445. *
  1446. * If 'obj' is an Object callback will be called passing
  1447. * the value, key, and complete object for each property.
  1448. *
  1449. * @param {Object|Array} obj The object to iterate
  1450. * @param {Function} fn The callback to invoke for each item
  1451. */
  1452. function forEach(obj, fn) {
  1453. // Don't bother if no value provided
  1454. if (obj === null || typeof obj === 'undefined') {
  1455. return;
  1456. }
  1457. // Force an array if not already something iterable
  1458. if (typeof obj !== 'object') {
  1459. /*eslint no-param-reassign:0*/
  1460. obj = [obj];
  1461. }
  1462. if (isArray(obj)) {
  1463. // Iterate over array values
  1464. for (var i = 0, l = obj.length; i < l; i++) {
  1465. fn.call(null, obj[i], i, obj);
  1466. }
  1467. } else {
  1468. // Iterate over object keys
  1469. for (var key in obj) {
  1470. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  1471. fn.call(null, obj[key], key, obj);
  1472. }
  1473. }
  1474. }
  1475. }
  1476. /**
  1477. * Accepts varargs expecting each argument to be an object, then
  1478. * immutably merges the properties of each object and returns result.
  1479. *
  1480. * When multiple objects contain the same key the later object in
  1481. * the arguments list will take precedence.
  1482. *
  1483. * Example:
  1484. *
  1485. * ```js
  1486. * var result = merge({foo: 123}, {foo: 456});
  1487. * console.log(result.foo); // outputs 456
  1488. * ```
  1489. *
  1490. * @param {Object} obj1 Object to merge
  1491. * @returns {Object} Result of all merge properties
  1492. */
  1493. function merge(/* obj1, obj2, obj3, ... */) {
  1494. var result = {};
  1495. function assignValue(val, key) {
  1496. if (typeof result[key] === 'object' && typeof val === 'object') {
  1497. result[key] = merge(result[key], val);
  1498. } else {
  1499. result[key] = val;
  1500. }
  1501. }
  1502. for (var i = 0, l = arguments.length; i < l; i++) {
  1503. forEach(arguments[i], assignValue);
  1504. }
  1505. return result;
  1506. }
  1507. /**
  1508. * Function equal to merge with the difference being that no reference
  1509. * to original objects is kept.
  1510. *
  1511. * @see merge
  1512. * @param {Object} obj1 Object to merge
  1513. * @returns {Object} Result of all merge properties
  1514. */
  1515. function deepMerge(/* obj1, obj2, obj3, ... */) {
  1516. var result = {};
  1517. function assignValue(val, key) {
  1518. if (typeof result[key] === 'object' && typeof val === 'object') {
  1519. result[key] = deepMerge(result[key], val);
  1520. } else if (typeof val === 'object') {
  1521. result[key] = deepMerge({}, val);
  1522. } else {
  1523. result[key] = val;
  1524. }
  1525. }
  1526. for (var i = 0, l = arguments.length; i < l; i++) {
  1527. forEach(arguments[i], assignValue);
  1528. }
  1529. return result;
  1530. }
  1531. /**
  1532. * Extends object a by mutably adding to it the properties of object b.
  1533. *
  1534. * @param {Object} a The object to be extended
  1535. * @param {Object} b The object to copy properties from
  1536. * @param {Object} thisArg The object to bind function to
  1537. * @return {Object} The resulting value of object a
  1538. */
  1539. function extend(a, b, thisArg) {
  1540. forEach(b, function assignValue(val, key) {
  1541. if (thisArg && typeof val === 'function') {
  1542. a[key] = bind(val, thisArg);
  1543. } else {
  1544. a[key] = val;
  1545. }
  1546. });
  1547. return a;
  1548. }
  1549. module.exports = {
  1550. isArray: isArray,
  1551. isArrayBuffer: isArrayBuffer,
  1552. isBuffer: isBuffer,
  1553. isFormData: isFormData,
  1554. isArrayBufferView: isArrayBufferView,
  1555. isString: isString,
  1556. isNumber: isNumber,
  1557. isObject: isObject,
  1558. isUndefined: isUndefined,
  1559. isDate: isDate,
  1560. isFile: isFile,
  1561. isBlob: isBlob,
  1562. isFunction: isFunction,
  1563. isStream: isStream,
  1564. isURLSearchParams: isURLSearchParams,
  1565. isStandardBrowserEnv: isStandardBrowserEnv,
  1566. forEach: forEach,
  1567. merge: merge,
  1568. deepMerge: deepMerge,
  1569. extend: extend,
  1570. trim: trim
  1571. };
  1572. /***/ }),
  1573. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&":
  1574. /*!***************************************************************************************************************************************************************************!*\
  1575. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js& ***!
  1576. \***************************************************************************************************************************************************************************/
  1577. /*! exports provided: default */
  1578. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1579. "use strict";
  1580. __webpack_require__.r(__webpack_exports__);
  1581. //
  1582. //
  1583. //
  1584. //
  1585. //
  1586. //
  1587. //
  1588. //
  1589. //
  1590. //
  1591. //
  1592. //
  1593. //
  1594. //
  1595. //
  1596. //
  1597. /* harmony default export */ __webpack_exports__["default"] = ({
  1598. mounted: function mounted() {
  1599. console.log('Component mounted.');
  1600. }
  1601. });
  1602. /***/ }),
  1603. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/assetinfo.vue?vue&type=script&lang=js&":
  1604. /*!********************************************************************************************************************************************************************!*\
  1605. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/assetinfo.vue?vue&type=script&lang=js& ***!
  1606. \********************************************************************************************************************************************************************/
  1607. /*! exports provided: default */
  1608. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1609. "use strict";
  1610. __webpack_require__.r(__webpack_exports__);
  1611. //
  1612. //
  1613. //
  1614. //
  1615. //
  1616. //
  1617. //
  1618. //
  1619. //
  1620. //
  1621. //
  1622. //
  1623. //
  1624. //
  1625. //
  1626. //
  1627. //
  1628. //
  1629. //
  1630. //
  1631. //
  1632. //
  1633. //
  1634. //
  1635. //
  1636. //
  1637. //
  1638. //
  1639. //
  1640. //
  1641. //
  1642. //
  1643. //
  1644. //
  1645. //
  1646. //
  1647. //
  1648. //
  1649. //
  1650. //
  1651. //
  1652. //
  1653. //
  1654. //
  1655. //
  1656. //
  1657. //
  1658. //
  1659. //
  1660. //
  1661. //
  1662. //
  1663. //
  1664. //
  1665. //
  1666. //
  1667. /* harmony default export */ __webpack_exports__["default"] = ({
  1668. props: ['asset', 'pcextraStart'],
  1669. data: function data() {
  1670. return {
  1671. data: JSON.parse(this.asset),
  1672. pcextra: JSON.parse(this.pcextraStart)
  1673. };
  1674. },
  1675. mounted: function mounted() {
  1676. var _this = this;
  1677. Echo.channel('asset.' + this.data.pcid).listen('AssetUpdated', function (e) {
  1678. _this.data = e.data;
  1679. _this.pcextra = JSON.parse(e.pcextra);
  1680. });
  1681. },
  1682. methods: {
  1683. updateAsset: function updateAsset() {
  1684. this.data.pcextra = this.pcextra;
  1685. axios.put('/api/assets/' + this.data.pcid, this.data).then(function (response) {})["catch"](function (error) {});
  1686. $('#asseteditModal').modal('hide');
  1687. }
  1688. }
  1689. });
  1690. /***/ }),
  1691. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js&":
  1692. /*!***************************************************************************************************************************************************************************************!*\
  1693. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js& ***!
  1694. \***************************************************************************************************************************************************************************************/
  1695. /*! exports provided: default */
  1696. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1697. "use strict";
  1698. __webpack_require__.r(__webpack_exports__);
  1699. //
  1700. //
  1701. //
  1702. //
  1703. //
  1704. //
  1705. //
  1706. //
  1707. //
  1708. //
  1709. //
  1710. //
  1711. //
  1712. //
  1713. //
  1714. //
  1715. //
  1716. //
  1717. //
  1718. //
  1719. //
  1720. /* harmony default export */ __webpack_exports__["default"] = ({
  1721. props: {
  1722. value: null,
  1723. // An object with the following format
  1724. // {
  1725. // key: value,
  1726. // key: value,
  1727. // }
  1728. options: {
  1729. type: Object,
  1730. required: true
  1731. },
  1732. allowCustom: {
  1733. type: Boolean,
  1734. "default": false
  1735. }
  1736. },
  1737. data: function data() {
  1738. return {
  1739. searchText: '',
  1740. selectedOption: null,
  1741. open: false,
  1742. // allows for checking whether button was clicked or text was typed.
  1743. // If button was clicked, we show all options without having to clear
  1744. // out any searchText that was autofilled when page loaded.
  1745. isSearching: false
  1746. };
  1747. },
  1748. computed: {
  1749. matches: function matches() {
  1750. var _this = this;
  1751. // If button was clicked, show all options, if typing, filter
  1752. // options based on searchText
  1753. return Object.entries(this.options).filter(function (option) {
  1754. var optionText = option[1].toUpperCase();
  1755. if (_this.isSearching) {
  1756. return optionText.match(_this.searchText.toUpperCase());
  1757. } else {
  1758. return optionText.match('');
  1759. }
  1760. });
  1761. }
  1762. },
  1763. methods: {
  1764. // if button is clicked, show all options
  1765. setOpen: function setOpen(isOpen) {
  1766. this.open = isOpen;
  1767. this.isSearching = false;
  1768. },
  1769. // if typing in the box, start filtering options
  1770. searchChanged: function searchChanged() {
  1771. if (!this.open) {
  1772. this.open = true;
  1773. }
  1774. if (!this.isSearching) {
  1775. this.isSearching = true;
  1776. } // If custom values are allowed, emits {id: 'custom', name: searchtext}
  1777. if (this.allowCustom) {
  1778. this.$emit('input', {
  1779. 'id': 'custom',
  1780. 'name': this.searchText
  1781. });
  1782. }
  1783. },
  1784. // emits { id: suggestion_id, name: suggestion_name} to v-model when
  1785. // a suggestion is selected
  1786. suggestionSelected: function suggestionSelected(suggestion) {
  1787. this.open = false;
  1788. this.searchText = suggestion[1];
  1789. this.$emit('input', {
  1790. 'id': suggestion[0],
  1791. 'name': suggestion[1]
  1792. });
  1793. },
  1794. updateComponentWithValue: function updateComponentWithValue(newValue) {
  1795. if (this.allowCustom) {
  1796. this.searchText = this.value.name;
  1797. } else {
  1798. if (newValue.id > -1) {
  1799. // Find the matching text for the supplied option value
  1800. for (var id in this.options) {
  1801. if (this.options.hasOwnProperty(id)) {
  1802. if (this.options[id] === this.options[newValue.id]) {
  1803. this.searchText = this.options[id];
  1804. }
  1805. }
  1806. }
  1807. }
  1808. }
  1809. }
  1810. },
  1811. mounted: function mounted() {
  1812. this.updateComponentWithValue(this.value);
  1813. },
  1814. watch: {
  1815. value: function value(newValue) {
  1816. this.updateComponentWithValue(newValue);
  1817. }
  1818. }
  1819. });
  1820. /***/ }),
  1821. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js&":
  1822. /*!********************************************************************************************************************************************************************************!*\
  1823. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js& ***!
  1824. \********************************************************************************************************************************************************************************/
  1825. /*! exports provided: default */
  1826. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1827. "use strict";
  1828. __webpack_require__.r(__webpack_exports__);
  1829. //
  1830. //
  1831. //
  1832. //
  1833. //
  1834. //
  1835. //
  1836. //
  1837. //
  1838. //
  1839. //
  1840. //
  1841. //
  1842. //
  1843. //
  1844. //
  1845. //
  1846. //
  1847. //
  1848. //
  1849. //
  1850. //
  1851. //
  1852. //
  1853. //
  1854. //
  1855. /* harmony default export */ __webpack_exports__["default"] = ({
  1856. props: {
  1857. populateWith: {
  1858. type: Object,
  1859. "default": function _default() {
  1860. return {
  1861. creddesc: null,
  1862. creduser: null,
  1863. credpass: null,
  1864. groupid: null,
  1865. pcid: null,
  1866. credtype: null
  1867. };
  1868. }
  1869. },
  1870. modalId: {
  1871. type: String,
  1872. required: true
  1873. },
  1874. descriptions: {
  1875. type: Object,
  1876. required: true
  1877. },
  1878. create: {
  1879. type: Boolean
  1880. },
  1881. pcid: {
  1882. type: Number
  1883. },
  1884. groupid: {
  1885. type: Number
  1886. }
  1887. },
  1888. data: function data() {
  1889. return {
  1890. data: JSON.parse(JSON.stringify(this.populateWith)),
  1891. creddesc: {},
  1892. id: this.modalId,
  1893. errors: []
  1894. };
  1895. },
  1896. mounted: function mounted() {
  1897. this.creddesc = {
  1898. 'id': this.data.credtype,
  1899. 'name': this.data.creddesc
  1900. };
  1901. },
  1902. methods: {
  1903. rndStr: function rndStr(len) {
  1904. var text = "";
  1905. var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%";
  1906. for (var i = 0; i < len; i++) {
  1907. text += chars.charAt(Math.floor(Math.random() * chars.length));
  1908. }
  1909. return text;
  1910. },
  1911. getRandomPassword: function getRandomPassword(id) {
  1912. this.data.credpass = this.rndStr(16);
  1913. },
  1914. updateCredential: function updateCredential() {
  1915. var _this = this;
  1916. if (this.creddesc.id === "custom") {
  1917. this.data.credtype = 1;
  1918. this.data.creddesc = this.creddesc.name;
  1919. } else {
  1920. this.data.credtype = this.creddesc.id;
  1921. this.data.creddesc = this.creddesc.name;
  1922. }
  1923. if (this.create) {
  1924. if (this.pcid) {
  1925. this.data.pcid = this.pcid;
  1926. }
  1927. if (this.groupid) {
  1928. this.data.groupid = this.groupid;
  1929. }
  1930. axios.post('/api/credentials/', this.data).then(function (response) {
  1931. $('#' + _this.id).modal('hide');
  1932. });
  1933. } else {
  1934. axios.put('/api/credentials/' + this.data.credid, this.data).then(function (response) {
  1935. $('#' + _this.id).modal('hide');
  1936. })["catch"](function (error) {
  1937. console.error(error);
  1938. });
  1939. }
  1940. }
  1941. }
  1942. });
  1943. /***/ }),
  1944. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-list.vue?vue&type=script&lang=js&":
  1945. /*!**************************************************************************************************************************************************************************!*\
  1946. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/credential-list.vue?vue&type=script&lang=js& ***!
  1947. \**************************************************************************************************************************************************************************/
  1948. /*! exports provided: default */
  1949. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1950. "use strict";
  1951. __webpack_require__.r(__webpack_exports__);
  1952. //
  1953. //
  1954. //
  1955. //
  1956. //
  1957. //
  1958. //
  1959. //
  1960. //
  1961. /* harmony default export */ __webpack_exports__["default"] = ({
  1962. props: {
  1963. credentialList: {
  1964. type: Array,
  1965. required: true
  1966. },
  1967. descriptions: {
  1968. type: Array,
  1969. required: true
  1970. },
  1971. pcid: {
  1972. type: Number
  1973. },
  1974. groupid: {
  1975. type: Number
  1976. }
  1977. },
  1978. data: function data() {
  1979. return {
  1980. credentials: this.credentialList
  1981. };
  1982. },
  1983. computed: {
  1984. creddescList: function creddescList() {
  1985. var list = {};
  1986. this.descriptions.map(function (val) {
  1987. list[val.creddescid] = val.credtitle;
  1988. });
  1989. return list;
  1990. }
  1991. },
  1992. methods: {
  1993. deleteCred: function deleteCred(index) {
  1994. this.credentials.splice(index, 1);
  1995. }
  1996. },
  1997. mounted: function mounted() {
  1998. var _this = this;
  1999. if (this.pcid) {
  2000. Echo.channel('credlist.pcid.' + this.pcid).listen('CredentialDeleted', function (e) {
  2001. var deletedCred = e.credential;
  2002. var index = _this.credentials.findIndex(function (credential) {
  2003. return credential.credid === deletedCred['credid'];
  2004. });
  2005. $('#credential' + deletedCred['credid'] + 'deleteModal').modal('hide');
  2006. _this.deleteCred(index);
  2007. }).listen('CredentialAdded', function (e) {
  2008. _this.credentials.unshift(e.credential);
  2009. });
  2010. }
  2011. if (this.groupid) {
  2012. Echo.channel('credlist.groupid.' + this.groupid).listen('CredentialDeleted', function (e) {
  2013. var deletedCred = e.credential;
  2014. var index = _this.credentials.findIndex(function (credential) {
  2015. return credential.groupid === deletedCred['groupid'];
  2016. });
  2017. $('#credential' + deletedCred['credid'] + 'deleteModal').modal('hide');
  2018. _this.deleteCred(index);
  2019. }).listen('CredentialAdded', function (e) {
  2020. _this.credentials.unshift(e.credential);
  2021. });
  2022. }
  2023. }
  2024. });
  2025. /***/ }),
  2026. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential.vue?vue&type=script&lang=js&":
  2027. /*!*********************************************************************************************************************************************************************!*\
  2028. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/credential.vue?vue&type=script&lang=js& ***!
  2029. \*********************************************************************************************************************************************************************/
  2030. /*! exports provided: default */
  2031. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2032. "use strict";
  2033. __webpack_require__.r(__webpack_exports__);
  2034. //
  2035. //
  2036. //
  2037. //
  2038. //
  2039. //
  2040. //
  2041. //
  2042. //
  2043. //
  2044. //
  2045. //
  2046. //
  2047. //
  2048. //
  2049. //
  2050. //
  2051. //
  2052. //
  2053. //
  2054. //
  2055. //
  2056. //
  2057. //
  2058. //
  2059. //
  2060. //
  2061. //
  2062. //
  2063. //
  2064. //
  2065. //
  2066. //
  2067. //
  2068. //
  2069. //
  2070. //
  2071. //
  2072. //
  2073. //
  2074. //
  2075. //
  2076. //
  2077. /* harmony default export */ __webpack_exports__["default"] = ({
  2078. props: ['credential', 'descriptions'],
  2079. data: function data() {
  2080. return {
  2081. data: this.credential,
  2082. creddescList: this.descriptions
  2083. };
  2084. },
  2085. mounted: function mounted() {
  2086. var _this = this;
  2087. Echo.channel('credential.' + this.data.credid).listen('CredentialUpdated', function (e) {
  2088. _this.data = e.credential;
  2089. });
  2090. },
  2091. methods: {
  2092. deleteCredential: function deleteCredential() {
  2093. var _this2 = this;
  2094. axios["delete"]('/api/credentials/' + this.data.credid, this.data).then(function (response) {
  2095. $('#credential' + _this2.data.credid + 'deleteModal').modal('hide');
  2096. })["catch"](function (error) {
  2097. console.error(error);
  2098. });
  2099. }
  2100. }
  2101. });
  2102. /***/ }),
  2103. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/errorlist.vue?vue&type=script&lang=js&":
  2104. /*!********************************************************************************************************************************************************************!*\
  2105. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/errorlist.vue?vue&type=script&lang=js& ***!
  2106. \********************************************************************************************************************************************************************/
  2107. /*! exports provided: default */
  2108. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2109. "use strict";
  2110. __webpack_require__.r(__webpack_exports__);
  2111. //
  2112. //
  2113. //
  2114. //
  2115. //
  2116. /* harmony default export */ __webpack_exports__["default"] = ({
  2117. props: ['errors'],
  2118. data: function data() {
  2119. return {
  2120. errorList: this.errors
  2121. };
  2122. },
  2123. watch: {
  2124. errors: function errors(newErrors) {
  2125. this.errorList = newErrors;
  2126. }
  2127. }
  2128. });
  2129. /***/ }),
  2130. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/note-form-modal.vue?vue&type=script&lang=js&":
  2131. /*!**************************************************************************************************************************************************************************!*\
  2132. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/note-form-modal.vue?vue&type=script&lang=js& ***!
  2133. \**************************************************************************************************************************************************************************/
  2134. /*! exports provided: default */
  2135. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2136. "use strict";
  2137. __webpack_require__.r(__webpack_exports__);
  2138. //
  2139. //
  2140. //
  2141. //
  2142. //
  2143. //
  2144. //
  2145. //
  2146. //
  2147. //
  2148. //
  2149. //
  2150. //
  2151. //
  2152. //
  2153. //
  2154. //
  2155. /* harmony default export */ __webpack_exports__["default"] = ({
  2156. props: {
  2157. populateWith: {
  2158. type: Object,
  2159. require: true
  2160. },
  2161. modalId: {
  2162. type: String,
  2163. require: true
  2164. },
  2165. noteType: {
  2166. type: Number
  2167. },
  2168. noteUser: {
  2169. type: String
  2170. },
  2171. woid: {
  2172. type: Number
  2173. }
  2174. },
  2175. data: function data() {
  2176. return {
  2177. note: JSON.parse(JSON.stringify(this.populateWith))
  2178. };
  2179. },
  2180. methods: {
  2181. updateNote: function updateNote(note) {
  2182. axios.put('/api/workorders/notes/' + note.noteid, note).then(function (response) {
  2183. hideModal();
  2184. });
  2185. },
  2186. hideModal: function hideModal() {
  2187. $('#' + this.modalId).modal('hide');
  2188. }
  2189. }
  2190. });
  2191. /***/ }),
  2192. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/notes.vue?vue&type=script&lang=js&":
  2193. /*!****************************************************************************************************************************************************************!*\
  2194. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/notes.vue?vue&type=script&lang=js& ***!
  2195. \****************************************************************************************************************************************************************/
  2196. /*! exports provided: default */
  2197. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2198. "use strict";
  2199. __webpack_require__.r(__webpack_exports__);
  2200. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2201. //
  2202. //
  2203. //
  2204. //
  2205. //
  2206. //
  2207. //
  2208. //
  2209. //
  2210. //
  2211. //
  2212. //
  2213. //
  2214. //
  2215. //
  2216. //
  2217. //
  2218. //
  2219. //
  2220. //
  2221. //
  2222. //
  2223. //
  2224. //
  2225. //
  2226. //
  2227. //
  2228. //
  2229. //
  2230. //
  2231. //
  2232. //
  2233. //
  2234. //
  2235. //
  2236. //
  2237. //
  2238. //
  2239. /* harmony default export */ __webpack_exports__["default"] = ({
  2240. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2241. props: ['initialnotes', 'authusername', 'noteType', 'woid'],
  2242. data: function data() {
  2243. return {
  2244. notes: this.initialnotes,
  2245. newNote: {
  2246. notetype: this.noteType,
  2247. thenote: '',
  2248. noteuser: this.authusername,
  2249. woid: this.woid
  2250. }
  2251. };
  2252. },
  2253. computed: {
  2254. noteOrders: function noteOrders() {
  2255. return this.getNoteOrders(this.notes);
  2256. }
  2257. },
  2258. mounted: function mounted() {
  2259. var _this = this;
  2260. Echo.channel('wonotes.' + this.noteType + '.' + this.woid).listen('WorkOrderNoteAdded', function (e) {
  2261. _this.notes.push(e.note);
  2262. }).listen('WorkOrderNoteEdited', function (e) {
  2263. var index = _this.notes.findIndex(function (note) {
  2264. return note.noteid === e.note.noteid;
  2265. });
  2266. _this.notes[index] = e.note;
  2267. }).listen('WorkOrderNoteDeleted', function (e) {
  2268. var index = _this.notes.findIndex(function (note) {
  2269. return note.noteid === e.noteid;
  2270. });
  2271. _this.notes.splice(index, 1);
  2272. });
  2273. },
  2274. methods: {
  2275. createNote: function createNote() {
  2276. var _this2 = this;
  2277. axios.post('/api/workorders/notes', this.newNote).then(function (response) {
  2278. $('#note' + _this2.noteType + 'add').collapse('hide');
  2279. _this2.newNote.thenote = '';
  2280. });
  2281. },
  2282. getNoteOrders: function getNoteOrders(notes) {
  2283. var noteOrders = [];
  2284. notes.forEach(function (note, index) {
  2285. if (index === 0) {
  2286. noteOrders[index] = 'order-first';
  2287. } else if (note.noteuser !== notes[index - 1].noteuser) {
  2288. if (noteOrders[index - 1] === 'order-first') {
  2289. noteOrders[index] = 'order-last';
  2290. } else {
  2291. noteOrders[index] = 'order-first';
  2292. }
  2293. } else {
  2294. noteOrders[index] = noteOrders[index - 1];
  2295. }
  2296. });
  2297. return noteOrders;
  2298. }
  2299. }
  2300. });
  2301. /***/ }),
  2302. /***/ "./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&":
  2303. /*!****************************************************************************************************************************************************************************!*\
  2304. !*** ./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& ***!
  2305. \****************************************************************************************************************************************************************************/
  2306. /*! exports provided: default */
  2307. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2308. "use strict";
  2309. __webpack_require__.r(__webpack_exports__);
  2310. //
  2311. //
  2312. //
  2313. //
  2314. //
  2315. //
  2316. //
  2317. //
  2318. //
  2319. //
  2320. //
  2321. //
  2322. //
  2323. //
  2324. //
  2325. //
  2326. //
  2327. //
  2328. //
  2329. //
  2330. //
  2331. //
  2332. //
  2333. //
  2334. //
  2335. //
  2336. //
  2337. //
  2338. //
  2339. //
  2340. //
  2341. //
  2342. //
  2343. /* harmony default export */ __webpack_exports__["default"] = ({
  2344. props: ['populateWith', 'storeList', 'modalId'],
  2345. data: function data() {
  2346. return {
  2347. // Copies object from prop, so it doesn't mutate the object
  2348. // from the parent component. Parent component will be updated via
  2349. // Websocket if updateWorkOrder is successful.
  2350. data: JSON.parse(JSON.stringify(this.populateWith)),
  2351. id: this.modalId,
  2352. store: {},
  2353. errors: []
  2354. };
  2355. },
  2356. mounted: function mounted() {
  2357. this.store = {
  2358. 'id': this.data.storeid,
  2359. 'name': this.storeList[this.data.storeid]
  2360. };
  2361. },
  2362. methods: {
  2363. updateWorkOrder: function updateWorkOrder() {
  2364. var _this = this;
  2365. this.data.storeid = this.store.id;
  2366. axios.put('/api/workorders/' + this.data.woid, this.data).then(function (response) {
  2367. $('#workordereditModal').modal('hide');
  2368. })["catch"](function (error) {
  2369. _this.errors = JSON.parse(error.response.request.response).errors;
  2370. });
  2371. }
  2372. }
  2373. });
  2374. /***/ }),
  2375. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  2376. /*!*****************************************************************************************************************************************************************!*\
  2377. !*** ./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& ***!
  2378. \*****************************************************************************************************************************************************************/
  2379. /*! exports provided: default */
  2380. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2381. "use strict";
  2382. __webpack_require__.r(__webpack_exports__);
  2383. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2384. //
  2385. //
  2386. //
  2387. //
  2388. //
  2389. //
  2390. //
  2391. //
  2392. //
  2393. //
  2394. //
  2395. //
  2396. //
  2397. //
  2398. //
  2399. //
  2400. //
  2401. //
  2402. //
  2403. //
  2404. /* harmony default export */ __webpack_exports__["default"] = ({
  2405. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2406. props: ['workOrder', 'stores'],
  2407. data: function data() {
  2408. return {
  2409. data: JSON.parse(this.workOrder)
  2410. };
  2411. },
  2412. computed: {
  2413. storeList: function storeList() {
  2414. var list = {};
  2415. JSON.parse(this.stores).map(function (val) {
  2416. list[val.storeid] = val.storesname;
  2417. });
  2418. return list;
  2419. }
  2420. },
  2421. mounted: function mounted() {
  2422. var _this = this;
  2423. Echo.channel('work-order.' + this.data.woid).listen('WorkOrderUpdated', function (e) {
  2424. _this.data = e.data;
  2425. });
  2426. }
  2427. });
  2428. /***/ }),
  2429. /***/ "./node_modules/base64-js/index.js":
  2430. /*!*****************************************!*\
  2431. !*** ./node_modules/base64-js/index.js ***!
  2432. \*****************************************/
  2433. /*! no static exports found */
  2434. /***/ (function(module, exports, __webpack_require__) {
  2435. "use strict";
  2436. exports.byteLength = byteLength
  2437. exports.toByteArray = toByteArray
  2438. exports.fromByteArray = fromByteArray
  2439. var lookup = []
  2440. var revLookup = []
  2441. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  2442. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  2443. for (var i = 0, len = code.length; i < len; ++i) {
  2444. lookup[i] = code[i]
  2445. revLookup[code.charCodeAt(i)] = i
  2446. }
  2447. // Support decoding URL-safe base64 strings, as Node.js does.
  2448. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  2449. revLookup['-'.charCodeAt(0)] = 62
  2450. revLookup['_'.charCodeAt(0)] = 63
  2451. function getLens (b64) {
  2452. var len = b64.length
  2453. if (len % 4 > 0) {
  2454. throw new Error('Invalid string. Length must be a multiple of 4')
  2455. }
  2456. // Trim off extra bytes after placeholder bytes are found
  2457. // See: https://github.com/beatgammit/base64-js/issues/42
  2458. var validLen = b64.indexOf('=')
  2459. if (validLen === -1) validLen = len
  2460. var placeHoldersLen = validLen === len
  2461. ? 0
  2462. : 4 - (validLen % 4)
  2463. return [validLen, placeHoldersLen]
  2464. }
  2465. // base64 is 4/3 + up to two characters of the original data
  2466. function byteLength (b64) {
  2467. var lens = getLens(b64)
  2468. var validLen = lens[0]
  2469. var placeHoldersLen = lens[1]
  2470. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2471. }
  2472. function _byteLength (b64, validLen, placeHoldersLen) {
  2473. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2474. }
  2475. function toByteArray (b64) {
  2476. var tmp
  2477. var lens = getLens(b64)
  2478. var validLen = lens[0]
  2479. var placeHoldersLen = lens[1]
  2480. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  2481. var curByte = 0
  2482. // if there are placeholders, only get up to the last complete 4 chars
  2483. var len = placeHoldersLen > 0
  2484. ? validLen - 4
  2485. : validLen
  2486. var i
  2487. for (i = 0; i < len; i += 4) {
  2488. tmp =
  2489. (revLookup[b64.charCodeAt(i)] << 18) |
  2490. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  2491. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  2492. revLookup[b64.charCodeAt(i + 3)]
  2493. arr[curByte++] = (tmp >> 16) & 0xFF
  2494. arr[curByte++] = (tmp >> 8) & 0xFF
  2495. arr[curByte++] = tmp & 0xFF
  2496. }
  2497. if (placeHoldersLen === 2) {
  2498. tmp =
  2499. (revLookup[b64.charCodeAt(i)] << 2) |
  2500. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  2501. arr[curByte++] = tmp & 0xFF
  2502. }
  2503. if (placeHoldersLen === 1) {
  2504. tmp =
  2505. (revLookup[b64.charCodeAt(i)] << 10) |
  2506. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  2507. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  2508. arr[curByte++] = (tmp >> 8) & 0xFF
  2509. arr[curByte++] = tmp & 0xFF
  2510. }
  2511. return arr
  2512. }
  2513. function tripletToBase64 (num) {
  2514. return lookup[num >> 18 & 0x3F] +
  2515. lookup[num >> 12 & 0x3F] +
  2516. lookup[num >> 6 & 0x3F] +
  2517. lookup[num & 0x3F]
  2518. }
  2519. function encodeChunk (uint8, start, end) {
  2520. var tmp
  2521. var output = []
  2522. for (var i = start; i < end; i += 3) {
  2523. tmp =
  2524. ((uint8[i] << 16) & 0xFF0000) +
  2525. ((uint8[i + 1] << 8) & 0xFF00) +
  2526. (uint8[i + 2] & 0xFF)
  2527. output.push(tripletToBase64(tmp))
  2528. }
  2529. return output.join('')
  2530. }
  2531. function fromByteArray (uint8) {
  2532. var tmp
  2533. var len = uint8.length
  2534. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  2535. var parts = []
  2536. var maxChunkLength = 16383 // must be multiple of 3
  2537. // go through the array every three bytes, we'll deal with trailing stuff later
  2538. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  2539. parts.push(encodeChunk(
  2540. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  2541. ))
  2542. }
  2543. // pad the end with zeros, but make sure to not forget the extra bytes
  2544. if (extraBytes === 1) {
  2545. tmp = uint8[len - 1]
  2546. parts.push(
  2547. lookup[tmp >> 2] +
  2548. lookup[(tmp << 4) & 0x3F] +
  2549. '=='
  2550. )
  2551. } else if (extraBytes === 2) {
  2552. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  2553. parts.push(
  2554. lookup[tmp >> 10] +
  2555. lookup[(tmp >> 4) & 0x3F] +
  2556. lookup[(tmp << 2) & 0x3F] +
  2557. '='
  2558. )
  2559. }
  2560. return parts.join('')
  2561. }
  2562. /***/ }),
  2563. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  2564. /*!*****************************************************!*\
  2565. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  2566. \*****************************************************/
  2567. /*! no static exports found */
  2568. /***/ (function(module, exports, __webpack_require__) {
  2569. /*!
  2570. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  2571. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  2572. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2573. */
  2574. (function (global, factory) {
  2575. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  2576. undefined;
  2577. }(this, (function (exports, $, Popper) { 'use strict';
  2578. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  2579. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  2580. function _defineProperties(target, props) {
  2581. for (var i = 0; i < props.length; i++) {
  2582. var descriptor = props[i];
  2583. descriptor.enumerable = descriptor.enumerable || false;
  2584. descriptor.configurable = true;
  2585. if ("value" in descriptor) descriptor.writable = true;
  2586. Object.defineProperty(target, descriptor.key, descriptor);
  2587. }
  2588. }
  2589. function _createClass(Constructor, protoProps, staticProps) {
  2590. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  2591. if (staticProps) _defineProperties(Constructor, staticProps);
  2592. return Constructor;
  2593. }
  2594. function _defineProperty(obj, key, value) {
  2595. if (key in obj) {
  2596. Object.defineProperty(obj, key, {
  2597. value: value,
  2598. enumerable: true,
  2599. configurable: true,
  2600. writable: true
  2601. });
  2602. } else {
  2603. obj[key] = value;
  2604. }
  2605. return obj;
  2606. }
  2607. function ownKeys(object, enumerableOnly) {
  2608. var keys = Object.keys(object);
  2609. if (Object.getOwnPropertySymbols) {
  2610. var symbols = Object.getOwnPropertySymbols(object);
  2611. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  2612. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  2613. });
  2614. keys.push.apply(keys, symbols);
  2615. }
  2616. return keys;
  2617. }
  2618. function _objectSpread2(target) {
  2619. for (var i = 1; i < arguments.length; i++) {
  2620. var source = arguments[i] != null ? arguments[i] : {};
  2621. if (i % 2) {
  2622. ownKeys(Object(source), true).forEach(function (key) {
  2623. _defineProperty(target, key, source[key]);
  2624. });
  2625. } else if (Object.getOwnPropertyDescriptors) {
  2626. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  2627. } else {
  2628. ownKeys(Object(source)).forEach(function (key) {
  2629. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  2630. });
  2631. }
  2632. }
  2633. return target;
  2634. }
  2635. function _inheritsLoose(subClass, superClass) {
  2636. subClass.prototype = Object.create(superClass.prototype);
  2637. subClass.prototype.constructor = subClass;
  2638. subClass.__proto__ = superClass;
  2639. }
  2640. /**
  2641. * --------------------------------------------------------------------------
  2642. * Bootstrap (v4.4.1): util.js
  2643. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2644. * --------------------------------------------------------------------------
  2645. */
  2646. /**
  2647. * ------------------------------------------------------------------------
  2648. * Private TransitionEnd Helpers
  2649. * ------------------------------------------------------------------------
  2650. */
  2651. var TRANSITION_END = 'transitionend';
  2652. var MAX_UID = 1000000;
  2653. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  2654. function toType(obj) {
  2655. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  2656. }
  2657. function getSpecialTransitionEndEvent() {
  2658. return {
  2659. bindType: TRANSITION_END,
  2660. delegateType: TRANSITION_END,
  2661. handle: function handle(event) {
  2662. if ($(event.target).is(this)) {
  2663. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  2664. }
  2665. return undefined; // eslint-disable-line no-undefined
  2666. }
  2667. };
  2668. }
  2669. function transitionEndEmulator(duration) {
  2670. var _this = this;
  2671. var called = false;
  2672. $(this).one(Util.TRANSITION_END, function () {
  2673. called = true;
  2674. });
  2675. setTimeout(function () {
  2676. if (!called) {
  2677. Util.triggerTransitionEnd(_this);
  2678. }
  2679. }, duration);
  2680. return this;
  2681. }
  2682. function setTransitionEndSupport() {
  2683. $.fn.emulateTransitionEnd = transitionEndEmulator;
  2684. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  2685. }
  2686. /**
  2687. * --------------------------------------------------------------------------
  2688. * Public Util Api
  2689. * --------------------------------------------------------------------------
  2690. */
  2691. var Util = {
  2692. TRANSITION_END: 'bsTransitionEnd',
  2693. getUID: function getUID(prefix) {
  2694. do {
  2695. // eslint-disable-next-line no-bitwise
  2696. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  2697. } while (document.getElementById(prefix));
  2698. return prefix;
  2699. },
  2700. getSelectorFromElement: function getSelectorFromElement(element) {
  2701. var selector = element.getAttribute('data-target');
  2702. if (!selector || selector === '#') {
  2703. var hrefAttr = element.getAttribute('href');
  2704. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  2705. }
  2706. try {
  2707. return document.querySelector(selector) ? selector : null;
  2708. } catch (err) {
  2709. return null;
  2710. }
  2711. },
  2712. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  2713. if (!element) {
  2714. return 0;
  2715. } // Get transition-duration of the element
  2716. var transitionDuration = $(element).css('transition-duration');
  2717. var transitionDelay = $(element).css('transition-delay');
  2718. var floatTransitionDuration = parseFloat(transitionDuration);
  2719. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  2720. if (!floatTransitionDuration && !floatTransitionDelay) {
  2721. return 0;
  2722. } // If multiple durations are defined, take the first
  2723. transitionDuration = transitionDuration.split(',')[0];
  2724. transitionDelay = transitionDelay.split(',')[0];
  2725. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  2726. },
  2727. reflow: function reflow(element) {
  2728. return element.offsetHeight;
  2729. },
  2730. triggerTransitionEnd: function triggerTransitionEnd(element) {
  2731. $(element).trigger(TRANSITION_END);
  2732. },
  2733. // TODO: Remove in v5
  2734. supportsTransitionEnd: function supportsTransitionEnd() {
  2735. return Boolean(TRANSITION_END);
  2736. },
  2737. isElement: function isElement(obj) {
  2738. return (obj[0] || obj).nodeType;
  2739. },
  2740. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  2741. for (var property in configTypes) {
  2742. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  2743. var expectedTypes = configTypes[property];
  2744. var value = config[property];
  2745. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  2746. if (!new RegExp(expectedTypes).test(valueType)) {
  2747. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  2748. }
  2749. }
  2750. }
  2751. },
  2752. findShadowRoot: function findShadowRoot(element) {
  2753. if (!document.documentElement.attachShadow) {
  2754. return null;
  2755. } // Can find the shadow root otherwise it'll return the document
  2756. if (typeof element.getRootNode === 'function') {
  2757. var root = element.getRootNode();
  2758. return root instanceof ShadowRoot ? root : null;
  2759. }
  2760. if (element instanceof ShadowRoot) {
  2761. return element;
  2762. } // when we don't find a shadow root
  2763. if (!element.parentNode) {
  2764. return null;
  2765. }
  2766. return Util.findShadowRoot(element.parentNode);
  2767. },
  2768. jQueryDetection: function jQueryDetection() {
  2769. if (typeof $ === 'undefined') {
  2770. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  2771. }
  2772. var version = $.fn.jquery.split(' ')[0].split('.');
  2773. var minMajor = 1;
  2774. var ltMajor = 2;
  2775. var minMinor = 9;
  2776. var minPatch = 1;
  2777. var maxMajor = 4;
  2778. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  2779. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  2780. }
  2781. }
  2782. };
  2783. Util.jQueryDetection();
  2784. setTransitionEndSupport();
  2785. /**
  2786. * ------------------------------------------------------------------------
  2787. * Constants
  2788. * ------------------------------------------------------------------------
  2789. */
  2790. var NAME = 'alert';
  2791. var VERSION = '4.4.1';
  2792. var DATA_KEY = 'bs.alert';
  2793. var EVENT_KEY = "." + DATA_KEY;
  2794. var DATA_API_KEY = '.data-api';
  2795. var JQUERY_NO_CONFLICT = $.fn[NAME];
  2796. var Selector = {
  2797. DISMISS: '[data-dismiss="alert"]'
  2798. };
  2799. var Event = {
  2800. CLOSE: "close" + EVENT_KEY,
  2801. CLOSED: "closed" + EVENT_KEY,
  2802. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  2803. };
  2804. var ClassName = {
  2805. ALERT: 'alert',
  2806. FADE: 'fade',
  2807. SHOW: 'show'
  2808. };
  2809. /**
  2810. * ------------------------------------------------------------------------
  2811. * Class Definition
  2812. * ------------------------------------------------------------------------
  2813. */
  2814. var Alert =
  2815. /*#__PURE__*/
  2816. function () {
  2817. function Alert(element) {
  2818. this._element = element;
  2819. } // Getters
  2820. var _proto = Alert.prototype;
  2821. // Public
  2822. _proto.close = function close(element) {
  2823. var rootElement = this._element;
  2824. if (element) {
  2825. rootElement = this._getRootElement(element);
  2826. }
  2827. var customEvent = this._triggerCloseEvent(rootElement);
  2828. if (customEvent.isDefaultPrevented()) {
  2829. return;
  2830. }
  2831. this._removeElement(rootElement);
  2832. };
  2833. _proto.dispose = function dispose() {
  2834. $.removeData(this._element, DATA_KEY);
  2835. this._element = null;
  2836. } // Private
  2837. ;
  2838. _proto._getRootElement = function _getRootElement(element) {
  2839. var selector = Util.getSelectorFromElement(element);
  2840. var parent = false;
  2841. if (selector) {
  2842. parent = document.querySelector(selector);
  2843. }
  2844. if (!parent) {
  2845. parent = $(element).closest("." + ClassName.ALERT)[0];
  2846. }
  2847. return parent;
  2848. };
  2849. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  2850. var closeEvent = $.Event(Event.CLOSE);
  2851. $(element).trigger(closeEvent);
  2852. return closeEvent;
  2853. };
  2854. _proto._removeElement = function _removeElement(element) {
  2855. var _this = this;
  2856. $(element).removeClass(ClassName.SHOW);
  2857. if (!$(element).hasClass(ClassName.FADE)) {
  2858. this._destroyElement(element);
  2859. return;
  2860. }
  2861. var transitionDuration = Util.getTransitionDurationFromElement(element);
  2862. $(element).one(Util.TRANSITION_END, function (event) {
  2863. return _this._destroyElement(element, event);
  2864. }).emulateTransitionEnd(transitionDuration);
  2865. };
  2866. _proto._destroyElement = function _destroyElement(element) {
  2867. $(element).detach().trigger(Event.CLOSED).remove();
  2868. } // Static
  2869. ;
  2870. Alert._jQueryInterface = function _jQueryInterface(config) {
  2871. return this.each(function () {
  2872. var $element = $(this);
  2873. var data = $element.data(DATA_KEY);
  2874. if (!data) {
  2875. data = new Alert(this);
  2876. $element.data(DATA_KEY, data);
  2877. }
  2878. if (config === 'close') {
  2879. data[config](this);
  2880. }
  2881. });
  2882. };
  2883. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  2884. return function (event) {
  2885. if (event) {
  2886. event.preventDefault();
  2887. }
  2888. alertInstance.close(this);
  2889. };
  2890. };
  2891. _createClass(Alert, null, [{
  2892. key: "VERSION",
  2893. get: function get() {
  2894. return VERSION;
  2895. }
  2896. }]);
  2897. return Alert;
  2898. }();
  2899. /**
  2900. * ------------------------------------------------------------------------
  2901. * Data Api implementation
  2902. * ------------------------------------------------------------------------
  2903. */
  2904. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  2905. /**
  2906. * ------------------------------------------------------------------------
  2907. * jQuery
  2908. * ------------------------------------------------------------------------
  2909. */
  2910. $.fn[NAME] = Alert._jQueryInterface;
  2911. $.fn[NAME].Constructor = Alert;
  2912. $.fn[NAME].noConflict = function () {
  2913. $.fn[NAME] = JQUERY_NO_CONFLICT;
  2914. return Alert._jQueryInterface;
  2915. };
  2916. /**
  2917. * ------------------------------------------------------------------------
  2918. * Constants
  2919. * ------------------------------------------------------------------------
  2920. */
  2921. var NAME$1 = 'button';
  2922. var VERSION$1 = '4.4.1';
  2923. var DATA_KEY$1 = 'bs.button';
  2924. var EVENT_KEY$1 = "." + DATA_KEY$1;
  2925. var DATA_API_KEY$1 = '.data-api';
  2926. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  2927. var ClassName$1 = {
  2928. ACTIVE: 'active',
  2929. BUTTON: 'btn',
  2930. FOCUS: 'focus'
  2931. };
  2932. var Selector$1 = {
  2933. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  2934. DATA_TOGGLES: '[data-toggle="buttons"]',
  2935. DATA_TOGGLE: '[data-toggle="button"]',
  2936. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  2937. INPUT: 'input:not([type="hidden"])',
  2938. ACTIVE: '.active',
  2939. BUTTON: '.btn'
  2940. };
  2941. var Event$1 = {
  2942. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  2943. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  2944. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  2945. };
  2946. /**
  2947. * ------------------------------------------------------------------------
  2948. * Class Definition
  2949. * ------------------------------------------------------------------------
  2950. */
  2951. var Button =
  2952. /*#__PURE__*/
  2953. function () {
  2954. function Button(element) {
  2955. this._element = element;
  2956. } // Getters
  2957. var _proto = Button.prototype;
  2958. // Public
  2959. _proto.toggle = function toggle() {
  2960. var triggerChangeEvent = true;
  2961. var addAriaPressed = true;
  2962. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  2963. if (rootElement) {
  2964. var input = this._element.querySelector(Selector$1.INPUT);
  2965. if (input) {
  2966. if (input.type === 'radio') {
  2967. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  2968. triggerChangeEvent = false;
  2969. } else {
  2970. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  2971. if (activeElement) {
  2972. $(activeElement).removeClass(ClassName$1.ACTIVE);
  2973. }
  2974. }
  2975. } else if (input.type === 'checkbox') {
  2976. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  2977. triggerChangeEvent = false;
  2978. }
  2979. } else {
  2980. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  2981. triggerChangeEvent = false;
  2982. }
  2983. if (triggerChangeEvent) {
  2984. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  2985. $(input).trigger('change');
  2986. }
  2987. input.focus();
  2988. addAriaPressed = false;
  2989. }
  2990. }
  2991. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  2992. if (addAriaPressed) {
  2993. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  2994. }
  2995. if (triggerChangeEvent) {
  2996. $(this._element).toggleClass(ClassName$1.ACTIVE);
  2997. }
  2998. }
  2999. };
  3000. _proto.dispose = function dispose() {
  3001. $.removeData(this._element, DATA_KEY$1);
  3002. this._element = null;
  3003. } // Static
  3004. ;
  3005. Button._jQueryInterface = function _jQueryInterface(config) {
  3006. return this.each(function () {
  3007. var data = $(this).data(DATA_KEY$1);
  3008. if (!data) {
  3009. data = new Button(this);
  3010. $(this).data(DATA_KEY$1, data);
  3011. }
  3012. if (config === 'toggle') {
  3013. data[config]();
  3014. }
  3015. });
  3016. };
  3017. _createClass(Button, null, [{
  3018. key: "VERSION",
  3019. get: function get() {
  3020. return VERSION$1;
  3021. }
  3022. }]);
  3023. return Button;
  3024. }();
  3025. /**
  3026. * ------------------------------------------------------------------------
  3027. * Data Api implementation
  3028. * ------------------------------------------------------------------------
  3029. */
  3030. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  3031. var button = event.target;
  3032. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  3033. button = $(button).closest(Selector$1.BUTTON)[0];
  3034. }
  3035. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  3036. event.preventDefault(); // work around Firefox bug #1540995
  3037. } else {
  3038. var inputBtn = button.querySelector(Selector$1.INPUT);
  3039. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  3040. event.preventDefault(); // work around Firefox bug #1540995
  3041. return;
  3042. }
  3043. Button._jQueryInterface.call($(button), 'toggle');
  3044. }
  3045. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  3046. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  3047. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  3048. });
  3049. $(window).on(Event$1.LOAD_DATA_API, function () {
  3050. // ensure correct active class is set to match the controls' actual values/states
  3051. // find all checkboxes/readio buttons inside data-toggle groups
  3052. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  3053. for (var i = 0, len = buttons.length; i < len; i++) {
  3054. var button = buttons[i];
  3055. var input = button.querySelector(Selector$1.INPUT);
  3056. if (input.checked || input.hasAttribute('checked')) {
  3057. button.classList.add(ClassName$1.ACTIVE);
  3058. } else {
  3059. button.classList.remove(ClassName$1.ACTIVE);
  3060. }
  3061. } // find all button toggles
  3062. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  3063. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  3064. var _button = buttons[_i];
  3065. if (_button.getAttribute('aria-pressed') === 'true') {
  3066. _button.classList.add(ClassName$1.ACTIVE);
  3067. } else {
  3068. _button.classList.remove(ClassName$1.ACTIVE);
  3069. }
  3070. }
  3071. });
  3072. /**
  3073. * ------------------------------------------------------------------------
  3074. * jQuery
  3075. * ------------------------------------------------------------------------
  3076. */
  3077. $.fn[NAME$1] = Button._jQueryInterface;
  3078. $.fn[NAME$1].Constructor = Button;
  3079. $.fn[NAME$1].noConflict = function () {
  3080. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  3081. return Button._jQueryInterface;
  3082. };
  3083. /**
  3084. * ------------------------------------------------------------------------
  3085. * Constants
  3086. * ------------------------------------------------------------------------
  3087. */
  3088. var NAME$2 = 'carousel';
  3089. var VERSION$2 = '4.4.1';
  3090. var DATA_KEY$2 = 'bs.carousel';
  3091. var EVENT_KEY$2 = "." + DATA_KEY$2;
  3092. var DATA_API_KEY$2 = '.data-api';
  3093. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  3094. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  3095. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  3096. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  3097. var SWIPE_THRESHOLD = 40;
  3098. var Default = {
  3099. interval: 5000,
  3100. keyboard: true,
  3101. slide: false,
  3102. pause: 'hover',
  3103. wrap: true,
  3104. touch: true
  3105. };
  3106. var DefaultType = {
  3107. interval: '(number|boolean)',
  3108. keyboard: 'boolean',
  3109. slide: '(boolean|string)',
  3110. pause: '(string|boolean)',
  3111. wrap: 'boolean',
  3112. touch: 'boolean'
  3113. };
  3114. var Direction = {
  3115. NEXT: 'next',
  3116. PREV: 'prev',
  3117. LEFT: 'left',
  3118. RIGHT: 'right'
  3119. };
  3120. var Event$2 = {
  3121. SLIDE: "slide" + EVENT_KEY$2,
  3122. SLID: "slid" + EVENT_KEY$2,
  3123. KEYDOWN: "keydown" + EVENT_KEY$2,
  3124. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  3125. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  3126. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  3127. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  3128. TOUCHEND: "touchend" + EVENT_KEY$2,
  3129. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  3130. POINTERUP: "pointerup" + EVENT_KEY$2,
  3131. DRAG_START: "dragstart" + EVENT_KEY$2,
  3132. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  3133. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  3134. };
  3135. var ClassName$2 = {
  3136. CAROUSEL: 'carousel',
  3137. ACTIVE: 'active',
  3138. SLIDE: 'slide',
  3139. RIGHT: 'carousel-item-right',
  3140. LEFT: 'carousel-item-left',
  3141. NEXT: 'carousel-item-next',
  3142. PREV: 'carousel-item-prev',
  3143. ITEM: 'carousel-item',
  3144. POINTER_EVENT: 'pointer-event'
  3145. };
  3146. var Selector$2 = {
  3147. ACTIVE: '.active',
  3148. ACTIVE_ITEM: '.active.carousel-item',
  3149. ITEM: '.carousel-item',
  3150. ITEM_IMG: '.carousel-item img',
  3151. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  3152. INDICATORS: '.carousel-indicators',
  3153. DATA_SLIDE: '[data-slide], [data-slide-to]',
  3154. DATA_RIDE: '[data-ride="carousel"]'
  3155. };
  3156. var PointerType = {
  3157. TOUCH: 'touch',
  3158. PEN: 'pen'
  3159. };
  3160. /**
  3161. * ------------------------------------------------------------------------
  3162. * Class Definition
  3163. * ------------------------------------------------------------------------
  3164. */
  3165. var Carousel =
  3166. /*#__PURE__*/
  3167. function () {
  3168. function Carousel(element, config) {
  3169. this._items = null;
  3170. this._interval = null;
  3171. this._activeElement = null;
  3172. this._isPaused = false;
  3173. this._isSliding = false;
  3174. this.touchTimeout = null;
  3175. this.touchStartX = 0;
  3176. this.touchDeltaX = 0;
  3177. this._config = this._getConfig(config);
  3178. this._element = element;
  3179. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  3180. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  3181. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  3182. this._addEventListeners();
  3183. } // Getters
  3184. var _proto = Carousel.prototype;
  3185. // Public
  3186. _proto.next = function next() {
  3187. if (!this._isSliding) {
  3188. this._slide(Direction.NEXT);
  3189. }
  3190. };
  3191. _proto.nextWhenVisible = function nextWhenVisible() {
  3192. // Don't call next when the page isn't visible
  3193. // or the carousel or its parent isn't visible
  3194. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  3195. this.next();
  3196. }
  3197. };
  3198. _proto.prev = function prev() {
  3199. if (!this._isSliding) {
  3200. this._slide(Direction.PREV);
  3201. }
  3202. };
  3203. _proto.pause = function pause(event) {
  3204. if (!event) {
  3205. this._isPaused = true;
  3206. }
  3207. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  3208. Util.triggerTransitionEnd(this._element);
  3209. this.cycle(true);
  3210. }
  3211. clearInterval(this._interval);
  3212. this._interval = null;
  3213. };
  3214. _proto.cycle = function cycle(event) {
  3215. if (!event) {
  3216. this._isPaused = false;
  3217. }
  3218. if (this._interval) {
  3219. clearInterval(this._interval);
  3220. this._interval = null;
  3221. }
  3222. if (this._config.interval && !this._isPaused) {
  3223. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  3224. }
  3225. };
  3226. _proto.to = function to(index) {
  3227. var _this = this;
  3228. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3229. var activeIndex = this._getItemIndex(this._activeElement);
  3230. if (index > this._items.length - 1 || index < 0) {
  3231. return;
  3232. }
  3233. if (this._isSliding) {
  3234. $(this._element).one(Event$2.SLID, function () {
  3235. return _this.to(index);
  3236. });
  3237. return;
  3238. }
  3239. if (activeIndex === index) {
  3240. this.pause();
  3241. this.cycle();
  3242. return;
  3243. }
  3244. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  3245. this._slide(direction, this._items[index]);
  3246. };
  3247. _proto.dispose = function dispose() {
  3248. $(this._element).off(EVENT_KEY$2);
  3249. $.removeData(this._element, DATA_KEY$2);
  3250. this._items = null;
  3251. this._config = null;
  3252. this._element = null;
  3253. this._interval = null;
  3254. this._isPaused = null;
  3255. this._isSliding = null;
  3256. this._activeElement = null;
  3257. this._indicatorsElement = null;
  3258. } // Private
  3259. ;
  3260. _proto._getConfig = function _getConfig(config) {
  3261. config = _objectSpread2({}, Default, {}, config);
  3262. Util.typeCheckConfig(NAME$2, config, DefaultType);
  3263. return config;
  3264. };
  3265. _proto._handleSwipe = function _handleSwipe() {
  3266. var absDeltax = Math.abs(this.touchDeltaX);
  3267. if (absDeltax <= SWIPE_THRESHOLD) {
  3268. return;
  3269. }
  3270. var direction = absDeltax / this.touchDeltaX;
  3271. this.touchDeltaX = 0; // swipe left
  3272. if (direction > 0) {
  3273. this.prev();
  3274. } // swipe right
  3275. if (direction < 0) {
  3276. this.next();
  3277. }
  3278. };
  3279. _proto._addEventListeners = function _addEventListeners() {
  3280. var _this2 = this;
  3281. if (this._config.keyboard) {
  3282. $(this._element).on(Event$2.KEYDOWN, function (event) {
  3283. return _this2._keydown(event);
  3284. });
  3285. }
  3286. if (this._config.pause === 'hover') {
  3287. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  3288. return _this2.pause(event);
  3289. }).on(Event$2.MOUSELEAVE, function (event) {
  3290. return _this2.cycle(event);
  3291. });
  3292. }
  3293. if (this._config.touch) {
  3294. this._addTouchEventListeners();
  3295. }
  3296. };
  3297. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  3298. var _this3 = this;
  3299. if (!this._touchSupported) {
  3300. return;
  3301. }
  3302. var start = function start(event) {
  3303. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3304. _this3.touchStartX = event.originalEvent.clientX;
  3305. } else if (!_this3._pointerEvent) {
  3306. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  3307. }
  3308. };
  3309. var move = function move(event) {
  3310. // ensure swiping with one touch and not pinching
  3311. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  3312. _this3.touchDeltaX = 0;
  3313. } else {
  3314. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  3315. }
  3316. };
  3317. var end = function end(event) {
  3318. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3319. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  3320. }
  3321. _this3._handleSwipe();
  3322. if (_this3._config.pause === 'hover') {
  3323. // If it's a touch-enabled device, mouseenter/leave are fired as
  3324. // part of the mouse compatibility events on first tap - the carousel
  3325. // would stop cycling until user tapped out of it;
  3326. // here, we listen for touchend, explicitly pause the carousel
  3327. // (as if it's the second time we tap on it, mouseenter compat event
  3328. // is NOT fired) and after a timeout (to allow for mouse compatibility
  3329. // events to fire) we explicitly restart cycling
  3330. _this3.pause();
  3331. if (_this3.touchTimeout) {
  3332. clearTimeout(_this3.touchTimeout);
  3333. }
  3334. _this3.touchTimeout = setTimeout(function (event) {
  3335. return _this3.cycle(event);
  3336. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  3337. }
  3338. };
  3339. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  3340. return e.preventDefault();
  3341. });
  3342. if (this._pointerEvent) {
  3343. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  3344. return start(event);
  3345. });
  3346. $(this._element).on(Event$2.POINTERUP, function (event) {
  3347. return end(event);
  3348. });
  3349. this._element.classList.add(ClassName$2.POINTER_EVENT);
  3350. } else {
  3351. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  3352. return start(event);
  3353. });
  3354. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  3355. return move(event);
  3356. });
  3357. $(this._element).on(Event$2.TOUCHEND, function (event) {
  3358. return end(event);
  3359. });
  3360. }
  3361. };
  3362. _proto._keydown = function _keydown(event) {
  3363. if (/input|textarea/i.test(event.target.tagName)) {
  3364. return;
  3365. }
  3366. switch (event.which) {
  3367. case ARROW_LEFT_KEYCODE:
  3368. event.preventDefault();
  3369. this.prev();
  3370. break;
  3371. case ARROW_RIGHT_KEYCODE:
  3372. event.preventDefault();
  3373. this.next();
  3374. break;
  3375. }
  3376. };
  3377. _proto._getItemIndex = function _getItemIndex(element) {
  3378. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  3379. return this._items.indexOf(element);
  3380. };
  3381. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  3382. var isNextDirection = direction === Direction.NEXT;
  3383. var isPrevDirection = direction === Direction.PREV;
  3384. var activeIndex = this._getItemIndex(activeElement);
  3385. var lastItemIndex = this._items.length - 1;
  3386. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  3387. if (isGoingToWrap && !this._config.wrap) {
  3388. return activeElement;
  3389. }
  3390. var delta = direction === Direction.PREV ? -1 : 1;
  3391. var itemIndex = (activeIndex + delta) % this._items.length;
  3392. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  3393. };
  3394. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  3395. var targetIndex = this._getItemIndex(relatedTarget);
  3396. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  3397. var slideEvent = $.Event(Event$2.SLIDE, {
  3398. relatedTarget: relatedTarget,
  3399. direction: eventDirectionName,
  3400. from: fromIndex,
  3401. to: targetIndex
  3402. });
  3403. $(this._element).trigger(slideEvent);
  3404. return slideEvent;
  3405. };
  3406. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  3407. if (this._indicatorsElement) {
  3408. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  3409. $(indicators).removeClass(ClassName$2.ACTIVE);
  3410. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  3411. if (nextIndicator) {
  3412. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  3413. }
  3414. }
  3415. };
  3416. _proto._slide = function _slide(direction, element) {
  3417. var _this4 = this;
  3418. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3419. var activeElementIndex = this._getItemIndex(activeElement);
  3420. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  3421. var nextElementIndex = this._getItemIndex(nextElement);
  3422. var isCycling = Boolean(this._interval);
  3423. var directionalClassName;
  3424. var orderClassName;
  3425. var eventDirectionName;
  3426. if (direction === Direction.NEXT) {
  3427. directionalClassName = ClassName$2.LEFT;
  3428. orderClassName = ClassName$2.NEXT;
  3429. eventDirectionName = Direction.LEFT;
  3430. } else {
  3431. directionalClassName = ClassName$2.RIGHT;
  3432. orderClassName = ClassName$2.PREV;
  3433. eventDirectionName = Direction.RIGHT;
  3434. }
  3435. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  3436. this._isSliding = false;
  3437. return;
  3438. }
  3439. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  3440. if (slideEvent.isDefaultPrevented()) {
  3441. return;
  3442. }
  3443. if (!activeElement || !nextElement) {
  3444. // Some weirdness is happening, so we bail
  3445. return;
  3446. }
  3447. this._isSliding = true;
  3448. if (isCycling) {
  3449. this.pause();
  3450. }
  3451. this._setActiveIndicatorElement(nextElement);
  3452. var slidEvent = $.Event(Event$2.SLID, {
  3453. relatedTarget: nextElement,
  3454. direction: eventDirectionName,
  3455. from: activeElementIndex,
  3456. to: nextElementIndex
  3457. });
  3458. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  3459. $(nextElement).addClass(orderClassName);
  3460. Util.reflow(nextElement);
  3461. $(activeElement).addClass(directionalClassName);
  3462. $(nextElement).addClass(directionalClassName);
  3463. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  3464. if (nextElementInterval) {
  3465. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  3466. this._config.interval = nextElementInterval;
  3467. } else {
  3468. this._config.interval = this._config.defaultInterval || this._config.interval;
  3469. }
  3470. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  3471. $(activeElement).one(Util.TRANSITION_END, function () {
  3472. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  3473. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  3474. _this4._isSliding = false;
  3475. setTimeout(function () {
  3476. return $(_this4._element).trigger(slidEvent);
  3477. }, 0);
  3478. }).emulateTransitionEnd(transitionDuration);
  3479. } else {
  3480. $(activeElement).removeClass(ClassName$2.ACTIVE);
  3481. $(nextElement).addClass(ClassName$2.ACTIVE);
  3482. this._isSliding = false;
  3483. $(this._element).trigger(slidEvent);
  3484. }
  3485. if (isCycling) {
  3486. this.cycle();
  3487. }
  3488. } // Static
  3489. ;
  3490. Carousel._jQueryInterface = function _jQueryInterface(config) {
  3491. return this.each(function () {
  3492. var data = $(this).data(DATA_KEY$2);
  3493. var _config = _objectSpread2({}, Default, {}, $(this).data());
  3494. if (typeof config === 'object') {
  3495. _config = _objectSpread2({}, _config, {}, config);
  3496. }
  3497. var action = typeof config === 'string' ? config : _config.slide;
  3498. if (!data) {
  3499. data = new Carousel(this, _config);
  3500. $(this).data(DATA_KEY$2, data);
  3501. }
  3502. if (typeof config === 'number') {
  3503. data.to(config);
  3504. } else if (typeof action === 'string') {
  3505. if (typeof data[action] === 'undefined') {
  3506. throw new TypeError("No method named \"" + action + "\"");
  3507. }
  3508. data[action]();
  3509. } else if (_config.interval && _config.ride) {
  3510. data.pause();
  3511. data.cycle();
  3512. }
  3513. });
  3514. };
  3515. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  3516. var selector = Util.getSelectorFromElement(this);
  3517. if (!selector) {
  3518. return;
  3519. }
  3520. var target = $(selector)[0];
  3521. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  3522. return;
  3523. }
  3524. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  3525. var slideIndex = this.getAttribute('data-slide-to');
  3526. if (slideIndex) {
  3527. config.interval = false;
  3528. }
  3529. Carousel._jQueryInterface.call($(target), config);
  3530. if (slideIndex) {
  3531. $(target).data(DATA_KEY$2).to(slideIndex);
  3532. }
  3533. event.preventDefault();
  3534. };
  3535. _createClass(Carousel, null, [{
  3536. key: "VERSION",
  3537. get: function get() {
  3538. return VERSION$2;
  3539. }
  3540. }, {
  3541. key: "Default",
  3542. get: function get() {
  3543. return Default;
  3544. }
  3545. }]);
  3546. return Carousel;
  3547. }();
  3548. /**
  3549. * ------------------------------------------------------------------------
  3550. * Data Api implementation
  3551. * ------------------------------------------------------------------------
  3552. */
  3553. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  3554. $(window).on(Event$2.LOAD_DATA_API, function () {
  3555. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  3556. for (var i = 0, len = carousels.length; i < len; i++) {
  3557. var $carousel = $(carousels[i]);
  3558. Carousel._jQueryInterface.call($carousel, $carousel.data());
  3559. }
  3560. });
  3561. /**
  3562. * ------------------------------------------------------------------------
  3563. * jQuery
  3564. * ------------------------------------------------------------------------
  3565. */
  3566. $.fn[NAME$2] = Carousel._jQueryInterface;
  3567. $.fn[NAME$2].Constructor = Carousel;
  3568. $.fn[NAME$2].noConflict = function () {
  3569. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  3570. return Carousel._jQueryInterface;
  3571. };
  3572. /**
  3573. * ------------------------------------------------------------------------
  3574. * Constants
  3575. * ------------------------------------------------------------------------
  3576. */
  3577. var NAME$3 = 'collapse';
  3578. var VERSION$3 = '4.4.1';
  3579. var DATA_KEY$3 = 'bs.collapse';
  3580. var EVENT_KEY$3 = "." + DATA_KEY$3;
  3581. var DATA_API_KEY$3 = '.data-api';
  3582. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  3583. var Default$1 = {
  3584. toggle: true,
  3585. parent: ''
  3586. };
  3587. var DefaultType$1 = {
  3588. toggle: 'boolean',
  3589. parent: '(string|element)'
  3590. };
  3591. var Event$3 = {
  3592. SHOW: "show" + EVENT_KEY$3,
  3593. SHOWN: "shown" + EVENT_KEY$3,
  3594. HIDE: "hide" + EVENT_KEY$3,
  3595. HIDDEN: "hidden" + EVENT_KEY$3,
  3596. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  3597. };
  3598. var ClassName$3 = {
  3599. SHOW: 'show',
  3600. COLLAPSE: 'collapse',
  3601. COLLAPSING: 'collapsing',
  3602. COLLAPSED: 'collapsed'
  3603. };
  3604. var Dimension = {
  3605. WIDTH: 'width',
  3606. HEIGHT: 'height'
  3607. };
  3608. var Selector$3 = {
  3609. ACTIVES: '.show, .collapsing',
  3610. DATA_TOGGLE: '[data-toggle="collapse"]'
  3611. };
  3612. /**
  3613. * ------------------------------------------------------------------------
  3614. * Class Definition
  3615. * ------------------------------------------------------------------------
  3616. */
  3617. var Collapse =
  3618. /*#__PURE__*/
  3619. function () {
  3620. function Collapse(element, config) {
  3621. this._isTransitioning = false;
  3622. this._element = element;
  3623. this._config = this._getConfig(config);
  3624. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  3625. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  3626. for (var i = 0, len = toggleList.length; i < len; i++) {
  3627. var elem = toggleList[i];
  3628. var selector = Util.getSelectorFromElement(elem);
  3629. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  3630. return foundElem === element;
  3631. });
  3632. if (selector !== null && filterElement.length > 0) {
  3633. this._selector = selector;
  3634. this._triggerArray.push(elem);
  3635. }
  3636. }
  3637. this._parent = this._config.parent ? this._getParent() : null;
  3638. if (!this._config.parent) {
  3639. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  3640. }
  3641. if (this._config.toggle) {
  3642. this.toggle();
  3643. }
  3644. } // Getters
  3645. var _proto = Collapse.prototype;
  3646. // Public
  3647. _proto.toggle = function toggle() {
  3648. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  3649. this.hide();
  3650. } else {
  3651. this.show();
  3652. }
  3653. };
  3654. _proto.show = function show() {
  3655. var _this = this;
  3656. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  3657. return;
  3658. }
  3659. var actives;
  3660. var activesData;
  3661. if (this._parent) {
  3662. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  3663. if (typeof _this._config.parent === 'string') {
  3664. return elem.getAttribute('data-parent') === _this._config.parent;
  3665. }
  3666. return elem.classList.contains(ClassName$3.COLLAPSE);
  3667. });
  3668. if (actives.length === 0) {
  3669. actives = null;
  3670. }
  3671. }
  3672. if (actives) {
  3673. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  3674. if (activesData && activesData._isTransitioning) {
  3675. return;
  3676. }
  3677. }
  3678. var startEvent = $.Event(Event$3.SHOW);
  3679. $(this._element).trigger(startEvent);
  3680. if (startEvent.isDefaultPrevented()) {
  3681. return;
  3682. }
  3683. if (actives) {
  3684. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  3685. if (!activesData) {
  3686. $(actives).data(DATA_KEY$3, null);
  3687. }
  3688. }
  3689. var dimension = this._getDimension();
  3690. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  3691. this._element.style[dimension] = 0;
  3692. if (this._triggerArray.length) {
  3693. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  3694. }
  3695. this.setTransitioning(true);
  3696. var complete = function complete() {
  3697. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  3698. _this._element.style[dimension] = '';
  3699. _this.setTransitioning(false);
  3700. $(_this._element).trigger(Event$3.SHOWN);
  3701. };
  3702. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  3703. var scrollSize = "scroll" + capitalizedDimension;
  3704. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3705. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3706. this._element.style[dimension] = this._element[scrollSize] + "px";
  3707. };
  3708. _proto.hide = function hide() {
  3709. var _this2 = this;
  3710. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  3711. return;
  3712. }
  3713. var startEvent = $.Event(Event$3.HIDE);
  3714. $(this._element).trigger(startEvent);
  3715. if (startEvent.isDefaultPrevented()) {
  3716. return;
  3717. }
  3718. var dimension = this._getDimension();
  3719. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  3720. Util.reflow(this._element);
  3721. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  3722. var triggerArrayLength = this._triggerArray.length;
  3723. if (triggerArrayLength > 0) {
  3724. for (var i = 0; i < triggerArrayLength; i++) {
  3725. var trigger = this._triggerArray[i];
  3726. var selector = Util.getSelectorFromElement(trigger);
  3727. if (selector !== null) {
  3728. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  3729. if (!$elem.hasClass(ClassName$3.SHOW)) {
  3730. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  3731. }
  3732. }
  3733. }
  3734. }
  3735. this.setTransitioning(true);
  3736. var complete = function complete() {
  3737. _this2.setTransitioning(false);
  3738. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  3739. };
  3740. this._element.style[dimension] = '';
  3741. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3742. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3743. };
  3744. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  3745. this._isTransitioning = isTransitioning;
  3746. };
  3747. _proto.dispose = function dispose() {
  3748. $.removeData(this._element, DATA_KEY$3);
  3749. this._config = null;
  3750. this._parent = null;
  3751. this._element = null;
  3752. this._triggerArray = null;
  3753. this._isTransitioning = null;
  3754. } // Private
  3755. ;
  3756. _proto._getConfig = function _getConfig(config) {
  3757. config = _objectSpread2({}, Default$1, {}, config);
  3758. config.toggle = Boolean(config.toggle); // Coerce string values
  3759. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  3760. return config;
  3761. };
  3762. _proto._getDimension = function _getDimension() {
  3763. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  3764. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  3765. };
  3766. _proto._getParent = function _getParent() {
  3767. var _this3 = this;
  3768. var parent;
  3769. if (Util.isElement(this._config.parent)) {
  3770. parent = this._config.parent; // It's a jQuery object
  3771. if (typeof this._config.parent.jquery !== 'undefined') {
  3772. parent = this._config.parent[0];
  3773. }
  3774. } else {
  3775. parent = document.querySelector(this._config.parent);
  3776. }
  3777. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  3778. var children = [].slice.call(parent.querySelectorAll(selector));
  3779. $(children).each(function (i, element) {
  3780. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  3781. });
  3782. return parent;
  3783. };
  3784. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  3785. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  3786. if (triggerArray.length) {
  3787. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  3788. }
  3789. } // Static
  3790. ;
  3791. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  3792. var selector = Util.getSelectorFromElement(element);
  3793. return selector ? document.querySelector(selector) : null;
  3794. };
  3795. Collapse._jQueryInterface = function _jQueryInterface(config) {
  3796. return this.each(function () {
  3797. var $this = $(this);
  3798. var data = $this.data(DATA_KEY$3);
  3799. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  3800. if (!data && _config.toggle && /show|hide/.test(config)) {
  3801. _config.toggle = false;
  3802. }
  3803. if (!data) {
  3804. data = new Collapse(this, _config);
  3805. $this.data(DATA_KEY$3, data);
  3806. }
  3807. if (typeof config === 'string') {
  3808. if (typeof data[config] === 'undefined') {
  3809. throw new TypeError("No method named \"" + config + "\"");
  3810. }
  3811. data[config]();
  3812. }
  3813. });
  3814. };
  3815. _createClass(Collapse, null, [{
  3816. key: "VERSION",
  3817. get: function get() {
  3818. return VERSION$3;
  3819. }
  3820. }, {
  3821. key: "Default",
  3822. get: function get() {
  3823. return Default$1;
  3824. }
  3825. }]);
  3826. return Collapse;
  3827. }();
  3828. /**
  3829. * ------------------------------------------------------------------------
  3830. * Data Api implementation
  3831. * ------------------------------------------------------------------------
  3832. */
  3833. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  3834. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  3835. if (event.currentTarget.tagName === 'A') {
  3836. event.preventDefault();
  3837. }
  3838. var $trigger = $(this);
  3839. var selector = Util.getSelectorFromElement(this);
  3840. var selectors = [].slice.call(document.querySelectorAll(selector));
  3841. $(selectors).each(function () {
  3842. var $target = $(this);
  3843. var data = $target.data(DATA_KEY$3);
  3844. var config = data ? 'toggle' : $trigger.data();
  3845. Collapse._jQueryInterface.call($target, config);
  3846. });
  3847. });
  3848. /**
  3849. * ------------------------------------------------------------------------
  3850. * jQuery
  3851. * ------------------------------------------------------------------------
  3852. */
  3853. $.fn[NAME$3] = Collapse._jQueryInterface;
  3854. $.fn[NAME$3].Constructor = Collapse;
  3855. $.fn[NAME$3].noConflict = function () {
  3856. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  3857. return Collapse._jQueryInterface;
  3858. };
  3859. /**
  3860. * ------------------------------------------------------------------------
  3861. * Constants
  3862. * ------------------------------------------------------------------------
  3863. */
  3864. var NAME$4 = 'dropdown';
  3865. var VERSION$4 = '4.4.1';
  3866. var DATA_KEY$4 = 'bs.dropdown';
  3867. var EVENT_KEY$4 = "." + DATA_KEY$4;
  3868. var DATA_API_KEY$4 = '.data-api';
  3869. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  3870. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  3871. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  3872. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  3873. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  3874. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  3875. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  3876. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  3877. var Event$4 = {
  3878. HIDE: "hide" + EVENT_KEY$4,
  3879. HIDDEN: "hidden" + EVENT_KEY$4,
  3880. SHOW: "show" + EVENT_KEY$4,
  3881. SHOWN: "shown" + EVENT_KEY$4,
  3882. CLICK: "click" + EVENT_KEY$4,
  3883. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  3884. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  3885. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  3886. };
  3887. var ClassName$4 = {
  3888. DISABLED: 'disabled',
  3889. SHOW: 'show',
  3890. DROPUP: 'dropup',
  3891. DROPRIGHT: 'dropright',
  3892. DROPLEFT: 'dropleft',
  3893. MENURIGHT: 'dropdown-menu-right',
  3894. MENULEFT: 'dropdown-menu-left',
  3895. POSITION_STATIC: 'position-static'
  3896. };
  3897. var Selector$4 = {
  3898. DATA_TOGGLE: '[data-toggle="dropdown"]',
  3899. FORM_CHILD: '.dropdown form',
  3900. MENU: '.dropdown-menu',
  3901. NAVBAR_NAV: '.navbar-nav',
  3902. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  3903. };
  3904. var AttachmentMap = {
  3905. TOP: 'top-start',
  3906. TOPEND: 'top-end',
  3907. BOTTOM: 'bottom-start',
  3908. BOTTOMEND: 'bottom-end',
  3909. RIGHT: 'right-start',
  3910. RIGHTEND: 'right-end',
  3911. LEFT: 'left-start',
  3912. LEFTEND: 'left-end'
  3913. };
  3914. var Default$2 = {
  3915. offset: 0,
  3916. flip: true,
  3917. boundary: 'scrollParent',
  3918. reference: 'toggle',
  3919. display: 'dynamic',
  3920. popperConfig: null
  3921. };
  3922. var DefaultType$2 = {
  3923. offset: '(number|string|function)',
  3924. flip: 'boolean',
  3925. boundary: '(string|element)',
  3926. reference: '(string|element)',
  3927. display: 'string',
  3928. popperConfig: '(null|object)'
  3929. };
  3930. /**
  3931. * ------------------------------------------------------------------------
  3932. * Class Definition
  3933. * ------------------------------------------------------------------------
  3934. */
  3935. var Dropdown =
  3936. /*#__PURE__*/
  3937. function () {
  3938. function Dropdown(element, config) {
  3939. this._element = element;
  3940. this._popper = null;
  3941. this._config = this._getConfig(config);
  3942. this._menu = this._getMenuElement();
  3943. this._inNavbar = this._detectNavbar();
  3944. this._addEventListeners();
  3945. } // Getters
  3946. var _proto = Dropdown.prototype;
  3947. // Public
  3948. _proto.toggle = function toggle() {
  3949. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  3950. return;
  3951. }
  3952. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  3953. Dropdown._clearMenus();
  3954. if (isActive) {
  3955. return;
  3956. }
  3957. this.show(true);
  3958. };
  3959. _proto.show = function show(usePopper) {
  3960. if (usePopper === void 0) {
  3961. usePopper = false;
  3962. }
  3963. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  3964. return;
  3965. }
  3966. var relatedTarget = {
  3967. relatedTarget: this._element
  3968. };
  3969. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  3970. var parent = Dropdown._getParentFromElement(this._element);
  3971. $(parent).trigger(showEvent);
  3972. if (showEvent.isDefaultPrevented()) {
  3973. return;
  3974. } // Disable totally Popper.js for Dropdown in Navbar
  3975. if (!this._inNavbar && usePopper) {
  3976. /**
  3977. * Check for Popper dependency
  3978. * Popper - https://popper.js.org
  3979. */
  3980. if (typeof Popper === 'undefined') {
  3981. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  3982. }
  3983. var referenceElement = this._element;
  3984. if (this._config.reference === 'parent') {
  3985. referenceElement = parent;
  3986. } else if (Util.isElement(this._config.reference)) {
  3987. referenceElement = this._config.reference; // Check if it's jQuery element
  3988. if (typeof this._config.reference.jquery !== 'undefined') {
  3989. referenceElement = this._config.reference[0];
  3990. }
  3991. } // If boundary is not `scrollParent`, then set position to `static`
  3992. // to allow the menu to "escape" the scroll parent's boundaries
  3993. // https://github.com/twbs/bootstrap/issues/24251
  3994. if (this._config.boundary !== 'scrollParent') {
  3995. $(parent).addClass(ClassName$4.POSITION_STATIC);
  3996. }
  3997. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  3998. } // If this is a touch-enabled device we add extra
  3999. // empty mouseover listeners to the body's immediate children;
  4000. // only needed because of broken event delegation on iOS
  4001. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4002. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  4003. $(document.body).children().on('mouseover', null, $.noop);
  4004. }
  4005. this._element.focus();
  4006. this._element.setAttribute('aria-expanded', true);
  4007. $(this._menu).toggleClass(ClassName$4.SHOW);
  4008. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  4009. };
  4010. _proto.hide = function hide() {
  4011. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  4012. return;
  4013. }
  4014. var relatedTarget = {
  4015. relatedTarget: this._element
  4016. };
  4017. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4018. var parent = Dropdown._getParentFromElement(this._element);
  4019. $(parent).trigger(hideEvent);
  4020. if (hideEvent.isDefaultPrevented()) {
  4021. return;
  4022. }
  4023. if (this._popper) {
  4024. this._popper.destroy();
  4025. }
  4026. $(this._menu).toggleClass(ClassName$4.SHOW);
  4027. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4028. };
  4029. _proto.dispose = function dispose() {
  4030. $.removeData(this._element, DATA_KEY$4);
  4031. $(this._element).off(EVENT_KEY$4);
  4032. this._element = null;
  4033. this._menu = null;
  4034. if (this._popper !== null) {
  4035. this._popper.destroy();
  4036. this._popper = null;
  4037. }
  4038. };
  4039. _proto.update = function update() {
  4040. this._inNavbar = this._detectNavbar();
  4041. if (this._popper !== null) {
  4042. this._popper.scheduleUpdate();
  4043. }
  4044. } // Private
  4045. ;
  4046. _proto._addEventListeners = function _addEventListeners() {
  4047. var _this = this;
  4048. $(this._element).on(Event$4.CLICK, function (event) {
  4049. event.preventDefault();
  4050. event.stopPropagation();
  4051. _this.toggle();
  4052. });
  4053. };
  4054. _proto._getConfig = function _getConfig(config) {
  4055. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  4056. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  4057. return config;
  4058. };
  4059. _proto._getMenuElement = function _getMenuElement() {
  4060. if (!this._menu) {
  4061. var parent = Dropdown._getParentFromElement(this._element);
  4062. if (parent) {
  4063. this._menu = parent.querySelector(Selector$4.MENU);
  4064. }
  4065. }
  4066. return this._menu;
  4067. };
  4068. _proto._getPlacement = function _getPlacement() {
  4069. var $parentDropdown = $(this._element.parentNode);
  4070. var placement = AttachmentMap.BOTTOM; // Handle dropup
  4071. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  4072. placement = AttachmentMap.TOP;
  4073. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  4074. placement = AttachmentMap.TOPEND;
  4075. }
  4076. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  4077. placement = AttachmentMap.RIGHT;
  4078. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  4079. placement = AttachmentMap.LEFT;
  4080. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  4081. placement = AttachmentMap.BOTTOMEND;
  4082. }
  4083. return placement;
  4084. };
  4085. _proto._detectNavbar = function _detectNavbar() {
  4086. return $(this._element).closest('.navbar').length > 0;
  4087. };
  4088. _proto._getOffset = function _getOffset() {
  4089. var _this2 = this;
  4090. var offset = {};
  4091. if (typeof this._config.offset === 'function') {
  4092. offset.fn = function (data) {
  4093. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  4094. return data;
  4095. };
  4096. } else {
  4097. offset.offset = this._config.offset;
  4098. }
  4099. return offset;
  4100. };
  4101. _proto._getPopperConfig = function _getPopperConfig() {
  4102. var popperConfig = {
  4103. placement: this._getPlacement(),
  4104. modifiers: {
  4105. offset: this._getOffset(),
  4106. flip: {
  4107. enabled: this._config.flip
  4108. },
  4109. preventOverflow: {
  4110. boundariesElement: this._config.boundary
  4111. }
  4112. }
  4113. }; // Disable Popper.js if we have a static display
  4114. if (this._config.display === 'static') {
  4115. popperConfig.modifiers.applyStyle = {
  4116. enabled: false
  4117. };
  4118. }
  4119. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  4120. } // Static
  4121. ;
  4122. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  4123. return this.each(function () {
  4124. var data = $(this).data(DATA_KEY$4);
  4125. var _config = typeof config === 'object' ? config : null;
  4126. if (!data) {
  4127. data = new Dropdown(this, _config);
  4128. $(this).data(DATA_KEY$4, data);
  4129. }
  4130. if (typeof config === 'string') {
  4131. if (typeof data[config] === 'undefined') {
  4132. throw new TypeError("No method named \"" + config + "\"");
  4133. }
  4134. data[config]();
  4135. }
  4136. });
  4137. };
  4138. Dropdown._clearMenus = function _clearMenus(event) {
  4139. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  4140. return;
  4141. }
  4142. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  4143. for (var i = 0, len = toggles.length; i < len; i++) {
  4144. var parent = Dropdown._getParentFromElement(toggles[i]);
  4145. var context = $(toggles[i]).data(DATA_KEY$4);
  4146. var relatedTarget = {
  4147. relatedTarget: toggles[i]
  4148. };
  4149. if (event && event.type === 'click') {
  4150. relatedTarget.clickEvent = event;
  4151. }
  4152. if (!context) {
  4153. continue;
  4154. }
  4155. var dropdownMenu = context._menu;
  4156. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  4157. continue;
  4158. }
  4159. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  4160. continue;
  4161. }
  4162. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4163. $(parent).trigger(hideEvent);
  4164. if (hideEvent.isDefaultPrevented()) {
  4165. continue;
  4166. } // If this is a touch-enabled device we remove the extra
  4167. // empty mouseover listeners we added for iOS support
  4168. if ('ontouchstart' in document.documentElement) {
  4169. $(document.body).children().off('mouseover', null, $.noop);
  4170. }
  4171. toggles[i].setAttribute('aria-expanded', 'false');
  4172. if (context._popper) {
  4173. context._popper.destroy();
  4174. }
  4175. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  4176. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4177. }
  4178. };
  4179. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  4180. var parent;
  4181. var selector = Util.getSelectorFromElement(element);
  4182. if (selector) {
  4183. parent = document.querySelector(selector);
  4184. }
  4185. return parent || element.parentNode;
  4186. } // eslint-disable-next-line complexity
  4187. ;
  4188. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  4189. // If not input/textarea:
  4190. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  4191. // If input/textarea:
  4192. // - If space key => not a dropdown command
  4193. // - If key is other than escape
  4194. // - If key is not up or down => not a dropdown command
  4195. // - If trigger inside the menu => not a dropdown command
  4196. 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)) {
  4197. return;
  4198. }
  4199. event.preventDefault();
  4200. event.stopPropagation();
  4201. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  4202. return;
  4203. }
  4204. var parent = Dropdown._getParentFromElement(this);
  4205. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  4206. if (!isActive && event.which === ESCAPE_KEYCODE) {
  4207. return;
  4208. }
  4209. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  4210. if (event.which === ESCAPE_KEYCODE) {
  4211. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  4212. $(toggle).trigger('focus');
  4213. }
  4214. $(this).trigger('click');
  4215. return;
  4216. }
  4217. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  4218. return $(item).is(':visible');
  4219. });
  4220. if (items.length === 0) {
  4221. return;
  4222. }
  4223. var index = items.indexOf(event.target);
  4224. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  4225. // Up
  4226. index--;
  4227. }
  4228. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  4229. // Down
  4230. index++;
  4231. }
  4232. if (index < 0) {
  4233. index = 0;
  4234. }
  4235. items[index].focus();
  4236. };
  4237. _createClass(Dropdown, null, [{
  4238. key: "VERSION",
  4239. get: function get() {
  4240. return VERSION$4;
  4241. }
  4242. }, {
  4243. key: "Default",
  4244. get: function get() {
  4245. return Default$2;
  4246. }
  4247. }, {
  4248. key: "DefaultType",
  4249. get: function get() {
  4250. return DefaultType$2;
  4251. }
  4252. }]);
  4253. return Dropdown;
  4254. }();
  4255. /**
  4256. * ------------------------------------------------------------------------
  4257. * Data Api implementation
  4258. * ------------------------------------------------------------------------
  4259. */
  4260. $(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) {
  4261. event.preventDefault();
  4262. event.stopPropagation();
  4263. Dropdown._jQueryInterface.call($(this), 'toggle');
  4264. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  4265. e.stopPropagation();
  4266. });
  4267. /**
  4268. * ------------------------------------------------------------------------
  4269. * jQuery
  4270. * ------------------------------------------------------------------------
  4271. */
  4272. $.fn[NAME$4] = Dropdown._jQueryInterface;
  4273. $.fn[NAME$4].Constructor = Dropdown;
  4274. $.fn[NAME$4].noConflict = function () {
  4275. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  4276. return Dropdown._jQueryInterface;
  4277. };
  4278. /**
  4279. * ------------------------------------------------------------------------
  4280. * Constants
  4281. * ------------------------------------------------------------------------
  4282. */
  4283. var NAME$5 = 'modal';
  4284. var VERSION$5 = '4.4.1';
  4285. var DATA_KEY$5 = 'bs.modal';
  4286. var EVENT_KEY$5 = "." + DATA_KEY$5;
  4287. var DATA_API_KEY$5 = '.data-api';
  4288. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  4289. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  4290. var Default$3 = {
  4291. backdrop: true,
  4292. keyboard: true,
  4293. focus: true,
  4294. show: true
  4295. };
  4296. var DefaultType$3 = {
  4297. backdrop: '(boolean|string)',
  4298. keyboard: 'boolean',
  4299. focus: 'boolean',
  4300. show: 'boolean'
  4301. };
  4302. var Event$5 = {
  4303. HIDE: "hide" + EVENT_KEY$5,
  4304. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  4305. HIDDEN: "hidden" + EVENT_KEY$5,
  4306. SHOW: "show" + EVENT_KEY$5,
  4307. SHOWN: "shown" + EVENT_KEY$5,
  4308. FOCUSIN: "focusin" + EVENT_KEY$5,
  4309. RESIZE: "resize" + EVENT_KEY$5,
  4310. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  4311. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  4312. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  4313. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  4314. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  4315. };
  4316. var ClassName$5 = {
  4317. SCROLLABLE: 'modal-dialog-scrollable',
  4318. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  4319. BACKDROP: 'modal-backdrop',
  4320. OPEN: 'modal-open',
  4321. FADE: 'fade',
  4322. SHOW: 'show',
  4323. STATIC: 'modal-static'
  4324. };
  4325. var Selector$5 = {
  4326. DIALOG: '.modal-dialog',
  4327. MODAL_BODY: '.modal-body',
  4328. DATA_TOGGLE: '[data-toggle="modal"]',
  4329. DATA_DISMISS: '[data-dismiss="modal"]',
  4330. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  4331. STICKY_CONTENT: '.sticky-top'
  4332. };
  4333. /**
  4334. * ------------------------------------------------------------------------
  4335. * Class Definition
  4336. * ------------------------------------------------------------------------
  4337. */
  4338. var Modal =
  4339. /*#__PURE__*/
  4340. function () {
  4341. function Modal(element, config) {
  4342. this._config = this._getConfig(config);
  4343. this._element = element;
  4344. this._dialog = element.querySelector(Selector$5.DIALOG);
  4345. this._backdrop = null;
  4346. this._isShown = false;
  4347. this._isBodyOverflowing = false;
  4348. this._ignoreBackdropClick = false;
  4349. this._isTransitioning = false;
  4350. this._scrollbarWidth = 0;
  4351. } // Getters
  4352. var _proto = Modal.prototype;
  4353. // Public
  4354. _proto.toggle = function toggle(relatedTarget) {
  4355. return this._isShown ? this.hide() : this.show(relatedTarget);
  4356. };
  4357. _proto.show = function show(relatedTarget) {
  4358. var _this = this;
  4359. if (this._isShown || this._isTransitioning) {
  4360. return;
  4361. }
  4362. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4363. this._isTransitioning = true;
  4364. }
  4365. var showEvent = $.Event(Event$5.SHOW, {
  4366. relatedTarget: relatedTarget
  4367. });
  4368. $(this._element).trigger(showEvent);
  4369. if (this._isShown || showEvent.isDefaultPrevented()) {
  4370. return;
  4371. }
  4372. this._isShown = true;
  4373. this._checkScrollbar();
  4374. this._setScrollbar();
  4375. this._adjustDialog();
  4376. this._setEscapeEvent();
  4377. this._setResizeEvent();
  4378. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  4379. return _this.hide(event);
  4380. });
  4381. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  4382. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  4383. if ($(event.target).is(_this._element)) {
  4384. _this._ignoreBackdropClick = true;
  4385. }
  4386. });
  4387. });
  4388. this._showBackdrop(function () {
  4389. return _this._showElement(relatedTarget);
  4390. });
  4391. };
  4392. _proto.hide = function hide(event) {
  4393. var _this2 = this;
  4394. if (event) {
  4395. event.preventDefault();
  4396. }
  4397. if (!this._isShown || this._isTransitioning) {
  4398. return;
  4399. }
  4400. var hideEvent = $.Event(Event$5.HIDE);
  4401. $(this._element).trigger(hideEvent);
  4402. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  4403. return;
  4404. }
  4405. this._isShown = false;
  4406. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4407. if (transition) {
  4408. this._isTransitioning = true;
  4409. }
  4410. this._setEscapeEvent();
  4411. this._setResizeEvent();
  4412. $(document).off(Event$5.FOCUSIN);
  4413. $(this._element).removeClass(ClassName$5.SHOW);
  4414. $(this._element).off(Event$5.CLICK_DISMISS);
  4415. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  4416. if (transition) {
  4417. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4418. $(this._element).one(Util.TRANSITION_END, function (event) {
  4419. return _this2._hideModal(event);
  4420. }).emulateTransitionEnd(transitionDuration);
  4421. } else {
  4422. this._hideModal();
  4423. }
  4424. };
  4425. _proto.dispose = function dispose() {
  4426. [window, this._element, this._dialog].forEach(function (htmlElement) {
  4427. return $(htmlElement).off(EVENT_KEY$5);
  4428. });
  4429. /**
  4430. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  4431. * Do not move `document` in `htmlElements` array
  4432. * It will remove `Event.CLICK_DATA_API` event that should remain
  4433. */
  4434. $(document).off(Event$5.FOCUSIN);
  4435. $.removeData(this._element, DATA_KEY$5);
  4436. this._config = null;
  4437. this._element = null;
  4438. this._dialog = null;
  4439. this._backdrop = null;
  4440. this._isShown = null;
  4441. this._isBodyOverflowing = null;
  4442. this._ignoreBackdropClick = null;
  4443. this._isTransitioning = null;
  4444. this._scrollbarWidth = null;
  4445. };
  4446. _proto.handleUpdate = function handleUpdate() {
  4447. this._adjustDialog();
  4448. } // Private
  4449. ;
  4450. _proto._getConfig = function _getConfig(config) {
  4451. config = _objectSpread2({}, Default$3, {}, config);
  4452. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  4453. return config;
  4454. };
  4455. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  4456. var _this3 = this;
  4457. if (this._config.backdrop === 'static') {
  4458. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  4459. $(this._element).trigger(hideEventPrevented);
  4460. if (hideEventPrevented.defaultPrevented) {
  4461. return;
  4462. }
  4463. this._element.classList.add(ClassName$5.STATIC);
  4464. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  4465. $(this._element).one(Util.TRANSITION_END, function () {
  4466. _this3._element.classList.remove(ClassName$5.STATIC);
  4467. }).emulateTransitionEnd(modalTransitionDuration);
  4468. this._element.focus();
  4469. } else {
  4470. this.hide();
  4471. }
  4472. };
  4473. _proto._showElement = function _showElement(relatedTarget) {
  4474. var _this4 = this;
  4475. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4476. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  4477. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  4478. // Don't move modal's DOM position
  4479. document.body.appendChild(this._element);
  4480. }
  4481. this._element.style.display = 'block';
  4482. this._element.removeAttribute('aria-hidden');
  4483. this._element.setAttribute('aria-modal', true);
  4484. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  4485. modalBody.scrollTop = 0;
  4486. } else {
  4487. this._element.scrollTop = 0;
  4488. }
  4489. if (transition) {
  4490. Util.reflow(this._element);
  4491. }
  4492. $(this._element).addClass(ClassName$5.SHOW);
  4493. if (this._config.focus) {
  4494. this._enforceFocus();
  4495. }
  4496. var shownEvent = $.Event(Event$5.SHOWN, {
  4497. relatedTarget: relatedTarget
  4498. });
  4499. var transitionComplete = function transitionComplete() {
  4500. if (_this4._config.focus) {
  4501. _this4._element.focus();
  4502. }
  4503. _this4._isTransitioning = false;
  4504. $(_this4._element).trigger(shownEvent);
  4505. };
  4506. if (transition) {
  4507. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  4508. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  4509. } else {
  4510. transitionComplete();
  4511. }
  4512. };
  4513. _proto._enforceFocus = function _enforceFocus() {
  4514. var _this5 = this;
  4515. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  4516. .on(Event$5.FOCUSIN, function (event) {
  4517. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  4518. _this5._element.focus();
  4519. }
  4520. });
  4521. };
  4522. _proto._setEscapeEvent = function _setEscapeEvent() {
  4523. var _this6 = this;
  4524. if (this._isShown && this._config.keyboard) {
  4525. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  4526. if (event.which === ESCAPE_KEYCODE$1) {
  4527. _this6._triggerBackdropTransition();
  4528. }
  4529. });
  4530. } else if (!this._isShown) {
  4531. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  4532. }
  4533. };
  4534. _proto._setResizeEvent = function _setResizeEvent() {
  4535. var _this7 = this;
  4536. if (this._isShown) {
  4537. $(window).on(Event$5.RESIZE, function (event) {
  4538. return _this7.handleUpdate(event);
  4539. });
  4540. } else {
  4541. $(window).off(Event$5.RESIZE);
  4542. }
  4543. };
  4544. _proto._hideModal = function _hideModal() {
  4545. var _this8 = this;
  4546. this._element.style.display = 'none';
  4547. this._element.setAttribute('aria-hidden', true);
  4548. this._element.removeAttribute('aria-modal');
  4549. this._isTransitioning = false;
  4550. this._showBackdrop(function () {
  4551. $(document.body).removeClass(ClassName$5.OPEN);
  4552. _this8._resetAdjustments();
  4553. _this8._resetScrollbar();
  4554. $(_this8._element).trigger(Event$5.HIDDEN);
  4555. });
  4556. };
  4557. _proto._removeBackdrop = function _removeBackdrop() {
  4558. if (this._backdrop) {
  4559. $(this._backdrop).remove();
  4560. this._backdrop = null;
  4561. }
  4562. };
  4563. _proto._showBackdrop = function _showBackdrop(callback) {
  4564. var _this9 = this;
  4565. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  4566. if (this._isShown && this._config.backdrop) {
  4567. this._backdrop = document.createElement('div');
  4568. this._backdrop.className = ClassName$5.BACKDROP;
  4569. if (animate) {
  4570. this._backdrop.classList.add(animate);
  4571. }
  4572. $(this._backdrop).appendTo(document.body);
  4573. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  4574. if (_this9._ignoreBackdropClick) {
  4575. _this9._ignoreBackdropClick = false;
  4576. return;
  4577. }
  4578. if (event.target !== event.currentTarget) {
  4579. return;
  4580. }
  4581. _this9._triggerBackdropTransition();
  4582. });
  4583. if (animate) {
  4584. Util.reflow(this._backdrop);
  4585. }
  4586. $(this._backdrop).addClass(ClassName$5.SHOW);
  4587. if (!callback) {
  4588. return;
  4589. }
  4590. if (!animate) {
  4591. callback();
  4592. return;
  4593. }
  4594. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4595. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  4596. } else if (!this._isShown && this._backdrop) {
  4597. $(this._backdrop).removeClass(ClassName$5.SHOW);
  4598. var callbackRemove = function callbackRemove() {
  4599. _this9._removeBackdrop();
  4600. if (callback) {
  4601. callback();
  4602. }
  4603. };
  4604. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4605. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4606. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  4607. } else {
  4608. callbackRemove();
  4609. }
  4610. } else if (callback) {
  4611. callback();
  4612. }
  4613. } // ----------------------------------------------------------------------
  4614. // the following methods are used to handle overflowing modals
  4615. // todo (fat): these should probably be refactored out of modal.js
  4616. // ----------------------------------------------------------------------
  4617. ;
  4618. _proto._adjustDialog = function _adjustDialog() {
  4619. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  4620. if (!this._isBodyOverflowing && isModalOverflowing) {
  4621. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  4622. }
  4623. if (this._isBodyOverflowing && !isModalOverflowing) {
  4624. this._element.style.paddingRight = this._scrollbarWidth + "px";
  4625. }
  4626. };
  4627. _proto._resetAdjustments = function _resetAdjustments() {
  4628. this._element.style.paddingLeft = '';
  4629. this._element.style.paddingRight = '';
  4630. };
  4631. _proto._checkScrollbar = function _checkScrollbar() {
  4632. var rect = document.body.getBoundingClientRect();
  4633. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  4634. this._scrollbarWidth = this._getScrollbarWidth();
  4635. };
  4636. _proto._setScrollbar = function _setScrollbar() {
  4637. var _this10 = this;
  4638. if (this._isBodyOverflowing) {
  4639. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  4640. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  4641. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4642. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  4643. $(fixedContent).each(function (index, element) {
  4644. var actualPadding = element.style.paddingRight;
  4645. var calculatedPadding = $(element).css('padding-right');
  4646. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  4647. }); // Adjust sticky content margin
  4648. $(stickyContent).each(function (index, element) {
  4649. var actualMargin = element.style.marginRight;
  4650. var calculatedMargin = $(element).css('margin-right');
  4651. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  4652. }); // Adjust body padding
  4653. var actualPadding = document.body.style.paddingRight;
  4654. var calculatedPadding = $(document.body).css('padding-right');
  4655. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  4656. }
  4657. $(document.body).addClass(ClassName$5.OPEN);
  4658. };
  4659. _proto._resetScrollbar = function _resetScrollbar() {
  4660. // Restore fixed content padding
  4661. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4662. $(fixedContent).each(function (index, element) {
  4663. var padding = $(element).data('padding-right');
  4664. $(element).removeData('padding-right');
  4665. element.style.paddingRight = padding ? padding : '';
  4666. }); // Restore sticky content
  4667. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  4668. $(elements).each(function (index, element) {
  4669. var margin = $(element).data('margin-right');
  4670. if (typeof margin !== 'undefined') {
  4671. $(element).css('margin-right', margin).removeData('margin-right');
  4672. }
  4673. }); // Restore body padding
  4674. var padding = $(document.body).data('padding-right');
  4675. $(document.body).removeData('padding-right');
  4676. document.body.style.paddingRight = padding ? padding : '';
  4677. };
  4678. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  4679. // thx d.walsh
  4680. var scrollDiv = document.createElement('div');
  4681. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  4682. document.body.appendChild(scrollDiv);
  4683. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  4684. document.body.removeChild(scrollDiv);
  4685. return scrollbarWidth;
  4686. } // Static
  4687. ;
  4688. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  4689. return this.each(function () {
  4690. var data = $(this).data(DATA_KEY$5);
  4691. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  4692. if (!data) {
  4693. data = new Modal(this, _config);
  4694. $(this).data(DATA_KEY$5, data);
  4695. }
  4696. if (typeof config === 'string') {
  4697. if (typeof data[config] === 'undefined') {
  4698. throw new TypeError("No method named \"" + config + "\"");
  4699. }
  4700. data[config](relatedTarget);
  4701. } else if (_config.show) {
  4702. data.show(relatedTarget);
  4703. }
  4704. });
  4705. };
  4706. _createClass(Modal, null, [{
  4707. key: "VERSION",
  4708. get: function get() {
  4709. return VERSION$5;
  4710. }
  4711. }, {
  4712. key: "Default",
  4713. get: function get() {
  4714. return Default$3;
  4715. }
  4716. }]);
  4717. return Modal;
  4718. }();
  4719. /**
  4720. * ------------------------------------------------------------------------
  4721. * Data Api implementation
  4722. * ------------------------------------------------------------------------
  4723. */
  4724. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  4725. var _this11 = this;
  4726. var target;
  4727. var selector = Util.getSelectorFromElement(this);
  4728. if (selector) {
  4729. target = document.querySelector(selector);
  4730. }
  4731. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  4732. if (this.tagName === 'A' || this.tagName === 'AREA') {
  4733. event.preventDefault();
  4734. }
  4735. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  4736. if (showEvent.isDefaultPrevented()) {
  4737. // Only register focus restorer if modal will actually get shown
  4738. return;
  4739. }
  4740. $target.one(Event$5.HIDDEN, function () {
  4741. if ($(_this11).is(':visible')) {
  4742. _this11.focus();
  4743. }
  4744. });
  4745. });
  4746. Modal._jQueryInterface.call($(target), config, this);
  4747. });
  4748. /**
  4749. * ------------------------------------------------------------------------
  4750. * jQuery
  4751. * ------------------------------------------------------------------------
  4752. */
  4753. $.fn[NAME$5] = Modal._jQueryInterface;
  4754. $.fn[NAME$5].Constructor = Modal;
  4755. $.fn[NAME$5].noConflict = function () {
  4756. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  4757. return Modal._jQueryInterface;
  4758. };
  4759. /**
  4760. * --------------------------------------------------------------------------
  4761. * Bootstrap (v4.4.1): tools/sanitizer.js
  4762. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  4763. * --------------------------------------------------------------------------
  4764. */
  4765. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  4766. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  4767. var DefaultWhitelist = {
  4768. // Global attributes allowed on any supplied element below.
  4769. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  4770. a: ['target', 'href', 'title', 'rel'],
  4771. area: [],
  4772. b: [],
  4773. br: [],
  4774. col: [],
  4775. code: [],
  4776. div: [],
  4777. em: [],
  4778. hr: [],
  4779. h1: [],
  4780. h2: [],
  4781. h3: [],
  4782. h4: [],
  4783. h5: [],
  4784. h6: [],
  4785. i: [],
  4786. img: ['src', 'alt', 'title', 'width', 'height'],
  4787. li: [],
  4788. ol: [],
  4789. p: [],
  4790. pre: [],
  4791. s: [],
  4792. small: [],
  4793. span: [],
  4794. sub: [],
  4795. sup: [],
  4796. strong: [],
  4797. u: [],
  4798. ul: []
  4799. };
  4800. /**
  4801. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  4802. *
  4803. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4804. */
  4805. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  4806. /**
  4807. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  4808. *
  4809. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4810. */
  4811. 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;
  4812. function allowedAttribute(attr, allowedAttributeList) {
  4813. var attrName = attr.nodeName.toLowerCase();
  4814. if (allowedAttributeList.indexOf(attrName) !== -1) {
  4815. if (uriAttrs.indexOf(attrName) !== -1) {
  4816. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  4817. }
  4818. return true;
  4819. }
  4820. var regExp = allowedAttributeList.filter(function (attrRegex) {
  4821. return attrRegex instanceof RegExp;
  4822. }); // Check if a regular expression validates the attribute.
  4823. for (var i = 0, l = regExp.length; i < l; i++) {
  4824. if (attrName.match(regExp[i])) {
  4825. return true;
  4826. }
  4827. }
  4828. return false;
  4829. }
  4830. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  4831. if (unsafeHtml.length === 0) {
  4832. return unsafeHtml;
  4833. }
  4834. if (sanitizeFn && typeof sanitizeFn === 'function') {
  4835. return sanitizeFn(unsafeHtml);
  4836. }
  4837. var domParser = new window.DOMParser();
  4838. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  4839. var whitelistKeys = Object.keys(whiteList);
  4840. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  4841. var _loop = function _loop(i, len) {
  4842. var el = elements[i];
  4843. var elName = el.nodeName.toLowerCase();
  4844. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  4845. el.parentNode.removeChild(el);
  4846. return "continue";
  4847. }
  4848. var attributeList = [].slice.call(el.attributes);
  4849. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  4850. attributeList.forEach(function (attr) {
  4851. if (!allowedAttribute(attr, whitelistedAttributes)) {
  4852. el.removeAttribute(attr.nodeName);
  4853. }
  4854. });
  4855. };
  4856. for (var i = 0, len = elements.length; i < len; i++) {
  4857. var _ret = _loop(i);
  4858. if (_ret === "continue") continue;
  4859. }
  4860. return createdDocument.body.innerHTML;
  4861. }
  4862. /**
  4863. * ------------------------------------------------------------------------
  4864. * Constants
  4865. * ------------------------------------------------------------------------
  4866. */
  4867. var NAME$6 = 'tooltip';
  4868. var VERSION$6 = '4.4.1';
  4869. var DATA_KEY$6 = 'bs.tooltip';
  4870. var EVENT_KEY$6 = "." + DATA_KEY$6;
  4871. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  4872. var CLASS_PREFIX = 'bs-tooltip';
  4873. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  4874. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  4875. var DefaultType$4 = {
  4876. animation: 'boolean',
  4877. template: 'string',
  4878. title: '(string|element|function)',
  4879. trigger: 'string',
  4880. delay: '(number|object)',
  4881. html: 'boolean',
  4882. selector: '(string|boolean)',
  4883. placement: '(string|function)',
  4884. offset: '(number|string|function)',
  4885. container: '(string|element|boolean)',
  4886. fallbackPlacement: '(string|array)',
  4887. boundary: '(string|element)',
  4888. sanitize: 'boolean',
  4889. sanitizeFn: '(null|function)',
  4890. whiteList: 'object',
  4891. popperConfig: '(null|object)'
  4892. };
  4893. var AttachmentMap$1 = {
  4894. AUTO: 'auto',
  4895. TOP: 'top',
  4896. RIGHT: 'right',
  4897. BOTTOM: 'bottom',
  4898. LEFT: 'left'
  4899. };
  4900. var Default$4 = {
  4901. animation: true,
  4902. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  4903. trigger: 'hover focus',
  4904. title: '',
  4905. delay: 0,
  4906. html: false,
  4907. selector: false,
  4908. placement: 'top',
  4909. offset: 0,
  4910. container: false,
  4911. fallbackPlacement: 'flip',
  4912. boundary: 'scrollParent',
  4913. sanitize: true,
  4914. sanitizeFn: null,
  4915. whiteList: DefaultWhitelist,
  4916. popperConfig: null
  4917. };
  4918. var HoverState = {
  4919. SHOW: 'show',
  4920. OUT: 'out'
  4921. };
  4922. var Event$6 = {
  4923. HIDE: "hide" + EVENT_KEY$6,
  4924. HIDDEN: "hidden" + EVENT_KEY$6,
  4925. SHOW: "show" + EVENT_KEY$6,
  4926. SHOWN: "shown" + EVENT_KEY$6,
  4927. INSERTED: "inserted" + EVENT_KEY$6,
  4928. CLICK: "click" + EVENT_KEY$6,
  4929. FOCUSIN: "focusin" + EVENT_KEY$6,
  4930. FOCUSOUT: "focusout" + EVENT_KEY$6,
  4931. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  4932. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  4933. };
  4934. var ClassName$6 = {
  4935. FADE: 'fade',
  4936. SHOW: 'show'
  4937. };
  4938. var Selector$6 = {
  4939. TOOLTIP: '.tooltip',
  4940. TOOLTIP_INNER: '.tooltip-inner',
  4941. ARROW: '.arrow'
  4942. };
  4943. var Trigger = {
  4944. HOVER: 'hover',
  4945. FOCUS: 'focus',
  4946. CLICK: 'click',
  4947. MANUAL: 'manual'
  4948. };
  4949. /**
  4950. * ------------------------------------------------------------------------
  4951. * Class Definition
  4952. * ------------------------------------------------------------------------
  4953. */
  4954. var Tooltip =
  4955. /*#__PURE__*/
  4956. function () {
  4957. function Tooltip(element, config) {
  4958. if (typeof Popper === 'undefined') {
  4959. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  4960. } // private
  4961. this._isEnabled = true;
  4962. this._timeout = 0;
  4963. this._hoverState = '';
  4964. this._activeTrigger = {};
  4965. this._popper = null; // Protected
  4966. this.element = element;
  4967. this.config = this._getConfig(config);
  4968. this.tip = null;
  4969. this._setListeners();
  4970. } // Getters
  4971. var _proto = Tooltip.prototype;
  4972. // Public
  4973. _proto.enable = function enable() {
  4974. this._isEnabled = true;
  4975. };
  4976. _proto.disable = function disable() {
  4977. this._isEnabled = false;
  4978. };
  4979. _proto.toggleEnabled = function toggleEnabled() {
  4980. this._isEnabled = !this._isEnabled;
  4981. };
  4982. _proto.toggle = function toggle(event) {
  4983. if (!this._isEnabled) {
  4984. return;
  4985. }
  4986. if (event) {
  4987. var dataKey = this.constructor.DATA_KEY;
  4988. var context = $(event.currentTarget).data(dataKey);
  4989. if (!context) {
  4990. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4991. $(event.currentTarget).data(dataKey, context);
  4992. }
  4993. context._activeTrigger.click = !context._activeTrigger.click;
  4994. if (context._isWithActiveTrigger()) {
  4995. context._enter(null, context);
  4996. } else {
  4997. context._leave(null, context);
  4998. }
  4999. } else {
  5000. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  5001. this._leave(null, this);
  5002. return;
  5003. }
  5004. this._enter(null, this);
  5005. }
  5006. };
  5007. _proto.dispose = function dispose() {
  5008. clearTimeout(this._timeout);
  5009. $.removeData(this.element, this.constructor.DATA_KEY);
  5010. $(this.element).off(this.constructor.EVENT_KEY);
  5011. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  5012. if (this.tip) {
  5013. $(this.tip).remove();
  5014. }
  5015. this._isEnabled = null;
  5016. this._timeout = null;
  5017. this._hoverState = null;
  5018. this._activeTrigger = null;
  5019. if (this._popper) {
  5020. this._popper.destroy();
  5021. }
  5022. this._popper = null;
  5023. this.element = null;
  5024. this.config = null;
  5025. this.tip = null;
  5026. };
  5027. _proto.show = function show() {
  5028. var _this = this;
  5029. if ($(this.element).css('display') === 'none') {
  5030. throw new Error('Please use show on visible elements');
  5031. }
  5032. var showEvent = $.Event(this.constructor.Event.SHOW);
  5033. if (this.isWithContent() && this._isEnabled) {
  5034. $(this.element).trigger(showEvent);
  5035. var shadowRoot = Util.findShadowRoot(this.element);
  5036. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  5037. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  5038. return;
  5039. }
  5040. var tip = this.getTipElement();
  5041. var tipId = Util.getUID(this.constructor.NAME);
  5042. tip.setAttribute('id', tipId);
  5043. this.element.setAttribute('aria-describedby', tipId);
  5044. this.setContent();
  5045. if (this.config.animation) {
  5046. $(tip).addClass(ClassName$6.FADE);
  5047. }
  5048. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  5049. var attachment = this._getAttachment(placement);
  5050. this.addAttachmentClass(attachment);
  5051. var container = this._getContainer();
  5052. $(tip).data(this.constructor.DATA_KEY, this);
  5053. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  5054. $(tip).appendTo(container);
  5055. }
  5056. $(this.element).trigger(this.constructor.Event.INSERTED);
  5057. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  5058. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  5059. // empty mouseover listeners to the body's immediate children;
  5060. // only needed because of broken event delegation on iOS
  5061. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  5062. if ('ontouchstart' in document.documentElement) {
  5063. $(document.body).children().on('mouseover', null, $.noop);
  5064. }
  5065. var complete = function complete() {
  5066. if (_this.config.animation) {
  5067. _this._fixTransition();
  5068. }
  5069. var prevHoverState = _this._hoverState;
  5070. _this._hoverState = null;
  5071. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  5072. if (prevHoverState === HoverState.OUT) {
  5073. _this._leave(null, _this);
  5074. }
  5075. };
  5076. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  5077. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  5078. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5079. } else {
  5080. complete();
  5081. }
  5082. }
  5083. };
  5084. _proto.hide = function hide(callback) {
  5085. var _this2 = this;
  5086. var tip = this.getTipElement();
  5087. var hideEvent = $.Event(this.constructor.Event.HIDE);
  5088. var complete = function complete() {
  5089. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  5090. tip.parentNode.removeChild(tip);
  5091. }
  5092. _this2._cleanTipClass();
  5093. _this2.element.removeAttribute('aria-describedby');
  5094. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  5095. if (_this2._popper !== null) {
  5096. _this2._popper.destroy();
  5097. }
  5098. if (callback) {
  5099. callback();
  5100. }
  5101. };
  5102. $(this.element).trigger(hideEvent);
  5103. if (hideEvent.isDefaultPrevented()) {
  5104. return;
  5105. }
  5106. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  5107. // empty mouseover listeners we added for iOS support
  5108. if ('ontouchstart' in document.documentElement) {
  5109. $(document.body).children().off('mouseover', null, $.noop);
  5110. }
  5111. this._activeTrigger[Trigger.CLICK] = false;
  5112. this._activeTrigger[Trigger.FOCUS] = false;
  5113. this._activeTrigger[Trigger.HOVER] = false;
  5114. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  5115. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  5116. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5117. } else {
  5118. complete();
  5119. }
  5120. this._hoverState = '';
  5121. };
  5122. _proto.update = function update() {
  5123. if (this._popper !== null) {
  5124. this._popper.scheduleUpdate();
  5125. }
  5126. } // Protected
  5127. ;
  5128. _proto.isWithContent = function isWithContent() {
  5129. return Boolean(this.getTitle());
  5130. };
  5131. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5132. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  5133. };
  5134. _proto.getTipElement = function getTipElement() {
  5135. this.tip = this.tip || $(this.config.template)[0];
  5136. return this.tip;
  5137. };
  5138. _proto.setContent = function setContent() {
  5139. var tip = this.getTipElement();
  5140. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  5141. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  5142. };
  5143. _proto.setElementContent = function setElementContent($element, content) {
  5144. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  5145. // Content is a DOM node or a jQuery
  5146. if (this.config.html) {
  5147. if (!$(content).parent().is($element)) {
  5148. $element.empty().append(content);
  5149. }
  5150. } else {
  5151. $element.text($(content).text());
  5152. }
  5153. return;
  5154. }
  5155. if (this.config.html) {
  5156. if (this.config.sanitize) {
  5157. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  5158. }
  5159. $element.html(content);
  5160. } else {
  5161. $element.text(content);
  5162. }
  5163. };
  5164. _proto.getTitle = function getTitle() {
  5165. var title = this.element.getAttribute('data-original-title');
  5166. if (!title) {
  5167. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  5168. }
  5169. return title;
  5170. } // Private
  5171. ;
  5172. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  5173. var _this3 = this;
  5174. var defaultBsConfig = {
  5175. placement: attachment,
  5176. modifiers: {
  5177. offset: this._getOffset(),
  5178. flip: {
  5179. behavior: this.config.fallbackPlacement
  5180. },
  5181. arrow: {
  5182. element: Selector$6.ARROW
  5183. },
  5184. preventOverflow: {
  5185. boundariesElement: this.config.boundary
  5186. }
  5187. },
  5188. onCreate: function onCreate(data) {
  5189. if (data.originalPlacement !== data.placement) {
  5190. _this3._handlePopperPlacementChange(data);
  5191. }
  5192. },
  5193. onUpdate: function onUpdate(data) {
  5194. return _this3._handlePopperPlacementChange(data);
  5195. }
  5196. };
  5197. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  5198. };
  5199. _proto._getOffset = function _getOffset() {
  5200. var _this4 = this;
  5201. var offset = {};
  5202. if (typeof this.config.offset === 'function') {
  5203. offset.fn = function (data) {
  5204. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  5205. return data;
  5206. };
  5207. } else {
  5208. offset.offset = this.config.offset;
  5209. }
  5210. return offset;
  5211. };
  5212. _proto._getContainer = function _getContainer() {
  5213. if (this.config.container === false) {
  5214. return document.body;
  5215. }
  5216. if (Util.isElement(this.config.container)) {
  5217. return $(this.config.container);
  5218. }
  5219. return $(document).find(this.config.container);
  5220. };
  5221. _proto._getAttachment = function _getAttachment(placement) {
  5222. return AttachmentMap$1[placement.toUpperCase()];
  5223. };
  5224. _proto._setListeners = function _setListeners() {
  5225. var _this5 = this;
  5226. var triggers = this.config.trigger.split(' ');
  5227. triggers.forEach(function (trigger) {
  5228. if (trigger === 'click') {
  5229. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  5230. return _this5.toggle(event);
  5231. });
  5232. } else if (trigger !== Trigger.MANUAL) {
  5233. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  5234. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  5235. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  5236. return _this5._enter(event);
  5237. }).on(eventOut, _this5.config.selector, function (event) {
  5238. return _this5._leave(event);
  5239. });
  5240. }
  5241. });
  5242. this._hideModalHandler = function () {
  5243. if (_this5.element) {
  5244. _this5.hide();
  5245. }
  5246. };
  5247. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  5248. if (this.config.selector) {
  5249. this.config = _objectSpread2({}, this.config, {
  5250. trigger: 'manual',
  5251. selector: ''
  5252. });
  5253. } else {
  5254. this._fixTitle();
  5255. }
  5256. };
  5257. _proto._fixTitle = function _fixTitle() {
  5258. var titleType = typeof this.element.getAttribute('data-original-title');
  5259. if (this.element.getAttribute('title') || titleType !== 'string') {
  5260. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  5261. this.element.setAttribute('title', '');
  5262. }
  5263. };
  5264. _proto._enter = function _enter(event, context) {
  5265. var dataKey = this.constructor.DATA_KEY;
  5266. context = context || $(event.currentTarget).data(dataKey);
  5267. if (!context) {
  5268. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5269. $(event.currentTarget).data(dataKey, context);
  5270. }
  5271. if (event) {
  5272. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  5273. }
  5274. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  5275. context._hoverState = HoverState.SHOW;
  5276. return;
  5277. }
  5278. clearTimeout(context._timeout);
  5279. context._hoverState = HoverState.SHOW;
  5280. if (!context.config.delay || !context.config.delay.show) {
  5281. context.show();
  5282. return;
  5283. }
  5284. context._timeout = setTimeout(function () {
  5285. if (context._hoverState === HoverState.SHOW) {
  5286. context.show();
  5287. }
  5288. }, context.config.delay.show);
  5289. };
  5290. _proto._leave = function _leave(event, context) {
  5291. var dataKey = this.constructor.DATA_KEY;
  5292. context = context || $(event.currentTarget).data(dataKey);
  5293. if (!context) {
  5294. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5295. $(event.currentTarget).data(dataKey, context);
  5296. }
  5297. if (event) {
  5298. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  5299. }
  5300. if (context._isWithActiveTrigger()) {
  5301. return;
  5302. }
  5303. clearTimeout(context._timeout);
  5304. context._hoverState = HoverState.OUT;
  5305. if (!context.config.delay || !context.config.delay.hide) {
  5306. context.hide();
  5307. return;
  5308. }
  5309. context._timeout = setTimeout(function () {
  5310. if (context._hoverState === HoverState.OUT) {
  5311. context.hide();
  5312. }
  5313. }, context.config.delay.hide);
  5314. };
  5315. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  5316. for (var trigger in this._activeTrigger) {
  5317. if (this._activeTrigger[trigger]) {
  5318. return true;
  5319. }
  5320. }
  5321. return false;
  5322. };
  5323. _proto._getConfig = function _getConfig(config) {
  5324. var dataAttributes = $(this.element).data();
  5325. Object.keys(dataAttributes).forEach(function (dataAttr) {
  5326. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  5327. delete dataAttributes[dataAttr];
  5328. }
  5329. });
  5330. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  5331. if (typeof config.delay === 'number') {
  5332. config.delay = {
  5333. show: config.delay,
  5334. hide: config.delay
  5335. };
  5336. }
  5337. if (typeof config.title === 'number') {
  5338. config.title = config.title.toString();
  5339. }
  5340. if (typeof config.content === 'number') {
  5341. config.content = config.content.toString();
  5342. }
  5343. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  5344. if (config.sanitize) {
  5345. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  5346. }
  5347. return config;
  5348. };
  5349. _proto._getDelegateConfig = function _getDelegateConfig() {
  5350. var config = {};
  5351. if (this.config) {
  5352. for (var key in this.config) {
  5353. if (this.constructor.Default[key] !== this.config[key]) {
  5354. config[key] = this.config[key];
  5355. }
  5356. }
  5357. }
  5358. return config;
  5359. };
  5360. _proto._cleanTipClass = function _cleanTipClass() {
  5361. var $tip = $(this.getTipElement());
  5362. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  5363. if (tabClass !== null && tabClass.length) {
  5364. $tip.removeClass(tabClass.join(''));
  5365. }
  5366. };
  5367. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  5368. var popperInstance = popperData.instance;
  5369. this.tip = popperInstance.popper;
  5370. this._cleanTipClass();
  5371. this.addAttachmentClass(this._getAttachment(popperData.placement));
  5372. };
  5373. _proto._fixTransition = function _fixTransition() {
  5374. var tip = this.getTipElement();
  5375. var initConfigAnimation = this.config.animation;
  5376. if (tip.getAttribute('x-placement') !== null) {
  5377. return;
  5378. }
  5379. $(tip).removeClass(ClassName$6.FADE);
  5380. this.config.animation = false;
  5381. this.hide();
  5382. this.show();
  5383. this.config.animation = initConfigAnimation;
  5384. } // Static
  5385. ;
  5386. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  5387. return this.each(function () {
  5388. var data = $(this).data(DATA_KEY$6);
  5389. var _config = typeof config === 'object' && config;
  5390. if (!data && /dispose|hide/.test(config)) {
  5391. return;
  5392. }
  5393. if (!data) {
  5394. data = new Tooltip(this, _config);
  5395. $(this).data(DATA_KEY$6, data);
  5396. }
  5397. if (typeof config === 'string') {
  5398. if (typeof data[config] === 'undefined') {
  5399. throw new TypeError("No method named \"" + config + "\"");
  5400. }
  5401. data[config]();
  5402. }
  5403. });
  5404. };
  5405. _createClass(Tooltip, null, [{
  5406. key: "VERSION",
  5407. get: function get() {
  5408. return VERSION$6;
  5409. }
  5410. }, {
  5411. key: "Default",
  5412. get: function get() {
  5413. return Default$4;
  5414. }
  5415. }, {
  5416. key: "NAME",
  5417. get: function get() {
  5418. return NAME$6;
  5419. }
  5420. }, {
  5421. key: "DATA_KEY",
  5422. get: function get() {
  5423. return DATA_KEY$6;
  5424. }
  5425. }, {
  5426. key: "Event",
  5427. get: function get() {
  5428. return Event$6;
  5429. }
  5430. }, {
  5431. key: "EVENT_KEY",
  5432. get: function get() {
  5433. return EVENT_KEY$6;
  5434. }
  5435. }, {
  5436. key: "DefaultType",
  5437. get: function get() {
  5438. return DefaultType$4;
  5439. }
  5440. }]);
  5441. return Tooltip;
  5442. }();
  5443. /**
  5444. * ------------------------------------------------------------------------
  5445. * jQuery
  5446. * ------------------------------------------------------------------------
  5447. */
  5448. $.fn[NAME$6] = Tooltip._jQueryInterface;
  5449. $.fn[NAME$6].Constructor = Tooltip;
  5450. $.fn[NAME$6].noConflict = function () {
  5451. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  5452. return Tooltip._jQueryInterface;
  5453. };
  5454. /**
  5455. * ------------------------------------------------------------------------
  5456. * Constants
  5457. * ------------------------------------------------------------------------
  5458. */
  5459. var NAME$7 = 'popover';
  5460. var VERSION$7 = '4.4.1';
  5461. var DATA_KEY$7 = 'bs.popover';
  5462. var EVENT_KEY$7 = "." + DATA_KEY$7;
  5463. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  5464. var CLASS_PREFIX$1 = 'bs-popover';
  5465. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  5466. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  5467. placement: 'right',
  5468. trigger: 'click',
  5469. content: '',
  5470. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  5471. });
  5472. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  5473. content: '(string|element|function)'
  5474. });
  5475. var ClassName$7 = {
  5476. FADE: 'fade',
  5477. SHOW: 'show'
  5478. };
  5479. var Selector$7 = {
  5480. TITLE: '.popover-header',
  5481. CONTENT: '.popover-body'
  5482. };
  5483. var Event$7 = {
  5484. HIDE: "hide" + EVENT_KEY$7,
  5485. HIDDEN: "hidden" + EVENT_KEY$7,
  5486. SHOW: "show" + EVENT_KEY$7,
  5487. SHOWN: "shown" + EVENT_KEY$7,
  5488. INSERTED: "inserted" + EVENT_KEY$7,
  5489. CLICK: "click" + EVENT_KEY$7,
  5490. FOCUSIN: "focusin" + EVENT_KEY$7,
  5491. FOCUSOUT: "focusout" + EVENT_KEY$7,
  5492. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  5493. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  5494. };
  5495. /**
  5496. * ------------------------------------------------------------------------
  5497. * Class Definition
  5498. * ------------------------------------------------------------------------
  5499. */
  5500. var Popover =
  5501. /*#__PURE__*/
  5502. function (_Tooltip) {
  5503. _inheritsLoose(Popover, _Tooltip);
  5504. function Popover() {
  5505. return _Tooltip.apply(this, arguments) || this;
  5506. }
  5507. var _proto = Popover.prototype;
  5508. // Overrides
  5509. _proto.isWithContent = function isWithContent() {
  5510. return this.getTitle() || this._getContent();
  5511. };
  5512. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5513. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  5514. };
  5515. _proto.getTipElement = function getTipElement() {
  5516. this.tip = this.tip || $(this.config.template)[0];
  5517. return this.tip;
  5518. };
  5519. _proto.setContent = function setContent() {
  5520. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  5521. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  5522. var content = this._getContent();
  5523. if (typeof content === 'function') {
  5524. content = content.call(this.element);
  5525. }
  5526. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  5527. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  5528. } // Private
  5529. ;
  5530. _proto._getContent = function _getContent() {
  5531. return this.element.getAttribute('data-content') || this.config.content;
  5532. };
  5533. _proto._cleanTipClass = function _cleanTipClass() {
  5534. var $tip = $(this.getTipElement());
  5535. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  5536. if (tabClass !== null && tabClass.length > 0) {
  5537. $tip.removeClass(tabClass.join(''));
  5538. }
  5539. } // Static
  5540. ;
  5541. Popover._jQueryInterface = function _jQueryInterface(config) {
  5542. return this.each(function () {
  5543. var data = $(this).data(DATA_KEY$7);
  5544. var _config = typeof config === 'object' ? config : null;
  5545. if (!data && /dispose|hide/.test(config)) {
  5546. return;
  5547. }
  5548. if (!data) {
  5549. data = new Popover(this, _config);
  5550. $(this).data(DATA_KEY$7, data);
  5551. }
  5552. if (typeof config === 'string') {
  5553. if (typeof data[config] === 'undefined') {
  5554. throw new TypeError("No method named \"" + config + "\"");
  5555. }
  5556. data[config]();
  5557. }
  5558. });
  5559. };
  5560. _createClass(Popover, null, [{
  5561. key: "VERSION",
  5562. // Getters
  5563. get: function get() {
  5564. return VERSION$7;
  5565. }
  5566. }, {
  5567. key: "Default",
  5568. get: function get() {
  5569. return Default$5;
  5570. }
  5571. }, {
  5572. key: "NAME",
  5573. get: function get() {
  5574. return NAME$7;
  5575. }
  5576. }, {
  5577. key: "DATA_KEY",
  5578. get: function get() {
  5579. return DATA_KEY$7;
  5580. }
  5581. }, {
  5582. key: "Event",
  5583. get: function get() {
  5584. return Event$7;
  5585. }
  5586. }, {
  5587. key: "EVENT_KEY",
  5588. get: function get() {
  5589. return EVENT_KEY$7;
  5590. }
  5591. }, {
  5592. key: "DefaultType",
  5593. get: function get() {
  5594. return DefaultType$5;
  5595. }
  5596. }]);
  5597. return Popover;
  5598. }(Tooltip);
  5599. /**
  5600. * ------------------------------------------------------------------------
  5601. * jQuery
  5602. * ------------------------------------------------------------------------
  5603. */
  5604. $.fn[NAME$7] = Popover._jQueryInterface;
  5605. $.fn[NAME$7].Constructor = Popover;
  5606. $.fn[NAME$7].noConflict = function () {
  5607. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  5608. return Popover._jQueryInterface;
  5609. };
  5610. /**
  5611. * ------------------------------------------------------------------------
  5612. * Constants
  5613. * ------------------------------------------------------------------------
  5614. */
  5615. var NAME$8 = 'scrollspy';
  5616. var VERSION$8 = '4.4.1';
  5617. var DATA_KEY$8 = 'bs.scrollspy';
  5618. var EVENT_KEY$8 = "." + DATA_KEY$8;
  5619. var DATA_API_KEY$6 = '.data-api';
  5620. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  5621. var Default$6 = {
  5622. offset: 10,
  5623. method: 'auto',
  5624. target: ''
  5625. };
  5626. var DefaultType$6 = {
  5627. offset: 'number',
  5628. method: 'string',
  5629. target: '(string|element)'
  5630. };
  5631. var Event$8 = {
  5632. ACTIVATE: "activate" + EVENT_KEY$8,
  5633. SCROLL: "scroll" + EVENT_KEY$8,
  5634. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  5635. };
  5636. var ClassName$8 = {
  5637. DROPDOWN_ITEM: 'dropdown-item',
  5638. DROPDOWN_MENU: 'dropdown-menu',
  5639. ACTIVE: 'active'
  5640. };
  5641. var Selector$8 = {
  5642. DATA_SPY: '[data-spy="scroll"]',
  5643. ACTIVE: '.active',
  5644. NAV_LIST_GROUP: '.nav, .list-group',
  5645. NAV_LINKS: '.nav-link',
  5646. NAV_ITEMS: '.nav-item',
  5647. LIST_ITEMS: '.list-group-item',
  5648. DROPDOWN: '.dropdown',
  5649. DROPDOWN_ITEMS: '.dropdown-item',
  5650. DROPDOWN_TOGGLE: '.dropdown-toggle'
  5651. };
  5652. var OffsetMethod = {
  5653. OFFSET: 'offset',
  5654. POSITION: 'position'
  5655. };
  5656. /**
  5657. * ------------------------------------------------------------------------
  5658. * Class Definition
  5659. * ------------------------------------------------------------------------
  5660. */
  5661. var ScrollSpy =
  5662. /*#__PURE__*/
  5663. function () {
  5664. function ScrollSpy(element, config) {
  5665. var _this = this;
  5666. this._element = element;
  5667. this._scrollElement = element.tagName === 'BODY' ? window : element;
  5668. this._config = this._getConfig(config);
  5669. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  5670. this._offsets = [];
  5671. this._targets = [];
  5672. this._activeTarget = null;
  5673. this._scrollHeight = 0;
  5674. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  5675. return _this._process(event);
  5676. });
  5677. this.refresh();
  5678. this._process();
  5679. } // Getters
  5680. var _proto = ScrollSpy.prototype;
  5681. // Public
  5682. _proto.refresh = function refresh() {
  5683. var _this2 = this;
  5684. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  5685. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  5686. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  5687. this._offsets = [];
  5688. this._targets = [];
  5689. this._scrollHeight = this._getScrollHeight();
  5690. var targets = [].slice.call(document.querySelectorAll(this._selector));
  5691. targets.map(function (element) {
  5692. var target;
  5693. var targetSelector = Util.getSelectorFromElement(element);
  5694. if (targetSelector) {
  5695. target = document.querySelector(targetSelector);
  5696. }
  5697. if (target) {
  5698. var targetBCR = target.getBoundingClientRect();
  5699. if (targetBCR.width || targetBCR.height) {
  5700. // TODO (fat): remove sketch reliance on jQuery position/offset
  5701. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  5702. }
  5703. }
  5704. return null;
  5705. }).filter(function (item) {
  5706. return item;
  5707. }).sort(function (a, b) {
  5708. return a[0] - b[0];
  5709. }).forEach(function (item) {
  5710. _this2._offsets.push(item[0]);
  5711. _this2._targets.push(item[1]);
  5712. });
  5713. };
  5714. _proto.dispose = function dispose() {
  5715. $.removeData(this._element, DATA_KEY$8);
  5716. $(this._scrollElement).off(EVENT_KEY$8);
  5717. this._element = null;
  5718. this._scrollElement = null;
  5719. this._config = null;
  5720. this._selector = null;
  5721. this._offsets = null;
  5722. this._targets = null;
  5723. this._activeTarget = null;
  5724. this._scrollHeight = null;
  5725. } // Private
  5726. ;
  5727. _proto._getConfig = function _getConfig(config) {
  5728. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  5729. if (typeof config.target !== 'string') {
  5730. var id = $(config.target).attr('id');
  5731. if (!id) {
  5732. id = Util.getUID(NAME$8);
  5733. $(config.target).attr('id', id);
  5734. }
  5735. config.target = "#" + id;
  5736. }
  5737. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  5738. return config;
  5739. };
  5740. _proto._getScrollTop = function _getScrollTop() {
  5741. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  5742. };
  5743. _proto._getScrollHeight = function _getScrollHeight() {
  5744. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  5745. };
  5746. _proto._getOffsetHeight = function _getOffsetHeight() {
  5747. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  5748. };
  5749. _proto._process = function _process() {
  5750. var scrollTop = this._getScrollTop() + this._config.offset;
  5751. var scrollHeight = this._getScrollHeight();
  5752. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  5753. if (this._scrollHeight !== scrollHeight) {
  5754. this.refresh();
  5755. }
  5756. if (scrollTop >= maxScroll) {
  5757. var target = this._targets[this._targets.length - 1];
  5758. if (this._activeTarget !== target) {
  5759. this._activate(target);
  5760. }
  5761. return;
  5762. }
  5763. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  5764. this._activeTarget = null;
  5765. this._clear();
  5766. return;
  5767. }
  5768. var offsetLength = this._offsets.length;
  5769. for (var i = offsetLength; i--;) {
  5770. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  5771. if (isActiveTarget) {
  5772. this._activate(this._targets[i]);
  5773. }
  5774. }
  5775. };
  5776. _proto._activate = function _activate(target) {
  5777. this._activeTarget = target;
  5778. this._clear();
  5779. var queries = this._selector.split(',').map(function (selector) {
  5780. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  5781. });
  5782. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  5783. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  5784. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  5785. $link.addClass(ClassName$8.ACTIVE);
  5786. } else {
  5787. // Set triggered link as active
  5788. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  5789. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  5790. $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
  5791. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  5792. }
  5793. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  5794. relatedTarget: target
  5795. });
  5796. };
  5797. _proto._clear = function _clear() {
  5798. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  5799. return node.classList.contains(ClassName$8.ACTIVE);
  5800. }).forEach(function (node) {
  5801. return node.classList.remove(ClassName$8.ACTIVE);
  5802. });
  5803. } // Static
  5804. ;
  5805. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  5806. return this.each(function () {
  5807. var data = $(this).data(DATA_KEY$8);
  5808. var _config = typeof config === 'object' && config;
  5809. if (!data) {
  5810. data = new ScrollSpy(this, _config);
  5811. $(this).data(DATA_KEY$8, data);
  5812. }
  5813. if (typeof config === 'string') {
  5814. if (typeof data[config] === 'undefined') {
  5815. throw new TypeError("No method named \"" + config + "\"");
  5816. }
  5817. data[config]();
  5818. }
  5819. });
  5820. };
  5821. _createClass(ScrollSpy, null, [{
  5822. key: "VERSION",
  5823. get: function get() {
  5824. return VERSION$8;
  5825. }
  5826. }, {
  5827. key: "Default",
  5828. get: function get() {
  5829. return Default$6;
  5830. }
  5831. }]);
  5832. return ScrollSpy;
  5833. }();
  5834. /**
  5835. * ------------------------------------------------------------------------
  5836. * Data Api implementation
  5837. * ------------------------------------------------------------------------
  5838. */
  5839. $(window).on(Event$8.LOAD_DATA_API, function () {
  5840. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  5841. var scrollSpysLength = scrollSpys.length;
  5842. for (var i = scrollSpysLength; i--;) {
  5843. var $spy = $(scrollSpys[i]);
  5844. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  5845. }
  5846. });
  5847. /**
  5848. * ------------------------------------------------------------------------
  5849. * jQuery
  5850. * ------------------------------------------------------------------------
  5851. */
  5852. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  5853. $.fn[NAME$8].Constructor = ScrollSpy;
  5854. $.fn[NAME$8].noConflict = function () {
  5855. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  5856. return ScrollSpy._jQueryInterface;
  5857. };
  5858. /**
  5859. * ------------------------------------------------------------------------
  5860. * Constants
  5861. * ------------------------------------------------------------------------
  5862. */
  5863. var NAME$9 = 'tab';
  5864. var VERSION$9 = '4.4.1';
  5865. var DATA_KEY$9 = 'bs.tab';
  5866. var EVENT_KEY$9 = "." + DATA_KEY$9;
  5867. var DATA_API_KEY$7 = '.data-api';
  5868. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  5869. var Event$9 = {
  5870. HIDE: "hide" + EVENT_KEY$9,
  5871. HIDDEN: "hidden" + EVENT_KEY$9,
  5872. SHOW: "show" + EVENT_KEY$9,
  5873. SHOWN: "shown" + EVENT_KEY$9,
  5874. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  5875. };
  5876. var ClassName$9 = {
  5877. DROPDOWN_MENU: 'dropdown-menu',
  5878. ACTIVE: 'active',
  5879. DISABLED: 'disabled',
  5880. FADE: 'fade',
  5881. SHOW: 'show'
  5882. };
  5883. var Selector$9 = {
  5884. DROPDOWN: '.dropdown',
  5885. NAV_LIST_GROUP: '.nav, .list-group',
  5886. ACTIVE: '.active',
  5887. ACTIVE_UL: '> li > .active',
  5888. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  5889. DROPDOWN_TOGGLE: '.dropdown-toggle',
  5890. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  5891. };
  5892. /**
  5893. * ------------------------------------------------------------------------
  5894. * Class Definition
  5895. * ------------------------------------------------------------------------
  5896. */
  5897. var Tab =
  5898. /*#__PURE__*/
  5899. function () {
  5900. function Tab(element) {
  5901. this._element = element;
  5902. } // Getters
  5903. var _proto = Tab.prototype;
  5904. // Public
  5905. _proto.show = function show() {
  5906. var _this = this;
  5907. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  5908. return;
  5909. }
  5910. var target;
  5911. var previous;
  5912. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  5913. var selector = Util.getSelectorFromElement(this._element);
  5914. if (listElement) {
  5915. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  5916. previous = $.makeArray($(listElement).find(itemSelector));
  5917. previous = previous[previous.length - 1];
  5918. }
  5919. var hideEvent = $.Event(Event$9.HIDE, {
  5920. relatedTarget: this._element
  5921. });
  5922. var showEvent = $.Event(Event$9.SHOW, {
  5923. relatedTarget: previous
  5924. });
  5925. if (previous) {
  5926. $(previous).trigger(hideEvent);
  5927. }
  5928. $(this._element).trigger(showEvent);
  5929. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  5930. return;
  5931. }
  5932. if (selector) {
  5933. target = document.querySelector(selector);
  5934. }
  5935. this._activate(this._element, listElement);
  5936. var complete = function complete() {
  5937. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  5938. relatedTarget: _this._element
  5939. });
  5940. var shownEvent = $.Event(Event$9.SHOWN, {
  5941. relatedTarget: previous
  5942. });
  5943. $(previous).trigger(hiddenEvent);
  5944. $(_this._element).trigger(shownEvent);
  5945. };
  5946. if (target) {
  5947. this._activate(target, target.parentNode, complete);
  5948. } else {
  5949. complete();
  5950. }
  5951. };
  5952. _proto.dispose = function dispose() {
  5953. $.removeData(this._element, DATA_KEY$9);
  5954. this._element = null;
  5955. } // Private
  5956. ;
  5957. _proto._activate = function _activate(element, container, callback) {
  5958. var _this2 = this;
  5959. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  5960. var active = activeElements[0];
  5961. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  5962. var complete = function complete() {
  5963. return _this2._transitionComplete(element, active, callback);
  5964. };
  5965. if (active && isTransitioning) {
  5966. var transitionDuration = Util.getTransitionDurationFromElement(active);
  5967. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5968. } else {
  5969. complete();
  5970. }
  5971. };
  5972. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  5973. if (active) {
  5974. $(active).removeClass(ClassName$9.ACTIVE);
  5975. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  5976. if (dropdownChild) {
  5977. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  5978. }
  5979. if (active.getAttribute('role') === 'tab') {
  5980. active.setAttribute('aria-selected', false);
  5981. }
  5982. }
  5983. $(element).addClass(ClassName$9.ACTIVE);
  5984. if (element.getAttribute('role') === 'tab') {
  5985. element.setAttribute('aria-selected', true);
  5986. }
  5987. Util.reflow(element);
  5988. if (element.classList.contains(ClassName$9.FADE)) {
  5989. element.classList.add(ClassName$9.SHOW);
  5990. }
  5991. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  5992. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  5993. if (dropdownElement) {
  5994. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  5995. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  5996. }
  5997. element.setAttribute('aria-expanded', true);
  5998. }
  5999. if (callback) {
  6000. callback();
  6001. }
  6002. } // Static
  6003. ;
  6004. Tab._jQueryInterface = function _jQueryInterface(config) {
  6005. return this.each(function () {
  6006. var $this = $(this);
  6007. var data = $this.data(DATA_KEY$9);
  6008. if (!data) {
  6009. data = new Tab(this);
  6010. $this.data(DATA_KEY$9, data);
  6011. }
  6012. if (typeof config === 'string') {
  6013. if (typeof data[config] === 'undefined') {
  6014. throw new TypeError("No method named \"" + config + "\"");
  6015. }
  6016. data[config]();
  6017. }
  6018. });
  6019. };
  6020. _createClass(Tab, null, [{
  6021. key: "VERSION",
  6022. get: function get() {
  6023. return VERSION$9;
  6024. }
  6025. }]);
  6026. return Tab;
  6027. }();
  6028. /**
  6029. * ------------------------------------------------------------------------
  6030. * Data Api implementation
  6031. * ------------------------------------------------------------------------
  6032. */
  6033. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  6034. event.preventDefault();
  6035. Tab._jQueryInterface.call($(this), 'show');
  6036. });
  6037. /**
  6038. * ------------------------------------------------------------------------
  6039. * jQuery
  6040. * ------------------------------------------------------------------------
  6041. */
  6042. $.fn[NAME$9] = Tab._jQueryInterface;
  6043. $.fn[NAME$9].Constructor = Tab;
  6044. $.fn[NAME$9].noConflict = function () {
  6045. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  6046. return Tab._jQueryInterface;
  6047. };
  6048. /**
  6049. * ------------------------------------------------------------------------
  6050. * Constants
  6051. * ------------------------------------------------------------------------
  6052. */
  6053. var NAME$a = 'toast';
  6054. var VERSION$a = '4.4.1';
  6055. var DATA_KEY$a = 'bs.toast';
  6056. var EVENT_KEY$a = "." + DATA_KEY$a;
  6057. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  6058. var Event$a = {
  6059. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  6060. HIDE: "hide" + EVENT_KEY$a,
  6061. HIDDEN: "hidden" + EVENT_KEY$a,
  6062. SHOW: "show" + EVENT_KEY$a,
  6063. SHOWN: "shown" + EVENT_KEY$a
  6064. };
  6065. var ClassName$a = {
  6066. FADE: 'fade',
  6067. HIDE: 'hide',
  6068. SHOW: 'show',
  6069. SHOWING: 'showing'
  6070. };
  6071. var DefaultType$7 = {
  6072. animation: 'boolean',
  6073. autohide: 'boolean',
  6074. delay: 'number'
  6075. };
  6076. var Default$7 = {
  6077. animation: true,
  6078. autohide: true,
  6079. delay: 500
  6080. };
  6081. var Selector$a = {
  6082. DATA_DISMISS: '[data-dismiss="toast"]'
  6083. };
  6084. /**
  6085. * ------------------------------------------------------------------------
  6086. * Class Definition
  6087. * ------------------------------------------------------------------------
  6088. */
  6089. var Toast =
  6090. /*#__PURE__*/
  6091. function () {
  6092. function Toast(element, config) {
  6093. this._element = element;
  6094. this._config = this._getConfig(config);
  6095. this._timeout = null;
  6096. this._setListeners();
  6097. } // Getters
  6098. var _proto = Toast.prototype;
  6099. // Public
  6100. _proto.show = function show() {
  6101. var _this = this;
  6102. var showEvent = $.Event(Event$a.SHOW);
  6103. $(this._element).trigger(showEvent);
  6104. if (showEvent.isDefaultPrevented()) {
  6105. return;
  6106. }
  6107. if (this._config.animation) {
  6108. this._element.classList.add(ClassName$a.FADE);
  6109. }
  6110. var complete = function complete() {
  6111. _this._element.classList.remove(ClassName$a.SHOWING);
  6112. _this._element.classList.add(ClassName$a.SHOW);
  6113. $(_this._element).trigger(Event$a.SHOWN);
  6114. if (_this._config.autohide) {
  6115. _this._timeout = setTimeout(function () {
  6116. _this.hide();
  6117. }, _this._config.delay);
  6118. }
  6119. };
  6120. this._element.classList.remove(ClassName$a.HIDE);
  6121. Util.reflow(this._element);
  6122. this._element.classList.add(ClassName$a.SHOWING);
  6123. if (this._config.animation) {
  6124. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6125. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6126. } else {
  6127. complete();
  6128. }
  6129. };
  6130. _proto.hide = function hide() {
  6131. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  6132. return;
  6133. }
  6134. var hideEvent = $.Event(Event$a.HIDE);
  6135. $(this._element).trigger(hideEvent);
  6136. if (hideEvent.isDefaultPrevented()) {
  6137. return;
  6138. }
  6139. this._close();
  6140. };
  6141. _proto.dispose = function dispose() {
  6142. clearTimeout(this._timeout);
  6143. this._timeout = null;
  6144. if (this._element.classList.contains(ClassName$a.SHOW)) {
  6145. this._element.classList.remove(ClassName$a.SHOW);
  6146. }
  6147. $(this._element).off(Event$a.CLICK_DISMISS);
  6148. $.removeData(this._element, DATA_KEY$a);
  6149. this._element = null;
  6150. this._config = null;
  6151. } // Private
  6152. ;
  6153. _proto._getConfig = function _getConfig(config) {
  6154. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  6155. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  6156. return config;
  6157. };
  6158. _proto._setListeners = function _setListeners() {
  6159. var _this2 = this;
  6160. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  6161. return _this2.hide();
  6162. });
  6163. };
  6164. _proto._close = function _close() {
  6165. var _this3 = this;
  6166. var complete = function complete() {
  6167. _this3._element.classList.add(ClassName$a.HIDE);
  6168. $(_this3._element).trigger(Event$a.HIDDEN);
  6169. };
  6170. this._element.classList.remove(ClassName$a.SHOW);
  6171. if (this._config.animation) {
  6172. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6173. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6174. } else {
  6175. complete();
  6176. }
  6177. } // Static
  6178. ;
  6179. Toast._jQueryInterface = function _jQueryInterface(config) {
  6180. return this.each(function () {
  6181. var $element = $(this);
  6182. var data = $element.data(DATA_KEY$a);
  6183. var _config = typeof config === 'object' && config;
  6184. if (!data) {
  6185. data = new Toast(this, _config);
  6186. $element.data(DATA_KEY$a, data);
  6187. }
  6188. if (typeof config === 'string') {
  6189. if (typeof data[config] === 'undefined') {
  6190. throw new TypeError("No method named \"" + config + "\"");
  6191. }
  6192. data[config](this);
  6193. }
  6194. });
  6195. };
  6196. _createClass(Toast, null, [{
  6197. key: "VERSION",
  6198. get: function get() {
  6199. return VERSION$a;
  6200. }
  6201. }, {
  6202. key: "DefaultType",
  6203. get: function get() {
  6204. return DefaultType$7;
  6205. }
  6206. }, {
  6207. key: "Default",
  6208. get: function get() {
  6209. return Default$7;
  6210. }
  6211. }]);
  6212. return Toast;
  6213. }();
  6214. /**
  6215. * ------------------------------------------------------------------------
  6216. * jQuery
  6217. * ------------------------------------------------------------------------
  6218. */
  6219. $.fn[NAME$a] = Toast._jQueryInterface;
  6220. $.fn[NAME$a].Constructor = Toast;
  6221. $.fn[NAME$a].noConflict = function () {
  6222. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  6223. return Toast._jQueryInterface;
  6224. };
  6225. exports.Alert = Alert;
  6226. exports.Button = Button;
  6227. exports.Carousel = Carousel;
  6228. exports.Collapse = Collapse;
  6229. exports.Dropdown = Dropdown;
  6230. exports.Modal = Modal;
  6231. exports.Popover = Popover;
  6232. exports.Scrollspy = ScrollSpy;
  6233. exports.Tab = Tab;
  6234. exports.Toast = Toast;
  6235. exports.Tooltip = Tooltip;
  6236. exports.Util = Util;
  6237. Object.defineProperty(exports, '__esModule', { value: true });
  6238. })));
  6239. //# sourceMappingURL=bootstrap.js.map
  6240. /***/ }),
  6241. /***/ "./node_modules/buffer/index.js":
  6242. /*!**************************************!*\
  6243. !*** ./node_modules/buffer/index.js ***!
  6244. \**************************************/
  6245. /*! no static exports found */
  6246. /***/ (function(module, exports, __webpack_require__) {
  6247. "use strict";
  6248. /* WEBPACK VAR INJECTION */(function(global) {/*!
  6249. * The buffer module from node.js, for the browser.
  6250. *
  6251. * @author Feross Aboukhadijeh <http://feross.org>
  6252. * @license MIT
  6253. */
  6254. /* eslint-disable no-proto */
  6255. var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
  6256. var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
  6257. var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
  6258. exports.Buffer = Buffer
  6259. exports.SlowBuffer = SlowBuffer
  6260. exports.INSPECT_MAX_BYTES = 50
  6261. /**
  6262. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  6263. * === true Use Uint8Array implementation (fastest)
  6264. * === false Use Object implementation (most compatible, even IE6)
  6265. *
  6266. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  6267. * Opera 11.6+, iOS 4.2+.
  6268. *
  6269. * Due to various browser bugs, sometimes the Object implementation will be used even
  6270. * when the browser supports typed arrays.
  6271. *
  6272. * Note:
  6273. *
  6274. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  6275. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  6276. *
  6277. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  6278. *
  6279. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  6280. * incorrect length in some situations.
  6281. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  6282. * get the Object implementation, which is slower but behaves correctly.
  6283. */
  6284. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  6285. ? global.TYPED_ARRAY_SUPPORT
  6286. : typedArraySupport()
  6287. /*
  6288. * Export kMaxLength after typed array support is determined.
  6289. */
  6290. exports.kMaxLength = kMaxLength()
  6291. function typedArraySupport () {
  6292. try {
  6293. var arr = new Uint8Array(1)
  6294. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  6295. return arr.foo() === 42 && // typed array instances can be augmented
  6296. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  6297. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  6298. } catch (e) {
  6299. return false
  6300. }
  6301. }
  6302. function kMaxLength () {
  6303. return Buffer.TYPED_ARRAY_SUPPORT
  6304. ? 0x7fffffff
  6305. : 0x3fffffff
  6306. }
  6307. function createBuffer (that, length) {
  6308. if (kMaxLength() < length) {
  6309. throw new RangeError('Invalid typed array length')
  6310. }
  6311. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6312. // Return an augmented `Uint8Array` instance, for best performance
  6313. that = new Uint8Array(length)
  6314. that.__proto__ = Buffer.prototype
  6315. } else {
  6316. // Fallback: Return an object instance of the Buffer class
  6317. if (that === null) {
  6318. that = new Buffer(length)
  6319. }
  6320. that.length = length
  6321. }
  6322. return that
  6323. }
  6324. /**
  6325. * The Buffer constructor returns instances of `Uint8Array` that have their
  6326. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  6327. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  6328. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  6329. * returns a single octet.
  6330. *
  6331. * The `Uint8Array` prototype remains unmodified.
  6332. */
  6333. function Buffer (arg, encodingOrOffset, length) {
  6334. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  6335. return new Buffer(arg, encodingOrOffset, length)
  6336. }
  6337. // Common case.
  6338. if (typeof arg === 'number') {
  6339. if (typeof encodingOrOffset === 'string') {
  6340. throw new Error(
  6341. 'If encoding is specified then the first argument must be a string'
  6342. )
  6343. }
  6344. return allocUnsafe(this, arg)
  6345. }
  6346. return from(this, arg, encodingOrOffset, length)
  6347. }
  6348. Buffer.poolSize = 8192 // not used by this implementation
  6349. // TODO: Legacy, not needed anymore. Remove in next major version.
  6350. Buffer._augment = function (arr) {
  6351. arr.__proto__ = Buffer.prototype
  6352. return arr
  6353. }
  6354. function from (that, value, encodingOrOffset, length) {
  6355. if (typeof value === 'number') {
  6356. throw new TypeError('"value" argument must not be a number')
  6357. }
  6358. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  6359. return fromArrayBuffer(that, value, encodingOrOffset, length)
  6360. }
  6361. if (typeof value === 'string') {
  6362. return fromString(that, value, encodingOrOffset)
  6363. }
  6364. return fromObject(that, value)
  6365. }
  6366. /**
  6367. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  6368. * if value is a number.
  6369. * Buffer.from(str[, encoding])
  6370. * Buffer.from(array)
  6371. * Buffer.from(buffer)
  6372. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  6373. **/
  6374. Buffer.from = function (value, encodingOrOffset, length) {
  6375. return from(null, value, encodingOrOffset, length)
  6376. }
  6377. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6378. Buffer.prototype.__proto__ = Uint8Array.prototype
  6379. Buffer.__proto__ = Uint8Array
  6380. if (typeof Symbol !== 'undefined' && Symbol.species &&
  6381. Buffer[Symbol.species] === Buffer) {
  6382. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  6383. Object.defineProperty(Buffer, Symbol.species, {
  6384. value: null,
  6385. configurable: true
  6386. })
  6387. }
  6388. }
  6389. function assertSize (size) {
  6390. if (typeof size !== 'number') {
  6391. throw new TypeError('"size" argument must be a number')
  6392. } else if (size < 0) {
  6393. throw new RangeError('"size" argument must not be negative')
  6394. }
  6395. }
  6396. function alloc (that, size, fill, encoding) {
  6397. assertSize(size)
  6398. if (size <= 0) {
  6399. return createBuffer(that, size)
  6400. }
  6401. if (fill !== undefined) {
  6402. // Only pay attention to encoding if it's a string. This
  6403. // prevents accidentally sending in a number that would
  6404. // be interpretted as a start offset.
  6405. return typeof encoding === 'string'
  6406. ? createBuffer(that, size).fill(fill, encoding)
  6407. : createBuffer(that, size).fill(fill)
  6408. }
  6409. return createBuffer(that, size)
  6410. }
  6411. /**
  6412. * Creates a new filled Buffer instance.
  6413. * alloc(size[, fill[, encoding]])
  6414. **/
  6415. Buffer.alloc = function (size, fill, encoding) {
  6416. return alloc(null, size, fill, encoding)
  6417. }
  6418. function allocUnsafe (that, size) {
  6419. assertSize(size)
  6420. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  6421. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  6422. for (var i = 0; i < size; ++i) {
  6423. that[i] = 0
  6424. }
  6425. }
  6426. return that
  6427. }
  6428. /**
  6429. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  6430. * */
  6431. Buffer.allocUnsafe = function (size) {
  6432. return allocUnsafe(null, size)
  6433. }
  6434. /**
  6435. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  6436. */
  6437. Buffer.allocUnsafeSlow = function (size) {
  6438. return allocUnsafe(null, size)
  6439. }
  6440. function fromString (that, string, encoding) {
  6441. if (typeof encoding !== 'string' || encoding === '') {
  6442. encoding = 'utf8'
  6443. }
  6444. if (!Buffer.isEncoding(encoding)) {
  6445. throw new TypeError('"encoding" must be a valid string encoding')
  6446. }
  6447. var length = byteLength(string, encoding) | 0
  6448. that = createBuffer(that, length)
  6449. var actual = that.write(string, encoding)
  6450. if (actual !== length) {
  6451. // Writing a hex string, for example, that contains invalid characters will
  6452. // cause everything after the first invalid character to be ignored. (e.g.
  6453. // 'abxxcd' will be treated as 'ab')
  6454. that = that.slice(0, actual)
  6455. }
  6456. return that
  6457. }
  6458. function fromArrayLike (that, array) {
  6459. var length = array.length < 0 ? 0 : checked(array.length) | 0
  6460. that = createBuffer(that, length)
  6461. for (var i = 0; i < length; i += 1) {
  6462. that[i] = array[i] & 255
  6463. }
  6464. return that
  6465. }
  6466. function fromArrayBuffer (that, array, byteOffset, length) {
  6467. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  6468. if (byteOffset < 0 || array.byteLength < byteOffset) {
  6469. throw new RangeError('\'offset\' is out of bounds')
  6470. }
  6471. if (array.byteLength < byteOffset + (length || 0)) {
  6472. throw new RangeError('\'length\' is out of bounds')
  6473. }
  6474. if (byteOffset === undefined && length === undefined) {
  6475. array = new Uint8Array(array)
  6476. } else if (length === undefined) {
  6477. array = new Uint8Array(array, byteOffset)
  6478. } else {
  6479. array = new Uint8Array(array, byteOffset, length)
  6480. }
  6481. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6482. // Return an augmented `Uint8Array` instance, for best performance
  6483. that = array
  6484. that.__proto__ = Buffer.prototype
  6485. } else {
  6486. // Fallback: Return an object instance of the Buffer class
  6487. that = fromArrayLike(that, array)
  6488. }
  6489. return that
  6490. }
  6491. function fromObject (that, obj) {
  6492. if (Buffer.isBuffer(obj)) {
  6493. var len = checked(obj.length) | 0
  6494. that = createBuffer(that, len)
  6495. if (that.length === 0) {
  6496. return that
  6497. }
  6498. obj.copy(that, 0, 0, len)
  6499. return that
  6500. }
  6501. if (obj) {
  6502. if ((typeof ArrayBuffer !== 'undefined' &&
  6503. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  6504. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  6505. return createBuffer(that, 0)
  6506. }
  6507. return fromArrayLike(that, obj)
  6508. }
  6509. if (obj.type === 'Buffer' && isArray(obj.data)) {
  6510. return fromArrayLike(that, obj.data)
  6511. }
  6512. }
  6513. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  6514. }
  6515. function checked (length) {
  6516. // Note: cannot use `length < kMaxLength()` here because that fails when
  6517. // length is NaN (which is otherwise coerced to zero.)
  6518. if (length >= kMaxLength()) {
  6519. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  6520. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  6521. }
  6522. return length | 0
  6523. }
  6524. function SlowBuffer (length) {
  6525. if (+length != length) { // eslint-disable-line eqeqeq
  6526. length = 0
  6527. }
  6528. return Buffer.alloc(+length)
  6529. }
  6530. Buffer.isBuffer = function isBuffer (b) {
  6531. return !!(b != null && b._isBuffer)
  6532. }
  6533. Buffer.compare = function compare (a, b) {
  6534. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  6535. throw new TypeError('Arguments must be Buffers')
  6536. }
  6537. if (a === b) return 0
  6538. var x = a.length
  6539. var y = b.length
  6540. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  6541. if (a[i] !== b[i]) {
  6542. x = a[i]
  6543. y = b[i]
  6544. break
  6545. }
  6546. }
  6547. if (x < y) return -1
  6548. if (y < x) return 1
  6549. return 0
  6550. }
  6551. Buffer.isEncoding = function isEncoding (encoding) {
  6552. switch (String(encoding).toLowerCase()) {
  6553. case 'hex':
  6554. case 'utf8':
  6555. case 'utf-8':
  6556. case 'ascii':
  6557. case 'latin1':
  6558. case 'binary':
  6559. case 'base64':
  6560. case 'ucs2':
  6561. case 'ucs-2':
  6562. case 'utf16le':
  6563. case 'utf-16le':
  6564. return true
  6565. default:
  6566. return false
  6567. }
  6568. }
  6569. Buffer.concat = function concat (list, length) {
  6570. if (!isArray(list)) {
  6571. throw new TypeError('"list" argument must be an Array of Buffers')
  6572. }
  6573. if (list.length === 0) {
  6574. return Buffer.alloc(0)
  6575. }
  6576. var i
  6577. if (length === undefined) {
  6578. length = 0
  6579. for (i = 0; i < list.length; ++i) {
  6580. length += list[i].length
  6581. }
  6582. }
  6583. var buffer = Buffer.allocUnsafe(length)
  6584. var pos = 0
  6585. for (i = 0; i < list.length; ++i) {
  6586. var buf = list[i]
  6587. if (!Buffer.isBuffer(buf)) {
  6588. throw new TypeError('"list" argument must be an Array of Buffers')
  6589. }
  6590. buf.copy(buffer, pos)
  6591. pos += buf.length
  6592. }
  6593. return buffer
  6594. }
  6595. function byteLength (string, encoding) {
  6596. if (Buffer.isBuffer(string)) {
  6597. return string.length
  6598. }
  6599. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  6600. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  6601. return string.byteLength
  6602. }
  6603. if (typeof string !== 'string') {
  6604. string = '' + string
  6605. }
  6606. var len = string.length
  6607. if (len === 0) return 0
  6608. // Use a for loop to avoid recursion
  6609. var loweredCase = false
  6610. for (;;) {
  6611. switch (encoding) {
  6612. case 'ascii':
  6613. case 'latin1':
  6614. case 'binary':
  6615. return len
  6616. case 'utf8':
  6617. case 'utf-8':
  6618. case undefined:
  6619. return utf8ToBytes(string).length
  6620. case 'ucs2':
  6621. case 'ucs-2':
  6622. case 'utf16le':
  6623. case 'utf-16le':
  6624. return len * 2
  6625. case 'hex':
  6626. return len >>> 1
  6627. case 'base64':
  6628. return base64ToBytes(string).length
  6629. default:
  6630. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  6631. encoding = ('' + encoding).toLowerCase()
  6632. loweredCase = true
  6633. }
  6634. }
  6635. }
  6636. Buffer.byteLength = byteLength
  6637. function slowToString (encoding, start, end) {
  6638. var loweredCase = false
  6639. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  6640. // property of a typed array.
  6641. // This behaves neither like String nor Uint8Array in that we set start/end
  6642. // to their upper/lower bounds if the value passed is out of range.
  6643. // undefined is handled specially as per ECMA-262 6th Edition,
  6644. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  6645. if (start === undefined || start < 0) {
  6646. start = 0
  6647. }
  6648. // Return early if start > this.length. Done here to prevent potential uint32
  6649. // coercion fail below.
  6650. if (start > this.length) {
  6651. return ''
  6652. }
  6653. if (end === undefined || end > this.length) {
  6654. end = this.length
  6655. }
  6656. if (end <= 0) {
  6657. return ''
  6658. }
  6659. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  6660. end >>>= 0
  6661. start >>>= 0
  6662. if (end <= start) {
  6663. return ''
  6664. }
  6665. if (!encoding) encoding = 'utf8'
  6666. while (true) {
  6667. switch (encoding) {
  6668. case 'hex':
  6669. return hexSlice(this, start, end)
  6670. case 'utf8':
  6671. case 'utf-8':
  6672. return utf8Slice(this, start, end)
  6673. case 'ascii':
  6674. return asciiSlice(this, start, end)
  6675. case 'latin1':
  6676. case 'binary':
  6677. return latin1Slice(this, start, end)
  6678. case 'base64':
  6679. return base64Slice(this, start, end)
  6680. case 'ucs2':
  6681. case 'ucs-2':
  6682. case 'utf16le':
  6683. case 'utf-16le':
  6684. return utf16leSlice(this, start, end)
  6685. default:
  6686. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6687. encoding = (encoding + '').toLowerCase()
  6688. loweredCase = true
  6689. }
  6690. }
  6691. }
  6692. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  6693. // Buffer instances.
  6694. Buffer.prototype._isBuffer = true
  6695. function swap (b, n, m) {
  6696. var i = b[n]
  6697. b[n] = b[m]
  6698. b[m] = i
  6699. }
  6700. Buffer.prototype.swap16 = function swap16 () {
  6701. var len = this.length
  6702. if (len % 2 !== 0) {
  6703. throw new RangeError('Buffer size must be a multiple of 16-bits')
  6704. }
  6705. for (var i = 0; i < len; i += 2) {
  6706. swap(this, i, i + 1)
  6707. }
  6708. return this
  6709. }
  6710. Buffer.prototype.swap32 = function swap32 () {
  6711. var len = this.length
  6712. if (len % 4 !== 0) {
  6713. throw new RangeError('Buffer size must be a multiple of 32-bits')
  6714. }
  6715. for (var i = 0; i < len; i += 4) {
  6716. swap(this, i, i + 3)
  6717. swap(this, i + 1, i + 2)
  6718. }
  6719. return this
  6720. }
  6721. Buffer.prototype.swap64 = function swap64 () {
  6722. var len = this.length
  6723. if (len % 8 !== 0) {
  6724. throw new RangeError('Buffer size must be a multiple of 64-bits')
  6725. }
  6726. for (var i = 0; i < len; i += 8) {
  6727. swap(this, i, i + 7)
  6728. swap(this, i + 1, i + 6)
  6729. swap(this, i + 2, i + 5)
  6730. swap(this, i + 3, i + 4)
  6731. }
  6732. return this
  6733. }
  6734. Buffer.prototype.toString = function toString () {
  6735. var length = this.length | 0
  6736. if (length === 0) return ''
  6737. if (arguments.length === 0) return utf8Slice(this, 0, length)
  6738. return slowToString.apply(this, arguments)
  6739. }
  6740. Buffer.prototype.equals = function equals (b) {
  6741. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  6742. if (this === b) return true
  6743. return Buffer.compare(this, b) === 0
  6744. }
  6745. Buffer.prototype.inspect = function inspect () {
  6746. var str = ''
  6747. var max = exports.INSPECT_MAX_BYTES
  6748. if (this.length > 0) {
  6749. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  6750. if (this.length > max) str += ' ... '
  6751. }
  6752. return '<Buffer ' + str + '>'
  6753. }
  6754. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  6755. if (!Buffer.isBuffer(target)) {
  6756. throw new TypeError('Argument must be a Buffer')
  6757. }
  6758. if (start === undefined) {
  6759. start = 0
  6760. }
  6761. if (end === undefined) {
  6762. end = target ? target.length : 0
  6763. }
  6764. if (thisStart === undefined) {
  6765. thisStart = 0
  6766. }
  6767. if (thisEnd === undefined) {
  6768. thisEnd = this.length
  6769. }
  6770. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  6771. throw new RangeError('out of range index')
  6772. }
  6773. if (thisStart >= thisEnd && start >= end) {
  6774. return 0
  6775. }
  6776. if (thisStart >= thisEnd) {
  6777. return -1
  6778. }
  6779. if (start >= end) {
  6780. return 1
  6781. }
  6782. start >>>= 0
  6783. end >>>= 0
  6784. thisStart >>>= 0
  6785. thisEnd >>>= 0
  6786. if (this === target) return 0
  6787. var x = thisEnd - thisStart
  6788. var y = end - start
  6789. var len = Math.min(x, y)
  6790. var thisCopy = this.slice(thisStart, thisEnd)
  6791. var targetCopy = target.slice(start, end)
  6792. for (var i = 0; i < len; ++i) {
  6793. if (thisCopy[i] !== targetCopy[i]) {
  6794. x = thisCopy[i]
  6795. y = targetCopy[i]
  6796. break
  6797. }
  6798. }
  6799. if (x < y) return -1
  6800. if (y < x) return 1
  6801. return 0
  6802. }
  6803. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  6804. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  6805. //
  6806. // Arguments:
  6807. // - buffer - a Buffer to search
  6808. // - val - a string, Buffer, or number
  6809. // - byteOffset - an index into `buffer`; will be clamped to an int32
  6810. // - encoding - an optional encoding, relevant is val is a string
  6811. // - dir - true for indexOf, false for lastIndexOf
  6812. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  6813. // Empty buffer means no match
  6814. if (buffer.length === 0) return -1
  6815. // Normalize byteOffset
  6816. if (typeof byteOffset === 'string') {
  6817. encoding = byteOffset
  6818. byteOffset = 0
  6819. } else if (byteOffset > 0x7fffffff) {
  6820. byteOffset = 0x7fffffff
  6821. } else if (byteOffset < -0x80000000) {
  6822. byteOffset = -0x80000000
  6823. }
  6824. byteOffset = +byteOffset // Coerce to Number.
  6825. if (isNaN(byteOffset)) {
  6826. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  6827. byteOffset = dir ? 0 : (buffer.length - 1)
  6828. }
  6829. // Normalize byteOffset: negative offsets start from the end of the buffer
  6830. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  6831. if (byteOffset >= buffer.length) {
  6832. if (dir) return -1
  6833. else byteOffset = buffer.length - 1
  6834. } else if (byteOffset < 0) {
  6835. if (dir) byteOffset = 0
  6836. else return -1
  6837. }
  6838. // Normalize val
  6839. if (typeof val === 'string') {
  6840. val = Buffer.from(val, encoding)
  6841. }
  6842. // Finally, search either indexOf (if dir is true) or lastIndexOf
  6843. if (Buffer.isBuffer(val)) {
  6844. // Special case: looking for empty string/buffer always fails
  6845. if (val.length === 0) {
  6846. return -1
  6847. }
  6848. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  6849. } else if (typeof val === 'number') {
  6850. val = val & 0xFF // Search for a byte value [0-255]
  6851. if (Buffer.TYPED_ARRAY_SUPPORT &&
  6852. typeof Uint8Array.prototype.indexOf === 'function') {
  6853. if (dir) {
  6854. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  6855. } else {
  6856. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  6857. }
  6858. }
  6859. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  6860. }
  6861. throw new TypeError('val must be string, number or Buffer')
  6862. }
  6863. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  6864. var indexSize = 1
  6865. var arrLength = arr.length
  6866. var valLength = val.length
  6867. if (encoding !== undefined) {
  6868. encoding = String(encoding).toLowerCase()
  6869. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  6870. encoding === 'utf16le' || encoding === 'utf-16le') {
  6871. if (arr.length < 2 || val.length < 2) {
  6872. return -1
  6873. }
  6874. indexSize = 2
  6875. arrLength /= 2
  6876. valLength /= 2
  6877. byteOffset /= 2
  6878. }
  6879. }
  6880. function read (buf, i) {
  6881. if (indexSize === 1) {
  6882. return buf[i]
  6883. } else {
  6884. return buf.readUInt16BE(i * indexSize)
  6885. }
  6886. }
  6887. var i
  6888. if (dir) {
  6889. var foundIndex = -1
  6890. for (i = byteOffset; i < arrLength; i++) {
  6891. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  6892. if (foundIndex === -1) foundIndex = i
  6893. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  6894. } else {
  6895. if (foundIndex !== -1) i -= i - foundIndex
  6896. foundIndex = -1
  6897. }
  6898. }
  6899. } else {
  6900. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  6901. for (i = byteOffset; i >= 0; i--) {
  6902. var found = true
  6903. for (var j = 0; j < valLength; j++) {
  6904. if (read(arr, i + j) !== read(val, j)) {
  6905. found = false
  6906. break
  6907. }
  6908. }
  6909. if (found) return i
  6910. }
  6911. }
  6912. return -1
  6913. }
  6914. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  6915. return this.indexOf(val, byteOffset, encoding) !== -1
  6916. }
  6917. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  6918. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  6919. }
  6920. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  6921. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  6922. }
  6923. function hexWrite (buf, string, offset, length) {
  6924. offset = Number(offset) || 0
  6925. var remaining = buf.length - offset
  6926. if (!length) {
  6927. length = remaining
  6928. } else {
  6929. length = Number(length)
  6930. if (length > remaining) {
  6931. length = remaining
  6932. }
  6933. }
  6934. // must be an even number of digits
  6935. var strLen = string.length
  6936. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  6937. if (length > strLen / 2) {
  6938. length = strLen / 2
  6939. }
  6940. for (var i = 0; i < length; ++i) {
  6941. var parsed = parseInt(string.substr(i * 2, 2), 16)
  6942. if (isNaN(parsed)) return i
  6943. buf[offset + i] = parsed
  6944. }
  6945. return i
  6946. }
  6947. function utf8Write (buf, string, offset, length) {
  6948. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  6949. }
  6950. function asciiWrite (buf, string, offset, length) {
  6951. return blitBuffer(asciiToBytes(string), buf, offset, length)
  6952. }
  6953. function latin1Write (buf, string, offset, length) {
  6954. return asciiWrite(buf, string, offset, length)
  6955. }
  6956. function base64Write (buf, string, offset, length) {
  6957. return blitBuffer(base64ToBytes(string), buf, offset, length)
  6958. }
  6959. function ucs2Write (buf, string, offset, length) {
  6960. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  6961. }
  6962. Buffer.prototype.write = function write (string, offset, length, encoding) {
  6963. // Buffer#write(string)
  6964. if (offset === undefined) {
  6965. encoding = 'utf8'
  6966. length = this.length
  6967. offset = 0
  6968. // Buffer#write(string, encoding)
  6969. } else if (length === undefined && typeof offset === 'string') {
  6970. encoding = offset
  6971. length = this.length
  6972. offset = 0
  6973. // Buffer#write(string, offset[, length][, encoding])
  6974. } else if (isFinite(offset)) {
  6975. offset = offset | 0
  6976. if (isFinite(length)) {
  6977. length = length | 0
  6978. if (encoding === undefined) encoding = 'utf8'
  6979. } else {
  6980. encoding = length
  6981. length = undefined
  6982. }
  6983. // legacy write(string, encoding, offset, length) - remove in v0.13
  6984. } else {
  6985. throw new Error(
  6986. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  6987. )
  6988. }
  6989. var remaining = this.length - offset
  6990. if (length === undefined || length > remaining) length = remaining
  6991. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  6992. throw new RangeError('Attempt to write outside buffer bounds')
  6993. }
  6994. if (!encoding) encoding = 'utf8'
  6995. var loweredCase = false
  6996. for (;;) {
  6997. switch (encoding) {
  6998. case 'hex':
  6999. return hexWrite(this, string, offset, length)
  7000. case 'utf8':
  7001. case 'utf-8':
  7002. return utf8Write(this, string, offset, length)
  7003. case 'ascii':
  7004. return asciiWrite(this, string, offset, length)
  7005. case 'latin1':
  7006. case 'binary':
  7007. return latin1Write(this, string, offset, length)
  7008. case 'base64':
  7009. // Warning: maxLength not taken into account in base64Write
  7010. return base64Write(this, string, offset, length)
  7011. case 'ucs2':
  7012. case 'ucs-2':
  7013. case 'utf16le':
  7014. case 'utf-16le':
  7015. return ucs2Write(this, string, offset, length)
  7016. default:
  7017. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  7018. encoding = ('' + encoding).toLowerCase()
  7019. loweredCase = true
  7020. }
  7021. }
  7022. }
  7023. Buffer.prototype.toJSON = function toJSON () {
  7024. return {
  7025. type: 'Buffer',
  7026. data: Array.prototype.slice.call(this._arr || this, 0)
  7027. }
  7028. }
  7029. function base64Slice (buf, start, end) {
  7030. if (start === 0 && end === buf.length) {
  7031. return base64.fromByteArray(buf)
  7032. } else {
  7033. return base64.fromByteArray(buf.slice(start, end))
  7034. }
  7035. }
  7036. function utf8Slice (buf, start, end) {
  7037. end = Math.min(buf.length, end)
  7038. var res = []
  7039. var i = start
  7040. while (i < end) {
  7041. var firstByte = buf[i]
  7042. var codePoint = null
  7043. var bytesPerSequence = (firstByte > 0xEF) ? 4
  7044. : (firstByte > 0xDF) ? 3
  7045. : (firstByte > 0xBF) ? 2
  7046. : 1
  7047. if (i + bytesPerSequence <= end) {
  7048. var secondByte, thirdByte, fourthByte, tempCodePoint
  7049. switch (bytesPerSequence) {
  7050. case 1:
  7051. if (firstByte < 0x80) {
  7052. codePoint = firstByte
  7053. }
  7054. break
  7055. case 2:
  7056. secondByte = buf[i + 1]
  7057. if ((secondByte & 0xC0) === 0x80) {
  7058. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  7059. if (tempCodePoint > 0x7F) {
  7060. codePoint = tempCodePoint
  7061. }
  7062. }
  7063. break
  7064. case 3:
  7065. secondByte = buf[i + 1]
  7066. thirdByte = buf[i + 2]
  7067. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  7068. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  7069. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  7070. codePoint = tempCodePoint
  7071. }
  7072. }
  7073. break
  7074. case 4:
  7075. secondByte = buf[i + 1]
  7076. thirdByte = buf[i + 2]
  7077. fourthByte = buf[i + 3]
  7078. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  7079. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  7080. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  7081. codePoint = tempCodePoint
  7082. }
  7083. }
  7084. }
  7085. }
  7086. if (codePoint === null) {
  7087. // we did not generate a valid codePoint so insert a
  7088. // replacement char (U+FFFD) and advance only 1 byte
  7089. codePoint = 0xFFFD
  7090. bytesPerSequence = 1
  7091. } else if (codePoint > 0xFFFF) {
  7092. // encode to utf16 (surrogate pair dance)
  7093. codePoint -= 0x10000
  7094. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  7095. codePoint = 0xDC00 | codePoint & 0x3FF
  7096. }
  7097. res.push(codePoint)
  7098. i += bytesPerSequence
  7099. }
  7100. return decodeCodePointsArray(res)
  7101. }
  7102. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  7103. // the lowest limit is Chrome, with 0x10000 args.
  7104. // We go 1 magnitude less, for safety
  7105. var MAX_ARGUMENTS_LENGTH = 0x1000
  7106. function decodeCodePointsArray (codePoints) {
  7107. var len = codePoints.length
  7108. if (len <= MAX_ARGUMENTS_LENGTH) {
  7109. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  7110. }
  7111. // Decode in chunks to avoid "call stack size exceeded".
  7112. var res = ''
  7113. var i = 0
  7114. while (i < len) {
  7115. res += String.fromCharCode.apply(
  7116. String,
  7117. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  7118. )
  7119. }
  7120. return res
  7121. }
  7122. function asciiSlice (buf, start, end) {
  7123. var ret = ''
  7124. end = Math.min(buf.length, end)
  7125. for (var i = start; i < end; ++i) {
  7126. ret += String.fromCharCode(buf[i] & 0x7F)
  7127. }
  7128. return ret
  7129. }
  7130. function latin1Slice (buf, start, end) {
  7131. var ret = ''
  7132. end = Math.min(buf.length, end)
  7133. for (var i = start; i < end; ++i) {
  7134. ret += String.fromCharCode(buf[i])
  7135. }
  7136. return ret
  7137. }
  7138. function hexSlice (buf, start, end) {
  7139. var len = buf.length
  7140. if (!start || start < 0) start = 0
  7141. if (!end || end < 0 || end > len) end = len
  7142. var out = ''
  7143. for (var i = start; i < end; ++i) {
  7144. out += toHex(buf[i])
  7145. }
  7146. return out
  7147. }
  7148. function utf16leSlice (buf, start, end) {
  7149. var bytes = buf.slice(start, end)
  7150. var res = ''
  7151. for (var i = 0; i < bytes.length; i += 2) {
  7152. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  7153. }
  7154. return res
  7155. }
  7156. Buffer.prototype.slice = function slice (start, end) {
  7157. var len = this.length
  7158. start = ~~start
  7159. end = end === undefined ? len : ~~end
  7160. if (start < 0) {
  7161. start += len
  7162. if (start < 0) start = 0
  7163. } else if (start > len) {
  7164. start = len
  7165. }
  7166. if (end < 0) {
  7167. end += len
  7168. if (end < 0) end = 0
  7169. } else if (end > len) {
  7170. end = len
  7171. }
  7172. if (end < start) end = start
  7173. var newBuf
  7174. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7175. newBuf = this.subarray(start, end)
  7176. newBuf.__proto__ = Buffer.prototype
  7177. } else {
  7178. var sliceLen = end - start
  7179. newBuf = new Buffer(sliceLen, undefined)
  7180. for (var i = 0; i < sliceLen; ++i) {
  7181. newBuf[i] = this[i + start]
  7182. }
  7183. }
  7184. return newBuf
  7185. }
  7186. /*
  7187. * Need to make sure that buffer isn't trying to write out of bounds.
  7188. */
  7189. function checkOffset (offset, ext, length) {
  7190. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  7191. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  7192. }
  7193. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  7194. offset = offset | 0
  7195. byteLength = byteLength | 0
  7196. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7197. var val = this[offset]
  7198. var mul = 1
  7199. var i = 0
  7200. while (++i < byteLength && (mul *= 0x100)) {
  7201. val += this[offset + i] * mul
  7202. }
  7203. return val
  7204. }
  7205. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  7206. offset = offset | 0
  7207. byteLength = byteLength | 0
  7208. if (!noAssert) {
  7209. checkOffset(offset, byteLength, this.length)
  7210. }
  7211. var val = this[offset + --byteLength]
  7212. var mul = 1
  7213. while (byteLength > 0 && (mul *= 0x100)) {
  7214. val += this[offset + --byteLength] * mul
  7215. }
  7216. return val
  7217. }
  7218. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  7219. if (!noAssert) checkOffset(offset, 1, this.length)
  7220. return this[offset]
  7221. }
  7222. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  7223. if (!noAssert) checkOffset(offset, 2, this.length)
  7224. return this[offset] | (this[offset + 1] << 8)
  7225. }
  7226. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  7227. if (!noAssert) checkOffset(offset, 2, this.length)
  7228. return (this[offset] << 8) | this[offset + 1]
  7229. }
  7230. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  7231. if (!noAssert) checkOffset(offset, 4, this.length)
  7232. return ((this[offset]) |
  7233. (this[offset + 1] << 8) |
  7234. (this[offset + 2] << 16)) +
  7235. (this[offset + 3] * 0x1000000)
  7236. }
  7237. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  7238. if (!noAssert) checkOffset(offset, 4, this.length)
  7239. return (this[offset] * 0x1000000) +
  7240. ((this[offset + 1] << 16) |
  7241. (this[offset + 2] << 8) |
  7242. this[offset + 3])
  7243. }
  7244. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  7245. offset = offset | 0
  7246. byteLength = byteLength | 0
  7247. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7248. var val = this[offset]
  7249. var mul = 1
  7250. var i = 0
  7251. while (++i < byteLength && (mul *= 0x100)) {
  7252. val += this[offset + i] * mul
  7253. }
  7254. mul *= 0x80
  7255. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7256. return val
  7257. }
  7258. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  7259. offset = offset | 0
  7260. byteLength = byteLength | 0
  7261. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7262. var i = byteLength
  7263. var mul = 1
  7264. var val = this[offset + --i]
  7265. while (i > 0 && (mul *= 0x100)) {
  7266. val += this[offset + --i] * mul
  7267. }
  7268. mul *= 0x80
  7269. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7270. return val
  7271. }
  7272. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  7273. if (!noAssert) checkOffset(offset, 1, this.length)
  7274. if (!(this[offset] & 0x80)) return (this[offset])
  7275. return ((0xff - this[offset] + 1) * -1)
  7276. }
  7277. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  7278. if (!noAssert) checkOffset(offset, 2, this.length)
  7279. var val = this[offset] | (this[offset + 1] << 8)
  7280. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7281. }
  7282. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  7283. if (!noAssert) checkOffset(offset, 2, this.length)
  7284. var val = this[offset + 1] | (this[offset] << 8)
  7285. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7286. }
  7287. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  7288. if (!noAssert) checkOffset(offset, 4, this.length)
  7289. return (this[offset]) |
  7290. (this[offset + 1] << 8) |
  7291. (this[offset + 2] << 16) |
  7292. (this[offset + 3] << 24)
  7293. }
  7294. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  7295. if (!noAssert) checkOffset(offset, 4, this.length)
  7296. return (this[offset] << 24) |
  7297. (this[offset + 1] << 16) |
  7298. (this[offset + 2] << 8) |
  7299. (this[offset + 3])
  7300. }
  7301. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  7302. if (!noAssert) checkOffset(offset, 4, this.length)
  7303. return ieee754.read(this, offset, true, 23, 4)
  7304. }
  7305. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  7306. if (!noAssert) checkOffset(offset, 4, this.length)
  7307. return ieee754.read(this, offset, false, 23, 4)
  7308. }
  7309. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  7310. if (!noAssert) checkOffset(offset, 8, this.length)
  7311. return ieee754.read(this, offset, true, 52, 8)
  7312. }
  7313. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  7314. if (!noAssert) checkOffset(offset, 8, this.length)
  7315. return ieee754.read(this, offset, false, 52, 8)
  7316. }
  7317. function checkInt (buf, value, offset, ext, max, min) {
  7318. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  7319. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  7320. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7321. }
  7322. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  7323. value = +value
  7324. offset = offset | 0
  7325. byteLength = byteLength | 0
  7326. if (!noAssert) {
  7327. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7328. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7329. }
  7330. var mul = 1
  7331. var i = 0
  7332. this[offset] = value & 0xFF
  7333. while (++i < byteLength && (mul *= 0x100)) {
  7334. this[offset + i] = (value / mul) & 0xFF
  7335. }
  7336. return offset + byteLength
  7337. }
  7338. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  7339. value = +value
  7340. offset = offset | 0
  7341. byteLength = byteLength | 0
  7342. if (!noAssert) {
  7343. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7344. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7345. }
  7346. var i = byteLength - 1
  7347. var mul = 1
  7348. this[offset + i] = value & 0xFF
  7349. while (--i >= 0 && (mul *= 0x100)) {
  7350. this[offset + i] = (value / mul) & 0xFF
  7351. }
  7352. return offset + byteLength
  7353. }
  7354. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  7355. value = +value
  7356. offset = offset | 0
  7357. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  7358. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7359. this[offset] = (value & 0xff)
  7360. return offset + 1
  7361. }
  7362. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  7363. if (value < 0) value = 0xffff + value + 1
  7364. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  7365. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  7366. (littleEndian ? i : 1 - i) * 8
  7367. }
  7368. }
  7369. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  7370. value = +value
  7371. offset = offset | 0
  7372. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7373. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7374. this[offset] = (value & 0xff)
  7375. this[offset + 1] = (value >>> 8)
  7376. } else {
  7377. objectWriteUInt16(this, value, offset, true)
  7378. }
  7379. return offset + 2
  7380. }
  7381. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  7382. value = +value
  7383. offset = offset | 0
  7384. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7385. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7386. this[offset] = (value >>> 8)
  7387. this[offset + 1] = (value & 0xff)
  7388. } else {
  7389. objectWriteUInt16(this, value, offset, false)
  7390. }
  7391. return offset + 2
  7392. }
  7393. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  7394. if (value < 0) value = 0xffffffff + value + 1
  7395. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  7396. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  7397. }
  7398. }
  7399. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  7400. value = +value
  7401. offset = offset | 0
  7402. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7403. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7404. this[offset + 3] = (value >>> 24)
  7405. this[offset + 2] = (value >>> 16)
  7406. this[offset + 1] = (value >>> 8)
  7407. this[offset] = (value & 0xff)
  7408. } else {
  7409. objectWriteUInt32(this, value, offset, true)
  7410. }
  7411. return offset + 4
  7412. }
  7413. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  7414. value = +value
  7415. offset = offset | 0
  7416. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7417. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7418. this[offset] = (value >>> 24)
  7419. this[offset + 1] = (value >>> 16)
  7420. this[offset + 2] = (value >>> 8)
  7421. this[offset + 3] = (value & 0xff)
  7422. } else {
  7423. objectWriteUInt32(this, value, offset, false)
  7424. }
  7425. return offset + 4
  7426. }
  7427. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  7428. value = +value
  7429. offset = offset | 0
  7430. if (!noAssert) {
  7431. var limit = Math.pow(2, 8 * byteLength - 1)
  7432. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7433. }
  7434. var i = 0
  7435. var mul = 1
  7436. var sub = 0
  7437. this[offset] = value & 0xFF
  7438. while (++i < byteLength && (mul *= 0x100)) {
  7439. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  7440. sub = 1
  7441. }
  7442. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7443. }
  7444. return offset + byteLength
  7445. }
  7446. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  7447. value = +value
  7448. offset = offset | 0
  7449. if (!noAssert) {
  7450. var limit = Math.pow(2, 8 * byteLength - 1)
  7451. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7452. }
  7453. var i = byteLength - 1
  7454. var mul = 1
  7455. var sub = 0
  7456. this[offset + i] = value & 0xFF
  7457. while (--i >= 0 && (mul *= 0x100)) {
  7458. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  7459. sub = 1
  7460. }
  7461. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7462. }
  7463. return offset + byteLength
  7464. }
  7465. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  7466. value = +value
  7467. offset = offset | 0
  7468. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  7469. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7470. if (value < 0) value = 0xff + value + 1
  7471. this[offset] = (value & 0xff)
  7472. return offset + 1
  7473. }
  7474. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  7475. value = +value
  7476. offset = offset | 0
  7477. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7478. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7479. this[offset] = (value & 0xff)
  7480. this[offset + 1] = (value >>> 8)
  7481. } else {
  7482. objectWriteUInt16(this, value, offset, true)
  7483. }
  7484. return offset + 2
  7485. }
  7486. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  7487. value = +value
  7488. offset = offset | 0
  7489. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7490. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7491. this[offset] = (value >>> 8)
  7492. this[offset + 1] = (value & 0xff)
  7493. } else {
  7494. objectWriteUInt16(this, value, offset, false)
  7495. }
  7496. return offset + 2
  7497. }
  7498. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  7499. value = +value
  7500. offset = offset | 0
  7501. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7502. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7503. this[offset] = (value & 0xff)
  7504. this[offset + 1] = (value >>> 8)
  7505. this[offset + 2] = (value >>> 16)
  7506. this[offset + 3] = (value >>> 24)
  7507. } else {
  7508. objectWriteUInt32(this, value, offset, true)
  7509. }
  7510. return offset + 4
  7511. }
  7512. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  7513. value = +value
  7514. offset = offset | 0
  7515. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7516. if (value < 0) value = 0xffffffff + value + 1
  7517. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7518. this[offset] = (value >>> 24)
  7519. this[offset + 1] = (value >>> 16)
  7520. this[offset + 2] = (value >>> 8)
  7521. this[offset + 3] = (value & 0xff)
  7522. } else {
  7523. objectWriteUInt32(this, value, offset, false)
  7524. }
  7525. return offset + 4
  7526. }
  7527. function checkIEEE754 (buf, value, offset, ext, max, min) {
  7528. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7529. if (offset < 0) throw new RangeError('Index out of range')
  7530. }
  7531. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  7532. if (!noAssert) {
  7533. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  7534. }
  7535. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  7536. return offset + 4
  7537. }
  7538. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  7539. return writeFloat(this, value, offset, true, noAssert)
  7540. }
  7541. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  7542. return writeFloat(this, value, offset, false, noAssert)
  7543. }
  7544. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  7545. if (!noAssert) {
  7546. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  7547. }
  7548. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  7549. return offset + 8
  7550. }
  7551. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  7552. return writeDouble(this, value, offset, true, noAssert)
  7553. }
  7554. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  7555. return writeDouble(this, value, offset, false, noAssert)
  7556. }
  7557. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  7558. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  7559. if (!start) start = 0
  7560. if (!end && end !== 0) end = this.length
  7561. if (targetStart >= target.length) targetStart = target.length
  7562. if (!targetStart) targetStart = 0
  7563. if (end > 0 && end < start) end = start
  7564. // Copy 0 bytes; we're done
  7565. if (end === start) return 0
  7566. if (target.length === 0 || this.length === 0) return 0
  7567. // Fatal error conditions
  7568. if (targetStart < 0) {
  7569. throw new RangeError('targetStart out of bounds')
  7570. }
  7571. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  7572. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  7573. // Are we oob?
  7574. if (end > this.length) end = this.length
  7575. if (target.length - targetStart < end - start) {
  7576. end = target.length - targetStart + start
  7577. }
  7578. var len = end - start
  7579. var i
  7580. if (this === target && start < targetStart && targetStart < end) {
  7581. // descending copy from end
  7582. for (i = len - 1; i >= 0; --i) {
  7583. target[i + targetStart] = this[i + start]
  7584. }
  7585. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  7586. // ascending copy from start
  7587. for (i = 0; i < len; ++i) {
  7588. target[i + targetStart] = this[i + start]
  7589. }
  7590. } else {
  7591. Uint8Array.prototype.set.call(
  7592. target,
  7593. this.subarray(start, start + len),
  7594. targetStart
  7595. )
  7596. }
  7597. return len
  7598. }
  7599. // Usage:
  7600. // buffer.fill(number[, offset[, end]])
  7601. // buffer.fill(buffer[, offset[, end]])
  7602. // buffer.fill(string[, offset[, end]][, encoding])
  7603. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  7604. // Handle string cases:
  7605. if (typeof val === 'string') {
  7606. if (typeof start === 'string') {
  7607. encoding = start
  7608. start = 0
  7609. end = this.length
  7610. } else if (typeof end === 'string') {
  7611. encoding = end
  7612. end = this.length
  7613. }
  7614. if (val.length === 1) {
  7615. var code = val.charCodeAt(0)
  7616. if (code < 256) {
  7617. val = code
  7618. }
  7619. }
  7620. if (encoding !== undefined && typeof encoding !== 'string') {
  7621. throw new TypeError('encoding must be a string')
  7622. }
  7623. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  7624. throw new TypeError('Unknown encoding: ' + encoding)
  7625. }
  7626. } else if (typeof val === 'number') {
  7627. val = val & 255
  7628. }
  7629. // Invalid ranges are not set to a default, so can range check early.
  7630. if (start < 0 || this.length < start || this.length < end) {
  7631. throw new RangeError('Out of range index')
  7632. }
  7633. if (end <= start) {
  7634. return this
  7635. }
  7636. start = start >>> 0
  7637. end = end === undefined ? this.length : end >>> 0
  7638. if (!val) val = 0
  7639. var i
  7640. if (typeof val === 'number') {
  7641. for (i = start; i < end; ++i) {
  7642. this[i] = val
  7643. }
  7644. } else {
  7645. var bytes = Buffer.isBuffer(val)
  7646. ? val
  7647. : utf8ToBytes(new Buffer(val, encoding).toString())
  7648. var len = bytes.length
  7649. for (i = 0; i < end - start; ++i) {
  7650. this[i + start] = bytes[i % len]
  7651. }
  7652. }
  7653. return this
  7654. }
  7655. // HELPER FUNCTIONS
  7656. // ================
  7657. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  7658. function base64clean (str) {
  7659. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  7660. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  7661. // Node converts strings with length < 2 to ''
  7662. if (str.length < 2) return ''
  7663. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  7664. while (str.length % 4 !== 0) {
  7665. str = str + '='
  7666. }
  7667. return str
  7668. }
  7669. function stringtrim (str) {
  7670. if (str.trim) return str.trim()
  7671. return str.replace(/^\s+|\s+$/g, '')
  7672. }
  7673. function toHex (n) {
  7674. if (n < 16) return '0' + n.toString(16)
  7675. return n.toString(16)
  7676. }
  7677. function utf8ToBytes (string, units) {
  7678. units = units || Infinity
  7679. var codePoint
  7680. var length = string.length
  7681. var leadSurrogate = null
  7682. var bytes = []
  7683. for (var i = 0; i < length; ++i) {
  7684. codePoint = string.charCodeAt(i)
  7685. // is surrogate component
  7686. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  7687. // last char was a lead
  7688. if (!leadSurrogate) {
  7689. // no lead yet
  7690. if (codePoint > 0xDBFF) {
  7691. // unexpected trail
  7692. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7693. continue
  7694. } else if (i + 1 === length) {
  7695. // unpaired lead
  7696. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7697. continue
  7698. }
  7699. // valid lead
  7700. leadSurrogate = codePoint
  7701. continue
  7702. }
  7703. // 2 leads in a row
  7704. if (codePoint < 0xDC00) {
  7705. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7706. leadSurrogate = codePoint
  7707. continue
  7708. }
  7709. // valid surrogate pair
  7710. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  7711. } else if (leadSurrogate) {
  7712. // valid bmp char, but last char was a lead
  7713. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7714. }
  7715. leadSurrogate = null
  7716. // encode utf8
  7717. if (codePoint < 0x80) {
  7718. if ((units -= 1) < 0) break
  7719. bytes.push(codePoint)
  7720. } else if (codePoint < 0x800) {
  7721. if ((units -= 2) < 0) break
  7722. bytes.push(
  7723. codePoint >> 0x6 | 0xC0,
  7724. codePoint & 0x3F | 0x80
  7725. )
  7726. } else if (codePoint < 0x10000) {
  7727. if ((units -= 3) < 0) break
  7728. bytes.push(
  7729. codePoint >> 0xC | 0xE0,
  7730. codePoint >> 0x6 & 0x3F | 0x80,
  7731. codePoint & 0x3F | 0x80
  7732. )
  7733. } else if (codePoint < 0x110000) {
  7734. if ((units -= 4) < 0) break
  7735. bytes.push(
  7736. codePoint >> 0x12 | 0xF0,
  7737. codePoint >> 0xC & 0x3F | 0x80,
  7738. codePoint >> 0x6 & 0x3F | 0x80,
  7739. codePoint & 0x3F | 0x80
  7740. )
  7741. } else {
  7742. throw new Error('Invalid code point')
  7743. }
  7744. }
  7745. return bytes
  7746. }
  7747. function asciiToBytes (str) {
  7748. var byteArray = []
  7749. for (var i = 0; i < str.length; ++i) {
  7750. // Node's code seems to be doing this and not & 0x7F..
  7751. byteArray.push(str.charCodeAt(i) & 0xFF)
  7752. }
  7753. return byteArray
  7754. }
  7755. function utf16leToBytes (str, units) {
  7756. var c, hi, lo
  7757. var byteArray = []
  7758. for (var i = 0; i < str.length; ++i) {
  7759. if ((units -= 2) < 0) break
  7760. c = str.charCodeAt(i)
  7761. hi = c >> 8
  7762. lo = c % 256
  7763. byteArray.push(lo)
  7764. byteArray.push(hi)
  7765. }
  7766. return byteArray
  7767. }
  7768. function base64ToBytes (str) {
  7769. return base64.toByteArray(base64clean(str))
  7770. }
  7771. function blitBuffer (src, dst, offset, length) {
  7772. for (var i = 0; i < length; ++i) {
  7773. if ((i + offset >= dst.length) || (i >= src.length)) break
  7774. dst[i + offset] = src[i]
  7775. }
  7776. return i
  7777. }
  7778. function isnan (val) {
  7779. return val !== val // eslint-disable-line no-self-compare
  7780. }
  7781. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  7782. /***/ }),
  7783. /***/ "./node_modules/clipboard/dist/clipboard.js":
  7784. /*!**************************************************!*\
  7785. !*** ./node_modules/clipboard/dist/clipboard.js ***!
  7786. \**************************************************/
  7787. /*! no static exports found */
  7788. /***/ (function(module, exports, __webpack_require__) {
  7789. /*!
  7790. * clipboard.js v2.0.4
  7791. * https://zenorocha.github.io/clipboard.js
  7792. *
  7793. * Licensed MIT © Zeno Rocha
  7794. */
  7795. (function webpackUniversalModuleDefinition(root, factory) {
  7796. if(true)
  7797. module.exports = factory();
  7798. else {}
  7799. })(this, function() {
  7800. return /******/ (function(modules) { // webpackBootstrap
  7801. /******/ // The module cache
  7802. /******/ var installedModules = {};
  7803. /******/
  7804. /******/ // The require function
  7805. /******/ function __webpack_require__(moduleId) {
  7806. /******/
  7807. /******/ // Check if module is in cache
  7808. /******/ if(installedModules[moduleId]) {
  7809. /******/ return installedModules[moduleId].exports;
  7810. /******/ }
  7811. /******/ // Create a new module (and put it into the cache)
  7812. /******/ var module = installedModules[moduleId] = {
  7813. /******/ i: moduleId,
  7814. /******/ l: false,
  7815. /******/ exports: {}
  7816. /******/ };
  7817. /******/
  7818. /******/ // Execute the module function
  7819. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  7820. /******/
  7821. /******/ // Flag the module as loaded
  7822. /******/ module.l = true;
  7823. /******/
  7824. /******/ // Return the exports of the module
  7825. /******/ return module.exports;
  7826. /******/ }
  7827. /******/
  7828. /******/
  7829. /******/ // expose the modules object (__webpack_modules__)
  7830. /******/ __webpack_require__.m = modules;
  7831. /******/
  7832. /******/ // expose the module cache
  7833. /******/ __webpack_require__.c = installedModules;
  7834. /******/
  7835. /******/ // define getter function for harmony exports
  7836. /******/ __webpack_require__.d = function(exports, name, getter) {
  7837. /******/ if(!__webpack_require__.o(exports, name)) {
  7838. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  7839. /******/ }
  7840. /******/ };
  7841. /******/
  7842. /******/ // define __esModule on exports
  7843. /******/ __webpack_require__.r = function(exports) {
  7844. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  7845. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  7846. /******/ }
  7847. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  7848. /******/ };
  7849. /******/
  7850. /******/ // create a fake namespace object
  7851. /******/ // mode & 1: value is a module id, require it
  7852. /******/ // mode & 2: merge all properties of value into the ns
  7853. /******/ // mode & 4: return value when already ns object
  7854. /******/ // mode & 8|1: behave like require
  7855. /******/ __webpack_require__.t = function(value, mode) {
  7856. /******/ if(mode & 1) value = __webpack_require__(value);
  7857. /******/ if(mode & 8) return value;
  7858. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  7859. /******/ var ns = Object.create(null);
  7860. /******/ __webpack_require__.r(ns);
  7861. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  7862. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  7863. /******/ return ns;
  7864. /******/ };
  7865. /******/
  7866. /******/ // getDefaultExport function for compatibility with non-harmony modules
  7867. /******/ __webpack_require__.n = function(module) {
  7868. /******/ var getter = module && module.__esModule ?
  7869. /******/ function getDefault() { return module['default']; } :
  7870. /******/ function getModuleExports() { return module; };
  7871. /******/ __webpack_require__.d(getter, 'a', getter);
  7872. /******/ return getter;
  7873. /******/ };
  7874. /******/
  7875. /******/ // Object.prototype.hasOwnProperty.call
  7876. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  7877. /******/
  7878. /******/ // __webpack_public_path__
  7879. /******/ __webpack_require__.p = "";
  7880. /******/
  7881. /******/
  7882. /******/ // Load entry module and return exports
  7883. /******/ return __webpack_require__(__webpack_require__.s = 0);
  7884. /******/ })
  7885. /************************************************************************/
  7886. /******/ ([
  7887. /* 0 */
  7888. /***/ (function(module, exports, __webpack_require__) {
  7889. "use strict";
  7890. 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; };
  7891. 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; }; }();
  7892. var _clipboardAction = __webpack_require__(1);
  7893. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  7894. var _tinyEmitter = __webpack_require__(3);
  7895. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  7896. var _goodListener = __webpack_require__(4);
  7897. var _goodListener2 = _interopRequireDefault(_goodListener);
  7898. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7899. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7900. 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; }
  7901. 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; }
  7902. /**
  7903. * Base class which takes one or more elements, adds event listeners to them,
  7904. * and instantiates a new `ClipboardAction` on each click.
  7905. */
  7906. var Clipboard = function (_Emitter) {
  7907. _inherits(Clipboard, _Emitter);
  7908. /**
  7909. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7910. * @param {Object} options
  7911. */
  7912. function Clipboard(trigger, options) {
  7913. _classCallCheck(this, Clipboard);
  7914. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
  7915. _this.resolveOptions(options);
  7916. _this.listenClick(trigger);
  7917. return _this;
  7918. }
  7919. /**
  7920. * Defines if attributes would be resolved using internal setter functions
  7921. * or custom functions that were passed in the constructor.
  7922. * @param {Object} options
  7923. */
  7924. _createClass(Clipboard, [{
  7925. key: 'resolveOptions',
  7926. value: function resolveOptions() {
  7927. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7928. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  7929. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  7930. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  7931. this.container = _typeof(options.container) === 'object' ? options.container : document.body;
  7932. }
  7933. /**
  7934. * Adds a click event listener to the passed trigger.
  7935. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7936. */
  7937. }, {
  7938. key: 'listenClick',
  7939. value: function listenClick(trigger) {
  7940. var _this2 = this;
  7941. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  7942. return _this2.onClick(e);
  7943. });
  7944. }
  7945. /**
  7946. * Defines a new `ClipboardAction` on each click event.
  7947. * @param {Event} e
  7948. */
  7949. }, {
  7950. key: 'onClick',
  7951. value: function onClick(e) {
  7952. var trigger = e.delegateTarget || e.currentTarget;
  7953. if (this.clipboardAction) {
  7954. this.clipboardAction = null;
  7955. }
  7956. this.clipboardAction = new _clipboardAction2.default({
  7957. action: this.action(trigger),
  7958. target: this.target(trigger),
  7959. text: this.text(trigger),
  7960. container: this.container,
  7961. trigger: trigger,
  7962. emitter: this
  7963. });
  7964. }
  7965. /**
  7966. * Default `action` lookup function.
  7967. * @param {Element} trigger
  7968. */
  7969. }, {
  7970. key: 'defaultAction',
  7971. value: function defaultAction(trigger) {
  7972. return getAttributeValue('action', trigger);
  7973. }
  7974. /**
  7975. * Default `target` lookup function.
  7976. * @param {Element} trigger
  7977. */
  7978. }, {
  7979. key: 'defaultTarget',
  7980. value: function defaultTarget(trigger) {
  7981. var selector = getAttributeValue('target', trigger);
  7982. if (selector) {
  7983. return document.querySelector(selector);
  7984. }
  7985. }
  7986. /**
  7987. * Returns the support of the given action, or all actions if no action is
  7988. * given.
  7989. * @param {String} [action]
  7990. */
  7991. }, {
  7992. key: 'defaultText',
  7993. /**
  7994. * Default `text` lookup function.
  7995. * @param {Element} trigger
  7996. */
  7997. value: function defaultText(trigger) {
  7998. return getAttributeValue('text', trigger);
  7999. }
  8000. /**
  8001. * Destroy lifecycle.
  8002. */
  8003. }, {
  8004. key: 'destroy',
  8005. value: function destroy() {
  8006. this.listener.destroy();
  8007. if (this.clipboardAction) {
  8008. this.clipboardAction.destroy();
  8009. this.clipboardAction = null;
  8010. }
  8011. }
  8012. }], [{
  8013. key: 'isSupported',
  8014. value: function isSupported() {
  8015. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
  8016. var actions = typeof action === 'string' ? [action] : action;
  8017. var support = !!document.queryCommandSupported;
  8018. actions.forEach(function (action) {
  8019. support = support && !!document.queryCommandSupported(action);
  8020. });
  8021. return support;
  8022. }
  8023. }]);
  8024. return Clipboard;
  8025. }(_tinyEmitter2.default);
  8026. /**
  8027. * Helper function to retrieve attribute value.
  8028. * @param {String} suffix
  8029. * @param {Element} element
  8030. */
  8031. function getAttributeValue(suffix, element) {
  8032. var attribute = 'data-clipboard-' + suffix;
  8033. if (!element.hasAttribute(attribute)) {
  8034. return;
  8035. }
  8036. return element.getAttribute(attribute);
  8037. }
  8038. module.exports = Clipboard;
  8039. /***/ }),
  8040. /* 1 */
  8041. /***/ (function(module, exports, __webpack_require__) {
  8042. "use strict";
  8043. 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; };
  8044. 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; }; }();
  8045. var _select = __webpack_require__(2);
  8046. var _select2 = _interopRequireDefault(_select);
  8047. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8048. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8049. /**
  8050. * Inner class which performs selection from either `text` or `target`
  8051. * properties and then executes copy or cut operations.
  8052. */
  8053. var ClipboardAction = function () {
  8054. /**
  8055. * @param {Object} options
  8056. */
  8057. function ClipboardAction(options) {
  8058. _classCallCheck(this, ClipboardAction);
  8059. this.resolveOptions(options);
  8060. this.initSelection();
  8061. }
  8062. /**
  8063. * Defines base properties passed from constructor.
  8064. * @param {Object} options
  8065. */
  8066. _createClass(ClipboardAction, [{
  8067. key: 'resolveOptions',
  8068. value: function resolveOptions() {
  8069. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  8070. this.action = options.action;
  8071. this.container = options.container;
  8072. this.emitter = options.emitter;
  8073. this.target = options.target;
  8074. this.text = options.text;
  8075. this.trigger = options.trigger;
  8076. this.selectedText = '';
  8077. }
  8078. /**
  8079. * Decides which selection strategy is going to be applied based
  8080. * on the existence of `text` and `target` properties.
  8081. */
  8082. }, {
  8083. key: 'initSelection',
  8084. value: function initSelection() {
  8085. if (this.text) {
  8086. this.selectFake();
  8087. } else if (this.target) {
  8088. this.selectTarget();
  8089. }
  8090. }
  8091. /**
  8092. * Creates a fake textarea element, sets its value from `text` property,
  8093. * and makes a selection on it.
  8094. */
  8095. }, {
  8096. key: 'selectFake',
  8097. value: function selectFake() {
  8098. var _this = this;
  8099. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  8100. this.removeFake();
  8101. this.fakeHandlerCallback = function () {
  8102. return _this.removeFake();
  8103. };
  8104. this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
  8105. this.fakeElem = document.createElement('textarea');
  8106. // Prevent zooming on iOS
  8107. this.fakeElem.style.fontSize = '12pt';
  8108. // Reset box model
  8109. this.fakeElem.style.border = '0';
  8110. this.fakeElem.style.padding = '0';
  8111. this.fakeElem.style.margin = '0';
  8112. // Move element out of screen horizontally
  8113. this.fakeElem.style.position = 'absolute';
  8114. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  8115. // Move element to the same position vertically
  8116. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  8117. this.fakeElem.style.top = yPosition + 'px';
  8118. this.fakeElem.setAttribute('readonly', '');
  8119. this.fakeElem.value = this.text;
  8120. this.container.appendChild(this.fakeElem);
  8121. this.selectedText = (0, _select2.default)(this.fakeElem);
  8122. this.copyText();
  8123. }
  8124. /**
  8125. * Only removes the fake element after another click event, that way
  8126. * a user can hit `Ctrl+C` to copy because selection still exists.
  8127. */
  8128. }, {
  8129. key: 'removeFake',
  8130. value: function removeFake() {
  8131. if (this.fakeHandler) {
  8132. this.container.removeEventListener('click', this.fakeHandlerCallback);
  8133. this.fakeHandler = null;
  8134. this.fakeHandlerCallback = null;
  8135. }
  8136. if (this.fakeElem) {
  8137. this.container.removeChild(this.fakeElem);
  8138. this.fakeElem = null;
  8139. }
  8140. }
  8141. /**
  8142. * Selects the content from element passed on `target` property.
  8143. */
  8144. }, {
  8145. key: 'selectTarget',
  8146. value: function selectTarget() {
  8147. this.selectedText = (0, _select2.default)(this.target);
  8148. this.copyText();
  8149. }
  8150. /**
  8151. * Executes the copy operation based on the current selection.
  8152. */
  8153. }, {
  8154. key: 'copyText',
  8155. value: function copyText() {
  8156. var succeeded = void 0;
  8157. try {
  8158. succeeded = document.execCommand(this.action);
  8159. } catch (err) {
  8160. succeeded = false;
  8161. }
  8162. this.handleResult(succeeded);
  8163. }
  8164. /**
  8165. * Fires an event based on the copy operation result.
  8166. * @param {Boolean} succeeded
  8167. */
  8168. }, {
  8169. key: 'handleResult',
  8170. value: function handleResult(succeeded) {
  8171. this.emitter.emit(succeeded ? 'success' : 'error', {
  8172. action: this.action,
  8173. text: this.selectedText,
  8174. trigger: this.trigger,
  8175. clearSelection: this.clearSelection.bind(this)
  8176. });
  8177. }
  8178. /**
  8179. * Moves focus away from `target` and back to the trigger, removes current selection.
  8180. */
  8181. }, {
  8182. key: 'clearSelection',
  8183. value: function clearSelection() {
  8184. if (this.trigger) {
  8185. this.trigger.focus();
  8186. }
  8187. window.getSelection().removeAllRanges();
  8188. }
  8189. /**
  8190. * Sets the `action` to be performed which can be either 'copy' or 'cut'.
  8191. * @param {String} action
  8192. */
  8193. }, {
  8194. key: 'destroy',
  8195. /**
  8196. * Destroy lifecycle.
  8197. */
  8198. value: function destroy() {
  8199. this.removeFake();
  8200. }
  8201. }, {
  8202. key: 'action',
  8203. set: function set() {
  8204. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
  8205. this._action = action;
  8206. if (this._action !== 'copy' && this._action !== 'cut') {
  8207. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  8208. }
  8209. }
  8210. /**
  8211. * Gets the `action` property.
  8212. * @return {String}
  8213. */
  8214. ,
  8215. get: function get() {
  8216. return this._action;
  8217. }
  8218. /**
  8219. * Sets the `target` property using an element
  8220. * that will be have its content copied.
  8221. * @param {Element} target
  8222. */
  8223. }, {
  8224. key: 'target',
  8225. set: function set(target) {
  8226. if (target !== undefined) {
  8227. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  8228. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  8229. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  8230. }
  8231. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  8232. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  8233. }
  8234. this._target = target;
  8235. } else {
  8236. throw new Error('Invalid "target" value, use a valid Element');
  8237. }
  8238. }
  8239. }
  8240. /**
  8241. * Gets the `target` property.
  8242. * @return {String|HTMLElement}
  8243. */
  8244. ,
  8245. get: function get() {
  8246. return this._target;
  8247. }
  8248. }]);
  8249. return ClipboardAction;
  8250. }();
  8251. module.exports = ClipboardAction;
  8252. /***/ }),
  8253. /* 2 */
  8254. /***/ (function(module, exports) {
  8255. function select(element) {
  8256. var selectedText;
  8257. if (element.nodeName === 'SELECT') {
  8258. element.focus();
  8259. selectedText = element.value;
  8260. }
  8261. else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  8262. var isReadOnly = element.hasAttribute('readonly');
  8263. if (!isReadOnly) {
  8264. element.setAttribute('readonly', '');
  8265. }
  8266. element.select();
  8267. element.setSelectionRange(0, element.value.length);
  8268. if (!isReadOnly) {
  8269. element.removeAttribute('readonly');
  8270. }
  8271. selectedText = element.value;
  8272. }
  8273. else {
  8274. if (element.hasAttribute('contenteditable')) {
  8275. element.focus();
  8276. }
  8277. var selection = window.getSelection();
  8278. var range = document.createRange();
  8279. range.selectNodeContents(element);
  8280. selection.removeAllRanges();
  8281. selection.addRange(range);
  8282. selectedText = selection.toString();
  8283. }
  8284. return selectedText;
  8285. }
  8286. module.exports = select;
  8287. /***/ }),
  8288. /* 3 */
  8289. /***/ (function(module, exports) {
  8290. function E () {
  8291. // Keep this empty so it's easier to inherit from
  8292. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  8293. }
  8294. E.prototype = {
  8295. on: function (name, callback, ctx) {
  8296. var e = this.e || (this.e = {});
  8297. (e[name] || (e[name] = [])).push({
  8298. fn: callback,
  8299. ctx: ctx
  8300. });
  8301. return this;
  8302. },
  8303. once: function (name, callback, ctx) {
  8304. var self = this;
  8305. function listener () {
  8306. self.off(name, listener);
  8307. callback.apply(ctx, arguments);
  8308. };
  8309. listener._ = callback
  8310. return this.on(name, listener, ctx);
  8311. },
  8312. emit: function (name) {
  8313. var data = [].slice.call(arguments, 1);
  8314. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  8315. var i = 0;
  8316. var len = evtArr.length;
  8317. for (i; i < len; i++) {
  8318. evtArr[i].fn.apply(evtArr[i].ctx, data);
  8319. }
  8320. return this;
  8321. },
  8322. off: function (name, callback) {
  8323. var e = this.e || (this.e = {});
  8324. var evts = e[name];
  8325. var liveEvents = [];
  8326. if (evts && callback) {
  8327. for (var i = 0, len = evts.length; i < len; i++) {
  8328. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  8329. liveEvents.push(evts[i]);
  8330. }
  8331. }
  8332. // Remove event from queue to prevent memory leak
  8333. // Suggested by https://github.com/lazd
  8334. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  8335. (liveEvents.length)
  8336. ? e[name] = liveEvents
  8337. : delete e[name];
  8338. return this;
  8339. }
  8340. };
  8341. module.exports = E;
  8342. /***/ }),
  8343. /* 4 */
  8344. /***/ (function(module, exports, __webpack_require__) {
  8345. var is = __webpack_require__(5);
  8346. var delegate = __webpack_require__(6);
  8347. /**
  8348. * Validates all params and calls the right
  8349. * listener function based on its target type.
  8350. *
  8351. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  8352. * @param {String} type
  8353. * @param {Function} callback
  8354. * @return {Object}
  8355. */
  8356. function listen(target, type, callback) {
  8357. if (!target && !type && !callback) {
  8358. throw new Error('Missing required arguments');
  8359. }
  8360. if (!is.string(type)) {
  8361. throw new TypeError('Second argument must be a String');
  8362. }
  8363. if (!is.fn(callback)) {
  8364. throw new TypeError('Third argument must be a Function');
  8365. }
  8366. if (is.node(target)) {
  8367. return listenNode(target, type, callback);
  8368. }
  8369. else if (is.nodeList(target)) {
  8370. return listenNodeList(target, type, callback);
  8371. }
  8372. else if (is.string(target)) {
  8373. return listenSelector(target, type, callback);
  8374. }
  8375. else {
  8376. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  8377. }
  8378. }
  8379. /**
  8380. * Adds an event listener to a HTML element
  8381. * and returns a remove listener function.
  8382. *
  8383. * @param {HTMLElement} node
  8384. * @param {String} type
  8385. * @param {Function} callback
  8386. * @return {Object}
  8387. */
  8388. function listenNode(node, type, callback) {
  8389. node.addEventListener(type, callback);
  8390. return {
  8391. destroy: function() {
  8392. node.removeEventListener(type, callback);
  8393. }
  8394. }
  8395. }
  8396. /**
  8397. * Add an event listener to a list of HTML elements
  8398. * and returns a remove listener function.
  8399. *
  8400. * @param {NodeList|HTMLCollection} nodeList
  8401. * @param {String} type
  8402. * @param {Function} callback
  8403. * @return {Object}
  8404. */
  8405. function listenNodeList(nodeList, type, callback) {
  8406. Array.prototype.forEach.call(nodeList, function(node) {
  8407. node.addEventListener(type, callback);
  8408. });
  8409. return {
  8410. destroy: function() {
  8411. Array.prototype.forEach.call(nodeList, function(node) {
  8412. node.removeEventListener(type, callback);
  8413. });
  8414. }
  8415. }
  8416. }
  8417. /**
  8418. * Add an event listener to a selector
  8419. * and returns a remove listener function.
  8420. *
  8421. * @param {String} selector
  8422. * @param {String} type
  8423. * @param {Function} callback
  8424. * @return {Object}
  8425. */
  8426. function listenSelector(selector, type, callback) {
  8427. return delegate(document.body, selector, type, callback);
  8428. }
  8429. module.exports = listen;
  8430. /***/ }),
  8431. /* 5 */
  8432. /***/ (function(module, exports) {
  8433. /**
  8434. * Check if argument is a HTML element.
  8435. *
  8436. * @param {Object} value
  8437. * @return {Boolean}
  8438. */
  8439. exports.node = function(value) {
  8440. return value !== undefined
  8441. && value instanceof HTMLElement
  8442. && value.nodeType === 1;
  8443. };
  8444. /**
  8445. * Check if argument is a list of HTML elements.
  8446. *
  8447. * @param {Object} value
  8448. * @return {Boolean}
  8449. */
  8450. exports.nodeList = function(value) {
  8451. var type = Object.prototype.toString.call(value);
  8452. return value !== undefined
  8453. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  8454. && ('length' in value)
  8455. && (value.length === 0 || exports.node(value[0]));
  8456. };
  8457. /**
  8458. * Check if argument is a string.
  8459. *
  8460. * @param {Object} value
  8461. * @return {Boolean}
  8462. */
  8463. exports.string = function(value) {
  8464. return typeof value === 'string'
  8465. || value instanceof String;
  8466. };
  8467. /**
  8468. * Check if argument is a function.
  8469. *
  8470. * @param {Object} value
  8471. * @return {Boolean}
  8472. */
  8473. exports.fn = function(value) {
  8474. var type = Object.prototype.toString.call(value);
  8475. return type === '[object Function]';
  8476. };
  8477. /***/ }),
  8478. /* 6 */
  8479. /***/ (function(module, exports, __webpack_require__) {
  8480. var closest = __webpack_require__(7);
  8481. /**
  8482. * Delegates event to a selector.
  8483. *
  8484. * @param {Element} element
  8485. * @param {String} selector
  8486. * @param {String} type
  8487. * @param {Function} callback
  8488. * @param {Boolean} useCapture
  8489. * @return {Object}
  8490. */
  8491. function _delegate(element, selector, type, callback, useCapture) {
  8492. var listenerFn = listener.apply(this, arguments);
  8493. element.addEventListener(type, listenerFn, useCapture);
  8494. return {
  8495. destroy: function() {
  8496. element.removeEventListener(type, listenerFn, useCapture);
  8497. }
  8498. }
  8499. }
  8500. /**
  8501. * Delegates event to a selector.
  8502. *
  8503. * @param {Element|String|Array} [elements]
  8504. * @param {String} selector
  8505. * @param {String} type
  8506. * @param {Function} callback
  8507. * @param {Boolean} useCapture
  8508. * @return {Object}
  8509. */
  8510. function delegate(elements, selector, type, callback, useCapture) {
  8511. // Handle the regular Element usage
  8512. if (typeof elements.addEventListener === 'function') {
  8513. return _delegate.apply(null, arguments);
  8514. }
  8515. // Handle Element-less usage, it defaults to global delegation
  8516. if (typeof type === 'function') {
  8517. // Use `document` as the first parameter, then apply arguments
  8518. // This is a short way to .unshift `arguments` without running into deoptimizations
  8519. return _delegate.bind(null, document).apply(null, arguments);
  8520. }
  8521. // Handle Selector-based usage
  8522. if (typeof elements === 'string') {
  8523. elements = document.querySelectorAll(elements);
  8524. }
  8525. // Handle Array-like based usage
  8526. return Array.prototype.map.call(elements, function (element) {
  8527. return _delegate(element, selector, type, callback, useCapture);
  8528. });
  8529. }
  8530. /**
  8531. * Finds closest match and invokes callback.
  8532. *
  8533. * @param {Element} element
  8534. * @param {String} selector
  8535. * @param {String} type
  8536. * @param {Function} callback
  8537. * @return {Function}
  8538. */
  8539. function listener(element, selector, type, callback) {
  8540. return function(e) {
  8541. e.delegateTarget = closest(e.target, selector);
  8542. if (e.delegateTarget) {
  8543. callback.call(element, e);
  8544. }
  8545. }
  8546. }
  8547. module.exports = delegate;
  8548. /***/ }),
  8549. /* 7 */
  8550. /***/ (function(module, exports) {
  8551. var DOCUMENT_NODE_TYPE = 9;
  8552. /**
  8553. * A polyfill for Element.matches()
  8554. */
  8555. if (typeof Element !== 'undefined' && !Element.prototype.matches) {
  8556. var proto = Element.prototype;
  8557. proto.matches = proto.matchesSelector ||
  8558. proto.mozMatchesSelector ||
  8559. proto.msMatchesSelector ||
  8560. proto.oMatchesSelector ||
  8561. proto.webkitMatchesSelector;
  8562. }
  8563. /**
  8564. * Finds the closest parent that matches a selector.
  8565. *
  8566. * @param {Element} element
  8567. * @param {String} selector
  8568. * @return {Function}
  8569. */
  8570. function closest (element, selector) {
  8571. while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
  8572. if (typeof element.matches === 'function' &&
  8573. element.matches(selector)) {
  8574. return element;
  8575. }
  8576. element = element.parentNode;
  8577. }
  8578. }
  8579. module.exports = closest;
  8580. /***/ })
  8581. /******/ ]);
  8582. });
  8583. /***/ }),
  8584. /***/ "./node_modules/ieee754/index.js":
  8585. /*!***************************************!*\
  8586. !*** ./node_modules/ieee754/index.js ***!
  8587. \***************************************/
  8588. /*! no static exports found */
  8589. /***/ (function(module, exports) {
  8590. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  8591. var e, m
  8592. var eLen = (nBytes * 8) - mLen - 1
  8593. var eMax = (1 << eLen) - 1
  8594. var eBias = eMax >> 1
  8595. var nBits = -7
  8596. var i = isLE ? (nBytes - 1) : 0
  8597. var d = isLE ? -1 : 1
  8598. var s = buffer[offset + i]
  8599. i += d
  8600. e = s & ((1 << (-nBits)) - 1)
  8601. s >>= (-nBits)
  8602. nBits += eLen
  8603. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8604. m = e & ((1 << (-nBits)) - 1)
  8605. e >>= (-nBits)
  8606. nBits += mLen
  8607. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8608. if (e === 0) {
  8609. e = 1 - eBias
  8610. } else if (e === eMax) {
  8611. return m ? NaN : ((s ? -1 : 1) * Infinity)
  8612. } else {
  8613. m = m + Math.pow(2, mLen)
  8614. e = e - eBias
  8615. }
  8616. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  8617. }
  8618. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  8619. var e, m, c
  8620. var eLen = (nBytes * 8) - mLen - 1
  8621. var eMax = (1 << eLen) - 1
  8622. var eBias = eMax >> 1
  8623. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  8624. var i = isLE ? 0 : (nBytes - 1)
  8625. var d = isLE ? 1 : -1
  8626. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  8627. value = Math.abs(value)
  8628. if (isNaN(value) || value === Infinity) {
  8629. m = isNaN(value) ? 1 : 0
  8630. e = eMax
  8631. } else {
  8632. e = Math.floor(Math.log(value) / Math.LN2)
  8633. if (value * (c = Math.pow(2, -e)) < 1) {
  8634. e--
  8635. c *= 2
  8636. }
  8637. if (e + eBias >= 1) {
  8638. value += rt / c
  8639. } else {
  8640. value += rt * Math.pow(2, 1 - eBias)
  8641. }
  8642. if (value * c >= 2) {
  8643. e++
  8644. c /= 2
  8645. }
  8646. if (e + eBias >= eMax) {
  8647. m = 0
  8648. e = eMax
  8649. } else if (e + eBias >= 1) {
  8650. m = ((value * c) - 1) * Math.pow(2, mLen)
  8651. e = e + eBias
  8652. } else {
  8653. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  8654. e = 0
  8655. }
  8656. }
  8657. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  8658. e = (e << mLen) | m
  8659. eLen += mLen
  8660. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  8661. buffer[offset + i - d] |= s * 128
  8662. }
  8663. /***/ }),
  8664. /***/ "./node_modules/isarray/index.js":
  8665. /*!***************************************!*\
  8666. !*** ./node_modules/isarray/index.js ***!
  8667. \***************************************/
  8668. /*! no static exports found */
  8669. /***/ (function(module, exports) {
  8670. var toString = {}.toString;
  8671. module.exports = Array.isArray || function (arr) {
  8672. return toString.call(arr) == '[object Array]';
  8673. };
  8674. /***/ }),
  8675. /***/ "./node_modules/jquery/dist/jquery.js":
  8676. /*!********************************************!*\
  8677. !*** ./node_modules/jquery/dist/jquery.js ***!
  8678. \********************************************/
  8679. /*! no static exports found */
  8680. /***/ (function(module, exports, __webpack_require__) {
  8681. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  8682. * jQuery JavaScript Library v3.4.1
  8683. * https://jquery.com/
  8684. *
  8685. * Includes Sizzle.js
  8686. * https://sizzlejs.com/
  8687. *
  8688. * Copyright JS Foundation and other contributors
  8689. * Released under the MIT license
  8690. * https://jquery.org/license
  8691. *
  8692. * Date: 2019-05-01T21:04Z
  8693. */
  8694. ( function( global, factory ) {
  8695. "use strict";
  8696. if ( true && typeof module.exports === "object" ) {
  8697. // For CommonJS and CommonJS-like environments where a proper `window`
  8698. // is present, execute the factory and get jQuery.
  8699. // For environments that do not have a `window` with a `document`
  8700. // (such as Node.js), expose a factory as module.exports.
  8701. // This accentuates the need for the creation of a real `window`.
  8702. // e.g. var jQuery = require("jquery")(window);
  8703. // See ticket #14549 for more info.
  8704. module.exports = global.document ?
  8705. factory( global, true ) :
  8706. function( w ) {
  8707. if ( !w.document ) {
  8708. throw new Error( "jQuery requires a window with a document" );
  8709. }
  8710. return factory( w );
  8711. };
  8712. } else {
  8713. factory( global );
  8714. }
  8715. // Pass this if window is not defined yet
  8716. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  8717. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  8718. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  8719. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  8720. // enough that all such attempts are guarded in a try block.
  8721. "use strict";
  8722. var arr = [];
  8723. var document = window.document;
  8724. var getProto = Object.getPrototypeOf;
  8725. var slice = arr.slice;
  8726. var concat = arr.concat;
  8727. var push = arr.push;
  8728. var indexOf = arr.indexOf;
  8729. var class2type = {};
  8730. var toString = class2type.toString;
  8731. var hasOwn = class2type.hasOwnProperty;
  8732. var fnToString = hasOwn.toString;
  8733. var ObjectFunctionString = fnToString.call( Object );
  8734. var support = {};
  8735. var isFunction = function isFunction( obj ) {
  8736. // Support: Chrome <=57, Firefox <=52
  8737. // In some browsers, typeof returns "function" for HTML <object> elements
  8738. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  8739. // We don't want to classify *any* DOM node as a function.
  8740. return typeof obj === "function" && typeof obj.nodeType !== "number";
  8741. };
  8742. var isWindow = function isWindow( obj ) {
  8743. return obj != null && obj === obj.window;
  8744. };
  8745. var preservedScriptAttributes = {
  8746. type: true,
  8747. src: true,
  8748. nonce: true,
  8749. noModule: true
  8750. };
  8751. function DOMEval( code, node, doc ) {
  8752. doc = doc || document;
  8753. var i, val,
  8754. script = doc.createElement( "script" );
  8755. script.text = code;
  8756. if ( node ) {
  8757. for ( i in preservedScriptAttributes ) {
  8758. // Support: Firefox 64+, Edge 18+
  8759. // Some browsers don't support the "nonce" property on scripts.
  8760. // On the other hand, just using `getAttribute` is not enough as
  8761. // the `nonce` attribute is reset to an empty string whenever it
  8762. // becomes browsing-context connected.
  8763. // See https://github.com/whatwg/html/issues/2369
  8764. // See https://html.spec.whatwg.org/#nonce-attributes
  8765. // The `node.getAttribute` check was added for the sake of
  8766. // `jQuery.globalEval` so that it can fake a nonce-containing node
  8767. // via an object.
  8768. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  8769. if ( val ) {
  8770. script.setAttribute( i, val );
  8771. }
  8772. }
  8773. }
  8774. doc.head.appendChild( script ).parentNode.removeChild( script );
  8775. }
  8776. function toType( obj ) {
  8777. if ( obj == null ) {
  8778. return obj + "";
  8779. }
  8780. // Support: Android <=2.3 only (functionish RegExp)
  8781. return typeof obj === "object" || typeof obj === "function" ?
  8782. class2type[ toString.call( obj ) ] || "object" :
  8783. typeof obj;
  8784. }
  8785. /* global Symbol */
  8786. // Defining this global in .eslintrc.json would create a danger of using the global
  8787. // unguarded in another place, it seems safer to define global only for this module
  8788. var
  8789. version = "3.4.1",
  8790. // Define a local copy of jQuery
  8791. jQuery = function( selector, context ) {
  8792. // The jQuery object is actually just the init constructor 'enhanced'
  8793. // Need init if jQuery is called (just allow error to be thrown if not included)
  8794. return new jQuery.fn.init( selector, context );
  8795. },
  8796. // Support: Android <=4.0 only
  8797. // Make sure we trim BOM and NBSP
  8798. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  8799. jQuery.fn = jQuery.prototype = {
  8800. // The current version of jQuery being used
  8801. jquery: version,
  8802. constructor: jQuery,
  8803. // The default length of a jQuery object is 0
  8804. length: 0,
  8805. toArray: function() {
  8806. return slice.call( this );
  8807. },
  8808. // Get the Nth element in the matched element set OR
  8809. // Get the whole matched element set as a clean array
  8810. get: function( num ) {
  8811. // Return all the elements in a clean array
  8812. if ( num == null ) {
  8813. return slice.call( this );
  8814. }
  8815. // Return just the one element from the set
  8816. return num < 0 ? this[ num + this.length ] : this[ num ];
  8817. },
  8818. // Take an array of elements and push it onto the stack
  8819. // (returning the new matched element set)
  8820. pushStack: function( elems ) {
  8821. // Build a new jQuery matched element set
  8822. var ret = jQuery.merge( this.constructor(), elems );
  8823. // Add the old object onto the stack (as a reference)
  8824. ret.prevObject = this;
  8825. // Return the newly-formed element set
  8826. return ret;
  8827. },
  8828. // Execute a callback for every element in the matched set.
  8829. each: function( callback ) {
  8830. return jQuery.each( this, callback );
  8831. },
  8832. map: function( callback ) {
  8833. return this.pushStack( jQuery.map( this, function( elem, i ) {
  8834. return callback.call( elem, i, elem );
  8835. } ) );
  8836. },
  8837. slice: function() {
  8838. return this.pushStack( slice.apply( this, arguments ) );
  8839. },
  8840. first: function() {
  8841. return this.eq( 0 );
  8842. },
  8843. last: function() {
  8844. return this.eq( -1 );
  8845. },
  8846. eq: function( i ) {
  8847. var len = this.length,
  8848. j = +i + ( i < 0 ? len : 0 );
  8849. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  8850. },
  8851. end: function() {
  8852. return this.prevObject || this.constructor();
  8853. },
  8854. // For internal use only.
  8855. // Behaves like an Array's method, not like a jQuery method.
  8856. push: push,
  8857. sort: arr.sort,
  8858. splice: arr.splice
  8859. };
  8860. jQuery.extend = jQuery.fn.extend = function() {
  8861. var options, name, src, copy, copyIsArray, clone,
  8862. target = arguments[ 0 ] || {},
  8863. i = 1,
  8864. length = arguments.length,
  8865. deep = false;
  8866. // Handle a deep copy situation
  8867. if ( typeof target === "boolean" ) {
  8868. deep = target;
  8869. // Skip the boolean and the target
  8870. target = arguments[ i ] || {};
  8871. i++;
  8872. }
  8873. // Handle case when target is a string or something (possible in deep copy)
  8874. if ( typeof target !== "object" && !isFunction( target ) ) {
  8875. target = {};
  8876. }
  8877. // Extend jQuery itself if only one argument is passed
  8878. if ( i === length ) {
  8879. target = this;
  8880. i--;
  8881. }
  8882. for ( ; i < length; i++ ) {
  8883. // Only deal with non-null/undefined values
  8884. if ( ( options = arguments[ i ] ) != null ) {
  8885. // Extend the base object
  8886. for ( name in options ) {
  8887. copy = options[ name ];
  8888. // Prevent Object.prototype pollution
  8889. // Prevent never-ending loop
  8890. if ( name === "__proto__" || target === copy ) {
  8891. continue;
  8892. }
  8893. // Recurse if we're merging plain objects or arrays
  8894. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  8895. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  8896. src = target[ name ];
  8897. // Ensure proper type for the source value
  8898. if ( copyIsArray && !Array.isArray( src ) ) {
  8899. clone = [];
  8900. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  8901. clone = {};
  8902. } else {
  8903. clone = src;
  8904. }
  8905. copyIsArray = false;
  8906. // Never move original objects, clone them
  8907. target[ name ] = jQuery.extend( deep, clone, copy );
  8908. // Don't bring in undefined values
  8909. } else if ( copy !== undefined ) {
  8910. target[ name ] = copy;
  8911. }
  8912. }
  8913. }
  8914. }
  8915. // Return the modified object
  8916. return target;
  8917. };
  8918. jQuery.extend( {
  8919. // Unique for each copy of jQuery on the page
  8920. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  8921. // Assume jQuery is ready without the ready module
  8922. isReady: true,
  8923. error: function( msg ) {
  8924. throw new Error( msg );
  8925. },
  8926. noop: function() {},
  8927. isPlainObject: function( obj ) {
  8928. var proto, Ctor;
  8929. // Detect obvious negatives
  8930. // Use toString instead of jQuery.type to catch host objects
  8931. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  8932. return false;
  8933. }
  8934. proto = getProto( obj );
  8935. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  8936. if ( !proto ) {
  8937. return true;
  8938. }
  8939. // Objects with prototype are plain iff they were constructed by a global Object function
  8940. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  8941. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  8942. },
  8943. isEmptyObject: function( obj ) {
  8944. var name;
  8945. for ( name in obj ) {
  8946. return false;
  8947. }
  8948. return true;
  8949. },
  8950. // Evaluates a script in a global context
  8951. globalEval: function( code, options ) {
  8952. DOMEval( code, { nonce: options && options.nonce } );
  8953. },
  8954. each: function( obj, callback ) {
  8955. var length, i = 0;
  8956. if ( isArrayLike( obj ) ) {
  8957. length = obj.length;
  8958. for ( ; i < length; i++ ) {
  8959. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8960. break;
  8961. }
  8962. }
  8963. } else {
  8964. for ( i in obj ) {
  8965. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8966. break;
  8967. }
  8968. }
  8969. }
  8970. return obj;
  8971. },
  8972. // Support: Android <=4.0 only
  8973. trim: function( text ) {
  8974. return text == null ?
  8975. "" :
  8976. ( text + "" ).replace( rtrim, "" );
  8977. },
  8978. // results is for internal usage only
  8979. makeArray: function( arr, results ) {
  8980. var ret = results || [];
  8981. if ( arr != null ) {
  8982. if ( isArrayLike( Object( arr ) ) ) {
  8983. jQuery.merge( ret,
  8984. typeof arr === "string" ?
  8985. [ arr ] : arr
  8986. );
  8987. } else {
  8988. push.call( ret, arr );
  8989. }
  8990. }
  8991. return ret;
  8992. },
  8993. inArray: function( elem, arr, i ) {
  8994. return arr == null ? -1 : indexOf.call( arr, elem, i );
  8995. },
  8996. // Support: Android <=4.0 only, PhantomJS 1 only
  8997. // push.apply(_, arraylike) throws on ancient WebKit
  8998. merge: function( first, second ) {
  8999. var len = +second.length,
  9000. j = 0,
  9001. i = first.length;
  9002. for ( ; j < len; j++ ) {
  9003. first[ i++ ] = second[ j ];
  9004. }
  9005. first.length = i;
  9006. return first;
  9007. },
  9008. grep: function( elems, callback, invert ) {
  9009. var callbackInverse,
  9010. matches = [],
  9011. i = 0,
  9012. length = elems.length,
  9013. callbackExpect = !invert;
  9014. // Go through the array, only saving the items
  9015. // that pass the validator function
  9016. for ( ; i < length; i++ ) {
  9017. callbackInverse = !callback( elems[ i ], i );
  9018. if ( callbackInverse !== callbackExpect ) {
  9019. matches.push( elems[ i ] );
  9020. }
  9021. }
  9022. return matches;
  9023. },
  9024. // arg is for internal usage only
  9025. map: function( elems, callback, arg ) {
  9026. var length, value,
  9027. i = 0,
  9028. ret = [];
  9029. // Go through the array, translating each of the items to their new values
  9030. if ( isArrayLike( elems ) ) {
  9031. length = elems.length;
  9032. for ( ; i < length; i++ ) {
  9033. value = callback( elems[ i ], i, arg );
  9034. if ( value != null ) {
  9035. ret.push( value );
  9036. }
  9037. }
  9038. // Go through every key on the object,
  9039. } else {
  9040. for ( i in elems ) {
  9041. value = callback( elems[ i ], i, arg );
  9042. if ( value != null ) {
  9043. ret.push( value );
  9044. }
  9045. }
  9046. }
  9047. // Flatten any nested arrays
  9048. return concat.apply( [], ret );
  9049. },
  9050. // A global GUID counter for objects
  9051. guid: 1,
  9052. // jQuery.support is not used in Core but other projects attach their
  9053. // properties to it so it needs to exist.
  9054. support: support
  9055. } );
  9056. if ( typeof Symbol === "function" ) {
  9057. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  9058. }
  9059. // Populate the class2type map
  9060. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  9061. function( i, name ) {
  9062. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  9063. } );
  9064. function isArrayLike( obj ) {
  9065. // Support: real iOS 8.2 only (not reproducible in simulator)
  9066. // `in` check used to prevent JIT error (gh-2145)
  9067. // hasOwn isn't used here due to false negatives
  9068. // regarding Nodelist length in IE
  9069. var length = !!obj && "length" in obj && obj.length,
  9070. type = toType( obj );
  9071. if ( isFunction( obj ) || isWindow( obj ) ) {
  9072. return false;
  9073. }
  9074. return type === "array" || length === 0 ||
  9075. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  9076. }
  9077. var Sizzle =
  9078. /*!
  9079. * Sizzle CSS Selector Engine v2.3.4
  9080. * https://sizzlejs.com/
  9081. *
  9082. * Copyright JS Foundation and other contributors
  9083. * Released under the MIT license
  9084. * https://js.foundation/
  9085. *
  9086. * Date: 2019-04-08
  9087. */
  9088. (function( window ) {
  9089. var i,
  9090. support,
  9091. Expr,
  9092. getText,
  9093. isXML,
  9094. tokenize,
  9095. compile,
  9096. select,
  9097. outermostContext,
  9098. sortInput,
  9099. hasDuplicate,
  9100. // Local document vars
  9101. setDocument,
  9102. document,
  9103. docElem,
  9104. documentIsHTML,
  9105. rbuggyQSA,
  9106. rbuggyMatches,
  9107. matches,
  9108. contains,
  9109. // Instance-specific data
  9110. expando = "sizzle" + 1 * new Date(),
  9111. preferredDoc = window.document,
  9112. dirruns = 0,
  9113. done = 0,
  9114. classCache = createCache(),
  9115. tokenCache = createCache(),
  9116. compilerCache = createCache(),
  9117. nonnativeSelectorCache = createCache(),
  9118. sortOrder = function( a, b ) {
  9119. if ( a === b ) {
  9120. hasDuplicate = true;
  9121. }
  9122. return 0;
  9123. },
  9124. // Instance methods
  9125. hasOwn = ({}).hasOwnProperty,
  9126. arr = [],
  9127. pop = arr.pop,
  9128. push_native = arr.push,
  9129. push = arr.push,
  9130. slice = arr.slice,
  9131. // Use a stripped-down indexOf as it's faster than native
  9132. // https://jsperf.com/thor-indexof-vs-for/5
  9133. indexOf = function( list, elem ) {
  9134. var i = 0,
  9135. len = list.length;
  9136. for ( ; i < len; i++ ) {
  9137. if ( list[i] === elem ) {
  9138. return i;
  9139. }
  9140. }
  9141. return -1;
  9142. },
  9143. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  9144. // Regular expressions
  9145. // http://www.w3.org/TR/css3-selectors/#whitespace
  9146. whitespace = "[\\x20\\t\\r\\n\\f]",
  9147. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  9148. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  9149. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  9150. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  9151. // Operator (capture 2)
  9152. "*([*^$|!~]?=)" + whitespace +
  9153. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  9154. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  9155. "*\\]",
  9156. pseudos = ":(" + identifier + ")(?:\\((" +
  9157. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  9158. // 1. quoted (capture 3; capture 4 or capture 5)
  9159. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  9160. // 2. simple (capture 6)
  9161. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  9162. // 3. anything else (capture 2)
  9163. ".*" +
  9164. ")\\)|)",
  9165. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  9166. rwhitespace = new RegExp( whitespace + "+", "g" ),
  9167. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  9168. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  9169. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  9170. rdescend = new RegExp( whitespace + "|>" ),
  9171. rpseudo = new RegExp( pseudos ),
  9172. ridentifier = new RegExp( "^" + identifier + "$" ),
  9173. matchExpr = {
  9174. "ID": new RegExp( "^#(" + identifier + ")" ),
  9175. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  9176. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  9177. "ATTR": new RegExp( "^" + attributes ),
  9178. "PSEUDO": new RegExp( "^" + pseudos ),
  9179. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  9180. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  9181. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  9182. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  9183. // For use in libraries implementing .is()
  9184. // We use this for POS matching in `select`
  9185. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  9186. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  9187. },
  9188. rhtml = /HTML$/i,
  9189. rinputs = /^(?:input|select|textarea|button)$/i,
  9190. rheader = /^h\d$/i,
  9191. rnative = /^[^{]+\{\s*\[native \w/,
  9192. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  9193. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  9194. rsibling = /[+~]/,
  9195. // CSS escapes
  9196. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  9197. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  9198. funescape = function( _, escaped, escapedWhitespace ) {
  9199. var high = "0x" + escaped - 0x10000;
  9200. // NaN means non-codepoint
  9201. // Support: Firefox<24
  9202. // Workaround erroneous numeric interpretation of +"0x"
  9203. return high !== high || escapedWhitespace ?
  9204. escaped :
  9205. high < 0 ?
  9206. // BMP codepoint
  9207. String.fromCharCode( high + 0x10000 ) :
  9208. // Supplemental Plane codepoint (surrogate pair)
  9209. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  9210. },
  9211. // CSS string/identifier serialization
  9212. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  9213. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  9214. fcssescape = function( ch, asCodePoint ) {
  9215. if ( asCodePoint ) {
  9216. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  9217. if ( ch === "\0" ) {
  9218. return "\uFFFD";
  9219. }
  9220. // Control characters and (dependent upon position) numbers get escaped as code points
  9221. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  9222. }
  9223. // Other potentially-special ASCII characters get backslash-escaped
  9224. return "\\" + ch;
  9225. },
  9226. // Used for iframes
  9227. // See setDocument()
  9228. // Removing the function wrapper causes a "Permission Denied"
  9229. // error in IE
  9230. unloadHandler = function() {
  9231. setDocument();
  9232. },
  9233. inDisabledFieldset = addCombinator(
  9234. function( elem ) {
  9235. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  9236. },
  9237. { dir: "parentNode", next: "legend" }
  9238. );
  9239. // Optimize for push.apply( _, NodeList )
  9240. try {
  9241. push.apply(
  9242. (arr = slice.call( preferredDoc.childNodes )),
  9243. preferredDoc.childNodes
  9244. );
  9245. // Support: Android<4.0
  9246. // Detect silently failing push.apply
  9247. arr[ preferredDoc.childNodes.length ].nodeType;
  9248. } catch ( e ) {
  9249. push = { apply: arr.length ?
  9250. // Leverage slice if possible
  9251. function( target, els ) {
  9252. push_native.apply( target, slice.call(els) );
  9253. } :
  9254. // Support: IE<9
  9255. // Otherwise append directly
  9256. function( target, els ) {
  9257. var j = target.length,
  9258. i = 0;
  9259. // Can't trust NodeList.length
  9260. while ( (target[j++] = els[i++]) ) {}
  9261. target.length = j - 1;
  9262. }
  9263. };
  9264. }
  9265. function Sizzle( selector, context, results, seed ) {
  9266. var m, i, elem, nid, match, groups, newSelector,
  9267. newContext = context && context.ownerDocument,
  9268. // nodeType defaults to 9, since context defaults to document
  9269. nodeType = context ? context.nodeType : 9;
  9270. results = results || [];
  9271. // Return early from calls with invalid selector or context
  9272. if ( typeof selector !== "string" || !selector ||
  9273. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  9274. return results;
  9275. }
  9276. // Try to shortcut find operations (as opposed to filters) in HTML documents
  9277. if ( !seed ) {
  9278. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  9279. setDocument( context );
  9280. }
  9281. context = context || document;
  9282. if ( documentIsHTML ) {
  9283. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  9284. // (excepting DocumentFragment context, where the methods don't exist)
  9285. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  9286. // ID selector
  9287. if ( (m = match[1]) ) {
  9288. // Document context
  9289. if ( nodeType === 9 ) {
  9290. if ( (elem = context.getElementById( m )) ) {
  9291. // Support: IE, Opera, Webkit
  9292. // TODO: identify versions
  9293. // getElementById can match elements by name instead of ID
  9294. if ( elem.id === m ) {
  9295. results.push( elem );
  9296. return results;
  9297. }
  9298. } else {
  9299. return results;
  9300. }
  9301. // Element context
  9302. } else {
  9303. // Support: IE, Opera, Webkit
  9304. // TODO: identify versions
  9305. // getElementById can match elements by name instead of ID
  9306. if ( newContext && (elem = newContext.getElementById( m )) &&
  9307. contains( context, elem ) &&
  9308. elem.id === m ) {
  9309. results.push( elem );
  9310. return results;
  9311. }
  9312. }
  9313. // Type selector
  9314. } else if ( match[2] ) {
  9315. push.apply( results, context.getElementsByTagName( selector ) );
  9316. return results;
  9317. // Class selector
  9318. } else if ( (m = match[3]) && support.getElementsByClassName &&
  9319. context.getElementsByClassName ) {
  9320. push.apply( results, context.getElementsByClassName( m ) );
  9321. return results;
  9322. }
  9323. }
  9324. // Take advantage of querySelectorAll
  9325. if ( support.qsa &&
  9326. !nonnativeSelectorCache[ selector + " " ] &&
  9327. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  9328. // Support: IE 8 only
  9329. // Exclude object elements
  9330. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  9331. newSelector = selector;
  9332. newContext = context;
  9333. // qSA considers elements outside a scoping root when evaluating child or
  9334. // descendant combinators, which is not what we want.
  9335. // In such cases, we work around the behavior by prefixing every selector in the
  9336. // list with an ID selector referencing the scope context.
  9337. // Thanks to Andrew Dupont for this technique.
  9338. if ( nodeType === 1 && rdescend.test( selector ) ) {
  9339. // Capture the context ID, setting it first if necessary
  9340. if ( (nid = context.getAttribute( "id" )) ) {
  9341. nid = nid.replace( rcssescape, fcssescape );
  9342. } else {
  9343. context.setAttribute( "id", (nid = expando) );
  9344. }
  9345. // Prefix every selector in the list
  9346. groups = tokenize( selector );
  9347. i = groups.length;
  9348. while ( i-- ) {
  9349. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  9350. }
  9351. newSelector = groups.join( "," );
  9352. // Expand context for sibling selectors
  9353. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  9354. context;
  9355. }
  9356. try {
  9357. push.apply( results,
  9358. newContext.querySelectorAll( newSelector )
  9359. );
  9360. return results;
  9361. } catch ( qsaError ) {
  9362. nonnativeSelectorCache( selector, true );
  9363. } finally {
  9364. if ( nid === expando ) {
  9365. context.removeAttribute( "id" );
  9366. }
  9367. }
  9368. }
  9369. }
  9370. }
  9371. // All others
  9372. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  9373. }
  9374. /**
  9375. * Create key-value caches of limited size
  9376. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  9377. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  9378. * deleting the oldest entry
  9379. */
  9380. function createCache() {
  9381. var keys = [];
  9382. function cache( key, value ) {
  9383. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  9384. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  9385. // Only keep the most recent entries
  9386. delete cache[ keys.shift() ];
  9387. }
  9388. return (cache[ key + " " ] = value);
  9389. }
  9390. return cache;
  9391. }
  9392. /**
  9393. * Mark a function for special use by Sizzle
  9394. * @param {Function} fn The function to mark
  9395. */
  9396. function markFunction( fn ) {
  9397. fn[ expando ] = true;
  9398. return fn;
  9399. }
  9400. /**
  9401. * Support testing using an element
  9402. * @param {Function} fn Passed the created element and returns a boolean result
  9403. */
  9404. function assert( fn ) {
  9405. var el = document.createElement("fieldset");
  9406. try {
  9407. return !!fn( el );
  9408. } catch (e) {
  9409. return false;
  9410. } finally {
  9411. // Remove from its parent by default
  9412. if ( el.parentNode ) {
  9413. el.parentNode.removeChild( el );
  9414. }
  9415. // release memory in IE
  9416. el = null;
  9417. }
  9418. }
  9419. /**
  9420. * Adds the same handler for all of the specified attrs
  9421. * @param {String} attrs Pipe-separated list of attributes
  9422. * @param {Function} handler The method that will be applied
  9423. */
  9424. function addHandle( attrs, handler ) {
  9425. var arr = attrs.split("|"),
  9426. i = arr.length;
  9427. while ( i-- ) {
  9428. Expr.attrHandle[ arr[i] ] = handler;
  9429. }
  9430. }
  9431. /**
  9432. * Checks document order of two siblings
  9433. * @param {Element} a
  9434. * @param {Element} b
  9435. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  9436. */
  9437. function siblingCheck( a, b ) {
  9438. var cur = b && a,
  9439. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  9440. a.sourceIndex - b.sourceIndex;
  9441. // Use IE sourceIndex if available on both nodes
  9442. if ( diff ) {
  9443. return diff;
  9444. }
  9445. // Check if b follows a
  9446. if ( cur ) {
  9447. while ( (cur = cur.nextSibling) ) {
  9448. if ( cur === b ) {
  9449. return -1;
  9450. }
  9451. }
  9452. }
  9453. return a ? 1 : -1;
  9454. }
  9455. /**
  9456. * Returns a function to use in pseudos for input types
  9457. * @param {String} type
  9458. */
  9459. function createInputPseudo( type ) {
  9460. return function( elem ) {
  9461. var name = elem.nodeName.toLowerCase();
  9462. return name === "input" && elem.type === type;
  9463. };
  9464. }
  9465. /**
  9466. * Returns a function to use in pseudos for buttons
  9467. * @param {String} type
  9468. */
  9469. function createButtonPseudo( type ) {
  9470. return function( elem ) {
  9471. var name = elem.nodeName.toLowerCase();
  9472. return (name === "input" || name === "button") && elem.type === type;
  9473. };
  9474. }
  9475. /**
  9476. * Returns a function to use in pseudos for :enabled/:disabled
  9477. * @param {Boolean} disabled true for :disabled; false for :enabled
  9478. */
  9479. function createDisabledPseudo( disabled ) {
  9480. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  9481. return function( elem ) {
  9482. // Only certain elements can match :enabled or :disabled
  9483. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  9484. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  9485. if ( "form" in elem ) {
  9486. // Check for inherited disabledness on relevant non-disabled elements:
  9487. // * listed form-associated elements in a disabled fieldset
  9488. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  9489. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  9490. // * option elements in a disabled optgroup
  9491. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  9492. // All such elements have a "form" property.
  9493. if ( elem.parentNode && elem.disabled === false ) {
  9494. // Option elements defer to a parent optgroup if present
  9495. if ( "label" in elem ) {
  9496. if ( "label" in elem.parentNode ) {
  9497. return elem.parentNode.disabled === disabled;
  9498. } else {
  9499. return elem.disabled === disabled;
  9500. }
  9501. }
  9502. // Support: IE 6 - 11
  9503. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  9504. return elem.isDisabled === disabled ||
  9505. // Where there is no isDisabled, check manually
  9506. /* jshint -W018 */
  9507. elem.isDisabled !== !disabled &&
  9508. inDisabledFieldset( elem ) === disabled;
  9509. }
  9510. return elem.disabled === disabled;
  9511. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  9512. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  9513. // even exist on them, let alone have a boolean value.
  9514. } else if ( "label" in elem ) {
  9515. return elem.disabled === disabled;
  9516. }
  9517. // Remaining elements are neither :enabled nor :disabled
  9518. return false;
  9519. };
  9520. }
  9521. /**
  9522. * Returns a function to use in pseudos for positionals
  9523. * @param {Function} fn
  9524. */
  9525. function createPositionalPseudo( fn ) {
  9526. return markFunction(function( argument ) {
  9527. argument = +argument;
  9528. return markFunction(function( seed, matches ) {
  9529. var j,
  9530. matchIndexes = fn( [], seed.length, argument ),
  9531. i = matchIndexes.length;
  9532. // Match elements found at the specified indexes
  9533. while ( i-- ) {
  9534. if ( seed[ (j = matchIndexes[i]) ] ) {
  9535. seed[j] = !(matches[j] = seed[j]);
  9536. }
  9537. }
  9538. });
  9539. });
  9540. }
  9541. /**
  9542. * Checks a node for validity as a Sizzle context
  9543. * @param {Element|Object=} context
  9544. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  9545. */
  9546. function testContext( context ) {
  9547. return context && typeof context.getElementsByTagName !== "undefined" && context;
  9548. }
  9549. // Expose support vars for convenience
  9550. support = Sizzle.support = {};
  9551. /**
  9552. * Detects XML nodes
  9553. * @param {Element|Object} elem An element or a document
  9554. * @returns {Boolean} True iff elem is a non-HTML XML node
  9555. */
  9556. isXML = Sizzle.isXML = function( elem ) {
  9557. var namespace = elem.namespaceURI,
  9558. docElem = (elem.ownerDocument || elem).documentElement;
  9559. // Support: IE <=8
  9560. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  9561. // https://bugs.jquery.com/ticket/4833
  9562. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  9563. };
  9564. /**
  9565. * Sets document-related variables once based on the current document
  9566. * @param {Element|Object} [doc] An element or document object to use to set the document
  9567. * @returns {Object} Returns the current document
  9568. */
  9569. setDocument = Sizzle.setDocument = function( node ) {
  9570. var hasCompare, subWindow,
  9571. doc = node ? node.ownerDocument || node : preferredDoc;
  9572. // Return early if doc is invalid or already selected
  9573. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  9574. return document;
  9575. }
  9576. // Update global variables
  9577. document = doc;
  9578. docElem = document.documentElement;
  9579. documentIsHTML = !isXML( document );
  9580. // Support: IE 9-11, Edge
  9581. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  9582. if ( preferredDoc !== document &&
  9583. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  9584. // Support: IE 11, Edge
  9585. if ( subWindow.addEventListener ) {
  9586. subWindow.addEventListener( "unload", unloadHandler, false );
  9587. // Support: IE 9 - 10 only
  9588. } else if ( subWindow.attachEvent ) {
  9589. subWindow.attachEvent( "onunload", unloadHandler );
  9590. }
  9591. }
  9592. /* Attributes
  9593. ---------------------------------------------------------------------- */
  9594. // Support: IE<8
  9595. // Verify that getAttribute really returns attributes and not properties
  9596. // (excepting IE8 booleans)
  9597. support.attributes = assert(function( el ) {
  9598. el.className = "i";
  9599. return !el.getAttribute("className");
  9600. });
  9601. /* getElement(s)By*
  9602. ---------------------------------------------------------------------- */
  9603. // Check if getElementsByTagName("*") returns only elements
  9604. support.getElementsByTagName = assert(function( el ) {
  9605. el.appendChild( document.createComment("") );
  9606. return !el.getElementsByTagName("*").length;
  9607. });
  9608. // Support: IE<9
  9609. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  9610. // Support: IE<10
  9611. // Check if getElementById returns elements by name
  9612. // The broken getElementById methods don't pick up programmatically-set names,
  9613. // so use a roundabout getElementsByName test
  9614. support.getById = assert(function( el ) {
  9615. docElem.appendChild( el ).id = expando;
  9616. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  9617. });
  9618. // ID filter and find
  9619. if ( support.getById ) {
  9620. Expr.filter["ID"] = function( id ) {
  9621. var attrId = id.replace( runescape, funescape );
  9622. return function( elem ) {
  9623. return elem.getAttribute("id") === attrId;
  9624. };
  9625. };
  9626. Expr.find["ID"] = function( id, context ) {
  9627. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9628. var elem = context.getElementById( id );
  9629. return elem ? [ elem ] : [];
  9630. }
  9631. };
  9632. } else {
  9633. Expr.filter["ID"] = function( id ) {
  9634. var attrId = id.replace( runescape, funescape );
  9635. return function( elem ) {
  9636. var node = typeof elem.getAttributeNode !== "undefined" &&
  9637. elem.getAttributeNode("id");
  9638. return node && node.value === attrId;
  9639. };
  9640. };
  9641. // Support: IE 6 - 7 only
  9642. // getElementById is not reliable as a find shortcut
  9643. Expr.find["ID"] = function( id, context ) {
  9644. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9645. var node, i, elems,
  9646. elem = context.getElementById( id );
  9647. if ( elem ) {
  9648. // Verify the id attribute
  9649. node = elem.getAttributeNode("id");
  9650. if ( node && node.value === id ) {
  9651. return [ elem ];
  9652. }
  9653. // Fall back on getElementsByName
  9654. elems = context.getElementsByName( id );
  9655. i = 0;
  9656. while ( (elem = elems[i++]) ) {
  9657. node = elem.getAttributeNode("id");
  9658. if ( node && node.value === id ) {
  9659. return [ elem ];
  9660. }
  9661. }
  9662. }
  9663. return [];
  9664. }
  9665. };
  9666. }
  9667. // Tag
  9668. Expr.find["TAG"] = support.getElementsByTagName ?
  9669. function( tag, context ) {
  9670. if ( typeof context.getElementsByTagName !== "undefined" ) {
  9671. return context.getElementsByTagName( tag );
  9672. // DocumentFragment nodes don't have gEBTN
  9673. } else if ( support.qsa ) {
  9674. return context.querySelectorAll( tag );
  9675. }
  9676. } :
  9677. function( tag, context ) {
  9678. var elem,
  9679. tmp = [],
  9680. i = 0,
  9681. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  9682. results = context.getElementsByTagName( tag );
  9683. // Filter out possible comments
  9684. if ( tag === "*" ) {
  9685. while ( (elem = results[i++]) ) {
  9686. if ( elem.nodeType === 1 ) {
  9687. tmp.push( elem );
  9688. }
  9689. }
  9690. return tmp;
  9691. }
  9692. return results;
  9693. };
  9694. // Class
  9695. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  9696. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  9697. return context.getElementsByClassName( className );
  9698. }
  9699. };
  9700. /* QSA/matchesSelector
  9701. ---------------------------------------------------------------------- */
  9702. // QSA and matchesSelector support
  9703. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  9704. rbuggyMatches = [];
  9705. // qSa(:focus) reports false when true (Chrome 21)
  9706. // We allow this because of a bug in IE8/9 that throws an error
  9707. // whenever `document.activeElement` is accessed on an iframe
  9708. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  9709. // See https://bugs.jquery.com/ticket/13378
  9710. rbuggyQSA = [];
  9711. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  9712. // Build QSA regex
  9713. // Regex strategy adopted from Diego Perini
  9714. assert(function( el ) {
  9715. // Select is set to empty string on purpose
  9716. // This is to test IE's treatment of not explicitly
  9717. // setting a boolean content attribute,
  9718. // since its presence should be enough
  9719. // https://bugs.jquery.com/ticket/12359
  9720. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  9721. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  9722. "<option selected=''></option></select>";
  9723. // Support: IE8, Opera 11-12.16
  9724. // Nothing should be selected when empty strings follow ^= or $= or *=
  9725. // The test attribute must be unknown in Opera but "safe" for WinRT
  9726. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  9727. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  9728. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  9729. }
  9730. // Support: IE8
  9731. // Boolean attributes and "value" are not treated correctly
  9732. if ( !el.querySelectorAll("[selected]").length ) {
  9733. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  9734. }
  9735. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  9736. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  9737. rbuggyQSA.push("~=");
  9738. }
  9739. // Webkit/Opera - :checked should return selected option elements
  9740. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  9741. // IE8 throws error here and will not see later tests
  9742. if ( !el.querySelectorAll(":checked").length ) {
  9743. rbuggyQSA.push(":checked");
  9744. }
  9745. // Support: Safari 8+, iOS 8+
  9746. // https://bugs.webkit.org/show_bug.cgi?id=136851
  9747. // In-page `selector#id sibling-combinator selector` fails
  9748. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  9749. rbuggyQSA.push(".#.+[+~]");
  9750. }
  9751. });
  9752. assert(function( el ) {
  9753. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  9754. "<select disabled='disabled'><option/></select>";
  9755. // Support: Windows 8 Native Apps
  9756. // The type and name attributes are restricted during .innerHTML assignment
  9757. var input = document.createElement("input");
  9758. input.setAttribute( "type", "hidden" );
  9759. el.appendChild( input ).setAttribute( "name", "D" );
  9760. // Support: IE8
  9761. // Enforce case-sensitivity of name attribute
  9762. if ( el.querySelectorAll("[name=d]").length ) {
  9763. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  9764. }
  9765. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  9766. // IE8 throws error here and will not see later tests
  9767. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  9768. rbuggyQSA.push( ":enabled", ":disabled" );
  9769. }
  9770. // Support: IE9-11+
  9771. // IE's :disabled selector does not pick up the children of disabled fieldsets
  9772. docElem.appendChild( el ).disabled = true;
  9773. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  9774. rbuggyQSA.push( ":enabled", ":disabled" );
  9775. }
  9776. // Opera 10-11 does not throw on post-comma invalid pseudos
  9777. el.querySelectorAll("*,:x");
  9778. rbuggyQSA.push(",.*:");
  9779. });
  9780. }
  9781. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  9782. docElem.webkitMatchesSelector ||
  9783. docElem.mozMatchesSelector ||
  9784. docElem.oMatchesSelector ||
  9785. docElem.msMatchesSelector) )) ) {
  9786. assert(function( el ) {
  9787. // Check to see if it's possible to do matchesSelector
  9788. // on a disconnected node (IE 9)
  9789. support.disconnectedMatch = matches.call( el, "*" );
  9790. // This should fail with an exception
  9791. // Gecko does not error, returns false instead
  9792. matches.call( el, "[s!='']:x" );
  9793. rbuggyMatches.push( "!=", pseudos );
  9794. });
  9795. }
  9796. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  9797. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  9798. /* Contains
  9799. ---------------------------------------------------------------------- */
  9800. hasCompare = rnative.test( docElem.compareDocumentPosition );
  9801. // Element contains another
  9802. // Purposefully self-exclusive
  9803. // As in, an element does not contain itself
  9804. contains = hasCompare || rnative.test( docElem.contains ) ?
  9805. function( a, b ) {
  9806. var adown = a.nodeType === 9 ? a.documentElement : a,
  9807. bup = b && b.parentNode;
  9808. return a === bup || !!( bup && bup.nodeType === 1 && (
  9809. adown.contains ?
  9810. adown.contains( bup ) :
  9811. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  9812. ));
  9813. } :
  9814. function( a, b ) {
  9815. if ( b ) {
  9816. while ( (b = b.parentNode) ) {
  9817. if ( b === a ) {
  9818. return true;
  9819. }
  9820. }
  9821. }
  9822. return false;
  9823. };
  9824. /* Sorting
  9825. ---------------------------------------------------------------------- */
  9826. // Document order sorting
  9827. sortOrder = hasCompare ?
  9828. function( a, b ) {
  9829. // Flag for duplicate removal
  9830. if ( a === b ) {
  9831. hasDuplicate = true;
  9832. return 0;
  9833. }
  9834. // Sort on method existence if only one input has compareDocumentPosition
  9835. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  9836. if ( compare ) {
  9837. return compare;
  9838. }
  9839. // Calculate position if both inputs belong to the same document
  9840. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  9841. a.compareDocumentPosition( b ) :
  9842. // Otherwise we know they are disconnected
  9843. 1;
  9844. // Disconnected nodes
  9845. if ( compare & 1 ||
  9846. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  9847. // Choose the first element that is related to our preferred document
  9848. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  9849. return -1;
  9850. }
  9851. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  9852. return 1;
  9853. }
  9854. // Maintain original order
  9855. return sortInput ?
  9856. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9857. 0;
  9858. }
  9859. return compare & 4 ? -1 : 1;
  9860. } :
  9861. function( a, b ) {
  9862. // Exit early if the nodes are identical
  9863. if ( a === b ) {
  9864. hasDuplicate = true;
  9865. return 0;
  9866. }
  9867. var cur,
  9868. i = 0,
  9869. aup = a.parentNode,
  9870. bup = b.parentNode,
  9871. ap = [ a ],
  9872. bp = [ b ];
  9873. // Parentless nodes are either documents or disconnected
  9874. if ( !aup || !bup ) {
  9875. return a === document ? -1 :
  9876. b === document ? 1 :
  9877. aup ? -1 :
  9878. bup ? 1 :
  9879. sortInput ?
  9880. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9881. 0;
  9882. // If the nodes are siblings, we can do a quick check
  9883. } else if ( aup === bup ) {
  9884. return siblingCheck( a, b );
  9885. }
  9886. // Otherwise we need full lists of their ancestors for comparison
  9887. cur = a;
  9888. while ( (cur = cur.parentNode) ) {
  9889. ap.unshift( cur );
  9890. }
  9891. cur = b;
  9892. while ( (cur = cur.parentNode) ) {
  9893. bp.unshift( cur );
  9894. }
  9895. // Walk down the tree looking for a discrepancy
  9896. while ( ap[i] === bp[i] ) {
  9897. i++;
  9898. }
  9899. return i ?
  9900. // Do a sibling check if the nodes have a common ancestor
  9901. siblingCheck( ap[i], bp[i] ) :
  9902. // Otherwise nodes in our document sort first
  9903. ap[i] === preferredDoc ? -1 :
  9904. bp[i] === preferredDoc ? 1 :
  9905. 0;
  9906. };
  9907. return document;
  9908. };
  9909. Sizzle.matches = function( expr, elements ) {
  9910. return Sizzle( expr, null, null, elements );
  9911. };
  9912. Sizzle.matchesSelector = function( elem, expr ) {
  9913. // Set document vars if needed
  9914. if ( ( elem.ownerDocument || elem ) !== document ) {
  9915. setDocument( elem );
  9916. }
  9917. if ( support.matchesSelector && documentIsHTML &&
  9918. !nonnativeSelectorCache[ expr + " " ] &&
  9919. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  9920. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  9921. try {
  9922. var ret = matches.call( elem, expr );
  9923. // IE 9's matchesSelector returns false on disconnected nodes
  9924. if ( ret || support.disconnectedMatch ||
  9925. // As well, disconnected nodes are said to be in a document
  9926. // fragment in IE 9
  9927. elem.document && elem.document.nodeType !== 11 ) {
  9928. return ret;
  9929. }
  9930. } catch (e) {
  9931. nonnativeSelectorCache( expr, true );
  9932. }
  9933. }
  9934. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  9935. };
  9936. Sizzle.contains = function( context, elem ) {
  9937. // Set document vars if needed
  9938. if ( ( context.ownerDocument || context ) !== document ) {
  9939. setDocument( context );
  9940. }
  9941. return contains( context, elem );
  9942. };
  9943. Sizzle.attr = function( elem, name ) {
  9944. // Set document vars if needed
  9945. if ( ( elem.ownerDocument || elem ) !== document ) {
  9946. setDocument( elem );
  9947. }
  9948. var fn = Expr.attrHandle[ name.toLowerCase() ],
  9949. // Don't get fooled by Object.prototype properties (jQuery #13807)
  9950. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  9951. fn( elem, name, !documentIsHTML ) :
  9952. undefined;
  9953. return val !== undefined ?
  9954. val :
  9955. support.attributes || !documentIsHTML ?
  9956. elem.getAttribute( name ) :
  9957. (val = elem.getAttributeNode(name)) && val.specified ?
  9958. val.value :
  9959. null;
  9960. };
  9961. Sizzle.escape = function( sel ) {
  9962. return (sel + "").replace( rcssescape, fcssescape );
  9963. };
  9964. Sizzle.error = function( msg ) {
  9965. throw new Error( "Syntax error, unrecognized expression: " + msg );
  9966. };
  9967. /**
  9968. * Document sorting and removing duplicates
  9969. * @param {ArrayLike} results
  9970. */
  9971. Sizzle.uniqueSort = function( results ) {
  9972. var elem,
  9973. duplicates = [],
  9974. j = 0,
  9975. i = 0;
  9976. // Unless we *know* we can detect duplicates, assume their presence
  9977. hasDuplicate = !support.detectDuplicates;
  9978. sortInput = !support.sortStable && results.slice( 0 );
  9979. results.sort( sortOrder );
  9980. if ( hasDuplicate ) {
  9981. while ( (elem = results[i++]) ) {
  9982. if ( elem === results[ i ] ) {
  9983. j = duplicates.push( i );
  9984. }
  9985. }
  9986. while ( j-- ) {
  9987. results.splice( duplicates[ j ], 1 );
  9988. }
  9989. }
  9990. // Clear input after sorting to release objects
  9991. // See https://github.com/jquery/sizzle/pull/225
  9992. sortInput = null;
  9993. return results;
  9994. };
  9995. /**
  9996. * Utility function for retrieving the text value of an array of DOM nodes
  9997. * @param {Array|Element} elem
  9998. */
  9999. getText = Sizzle.getText = function( elem ) {
  10000. var node,
  10001. ret = "",
  10002. i = 0,
  10003. nodeType = elem.nodeType;
  10004. if ( !nodeType ) {
  10005. // If no nodeType, this is expected to be an array
  10006. while ( (node = elem[i++]) ) {
  10007. // Do not traverse comment nodes
  10008. ret += getText( node );
  10009. }
  10010. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  10011. // Use textContent for elements
  10012. // innerText usage removed for consistency of new lines (jQuery #11153)
  10013. if ( typeof elem.textContent === "string" ) {
  10014. return elem.textContent;
  10015. } else {
  10016. // Traverse its children
  10017. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  10018. ret += getText( elem );
  10019. }
  10020. }
  10021. } else if ( nodeType === 3 || nodeType === 4 ) {
  10022. return elem.nodeValue;
  10023. }
  10024. // Do not include comment or processing instruction nodes
  10025. return ret;
  10026. };
  10027. Expr = Sizzle.selectors = {
  10028. // Can be adjusted by the user
  10029. cacheLength: 50,
  10030. createPseudo: markFunction,
  10031. match: matchExpr,
  10032. attrHandle: {},
  10033. find: {},
  10034. relative: {
  10035. ">": { dir: "parentNode", first: true },
  10036. " ": { dir: "parentNode" },
  10037. "+": { dir: "previousSibling", first: true },
  10038. "~": { dir: "previousSibling" }
  10039. },
  10040. preFilter: {
  10041. "ATTR": function( match ) {
  10042. match[1] = match[1].replace( runescape, funescape );
  10043. // Move the given value to match[3] whether quoted or unquoted
  10044. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  10045. if ( match[2] === "~=" ) {
  10046. match[3] = " " + match[3] + " ";
  10047. }
  10048. return match.slice( 0, 4 );
  10049. },
  10050. "CHILD": function( match ) {
  10051. /* matches from matchExpr["CHILD"]
  10052. 1 type (only|nth|...)
  10053. 2 what (child|of-type)
  10054. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  10055. 4 xn-component of xn+y argument ([+-]?\d*n|)
  10056. 5 sign of xn-component
  10057. 6 x of xn-component
  10058. 7 sign of y-component
  10059. 8 y of y-component
  10060. */
  10061. match[1] = match[1].toLowerCase();
  10062. if ( match[1].slice( 0, 3 ) === "nth" ) {
  10063. // nth-* requires argument
  10064. if ( !match[3] ) {
  10065. Sizzle.error( match[0] );
  10066. }
  10067. // numeric x and y parameters for Expr.filter.CHILD
  10068. // remember that false/true cast respectively to 0/1
  10069. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  10070. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  10071. // other types prohibit arguments
  10072. } else if ( match[3] ) {
  10073. Sizzle.error( match[0] );
  10074. }
  10075. return match;
  10076. },
  10077. "PSEUDO": function( match ) {
  10078. var excess,
  10079. unquoted = !match[6] && match[2];
  10080. if ( matchExpr["CHILD"].test( match[0] ) ) {
  10081. return null;
  10082. }
  10083. // Accept quoted arguments as-is
  10084. if ( match[3] ) {
  10085. match[2] = match[4] || match[5] || "";
  10086. // Strip excess characters from unquoted arguments
  10087. } else if ( unquoted && rpseudo.test( unquoted ) &&
  10088. // Get excess from tokenize (recursively)
  10089. (excess = tokenize( unquoted, true )) &&
  10090. // advance to the next closing parenthesis
  10091. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  10092. // excess is a negative index
  10093. match[0] = match[0].slice( 0, excess );
  10094. match[2] = unquoted.slice( 0, excess );
  10095. }
  10096. // Return only captures needed by the pseudo filter method (type and argument)
  10097. return match.slice( 0, 3 );
  10098. }
  10099. },
  10100. filter: {
  10101. "TAG": function( nodeNameSelector ) {
  10102. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  10103. return nodeNameSelector === "*" ?
  10104. function() { return true; } :
  10105. function( elem ) {
  10106. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  10107. };
  10108. },
  10109. "CLASS": function( className ) {
  10110. var pattern = classCache[ className + " " ];
  10111. return pattern ||
  10112. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  10113. classCache( className, function( elem ) {
  10114. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  10115. });
  10116. },
  10117. "ATTR": function( name, operator, check ) {
  10118. return function( elem ) {
  10119. var result = Sizzle.attr( elem, name );
  10120. if ( result == null ) {
  10121. return operator === "!=";
  10122. }
  10123. if ( !operator ) {
  10124. return true;
  10125. }
  10126. result += "";
  10127. return operator === "=" ? result === check :
  10128. operator === "!=" ? result !== check :
  10129. operator === "^=" ? check && result.indexOf( check ) === 0 :
  10130. operator === "*=" ? check && result.indexOf( check ) > -1 :
  10131. operator === "$=" ? check && result.slice( -check.length ) === check :
  10132. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  10133. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  10134. false;
  10135. };
  10136. },
  10137. "CHILD": function( type, what, argument, first, last ) {
  10138. var simple = type.slice( 0, 3 ) !== "nth",
  10139. forward = type.slice( -4 ) !== "last",
  10140. ofType = what === "of-type";
  10141. return first === 1 && last === 0 ?
  10142. // Shortcut for :nth-*(n)
  10143. function( elem ) {
  10144. return !!elem.parentNode;
  10145. } :
  10146. function( elem, context, xml ) {
  10147. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  10148. dir = simple !== forward ? "nextSibling" : "previousSibling",
  10149. parent = elem.parentNode,
  10150. name = ofType && elem.nodeName.toLowerCase(),
  10151. useCache = !xml && !ofType,
  10152. diff = false;
  10153. if ( parent ) {
  10154. // :(first|last|only)-(child|of-type)
  10155. if ( simple ) {
  10156. while ( dir ) {
  10157. node = elem;
  10158. while ( (node = node[ dir ]) ) {
  10159. if ( ofType ?
  10160. node.nodeName.toLowerCase() === name :
  10161. node.nodeType === 1 ) {
  10162. return false;
  10163. }
  10164. }
  10165. // Reverse direction for :only-* (if we haven't yet done so)
  10166. start = dir = type === "only" && !start && "nextSibling";
  10167. }
  10168. return true;
  10169. }
  10170. start = [ forward ? parent.firstChild : parent.lastChild ];
  10171. // non-xml :nth-child(...) stores cache data on `parent`
  10172. if ( forward && useCache ) {
  10173. // Seek `elem` from a previously-cached index
  10174. // ...in a gzip-friendly way
  10175. node = parent;
  10176. outerCache = node[ expando ] || (node[ expando ] = {});
  10177. // Support: IE <9 only
  10178. // Defend against cloned attroperties (jQuery gh-1709)
  10179. uniqueCache = outerCache[ node.uniqueID ] ||
  10180. (outerCache[ node.uniqueID ] = {});
  10181. cache = uniqueCache[ type ] || [];
  10182. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10183. diff = nodeIndex && cache[ 2 ];
  10184. node = nodeIndex && parent.childNodes[ nodeIndex ];
  10185. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10186. // Fallback to seeking `elem` from the start
  10187. (diff = nodeIndex = 0) || start.pop()) ) {
  10188. // When found, cache indexes on `parent` and break
  10189. if ( node.nodeType === 1 && ++diff && node === elem ) {
  10190. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  10191. break;
  10192. }
  10193. }
  10194. } else {
  10195. // Use previously-cached element index if available
  10196. if ( useCache ) {
  10197. // ...in a gzip-friendly way
  10198. node = elem;
  10199. outerCache = node[ expando ] || (node[ expando ] = {});
  10200. // Support: IE <9 only
  10201. // Defend against cloned attroperties (jQuery gh-1709)
  10202. uniqueCache = outerCache[ node.uniqueID ] ||
  10203. (outerCache[ node.uniqueID ] = {});
  10204. cache = uniqueCache[ type ] || [];
  10205. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10206. diff = nodeIndex;
  10207. }
  10208. // xml :nth-child(...)
  10209. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  10210. if ( diff === false ) {
  10211. // Use the same loop as above to seek `elem` from the start
  10212. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10213. (diff = nodeIndex = 0) || start.pop()) ) {
  10214. if ( ( ofType ?
  10215. node.nodeName.toLowerCase() === name :
  10216. node.nodeType === 1 ) &&
  10217. ++diff ) {
  10218. // Cache the index of each encountered element
  10219. if ( useCache ) {
  10220. outerCache = node[ expando ] || (node[ expando ] = {});
  10221. // Support: IE <9 only
  10222. // Defend against cloned attroperties (jQuery gh-1709)
  10223. uniqueCache = outerCache[ node.uniqueID ] ||
  10224. (outerCache[ node.uniqueID ] = {});
  10225. uniqueCache[ type ] = [ dirruns, diff ];
  10226. }
  10227. if ( node === elem ) {
  10228. break;
  10229. }
  10230. }
  10231. }
  10232. }
  10233. }
  10234. // Incorporate the offset, then check against cycle size
  10235. diff -= last;
  10236. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  10237. }
  10238. };
  10239. },
  10240. "PSEUDO": function( pseudo, argument ) {
  10241. // pseudo-class names are case-insensitive
  10242. // http://www.w3.org/TR/selectors/#pseudo-classes
  10243. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  10244. // Remember that setFilters inherits from pseudos
  10245. var args,
  10246. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  10247. Sizzle.error( "unsupported pseudo: " + pseudo );
  10248. // The user may use createPseudo to indicate that
  10249. // arguments are needed to create the filter function
  10250. // just as Sizzle does
  10251. if ( fn[ expando ] ) {
  10252. return fn( argument );
  10253. }
  10254. // But maintain support for old signatures
  10255. if ( fn.length > 1 ) {
  10256. args = [ pseudo, pseudo, "", argument ];
  10257. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  10258. markFunction(function( seed, matches ) {
  10259. var idx,
  10260. matched = fn( seed, argument ),
  10261. i = matched.length;
  10262. while ( i-- ) {
  10263. idx = indexOf( seed, matched[i] );
  10264. seed[ idx ] = !( matches[ idx ] = matched[i] );
  10265. }
  10266. }) :
  10267. function( elem ) {
  10268. return fn( elem, 0, args );
  10269. };
  10270. }
  10271. return fn;
  10272. }
  10273. },
  10274. pseudos: {
  10275. // Potentially complex pseudos
  10276. "not": markFunction(function( selector ) {
  10277. // Trim the selector passed to compile
  10278. // to avoid treating leading and trailing
  10279. // spaces as combinators
  10280. var input = [],
  10281. results = [],
  10282. matcher = compile( selector.replace( rtrim, "$1" ) );
  10283. return matcher[ expando ] ?
  10284. markFunction(function( seed, matches, context, xml ) {
  10285. var elem,
  10286. unmatched = matcher( seed, null, xml, [] ),
  10287. i = seed.length;
  10288. // Match elements unmatched by `matcher`
  10289. while ( i-- ) {
  10290. if ( (elem = unmatched[i]) ) {
  10291. seed[i] = !(matches[i] = elem);
  10292. }
  10293. }
  10294. }) :
  10295. function( elem, context, xml ) {
  10296. input[0] = elem;
  10297. matcher( input, null, xml, results );
  10298. // Don't keep the element (issue #299)
  10299. input[0] = null;
  10300. return !results.pop();
  10301. };
  10302. }),
  10303. "has": markFunction(function( selector ) {
  10304. return function( elem ) {
  10305. return Sizzle( selector, elem ).length > 0;
  10306. };
  10307. }),
  10308. "contains": markFunction(function( text ) {
  10309. text = text.replace( runescape, funescape );
  10310. return function( elem ) {
  10311. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  10312. };
  10313. }),
  10314. // "Whether an element is represented by a :lang() selector
  10315. // is based solely on the element's language value
  10316. // being equal to the identifier C,
  10317. // or beginning with the identifier C immediately followed by "-".
  10318. // The matching of C against the element's language value is performed case-insensitively.
  10319. // The identifier C does not have to be a valid language name."
  10320. // http://www.w3.org/TR/selectors/#lang-pseudo
  10321. "lang": markFunction( function( lang ) {
  10322. // lang value must be a valid identifier
  10323. if ( !ridentifier.test(lang || "") ) {
  10324. Sizzle.error( "unsupported lang: " + lang );
  10325. }
  10326. lang = lang.replace( runescape, funescape ).toLowerCase();
  10327. return function( elem ) {
  10328. var elemLang;
  10329. do {
  10330. if ( (elemLang = documentIsHTML ?
  10331. elem.lang :
  10332. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  10333. elemLang = elemLang.toLowerCase();
  10334. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  10335. }
  10336. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  10337. return false;
  10338. };
  10339. }),
  10340. // Miscellaneous
  10341. "target": function( elem ) {
  10342. var hash = window.location && window.location.hash;
  10343. return hash && hash.slice( 1 ) === elem.id;
  10344. },
  10345. "root": function( elem ) {
  10346. return elem === docElem;
  10347. },
  10348. "focus": function( elem ) {
  10349. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  10350. },
  10351. // Boolean properties
  10352. "enabled": createDisabledPseudo( false ),
  10353. "disabled": createDisabledPseudo( true ),
  10354. "checked": function( elem ) {
  10355. // In CSS3, :checked should return both checked and selected elements
  10356. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  10357. var nodeName = elem.nodeName.toLowerCase();
  10358. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  10359. },
  10360. "selected": function( elem ) {
  10361. // Accessing this property makes selected-by-default
  10362. // options in Safari work properly
  10363. if ( elem.parentNode ) {
  10364. elem.parentNode.selectedIndex;
  10365. }
  10366. return elem.selected === true;
  10367. },
  10368. // Contents
  10369. "empty": function( elem ) {
  10370. // http://www.w3.org/TR/selectors/#empty-pseudo
  10371. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  10372. // but not by others (comment: 8; processing instruction: 7; etc.)
  10373. // nodeType < 6 works because attributes (2) do not appear as children
  10374. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  10375. if ( elem.nodeType < 6 ) {
  10376. return false;
  10377. }
  10378. }
  10379. return true;
  10380. },
  10381. "parent": function( elem ) {
  10382. return !Expr.pseudos["empty"]( elem );
  10383. },
  10384. // Element/input types
  10385. "header": function( elem ) {
  10386. return rheader.test( elem.nodeName );
  10387. },
  10388. "input": function( elem ) {
  10389. return rinputs.test( elem.nodeName );
  10390. },
  10391. "button": function( elem ) {
  10392. var name = elem.nodeName.toLowerCase();
  10393. return name === "input" && elem.type === "button" || name === "button";
  10394. },
  10395. "text": function( elem ) {
  10396. var attr;
  10397. return elem.nodeName.toLowerCase() === "input" &&
  10398. elem.type === "text" &&
  10399. // Support: IE<8
  10400. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  10401. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  10402. },
  10403. // Position-in-collection
  10404. "first": createPositionalPseudo(function() {
  10405. return [ 0 ];
  10406. }),
  10407. "last": createPositionalPseudo(function( matchIndexes, length ) {
  10408. return [ length - 1 ];
  10409. }),
  10410. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10411. return [ argument < 0 ? argument + length : argument ];
  10412. }),
  10413. "even": createPositionalPseudo(function( matchIndexes, length ) {
  10414. var i = 0;
  10415. for ( ; i < length; i += 2 ) {
  10416. matchIndexes.push( i );
  10417. }
  10418. return matchIndexes;
  10419. }),
  10420. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  10421. var i = 1;
  10422. for ( ; i < length; i += 2 ) {
  10423. matchIndexes.push( i );
  10424. }
  10425. return matchIndexes;
  10426. }),
  10427. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10428. var i = argument < 0 ?
  10429. argument + length :
  10430. argument > length ?
  10431. length :
  10432. argument;
  10433. for ( ; --i >= 0; ) {
  10434. matchIndexes.push( i );
  10435. }
  10436. return matchIndexes;
  10437. }),
  10438. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10439. var i = argument < 0 ? argument + length : argument;
  10440. for ( ; ++i < length; ) {
  10441. matchIndexes.push( i );
  10442. }
  10443. return matchIndexes;
  10444. })
  10445. }
  10446. };
  10447. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  10448. // Add button/input type pseudos
  10449. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  10450. Expr.pseudos[ i ] = createInputPseudo( i );
  10451. }
  10452. for ( i in { submit: true, reset: true } ) {
  10453. Expr.pseudos[ i ] = createButtonPseudo( i );
  10454. }
  10455. // Easy API for creating new setFilters
  10456. function setFilters() {}
  10457. setFilters.prototype = Expr.filters = Expr.pseudos;
  10458. Expr.setFilters = new setFilters();
  10459. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  10460. var matched, match, tokens, type,
  10461. soFar, groups, preFilters,
  10462. cached = tokenCache[ selector + " " ];
  10463. if ( cached ) {
  10464. return parseOnly ? 0 : cached.slice( 0 );
  10465. }
  10466. soFar = selector;
  10467. groups = [];
  10468. preFilters = Expr.preFilter;
  10469. while ( soFar ) {
  10470. // Comma and first run
  10471. if ( !matched || (match = rcomma.exec( soFar )) ) {
  10472. if ( match ) {
  10473. // Don't consume trailing commas as valid
  10474. soFar = soFar.slice( match[0].length ) || soFar;
  10475. }
  10476. groups.push( (tokens = []) );
  10477. }
  10478. matched = false;
  10479. // Combinators
  10480. if ( (match = rcombinators.exec( soFar )) ) {
  10481. matched = match.shift();
  10482. tokens.push({
  10483. value: matched,
  10484. // Cast descendant combinators to space
  10485. type: match[0].replace( rtrim, " " )
  10486. });
  10487. soFar = soFar.slice( matched.length );
  10488. }
  10489. // Filters
  10490. for ( type in Expr.filter ) {
  10491. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  10492. (match = preFilters[ type ]( match ))) ) {
  10493. matched = match.shift();
  10494. tokens.push({
  10495. value: matched,
  10496. type: type,
  10497. matches: match
  10498. });
  10499. soFar = soFar.slice( matched.length );
  10500. }
  10501. }
  10502. if ( !matched ) {
  10503. break;
  10504. }
  10505. }
  10506. // Return the length of the invalid excess
  10507. // if we're just parsing
  10508. // Otherwise, throw an error or return tokens
  10509. return parseOnly ?
  10510. soFar.length :
  10511. soFar ?
  10512. Sizzle.error( selector ) :
  10513. // Cache the tokens
  10514. tokenCache( selector, groups ).slice( 0 );
  10515. };
  10516. function toSelector( tokens ) {
  10517. var i = 0,
  10518. len = tokens.length,
  10519. selector = "";
  10520. for ( ; i < len; i++ ) {
  10521. selector += tokens[i].value;
  10522. }
  10523. return selector;
  10524. }
  10525. function addCombinator( matcher, combinator, base ) {
  10526. var dir = combinator.dir,
  10527. skip = combinator.next,
  10528. key = skip || dir,
  10529. checkNonElements = base && key === "parentNode",
  10530. doneName = done++;
  10531. return combinator.first ?
  10532. // Check against closest ancestor/preceding element
  10533. function( elem, context, xml ) {
  10534. while ( (elem = elem[ dir ]) ) {
  10535. if ( elem.nodeType === 1 || checkNonElements ) {
  10536. return matcher( elem, context, xml );
  10537. }
  10538. }
  10539. return false;
  10540. } :
  10541. // Check against all ancestor/preceding elements
  10542. function( elem, context, xml ) {
  10543. var oldCache, uniqueCache, outerCache,
  10544. newCache = [ dirruns, doneName ];
  10545. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  10546. if ( xml ) {
  10547. while ( (elem = elem[ dir ]) ) {
  10548. if ( elem.nodeType === 1 || checkNonElements ) {
  10549. if ( matcher( elem, context, xml ) ) {
  10550. return true;
  10551. }
  10552. }
  10553. }
  10554. } else {
  10555. while ( (elem = elem[ dir ]) ) {
  10556. if ( elem.nodeType === 1 || checkNonElements ) {
  10557. outerCache = elem[ expando ] || (elem[ expando ] = {});
  10558. // Support: IE <9 only
  10559. // Defend against cloned attroperties (jQuery gh-1709)
  10560. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  10561. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  10562. elem = elem[ dir ] || elem;
  10563. } else if ( (oldCache = uniqueCache[ key ]) &&
  10564. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  10565. // Assign to newCache so results back-propagate to previous elements
  10566. return (newCache[ 2 ] = oldCache[ 2 ]);
  10567. } else {
  10568. // Reuse newcache so results back-propagate to previous elements
  10569. uniqueCache[ key ] = newCache;
  10570. // A match means we're done; a fail means we have to keep checking
  10571. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  10572. return true;
  10573. }
  10574. }
  10575. }
  10576. }
  10577. }
  10578. return false;
  10579. };
  10580. }
  10581. function elementMatcher( matchers ) {
  10582. return matchers.length > 1 ?
  10583. function( elem, context, xml ) {
  10584. var i = matchers.length;
  10585. while ( i-- ) {
  10586. if ( !matchers[i]( elem, context, xml ) ) {
  10587. return false;
  10588. }
  10589. }
  10590. return true;
  10591. } :
  10592. matchers[0];
  10593. }
  10594. function multipleContexts( selector, contexts, results ) {
  10595. var i = 0,
  10596. len = contexts.length;
  10597. for ( ; i < len; i++ ) {
  10598. Sizzle( selector, contexts[i], results );
  10599. }
  10600. return results;
  10601. }
  10602. function condense( unmatched, map, filter, context, xml ) {
  10603. var elem,
  10604. newUnmatched = [],
  10605. i = 0,
  10606. len = unmatched.length,
  10607. mapped = map != null;
  10608. for ( ; i < len; i++ ) {
  10609. if ( (elem = unmatched[i]) ) {
  10610. if ( !filter || filter( elem, context, xml ) ) {
  10611. newUnmatched.push( elem );
  10612. if ( mapped ) {
  10613. map.push( i );
  10614. }
  10615. }
  10616. }
  10617. }
  10618. return newUnmatched;
  10619. }
  10620. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  10621. if ( postFilter && !postFilter[ expando ] ) {
  10622. postFilter = setMatcher( postFilter );
  10623. }
  10624. if ( postFinder && !postFinder[ expando ] ) {
  10625. postFinder = setMatcher( postFinder, postSelector );
  10626. }
  10627. return markFunction(function( seed, results, context, xml ) {
  10628. var temp, i, elem,
  10629. preMap = [],
  10630. postMap = [],
  10631. preexisting = results.length,
  10632. // Get initial elements from seed or context
  10633. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  10634. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  10635. matcherIn = preFilter && ( seed || !selector ) ?
  10636. condense( elems, preMap, preFilter, context, xml ) :
  10637. elems,
  10638. matcherOut = matcher ?
  10639. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  10640. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  10641. // ...intermediate processing is necessary
  10642. [] :
  10643. // ...otherwise use results directly
  10644. results :
  10645. matcherIn;
  10646. // Find primary matches
  10647. if ( matcher ) {
  10648. matcher( matcherIn, matcherOut, context, xml );
  10649. }
  10650. // Apply postFilter
  10651. if ( postFilter ) {
  10652. temp = condense( matcherOut, postMap );
  10653. postFilter( temp, [], context, xml );
  10654. // Un-match failing elements by moving them back to matcherIn
  10655. i = temp.length;
  10656. while ( i-- ) {
  10657. if ( (elem = temp[i]) ) {
  10658. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  10659. }
  10660. }
  10661. }
  10662. if ( seed ) {
  10663. if ( postFinder || preFilter ) {
  10664. if ( postFinder ) {
  10665. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  10666. temp = [];
  10667. i = matcherOut.length;
  10668. while ( i-- ) {
  10669. if ( (elem = matcherOut[i]) ) {
  10670. // Restore matcherIn since elem is not yet a final match
  10671. temp.push( (matcherIn[i] = elem) );
  10672. }
  10673. }
  10674. postFinder( null, (matcherOut = []), temp, xml );
  10675. }
  10676. // Move matched elements from seed to results to keep them synchronized
  10677. i = matcherOut.length;
  10678. while ( i-- ) {
  10679. if ( (elem = matcherOut[i]) &&
  10680. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  10681. seed[temp] = !(results[temp] = elem);
  10682. }
  10683. }
  10684. }
  10685. // Add elements to results, through postFinder if defined
  10686. } else {
  10687. matcherOut = condense(
  10688. matcherOut === results ?
  10689. matcherOut.splice( preexisting, matcherOut.length ) :
  10690. matcherOut
  10691. );
  10692. if ( postFinder ) {
  10693. postFinder( null, results, matcherOut, xml );
  10694. } else {
  10695. push.apply( results, matcherOut );
  10696. }
  10697. }
  10698. });
  10699. }
  10700. function matcherFromTokens( tokens ) {
  10701. var checkContext, matcher, j,
  10702. len = tokens.length,
  10703. leadingRelative = Expr.relative[ tokens[0].type ],
  10704. implicitRelative = leadingRelative || Expr.relative[" "],
  10705. i = leadingRelative ? 1 : 0,
  10706. // The foundational matcher ensures that elements are reachable from top-level context(s)
  10707. matchContext = addCombinator( function( elem ) {
  10708. return elem === checkContext;
  10709. }, implicitRelative, true ),
  10710. matchAnyContext = addCombinator( function( elem ) {
  10711. return indexOf( checkContext, elem ) > -1;
  10712. }, implicitRelative, true ),
  10713. matchers = [ function( elem, context, xml ) {
  10714. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  10715. (checkContext = context).nodeType ?
  10716. matchContext( elem, context, xml ) :
  10717. matchAnyContext( elem, context, xml ) );
  10718. // Avoid hanging onto element (issue #299)
  10719. checkContext = null;
  10720. return ret;
  10721. } ];
  10722. for ( ; i < len; i++ ) {
  10723. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  10724. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  10725. } else {
  10726. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  10727. // Return special upon seeing a positional matcher
  10728. if ( matcher[ expando ] ) {
  10729. // Find the next relative operator (if any) for proper handling
  10730. j = ++i;
  10731. for ( ; j < len; j++ ) {
  10732. if ( Expr.relative[ tokens[j].type ] ) {
  10733. break;
  10734. }
  10735. }
  10736. return setMatcher(
  10737. i > 1 && elementMatcher( matchers ),
  10738. i > 1 && toSelector(
  10739. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  10740. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  10741. ).replace( rtrim, "$1" ),
  10742. matcher,
  10743. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  10744. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  10745. j < len && toSelector( tokens )
  10746. );
  10747. }
  10748. matchers.push( matcher );
  10749. }
  10750. }
  10751. return elementMatcher( matchers );
  10752. }
  10753. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  10754. var bySet = setMatchers.length > 0,
  10755. byElement = elementMatchers.length > 0,
  10756. superMatcher = function( seed, context, xml, results, outermost ) {
  10757. var elem, j, matcher,
  10758. matchedCount = 0,
  10759. i = "0",
  10760. unmatched = seed && [],
  10761. setMatched = [],
  10762. contextBackup = outermostContext,
  10763. // We must always have either seed elements or outermost context
  10764. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  10765. // Use integer dirruns iff this is the outermost matcher
  10766. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  10767. len = elems.length;
  10768. if ( outermost ) {
  10769. outermostContext = context === document || context || outermost;
  10770. }
  10771. // Add elements passing elementMatchers directly to results
  10772. // Support: IE<9, Safari
  10773. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  10774. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  10775. if ( byElement && elem ) {
  10776. j = 0;
  10777. if ( !context && elem.ownerDocument !== document ) {
  10778. setDocument( elem );
  10779. xml = !documentIsHTML;
  10780. }
  10781. while ( (matcher = elementMatchers[j++]) ) {
  10782. if ( matcher( elem, context || document, xml) ) {
  10783. results.push( elem );
  10784. break;
  10785. }
  10786. }
  10787. if ( outermost ) {
  10788. dirruns = dirrunsUnique;
  10789. }
  10790. }
  10791. // Track unmatched elements for set filters
  10792. if ( bySet ) {
  10793. // They will have gone through all possible matchers
  10794. if ( (elem = !matcher && elem) ) {
  10795. matchedCount--;
  10796. }
  10797. // Lengthen the array for every element, matched or not
  10798. if ( seed ) {
  10799. unmatched.push( elem );
  10800. }
  10801. }
  10802. }
  10803. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  10804. // makes the latter nonnegative.
  10805. matchedCount += i;
  10806. // Apply set filters to unmatched elements
  10807. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  10808. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  10809. // no element matchers and no seed.
  10810. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  10811. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  10812. // numerically zero.
  10813. if ( bySet && i !== matchedCount ) {
  10814. j = 0;
  10815. while ( (matcher = setMatchers[j++]) ) {
  10816. matcher( unmatched, setMatched, context, xml );
  10817. }
  10818. if ( seed ) {
  10819. // Reintegrate element matches to eliminate the need for sorting
  10820. if ( matchedCount > 0 ) {
  10821. while ( i-- ) {
  10822. if ( !(unmatched[i] || setMatched[i]) ) {
  10823. setMatched[i] = pop.call( results );
  10824. }
  10825. }
  10826. }
  10827. // Discard index placeholder values to get only actual matches
  10828. setMatched = condense( setMatched );
  10829. }
  10830. // Add matches to results
  10831. push.apply( results, setMatched );
  10832. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  10833. if ( outermost && !seed && setMatched.length > 0 &&
  10834. ( matchedCount + setMatchers.length ) > 1 ) {
  10835. Sizzle.uniqueSort( results );
  10836. }
  10837. }
  10838. // Override manipulation of globals by nested matchers
  10839. if ( outermost ) {
  10840. dirruns = dirrunsUnique;
  10841. outermostContext = contextBackup;
  10842. }
  10843. return unmatched;
  10844. };
  10845. return bySet ?
  10846. markFunction( superMatcher ) :
  10847. superMatcher;
  10848. }
  10849. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  10850. var i,
  10851. setMatchers = [],
  10852. elementMatchers = [],
  10853. cached = compilerCache[ selector + " " ];
  10854. if ( !cached ) {
  10855. // Generate a function of recursive functions that can be used to check each element
  10856. if ( !match ) {
  10857. match = tokenize( selector );
  10858. }
  10859. i = match.length;
  10860. while ( i-- ) {
  10861. cached = matcherFromTokens( match[i] );
  10862. if ( cached[ expando ] ) {
  10863. setMatchers.push( cached );
  10864. } else {
  10865. elementMatchers.push( cached );
  10866. }
  10867. }
  10868. // Cache the compiled function
  10869. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  10870. // Save selector and tokenization
  10871. cached.selector = selector;
  10872. }
  10873. return cached;
  10874. };
  10875. /**
  10876. * A low-level selection function that works with Sizzle's compiled
  10877. * selector functions
  10878. * @param {String|Function} selector A selector or a pre-compiled
  10879. * selector function built with Sizzle.compile
  10880. * @param {Element} context
  10881. * @param {Array} [results]
  10882. * @param {Array} [seed] A set of elements to match against
  10883. */
  10884. select = Sizzle.select = function( selector, context, results, seed ) {
  10885. var i, tokens, token, type, find,
  10886. compiled = typeof selector === "function" && selector,
  10887. match = !seed && tokenize( (selector = compiled.selector || selector) );
  10888. results = results || [];
  10889. // Try to minimize operations if there is only one selector in the list and no seed
  10890. // (the latter of which guarantees us context)
  10891. if ( match.length === 1 ) {
  10892. // Reduce context if the leading compound selector is an ID
  10893. tokens = match[0] = match[0].slice( 0 );
  10894. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  10895. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  10896. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  10897. if ( !context ) {
  10898. return results;
  10899. // Precompiled matchers will still verify ancestry, so step up a level
  10900. } else if ( compiled ) {
  10901. context = context.parentNode;
  10902. }
  10903. selector = selector.slice( tokens.shift().value.length );
  10904. }
  10905. // Fetch a seed set for right-to-left matching
  10906. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  10907. while ( i-- ) {
  10908. token = tokens[i];
  10909. // Abort if we hit a combinator
  10910. if ( Expr.relative[ (type = token.type) ] ) {
  10911. break;
  10912. }
  10913. if ( (find = Expr.find[ type ]) ) {
  10914. // Search, expanding context for leading sibling combinators
  10915. if ( (seed = find(
  10916. token.matches[0].replace( runescape, funescape ),
  10917. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  10918. )) ) {
  10919. // If seed is empty or no tokens remain, we can return early
  10920. tokens.splice( i, 1 );
  10921. selector = seed.length && toSelector( tokens );
  10922. if ( !selector ) {
  10923. push.apply( results, seed );
  10924. return results;
  10925. }
  10926. break;
  10927. }
  10928. }
  10929. }
  10930. }
  10931. // Compile and execute a filtering function if one is not provided
  10932. // Provide `match` to avoid retokenization if we modified the selector above
  10933. ( compiled || compile( selector, match ) )(
  10934. seed,
  10935. context,
  10936. !documentIsHTML,
  10937. results,
  10938. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  10939. );
  10940. return results;
  10941. };
  10942. // One-time assignments
  10943. // Sort stability
  10944. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  10945. // Support: Chrome 14-35+
  10946. // Always assume duplicates if they aren't passed to the comparison function
  10947. support.detectDuplicates = !!hasDuplicate;
  10948. // Initialize against the default document
  10949. setDocument();
  10950. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  10951. // Detached nodes confoundingly follow *each other*
  10952. support.sortDetached = assert(function( el ) {
  10953. // Should return 1, but returns 4 (following)
  10954. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  10955. });
  10956. // Support: IE<8
  10957. // Prevent attribute/property "interpolation"
  10958. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  10959. if ( !assert(function( el ) {
  10960. el.innerHTML = "<a href='#'></a>";
  10961. return el.firstChild.getAttribute("href") === "#" ;
  10962. }) ) {
  10963. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  10964. if ( !isXML ) {
  10965. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  10966. }
  10967. });
  10968. }
  10969. // Support: IE<9
  10970. // Use defaultValue in place of getAttribute("value")
  10971. if ( !support.attributes || !assert(function( el ) {
  10972. el.innerHTML = "<input/>";
  10973. el.firstChild.setAttribute( "value", "" );
  10974. return el.firstChild.getAttribute( "value" ) === "";
  10975. }) ) {
  10976. addHandle( "value", function( elem, name, isXML ) {
  10977. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  10978. return elem.defaultValue;
  10979. }
  10980. });
  10981. }
  10982. // Support: IE<9
  10983. // Use getAttributeNode to fetch booleans when getAttribute lies
  10984. if ( !assert(function( el ) {
  10985. return el.getAttribute("disabled") == null;
  10986. }) ) {
  10987. addHandle( booleans, function( elem, name, isXML ) {
  10988. var val;
  10989. if ( !isXML ) {
  10990. return elem[ name ] === true ? name.toLowerCase() :
  10991. (val = elem.getAttributeNode( name )) && val.specified ?
  10992. val.value :
  10993. null;
  10994. }
  10995. });
  10996. }
  10997. return Sizzle;
  10998. })( window );
  10999. jQuery.find = Sizzle;
  11000. jQuery.expr = Sizzle.selectors;
  11001. // Deprecated
  11002. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  11003. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  11004. jQuery.text = Sizzle.getText;
  11005. jQuery.isXMLDoc = Sizzle.isXML;
  11006. jQuery.contains = Sizzle.contains;
  11007. jQuery.escapeSelector = Sizzle.escape;
  11008. var dir = function( elem, dir, until ) {
  11009. var matched = [],
  11010. truncate = until !== undefined;
  11011. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  11012. if ( elem.nodeType === 1 ) {
  11013. if ( truncate && jQuery( elem ).is( until ) ) {
  11014. break;
  11015. }
  11016. matched.push( elem );
  11017. }
  11018. }
  11019. return matched;
  11020. };
  11021. var siblings = function( n, elem ) {
  11022. var matched = [];
  11023. for ( ; n; n = n.nextSibling ) {
  11024. if ( n.nodeType === 1 && n !== elem ) {
  11025. matched.push( n );
  11026. }
  11027. }
  11028. return matched;
  11029. };
  11030. var rneedsContext = jQuery.expr.match.needsContext;
  11031. function nodeName( elem, name ) {
  11032. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  11033. };
  11034. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  11035. // Implement the identical functionality for filter and not
  11036. function winnow( elements, qualifier, not ) {
  11037. if ( isFunction( qualifier ) ) {
  11038. return jQuery.grep( elements, function( elem, i ) {
  11039. return !!qualifier.call( elem, i, elem ) !== not;
  11040. } );
  11041. }
  11042. // Single element
  11043. if ( qualifier.nodeType ) {
  11044. return jQuery.grep( elements, function( elem ) {
  11045. return ( elem === qualifier ) !== not;
  11046. } );
  11047. }
  11048. // Arraylike of elements (jQuery, arguments, Array)
  11049. if ( typeof qualifier !== "string" ) {
  11050. return jQuery.grep( elements, function( elem ) {
  11051. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  11052. } );
  11053. }
  11054. // Filtered directly for both simple and complex selectors
  11055. return jQuery.filter( qualifier, elements, not );
  11056. }
  11057. jQuery.filter = function( expr, elems, not ) {
  11058. var elem = elems[ 0 ];
  11059. if ( not ) {
  11060. expr = ":not(" + expr + ")";
  11061. }
  11062. if ( elems.length === 1 && elem.nodeType === 1 ) {
  11063. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  11064. }
  11065. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  11066. return elem.nodeType === 1;
  11067. } ) );
  11068. };
  11069. jQuery.fn.extend( {
  11070. find: function( selector ) {
  11071. var i, ret,
  11072. len = this.length,
  11073. self = this;
  11074. if ( typeof selector !== "string" ) {
  11075. return this.pushStack( jQuery( selector ).filter( function() {
  11076. for ( i = 0; i < len; i++ ) {
  11077. if ( jQuery.contains( self[ i ], this ) ) {
  11078. return true;
  11079. }
  11080. }
  11081. } ) );
  11082. }
  11083. ret = this.pushStack( [] );
  11084. for ( i = 0; i < len; i++ ) {
  11085. jQuery.find( selector, self[ i ], ret );
  11086. }
  11087. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  11088. },
  11089. filter: function( selector ) {
  11090. return this.pushStack( winnow( this, selector || [], false ) );
  11091. },
  11092. not: function( selector ) {
  11093. return this.pushStack( winnow( this, selector || [], true ) );
  11094. },
  11095. is: function( selector ) {
  11096. return !!winnow(
  11097. this,
  11098. // If this is a positional/relative selector, check membership in the returned set
  11099. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  11100. typeof selector === "string" && rneedsContext.test( selector ) ?
  11101. jQuery( selector ) :
  11102. selector || [],
  11103. false
  11104. ).length;
  11105. }
  11106. } );
  11107. // Initialize a jQuery object
  11108. // A central reference to the root jQuery(document)
  11109. var rootjQuery,
  11110. // A simple way to check for HTML strings
  11111. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  11112. // Strict HTML recognition (#11290: must start with <)
  11113. // Shortcut simple #id case for speed
  11114. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  11115. init = jQuery.fn.init = function( selector, context, root ) {
  11116. var match, elem;
  11117. // HANDLE: $(""), $(null), $(undefined), $(false)
  11118. if ( !selector ) {
  11119. return this;
  11120. }
  11121. // Method init() accepts an alternate rootjQuery
  11122. // so migrate can support jQuery.sub (gh-2101)
  11123. root = root || rootjQuery;
  11124. // Handle HTML strings
  11125. if ( typeof selector === "string" ) {
  11126. if ( selector[ 0 ] === "<" &&
  11127. selector[ selector.length - 1 ] === ">" &&
  11128. selector.length >= 3 ) {
  11129. // Assume that strings that start and end with <> are HTML and skip the regex check
  11130. match = [ null, selector, null ];
  11131. } else {
  11132. match = rquickExpr.exec( selector );
  11133. }
  11134. // Match html or make sure no context is specified for #id
  11135. if ( match && ( match[ 1 ] || !context ) ) {
  11136. // HANDLE: $(html) -> $(array)
  11137. if ( match[ 1 ] ) {
  11138. context = context instanceof jQuery ? context[ 0 ] : context;
  11139. // Option to run scripts is true for back-compat
  11140. // Intentionally let the error be thrown if parseHTML is not present
  11141. jQuery.merge( this, jQuery.parseHTML(
  11142. match[ 1 ],
  11143. context && context.nodeType ? context.ownerDocument || context : document,
  11144. true
  11145. ) );
  11146. // HANDLE: $(html, props)
  11147. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  11148. for ( match in context ) {
  11149. // Properties of context are called as methods if possible
  11150. if ( isFunction( this[ match ] ) ) {
  11151. this[ match ]( context[ match ] );
  11152. // ...and otherwise set as attributes
  11153. } else {
  11154. this.attr( match, context[ match ] );
  11155. }
  11156. }
  11157. }
  11158. return this;
  11159. // HANDLE: $(#id)
  11160. } else {
  11161. elem = document.getElementById( match[ 2 ] );
  11162. if ( elem ) {
  11163. // Inject the element directly into the jQuery object
  11164. this[ 0 ] = elem;
  11165. this.length = 1;
  11166. }
  11167. return this;
  11168. }
  11169. // HANDLE: $(expr, $(...))
  11170. } else if ( !context || context.jquery ) {
  11171. return ( context || root ).find( selector );
  11172. // HANDLE: $(expr, context)
  11173. // (which is just equivalent to: $(context).find(expr)
  11174. } else {
  11175. return this.constructor( context ).find( selector );
  11176. }
  11177. // HANDLE: $(DOMElement)
  11178. } else if ( selector.nodeType ) {
  11179. this[ 0 ] = selector;
  11180. this.length = 1;
  11181. return this;
  11182. // HANDLE: $(function)
  11183. // Shortcut for document ready
  11184. } else if ( isFunction( selector ) ) {
  11185. return root.ready !== undefined ?
  11186. root.ready( selector ) :
  11187. // Execute immediately if ready is not present
  11188. selector( jQuery );
  11189. }
  11190. return jQuery.makeArray( selector, this );
  11191. };
  11192. // Give the init function the jQuery prototype for later instantiation
  11193. init.prototype = jQuery.fn;
  11194. // Initialize central reference
  11195. rootjQuery = jQuery( document );
  11196. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  11197. // Methods guaranteed to produce a unique set when starting from a unique set
  11198. guaranteedUnique = {
  11199. children: true,
  11200. contents: true,
  11201. next: true,
  11202. prev: true
  11203. };
  11204. jQuery.fn.extend( {
  11205. has: function( target ) {
  11206. var targets = jQuery( target, this ),
  11207. l = targets.length;
  11208. return this.filter( function() {
  11209. var i = 0;
  11210. for ( ; i < l; i++ ) {
  11211. if ( jQuery.contains( this, targets[ i ] ) ) {
  11212. return true;
  11213. }
  11214. }
  11215. } );
  11216. },
  11217. closest: function( selectors, context ) {
  11218. var cur,
  11219. i = 0,
  11220. l = this.length,
  11221. matched = [],
  11222. targets = typeof selectors !== "string" && jQuery( selectors );
  11223. // Positional selectors never match, since there's no _selection_ context
  11224. if ( !rneedsContext.test( selectors ) ) {
  11225. for ( ; i < l; i++ ) {
  11226. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  11227. // Always skip document fragments
  11228. if ( cur.nodeType < 11 && ( targets ?
  11229. targets.index( cur ) > -1 :
  11230. // Don't pass non-elements to Sizzle
  11231. cur.nodeType === 1 &&
  11232. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  11233. matched.push( cur );
  11234. break;
  11235. }
  11236. }
  11237. }
  11238. }
  11239. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  11240. },
  11241. // Determine the position of an element within the set
  11242. index: function( elem ) {
  11243. // No argument, return index in parent
  11244. if ( !elem ) {
  11245. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  11246. }
  11247. // Index in selector
  11248. if ( typeof elem === "string" ) {
  11249. return indexOf.call( jQuery( elem ), this[ 0 ] );
  11250. }
  11251. // Locate the position of the desired element
  11252. return indexOf.call( this,
  11253. // If it receives a jQuery object, the first element is used
  11254. elem.jquery ? elem[ 0 ] : elem
  11255. );
  11256. },
  11257. add: function( selector, context ) {
  11258. return this.pushStack(
  11259. jQuery.uniqueSort(
  11260. jQuery.merge( this.get(), jQuery( selector, context ) )
  11261. )
  11262. );
  11263. },
  11264. addBack: function( selector ) {
  11265. return this.add( selector == null ?
  11266. this.prevObject : this.prevObject.filter( selector )
  11267. );
  11268. }
  11269. } );
  11270. function sibling( cur, dir ) {
  11271. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  11272. return cur;
  11273. }
  11274. jQuery.each( {
  11275. parent: function( elem ) {
  11276. var parent = elem.parentNode;
  11277. return parent && parent.nodeType !== 11 ? parent : null;
  11278. },
  11279. parents: function( elem ) {
  11280. return dir( elem, "parentNode" );
  11281. },
  11282. parentsUntil: function( elem, i, until ) {
  11283. return dir( elem, "parentNode", until );
  11284. },
  11285. next: function( elem ) {
  11286. return sibling( elem, "nextSibling" );
  11287. },
  11288. prev: function( elem ) {
  11289. return sibling( elem, "previousSibling" );
  11290. },
  11291. nextAll: function( elem ) {
  11292. return dir( elem, "nextSibling" );
  11293. },
  11294. prevAll: function( elem ) {
  11295. return dir( elem, "previousSibling" );
  11296. },
  11297. nextUntil: function( elem, i, until ) {
  11298. return dir( elem, "nextSibling", until );
  11299. },
  11300. prevUntil: function( elem, i, until ) {
  11301. return dir( elem, "previousSibling", until );
  11302. },
  11303. siblings: function( elem ) {
  11304. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  11305. },
  11306. children: function( elem ) {
  11307. return siblings( elem.firstChild );
  11308. },
  11309. contents: function( elem ) {
  11310. if ( typeof elem.contentDocument !== "undefined" ) {
  11311. return elem.contentDocument;
  11312. }
  11313. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  11314. // Treat the template element as a regular one in browsers that
  11315. // don't support it.
  11316. if ( nodeName( elem, "template" ) ) {
  11317. elem = elem.content || elem;
  11318. }
  11319. return jQuery.merge( [], elem.childNodes );
  11320. }
  11321. }, function( name, fn ) {
  11322. jQuery.fn[ name ] = function( until, selector ) {
  11323. var matched = jQuery.map( this, fn, until );
  11324. if ( name.slice( -5 ) !== "Until" ) {
  11325. selector = until;
  11326. }
  11327. if ( selector && typeof selector === "string" ) {
  11328. matched = jQuery.filter( selector, matched );
  11329. }
  11330. if ( this.length > 1 ) {
  11331. // Remove duplicates
  11332. if ( !guaranteedUnique[ name ] ) {
  11333. jQuery.uniqueSort( matched );
  11334. }
  11335. // Reverse order for parents* and prev-derivatives
  11336. if ( rparentsprev.test( name ) ) {
  11337. matched.reverse();
  11338. }
  11339. }
  11340. return this.pushStack( matched );
  11341. };
  11342. } );
  11343. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  11344. // Convert String-formatted options into Object-formatted ones
  11345. function createOptions( options ) {
  11346. var object = {};
  11347. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  11348. object[ flag ] = true;
  11349. } );
  11350. return object;
  11351. }
  11352. /*
  11353. * Create a callback list using the following parameters:
  11354. *
  11355. * options: an optional list of space-separated options that will change how
  11356. * the callback list behaves or a more traditional option object
  11357. *
  11358. * By default a callback list will act like an event callback list and can be
  11359. * "fired" multiple times.
  11360. *
  11361. * Possible options:
  11362. *
  11363. * once: will ensure the callback list can only be fired once (like a Deferred)
  11364. *
  11365. * memory: will keep track of previous values and will call any callback added
  11366. * after the list has been fired right away with the latest "memorized"
  11367. * values (like a Deferred)
  11368. *
  11369. * unique: will ensure a callback can only be added once (no duplicate in the list)
  11370. *
  11371. * stopOnFalse: interrupt callings when a callback returns false
  11372. *
  11373. */
  11374. jQuery.Callbacks = function( options ) {
  11375. // Convert options from String-formatted to Object-formatted if needed
  11376. // (we check in cache first)
  11377. options = typeof options === "string" ?
  11378. createOptions( options ) :
  11379. jQuery.extend( {}, options );
  11380. var // Flag to know if list is currently firing
  11381. firing,
  11382. // Last fire value for non-forgettable lists
  11383. memory,
  11384. // Flag to know if list was already fired
  11385. fired,
  11386. // Flag to prevent firing
  11387. locked,
  11388. // Actual callback list
  11389. list = [],
  11390. // Queue of execution data for repeatable lists
  11391. queue = [],
  11392. // Index of currently firing callback (modified by add/remove as needed)
  11393. firingIndex = -1,
  11394. // Fire callbacks
  11395. fire = function() {
  11396. // Enforce single-firing
  11397. locked = locked || options.once;
  11398. // Execute callbacks for all pending executions,
  11399. // respecting firingIndex overrides and runtime changes
  11400. fired = firing = true;
  11401. for ( ; queue.length; firingIndex = -1 ) {
  11402. memory = queue.shift();
  11403. while ( ++firingIndex < list.length ) {
  11404. // Run callback and check for early termination
  11405. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  11406. options.stopOnFalse ) {
  11407. // Jump to end and forget the data so .add doesn't re-fire
  11408. firingIndex = list.length;
  11409. memory = false;
  11410. }
  11411. }
  11412. }
  11413. // Forget the data if we're done with it
  11414. if ( !options.memory ) {
  11415. memory = false;
  11416. }
  11417. firing = false;
  11418. // Clean up if we're done firing for good
  11419. if ( locked ) {
  11420. // Keep an empty list if we have data for future add calls
  11421. if ( memory ) {
  11422. list = [];
  11423. // Otherwise, this object is spent
  11424. } else {
  11425. list = "";
  11426. }
  11427. }
  11428. },
  11429. // Actual Callbacks object
  11430. self = {
  11431. // Add a callback or a collection of callbacks to the list
  11432. add: function() {
  11433. if ( list ) {
  11434. // If we have memory from a past run, we should fire after adding
  11435. if ( memory && !firing ) {
  11436. firingIndex = list.length - 1;
  11437. queue.push( memory );
  11438. }
  11439. ( function add( args ) {
  11440. jQuery.each( args, function( _, arg ) {
  11441. if ( isFunction( arg ) ) {
  11442. if ( !options.unique || !self.has( arg ) ) {
  11443. list.push( arg );
  11444. }
  11445. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  11446. // Inspect recursively
  11447. add( arg );
  11448. }
  11449. } );
  11450. } )( arguments );
  11451. if ( memory && !firing ) {
  11452. fire();
  11453. }
  11454. }
  11455. return this;
  11456. },
  11457. // Remove a callback from the list
  11458. remove: function() {
  11459. jQuery.each( arguments, function( _, arg ) {
  11460. var index;
  11461. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  11462. list.splice( index, 1 );
  11463. // Handle firing indexes
  11464. if ( index <= firingIndex ) {
  11465. firingIndex--;
  11466. }
  11467. }
  11468. } );
  11469. return this;
  11470. },
  11471. // Check if a given callback is in the list.
  11472. // If no argument is given, return whether or not list has callbacks attached.
  11473. has: function( fn ) {
  11474. return fn ?
  11475. jQuery.inArray( fn, list ) > -1 :
  11476. list.length > 0;
  11477. },
  11478. // Remove all callbacks from the list
  11479. empty: function() {
  11480. if ( list ) {
  11481. list = [];
  11482. }
  11483. return this;
  11484. },
  11485. // Disable .fire and .add
  11486. // Abort any current/pending executions
  11487. // Clear all callbacks and values
  11488. disable: function() {
  11489. locked = queue = [];
  11490. list = memory = "";
  11491. return this;
  11492. },
  11493. disabled: function() {
  11494. return !list;
  11495. },
  11496. // Disable .fire
  11497. // Also disable .add unless we have memory (since it would have no effect)
  11498. // Abort any pending executions
  11499. lock: function() {
  11500. locked = queue = [];
  11501. if ( !memory && !firing ) {
  11502. list = memory = "";
  11503. }
  11504. return this;
  11505. },
  11506. locked: function() {
  11507. return !!locked;
  11508. },
  11509. // Call all callbacks with the given context and arguments
  11510. fireWith: function( context, args ) {
  11511. if ( !locked ) {
  11512. args = args || [];
  11513. args = [ context, args.slice ? args.slice() : args ];
  11514. queue.push( args );
  11515. if ( !firing ) {
  11516. fire();
  11517. }
  11518. }
  11519. return this;
  11520. },
  11521. // Call all the callbacks with the given arguments
  11522. fire: function() {
  11523. self.fireWith( this, arguments );
  11524. return this;
  11525. },
  11526. // To know if the callbacks have already been called at least once
  11527. fired: function() {
  11528. return !!fired;
  11529. }
  11530. };
  11531. return self;
  11532. };
  11533. function Identity( v ) {
  11534. return v;
  11535. }
  11536. function Thrower( ex ) {
  11537. throw ex;
  11538. }
  11539. function adoptValue( value, resolve, reject, noValue ) {
  11540. var method;
  11541. try {
  11542. // Check for promise aspect first to privilege synchronous behavior
  11543. if ( value && isFunction( ( method = value.promise ) ) ) {
  11544. method.call( value ).done( resolve ).fail( reject );
  11545. // Other thenables
  11546. } else if ( value && isFunction( ( method = value.then ) ) ) {
  11547. method.call( value, resolve, reject );
  11548. // Other non-thenables
  11549. } else {
  11550. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  11551. // * false: [ value ].slice( 0 ) => resolve( value )
  11552. // * true: [ value ].slice( 1 ) => resolve()
  11553. resolve.apply( undefined, [ value ].slice( noValue ) );
  11554. }
  11555. // For Promises/A+, convert exceptions into rejections
  11556. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  11557. // Deferred#then to conditionally suppress rejection.
  11558. } catch ( value ) {
  11559. // Support: Android 4.0 only
  11560. // Strict mode functions invoked without .call/.apply get global-object context
  11561. reject.apply( undefined, [ value ] );
  11562. }
  11563. }
  11564. jQuery.extend( {
  11565. Deferred: function( func ) {
  11566. var tuples = [
  11567. // action, add listener, callbacks,
  11568. // ... .then handlers, argument index, [final state]
  11569. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  11570. jQuery.Callbacks( "memory" ), 2 ],
  11571. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  11572. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  11573. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  11574. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  11575. ],
  11576. state = "pending",
  11577. promise = {
  11578. state: function() {
  11579. return state;
  11580. },
  11581. always: function() {
  11582. deferred.done( arguments ).fail( arguments );
  11583. return this;
  11584. },
  11585. "catch": function( fn ) {
  11586. return promise.then( null, fn );
  11587. },
  11588. // Keep pipe for back-compat
  11589. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  11590. var fns = arguments;
  11591. return jQuery.Deferred( function( newDefer ) {
  11592. jQuery.each( tuples, function( i, tuple ) {
  11593. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  11594. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  11595. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  11596. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  11597. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  11598. deferred[ tuple[ 1 ] ]( function() {
  11599. var returned = fn && fn.apply( this, arguments );
  11600. if ( returned && isFunction( returned.promise ) ) {
  11601. returned.promise()
  11602. .progress( newDefer.notify )
  11603. .done( newDefer.resolve )
  11604. .fail( newDefer.reject );
  11605. } else {
  11606. newDefer[ tuple[ 0 ] + "With" ](
  11607. this,
  11608. fn ? [ returned ] : arguments
  11609. );
  11610. }
  11611. } );
  11612. } );
  11613. fns = null;
  11614. } ).promise();
  11615. },
  11616. then: function( onFulfilled, onRejected, onProgress ) {
  11617. var maxDepth = 0;
  11618. function resolve( depth, deferred, handler, special ) {
  11619. return function() {
  11620. var that = this,
  11621. args = arguments,
  11622. mightThrow = function() {
  11623. var returned, then;
  11624. // Support: Promises/A+ section 2.3.3.3.3
  11625. // https://promisesaplus.com/#point-59
  11626. // Ignore double-resolution attempts
  11627. if ( depth < maxDepth ) {
  11628. return;
  11629. }
  11630. returned = handler.apply( that, args );
  11631. // Support: Promises/A+ section 2.3.1
  11632. // https://promisesaplus.com/#point-48
  11633. if ( returned === deferred.promise() ) {
  11634. throw new TypeError( "Thenable self-resolution" );
  11635. }
  11636. // Support: Promises/A+ sections 2.3.3.1, 3.5
  11637. // https://promisesaplus.com/#point-54
  11638. // https://promisesaplus.com/#point-75
  11639. // Retrieve `then` only once
  11640. then = returned &&
  11641. // Support: Promises/A+ section 2.3.4
  11642. // https://promisesaplus.com/#point-64
  11643. // Only check objects and functions for thenability
  11644. ( typeof returned === "object" ||
  11645. typeof returned === "function" ) &&
  11646. returned.then;
  11647. // Handle a returned thenable
  11648. if ( isFunction( then ) ) {
  11649. // Special processors (notify) just wait for resolution
  11650. if ( special ) {
  11651. then.call(
  11652. returned,
  11653. resolve( maxDepth, deferred, Identity, special ),
  11654. resolve( maxDepth, deferred, Thrower, special )
  11655. );
  11656. // Normal processors (resolve) also hook into progress
  11657. } else {
  11658. // ...and disregard older resolution values
  11659. maxDepth++;
  11660. then.call(
  11661. returned,
  11662. resolve( maxDepth, deferred, Identity, special ),
  11663. resolve( maxDepth, deferred, Thrower, special ),
  11664. resolve( maxDepth, deferred, Identity,
  11665. deferred.notifyWith )
  11666. );
  11667. }
  11668. // Handle all other returned values
  11669. } else {
  11670. // Only substitute handlers pass on context
  11671. // and multiple values (non-spec behavior)
  11672. if ( handler !== Identity ) {
  11673. that = undefined;
  11674. args = [ returned ];
  11675. }
  11676. // Process the value(s)
  11677. // Default process is resolve
  11678. ( special || deferred.resolveWith )( that, args );
  11679. }
  11680. },
  11681. // Only normal processors (resolve) catch and reject exceptions
  11682. process = special ?
  11683. mightThrow :
  11684. function() {
  11685. try {
  11686. mightThrow();
  11687. } catch ( e ) {
  11688. if ( jQuery.Deferred.exceptionHook ) {
  11689. jQuery.Deferred.exceptionHook( e,
  11690. process.stackTrace );
  11691. }
  11692. // Support: Promises/A+ section 2.3.3.3.4.1
  11693. // https://promisesaplus.com/#point-61
  11694. // Ignore post-resolution exceptions
  11695. if ( depth + 1 >= maxDepth ) {
  11696. // Only substitute handlers pass on context
  11697. // and multiple values (non-spec behavior)
  11698. if ( handler !== Thrower ) {
  11699. that = undefined;
  11700. args = [ e ];
  11701. }
  11702. deferred.rejectWith( that, args );
  11703. }
  11704. }
  11705. };
  11706. // Support: Promises/A+ section 2.3.3.3.1
  11707. // https://promisesaplus.com/#point-57
  11708. // Re-resolve promises immediately to dodge false rejection from
  11709. // subsequent errors
  11710. if ( depth ) {
  11711. process();
  11712. } else {
  11713. // Call an optional hook to record the stack, in case of exception
  11714. // since it's otherwise lost when execution goes async
  11715. if ( jQuery.Deferred.getStackHook ) {
  11716. process.stackTrace = jQuery.Deferred.getStackHook();
  11717. }
  11718. window.setTimeout( process );
  11719. }
  11720. };
  11721. }
  11722. return jQuery.Deferred( function( newDefer ) {
  11723. // progress_handlers.add( ... )
  11724. tuples[ 0 ][ 3 ].add(
  11725. resolve(
  11726. 0,
  11727. newDefer,
  11728. isFunction( onProgress ) ?
  11729. onProgress :
  11730. Identity,
  11731. newDefer.notifyWith
  11732. )
  11733. );
  11734. // fulfilled_handlers.add( ... )
  11735. tuples[ 1 ][ 3 ].add(
  11736. resolve(
  11737. 0,
  11738. newDefer,
  11739. isFunction( onFulfilled ) ?
  11740. onFulfilled :
  11741. Identity
  11742. )
  11743. );
  11744. // rejected_handlers.add( ... )
  11745. tuples[ 2 ][ 3 ].add(
  11746. resolve(
  11747. 0,
  11748. newDefer,
  11749. isFunction( onRejected ) ?
  11750. onRejected :
  11751. Thrower
  11752. )
  11753. );
  11754. } ).promise();
  11755. },
  11756. // Get a promise for this deferred
  11757. // If obj is provided, the promise aspect is added to the object
  11758. promise: function( obj ) {
  11759. return obj != null ? jQuery.extend( obj, promise ) : promise;
  11760. }
  11761. },
  11762. deferred = {};
  11763. // Add list-specific methods
  11764. jQuery.each( tuples, function( i, tuple ) {
  11765. var list = tuple[ 2 ],
  11766. stateString = tuple[ 5 ];
  11767. // promise.progress = list.add
  11768. // promise.done = list.add
  11769. // promise.fail = list.add
  11770. promise[ tuple[ 1 ] ] = list.add;
  11771. // Handle state
  11772. if ( stateString ) {
  11773. list.add(
  11774. function() {
  11775. // state = "resolved" (i.e., fulfilled)
  11776. // state = "rejected"
  11777. state = stateString;
  11778. },
  11779. // rejected_callbacks.disable
  11780. // fulfilled_callbacks.disable
  11781. tuples[ 3 - i ][ 2 ].disable,
  11782. // rejected_handlers.disable
  11783. // fulfilled_handlers.disable
  11784. tuples[ 3 - i ][ 3 ].disable,
  11785. // progress_callbacks.lock
  11786. tuples[ 0 ][ 2 ].lock,
  11787. // progress_handlers.lock
  11788. tuples[ 0 ][ 3 ].lock
  11789. );
  11790. }
  11791. // progress_handlers.fire
  11792. // fulfilled_handlers.fire
  11793. // rejected_handlers.fire
  11794. list.add( tuple[ 3 ].fire );
  11795. // deferred.notify = function() { deferred.notifyWith(...) }
  11796. // deferred.resolve = function() { deferred.resolveWith(...) }
  11797. // deferred.reject = function() { deferred.rejectWith(...) }
  11798. deferred[ tuple[ 0 ] ] = function() {
  11799. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  11800. return this;
  11801. };
  11802. // deferred.notifyWith = list.fireWith
  11803. // deferred.resolveWith = list.fireWith
  11804. // deferred.rejectWith = list.fireWith
  11805. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  11806. } );
  11807. // Make the deferred a promise
  11808. promise.promise( deferred );
  11809. // Call given func if any
  11810. if ( func ) {
  11811. func.call( deferred, deferred );
  11812. }
  11813. // All done!
  11814. return deferred;
  11815. },
  11816. // Deferred helper
  11817. when: function( singleValue ) {
  11818. var
  11819. // count of uncompleted subordinates
  11820. remaining = arguments.length,
  11821. // count of unprocessed arguments
  11822. i = remaining,
  11823. // subordinate fulfillment data
  11824. resolveContexts = Array( i ),
  11825. resolveValues = slice.call( arguments ),
  11826. // the master Deferred
  11827. master = jQuery.Deferred(),
  11828. // subordinate callback factory
  11829. updateFunc = function( i ) {
  11830. return function( value ) {
  11831. resolveContexts[ i ] = this;
  11832. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  11833. if ( !( --remaining ) ) {
  11834. master.resolveWith( resolveContexts, resolveValues );
  11835. }
  11836. };
  11837. };
  11838. // Single- and empty arguments are adopted like Promise.resolve
  11839. if ( remaining <= 1 ) {
  11840. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  11841. !remaining );
  11842. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  11843. if ( master.state() === "pending" ||
  11844. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  11845. return master.then();
  11846. }
  11847. }
  11848. // Multiple arguments are aggregated like Promise.all array elements
  11849. while ( i-- ) {
  11850. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  11851. }
  11852. return master.promise();
  11853. }
  11854. } );
  11855. // These usually indicate a programmer mistake during development,
  11856. // warn about them ASAP rather than swallowing them by default.
  11857. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  11858. jQuery.Deferred.exceptionHook = function( error, stack ) {
  11859. // Support: IE 8 - 9 only
  11860. // Console exists when dev tools are open, which can happen at any time
  11861. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  11862. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  11863. }
  11864. };
  11865. jQuery.readyException = function( error ) {
  11866. window.setTimeout( function() {
  11867. throw error;
  11868. } );
  11869. };
  11870. // The deferred used on DOM ready
  11871. var readyList = jQuery.Deferred();
  11872. jQuery.fn.ready = function( fn ) {
  11873. readyList
  11874. .then( fn )
  11875. // Wrap jQuery.readyException in a function so that the lookup
  11876. // happens at the time of error handling instead of callback
  11877. // registration.
  11878. .catch( function( error ) {
  11879. jQuery.readyException( error );
  11880. } );
  11881. return this;
  11882. };
  11883. jQuery.extend( {
  11884. // Is the DOM ready to be used? Set to true once it occurs.
  11885. isReady: false,
  11886. // A counter to track how many items to wait for before
  11887. // the ready event fires. See #6781
  11888. readyWait: 1,
  11889. // Handle when the DOM is ready
  11890. ready: function( wait ) {
  11891. // Abort if there are pending holds or we're already ready
  11892. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  11893. return;
  11894. }
  11895. // Remember that the DOM is ready
  11896. jQuery.isReady = true;
  11897. // If a normal DOM Ready event fired, decrement, and wait if need be
  11898. if ( wait !== true && --jQuery.readyWait > 0 ) {
  11899. return;
  11900. }
  11901. // If there are functions bound, to execute
  11902. readyList.resolveWith( document, [ jQuery ] );
  11903. }
  11904. } );
  11905. jQuery.ready.then = readyList.then;
  11906. // The ready event handler and self cleanup method
  11907. function completed() {
  11908. document.removeEventListener( "DOMContentLoaded", completed );
  11909. window.removeEventListener( "load", completed );
  11910. jQuery.ready();
  11911. }
  11912. // Catch cases where $(document).ready() is called
  11913. // after the browser event has already occurred.
  11914. // Support: IE <=9 - 10 only
  11915. // Older IE sometimes signals "interactive" too soon
  11916. if ( document.readyState === "complete" ||
  11917. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  11918. // Handle it asynchronously to allow scripts the opportunity to delay ready
  11919. window.setTimeout( jQuery.ready );
  11920. } else {
  11921. // Use the handy event callback
  11922. document.addEventListener( "DOMContentLoaded", completed );
  11923. // A fallback to window.onload, that will always work
  11924. window.addEventListener( "load", completed );
  11925. }
  11926. // Multifunctional method to get and set values of a collection
  11927. // The value/s can optionally be executed if it's a function
  11928. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  11929. var i = 0,
  11930. len = elems.length,
  11931. bulk = key == null;
  11932. // Sets many values
  11933. if ( toType( key ) === "object" ) {
  11934. chainable = true;
  11935. for ( i in key ) {
  11936. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  11937. }
  11938. // Sets one value
  11939. } else if ( value !== undefined ) {
  11940. chainable = true;
  11941. if ( !isFunction( value ) ) {
  11942. raw = true;
  11943. }
  11944. if ( bulk ) {
  11945. // Bulk operations run against the entire set
  11946. if ( raw ) {
  11947. fn.call( elems, value );
  11948. fn = null;
  11949. // ...except when executing function values
  11950. } else {
  11951. bulk = fn;
  11952. fn = function( elem, key, value ) {
  11953. return bulk.call( jQuery( elem ), value );
  11954. };
  11955. }
  11956. }
  11957. if ( fn ) {
  11958. for ( ; i < len; i++ ) {
  11959. fn(
  11960. elems[ i ], key, raw ?
  11961. value :
  11962. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  11963. );
  11964. }
  11965. }
  11966. }
  11967. if ( chainable ) {
  11968. return elems;
  11969. }
  11970. // Gets
  11971. if ( bulk ) {
  11972. return fn.call( elems );
  11973. }
  11974. return len ? fn( elems[ 0 ], key ) : emptyGet;
  11975. };
  11976. // Matches dashed string for camelizing
  11977. var rmsPrefix = /^-ms-/,
  11978. rdashAlpha = /-([a-z])/g;
  11979. // Used by camelCase as callback to replace()
  11980. function fcamelCase( all, letter ) {
  11981. return letter.toUpperCase();
  11982. }
  11983. // Convert dashed to camelCase; used by the css and data modules
  11984. // Support: IE <=9 - 11, Edge 12 - 15
  11985. // Microsoft forgot to hump their vendor prefix (#9572)
  11986. function camelCase( string ) {
  11987. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  11988. }
  11989. var acceptData = function( owner ) {
  11990. // Accepts only:
  11991. // - Node
  11992. // - Node.ELEMENT_NODE
  11993. // - Node.DOCUMENT_NODE
  11994. // - Object
  11995. // - Any
  11996. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  11997. };
  11998. function Data() {
  11999. this.expando = jQuery.expando + Data.uid++;
  12000. }
  12001. Data.uid = 1;
  12002. Data.prototype = {
  12003. cache: function( owner ) {
  12004. // Check if the owner object already has a cache
  12005. var value = owner[ this.expando ];
  12006. // If not, create one
  12007. if ( !value ) {
  12008. value = {};
  12009. // We can accept data for non-element nodes in modern browsers,
  12010. // but we should not, see #8335.
  12011. // Always return an empty object.
  12012. if ( acceptData( owner ) ) {
  12013. // If it is a node unlikely to be stringify-ed or looped over
  12014. // use plain assignment
  12015. if ( owner.nodeType ) {
  12016. owner[ this.expando ] = value;
  12017. // Otherwise secure it in a non-enumerable property
  12018. // configurable must be true to allow the property to be
  12019. // deleted when data is removed
  12020. } else {
  12021. Object.defineProperty( owner, this.expando, {
  12022. value: value,
  12023. configurable: true
  12024. } );
  12025. }
  12026. }
  12027. }
  12028. return value;
  12029. },
  12030. set: function( owner, data, value ) {
  12031. var prop,
  12032. cache = this.cache( owner );
  12033. // Handle: [ owner, key, value ] args
  12034. // Always use camelCase key (gh-2257)
  12035. if ( typeof data === "string" ) {
  12036. cache[ camelCase( data ) ] = value;
  12037. // Handle: [ owner, { properties } ] args
  12038. } else {
  12039. // Copy the properties one-by-one to the cache object
  12040. for ( prop in data ) {
  12041. cache[ camelCase( prop ) ] = data[ prop ];
  12042. }
  12043. }
  12044. return cache;
  12045. },
  12046. get: function( owner, key ) {
  12047. return key === undefined ?
  12048. this.cache( owner ) :
  12049. // Always use camelCase key (gh-2257)
  12050. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  12051. },
  12052. access: function( owner, key, value ) {
  12053. // In cases where either:
  12054. //
  12055. // 1. No key was specified
  12056. // 2. A string key was specified, but no value provided
  12057. //
  12058. // Take the "read" path and allow the get method to determine
  12059. // which value to return, respectively either:
  12060. //
  12061. // 1. The entire cache object
  12062. // 2. The data stored at the key
  12063. //
  12064. if ( key === undefined ||
  12065. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  12066. return this.get( owner, key );
  12067. }
  12068. // When the key is not a string, or both a key and value
  12069. // are specified, set or extend (existing objects) with either:
  12070. //
  12071. // 1. An object of properties
  12072. // 2. A key and value
  12073. //
  12074. this.set( owner, key, value );
  12075. // Since the "set" path can have two possible entry points
  12076. // return the expected data based on which path was taken[*]
  12077. return value !== undefined ? value : key;
  12078. },
  12079. remove: function( owner, key ) {
  12080. var i,
  12081. cache = owner[ this.expando ];
  12082. if ( cache === undefined ) {
  12083. return;
  12084. }
  12085. if ( key !== undefined ) {
  12086. // Support array or space separated string of keys
  12087. if ( Array.isArray( key ) ) {
  12088. // If key is an array of keys...
  12089. // We always set camelCase keys, so remove that.
  12090. key = key.map( camelCase );
  12091. } else {
  12092. key = camelCase( key );
  12093. // If a key with the spaces exists, use it.
  12094. // Otherwise, create an array by matching non-whitespace
  12095. key = key in cache ?
  12096. [ key ] :
  12097. ( key.match( rnothtmlwhite ) || [] );
  12098. }
  12099. i = key.length;
  12100. while ( i-- ) {
  12101. delete cache[ key[ i ] ];
  12102. }
  12103. }
  12104. // Remove the expando if there's no more data
  12105. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  12106. // Support: Chrome <=35 - 45
  12107. // Webkit & Blink performance suffers when deleting properties
  12108. // from DOM nodes, so set to undefined instead
  12109. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  12110. if ( owner.nodeType ) {
  12111. owner[ this.expando ] = undefined;
  12112. } else {
  12113. delete owner[ this.expando ];
  12114. }
  12115. }
  12116. },
  12117. hasData: function( owner ) {
  12118. var cache = owner[ this.expando ];
  12119. return cache !== undefined && !jQuery.isEmptyObject( cache );
  12120. }
  12121. };
  12122. var dataPriv = new Data();
  12123. var dataUser = new Data();
  12124. // Implementation Summary
  12125. //
  12126. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  12127. // 2. Improve the module's maintainability by reducing the storage
  12128. // paths to a single mechanism.
  12129. // 3. Use the same single mechanism to support "private" and "user" data.
  12130. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  12131. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  12132. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  12133. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  12134. rmultiDash = /[A-Z]/g;
  12135. function getData( data ) {
  12136. if ( data === "true" ) {
  12137. return true;
  12138. }
  12139. if ( data === "false" ) {
  12140. return false;
  12141. }
  12142. if ( data === "null" ) {
  12143. return null;
  12144. }
  12145. // Only convert to a number if it doesn't change the string
  12146. if ( data === +data + "" ) {
  12147. return +data;
  12148. }
  12149. if ( rbrace.test( data ) ) {
  12150. return JSON.parse( data );
  12151. }
  12152. return data;
  12153. }
  12154. function dataAttr( elem, key, data ) {
  12155. var name;
  12156. // If nothing was found internally, try to fetch any
  12157. // data from the HTML5 data-* attribute
  12158. if ( data === undefined && elem.nodeType === 1 ) {
  12159. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  12160. data = elem.getAttribute( name );
  12161. if ( typeof data === "string" ) {
  12162. try {
  12163. data = getData( data );
  12164. } catch ( e ) {}
  12165. // Make sure we set the data so it isn't changed later
  12166. dataUser.set( elem, key, data );
  12167. } else {
  12168. data = undefined;
  12169. }
  12170. }
  12171. return data;
  12172. }
  12173. jQuery.extend( {
  12174. hasData: function( elem ) {
  12175. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  12176. },
  12177. data: function( elem, name, data ) {
  12178. return dataUser.access( elem, name, data );
  12179. },
  12180. removeData: function( elem, name ) {
  12181. dataUser.remove( elem, name );
  12182. },
  12183. // TODO: Now that all calls to _data and _removeData have been replaced
  12184. // with direct calls to dataPriv methods, these can be deprecated.
  12185. _data: function( elem, name, data ) {
  12186. return dataPriv.access( elem, name, data );
  12187. },
  12188. _removeData: function( elem, name ) {
  12189. dataPriv.remove( elem, name );
  12190. }
  12191. } );
  12192. jQuery.fn.extend( {
  12193. data: function( key, value ) {
  12194. var i, name, data,
  12195. elem = this[ 0 ],
  12196. attrs = elem && elem.attributes;
  12197. // Gets all values
  12198. if ( key === undefined ) {
  12199. if ( this.length ) {
  12200. data = dataUser.get( elem );
  12201. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  12202. i = attrs.length;
  12203. while ( i-- ) {
  12204. // Support: IE 11 only
  12205. // The attrs elements can be null (#14894)
  12206. if ( attrs[ i ] ) {
  12207. name = attrs[ i ].name;
  12208. if ( name.indexOf( "data-" ) === 0 ) {
  12209. name = camelCase( name.slice( 5 ) );
  12210. dataAttr( elem, name, data[ name ] );
  12211. }
  12212. }
  12213. }
  12214. dataPriv.set( elem, "hasDataAttrs", true );
  12215. }
  12216. }
  12217. return data;
  12218. }
  12219. // Sets multiple values
  12220. if ( typeof key === "object" ) {
  12221. return this.each( function() {
  12222. dataUser.set( this, key );
  12223. } );
  12224. }
  12225. return access( this, function( value ) {
  12226. var data;
  12227. // The calling jQuery object (element matches) is not empty
  12228. // (and therefore has an element appears at this[ 0 ]) and the
  12229. // `value` parameter was not undefined. An empty jQuery object
  12230. // will result in `undefined` for elem = this[ 0 ] which will
  12231. // throw an exception if an attempt to read a data cache is made.
  12232. if ( elem && value === undefined ) {
  12233. // Attempt to get data from the cache
  12234. // The key will always be camelCased in Data
  12235. data = dataUser.get( elem, key );
  12236. if ( data !== undefined ) {
  12237. return data;
  12238. }
  12239. // Attempt to "discover" the data in
  12240. // HTML5 custom data-* attrs
  12241. data = dataAttr( elem, key );
  12242. if ( data !== undefined ) {
  12243. return data;
  12244. }
  12245. // We tried really hard, but the data doesn't exist.
  12246. return;
  12247. }
  12248. // Set the data...
  12249. this.each( function() {
  12250. // We always store the camelCased key
  12251. dataUser.set( this, key, value );
  12252. } );
  12253. }, null, value, arguments.length > 1, null, true );
  12254. },
  12255. removeData: function( key ) {
  12256. return this.each( function() {
  12257. dataUser.remove( this, key );
  12258. } );
  12259. }
  12260. } );
  12261. jQuery.extend( {
  12262. queue: function( elem, type, data ) {
  12263. var queue;
  12264. if ( elem ) {
  12265. type = ( type || "fx" ) + "queue";
  12266. queue = dataPriv.get( elem, type );
  12267. // Speed up dequeue by getting out quickly if this is just a lookup
  12268. if ( data ) {
  12269. if ( !queue || Array.isArray( data ) ) {
  12270. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  12271. } else {
  12272. queue.push( data );
  12273. }
  12274. }
  12275. return queue || [];
  12276. }
  12277. },
  12278. dequeue: function( elem, type ) {
  12279. type = type || "fx";
  12280. var queue = jQuery.queue( elem, type ),
  12281. startLength = queue.length,
  12282. fn = queue.shift(),
  12283. hooks = jQuery._queueHooks( elem, type ),
  12284. next = function() {
  12285. jQuery.dequeue( elem, type );
  12286. };
  12287. // If the fx queue is dequeued, always remove the progress sentinel
  12288. if ( fn === "inprogress" ) {
  12289. fn = queue.shift();
  12290. startLength--;
  12291. }
  12292. if ( fn ) {
  12293. // Add a progress sentinel to prevent the fx queue from being
  12294. // automatically dequeued
  12295. if ( type === "fx" ) {
  12296. queue.unshift( "inprogress" );
  12297. }
  12298. // Clear up the last queue stop function
  12299. delete hooks.stop;
  12300. fn.call( elem, next, hooks );
  12301. }
  12302. if ( !startLength && hooks ) {
  12303. hooks.empty.fire();
  12304. }
  12305. },
  12306. // Not public - generate a queueHooks object, or return the current one
  12307. _queueHooks: function( elem, type ) {
  12308. var key = type + "queueHooks";
  12309. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  12310. empty: jQuery.Callbacks( "once memory" ).add( function() {
  12311. dataPriv.remove( elem, [ type + "queue", key ] );
  12312. } )
  12313. } );
  12314. }
  12315. } );
  12316. jQuery.fn.extend( {
  12317. queue: function( type, data ) {
  12318. var setter = 2;
  12319. if ( typeof type !== "string" ) {
  12320. data = type;
  12321. type = "fx";
  12322. setter--;
  12323. }
  12324. if ( arguments.length < setter ) {
  12325. return jQuery.queue( this[ 0 ], type );
  12326. }
  12327. return data === undefined ?
  12328. this :
  12329. this.each( function() {
  12330. var queue = jQuery.queue( this, type, data );
  12331. // Ensure a hooks for this queue
  12332. jQuery._queueHooks( this, type );
  12333. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  12334. jQuery.dequeue( this, type );
  12335. }
  12336. } );
  12337. },
  12338. dequeue: function( type ) {
  12339. return this.each( function() {
  12340. jQuery.dequeue( this, type );
  12341. } );
  12342. },
  12343. clearQueue: function( type ) {
  12344. return this.queue( type || "fx", [] );
  12345. },
  12346. // Get a promise resolved when queues of a certain type
  12347. // are emptied (fx is the type by default)
  12348. promise: function( type, obj ) {
  12349. var tmp,
  12350. count = 1,
  12351. defer = jQuery.Deferred(),
  12352. elements = this,
  12353. i = this.length,
  12354. resolve = function() {
  12355. if ( !( --count ) ) {
  12356. defer.resolveWith( elements, [ elements ] );
  12357. }
  12358. };
  12359. if ( typeof type !== "string" ) {
  12360. obj = type;
  12361. type = undefined;
  12362. }
  12363. type = type || "fx";
  12364. while ( i-- ) {
  12365. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  12366. if ( tmp && tmp.empty ) {
  12367. count++;
  12368. tmp.empty.add( resolve );
  12369. }
  12370. }
  12371. resolve();
  12372. return defer.promise( obj );
  12373. }
  12374. } );
  12375. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  12376. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  12377. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  12378. var documentElement = document.documentElement;
  12379. var isAttached = function( elem ) {
  12380. return jQuery.contains( elem.ownerDocument, elem );
  12381. },
  12382. composed = { composed: true };
  12383. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  12384. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  12385. // Support: iOS 10.0-10.2 only
  12386. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  12387. // leading to errors. We need to check for `getRootNode`.
  12388. if ( documentElement.getRootNode ) {
  12389. isAttached = function( elem ) {
  12390. return jQuery.contains( elem.ownerDocument, elem ) ||
  12391. elem.getRootNode( composed ) === elem.ownerDocument;
  12392. };
  12393. }
  12394. var isHiddenWithinTree = function( elem, el ) {
  12395. // isHiddenWithinTree might be called from jQuery#filter function;
  12396. // in that case, element will be second argument
  12397. elem = el || elem;
  12398. // Inline style trumps all
  12399. return elem.style.display === "none" ||
  12400. elem.style.display === "" &&
  12401. // Otherwise, check computed style
  12402. // Support: Firefox <=43 - 45
  12403. // Disconnected elements can have computed display: none, so first confirm that elem is
  12404. // in the document.
  12405. isAttached( elem ) &&
  12406. jQuery.css( elem, "display" ) === "none";
  12407. };
  12408. var swap = function( elem, options, callback, args ) {
  12409. var ret, name,
  12410. old = {};
  12411. // Remember the old values, and insert the new ones
  12412. for ( name in options ) {
  12413. old[ name ] = elem.style[ name ];
  12414. elem.style[ name ] = options[ name ];
  12415. }
  12416. ret = callback.apply( elem, args || [] );
  12417. // Revert the old values
  12418. for ( name in options ) {
  12419. elem.style[ name ] = old[ name ];
  12420. }
  12421. return ret;
  12422. };
  12423. function adjustCSS( elem, prop, valueParts, tween ) {
  12424. var adjusted, scale,
  12425. maxIterations = 20,
  12426. currentValue = tween ?
  12427. function() {
  12428. return tween.cur();
  12429. } :
  12430. function() {
  12431. return jQuery.css( elem, prop, "" );
  12432. },
  12433. initial = currentValue(),
  12434. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  12435. // Starting value computation is required for potential unit mismatches
  12436. initialInUnit = elem.nodeType &&
  12437. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  12438. rcssNum.exec( jQuery.css( elem, prop ) );
  12439. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  12440. // Support: Firefox <=54
  12441. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  12442. initial = initial / 2;
  12443. // Trust units reported by jQuery.css
  12444. unit = unit || initialInUnit[ 3 ];
  12445. // Iteratively approximate from a nonzero starting point
  12446. initialInUnit = +initial || 1;
  12447. while ( maxIterations-- ) {
  12448. // Evaluate and update our best guess (doubling guesses that zero out).
  12449. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  12450. jQuery.style( elem, prop, initialInUnit + unit );
  12451. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  12452. maxIterations = 0;
  12453. }
  12454. initialInUnit = initialInUnit / scale;
  12455. }
  12456. initialInUnit = initialInUnit * 2;
  12457. jQuery.style( elem, prop, initialInUnit + unit );
  12458. // Make sure we update the tween properties later on
  12459. valueParts = valueParts || [];
  12460. }
  12461. if ( valueParts ) {
  12462. initialInUnit = +initialInUnit || +initial || 0;
  12463. // Apply relative offset (+=/-=) if specified
  12464. adjusted = valueParts[ 1 ] ?
  12465. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  12466. +valueParts[ 2 ];
  12467. if ( tween ) {
  12468. tween.unit = unit;
  12469. tween.start = initialInUnit;
  12470. tween.end = adjusted;
  12471. }
  12472. }
  12473. return adjusted;
  12474. }
  12475. var defaultDisplayMap = {};
  12476. function getDefaultDisplay( elem ) {
  12477. var temp,
  12478. doc = elem.ownerDocument,
  12479. nodeName = elem.nodeName,
  12480. display = defaultDisplayMap[ nodeName ];
  12481. if ( display ) {
  12482. return display;
  12483. }
  12484. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  12485. display = jQuery.css( temp, "display" );
  12486. temp.parentNode.removeChild( temp );
  12487. if ( display === "none" ) {
  12488. display = "block";
  12489. }
  12490. defaultDisplayMap[ nodeName ] = display;
  12491. return display;
  12492. }
  12493. function showHide( elements, show ) {
  12494. var display, elem,
  12495. values = [],
  12496. index = 0,
  12497. length = elements.length;
  12498. // Determine new display value for elements that need to change
  12499. for ( ; index < length; index++ ) {
  12500. elem = elements[ index ];
  12501. if ( !elem.style ) {
  12502. continue;
  12503. }
  12504. display = elem.style.display;
  12505. if ( show ) {
  12506. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  12507. // check is required in this first loop unless we have a nonempty display value (either
  12508. // inline or about-to-be-restored)
  12509. if ( display === "none" ) {
  12510. values[ index ] = dataPriv.get( elem, "display" ) || null;
  12511. if ( !values[ index ] ) {
  12512. elem.style.display = "";
  12513. }
  12514. }
  12515. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  12516. values[ index ] = getDefaultDisplay( elem );
  12517. }
  12518. } else {
  12519. if ( display !== "none" ) {
  12520. values[ index ] = "none";
  12521. // Remember what we're overwriting
  12522. dataPriv.set( elem, "display", display );
  12523. }
  12524. }
  12525. }
  12526. // Set the display of the elements in a second loop to avoid constant reflow
  12527. for ( index = 0; index < length; index++ ) {
  12528. if ( values[ index ] != null ) {
  12529. elements[ index ].style.display = values[ index ];
  12530. }
  12531. }
  12532. return elements;
  12533. }
  12534. jQuery.fn.extend( {
  12535. show: function() {
  12536. return showHide( this, true );
  12537. },
  12538. hide: function() {
  12539. return showHide( this );
  12540. },
  12541. toggle: function( state ) {
  12542. if ( typeof state === "boolean" ) {
  12543. return state ? this.show() : this.hide();
  12544. }
  12545. return this.each( function() {
  12546. if ( isHiddenWithinTree( this ) ) {
  12547. jQuery( this ).show();
  12548. } else {
  12549. jQuery( this ).hide();
  12550. }
  12551. } );
  12552. }
  12553. } );
  12554. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  12555. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  12556. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  12557. // We have to close these tags to support XHTML (#13200)
  12558. var wrapMap = {
  12559. // Support: IE <=9 only
  12560. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  12561. // XHTML parsers do not magically insert elements in the
  12562. // same way that tag soup parsers do. So we cannot shorten
  12563. // this by omitting <tbody> or other required elements.
  12564. thead: [ 1, "<table>", "</table>" ],
  12565. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  12566. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  12567. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  12568. _default: [ 0, "", "" ]
  12569. };
  12570. // Support: IE <=9 only
  12571. wrapMap.optgroup = wrapMap.option;
  12572. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  12573. wrapMap.th = wrapMap.td;
  12574. function getAll( context, tag ) {
  12575. // Support: IE <=9 - 11 only
  12576. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  12577. var ret;
  12578. if ( typeof context.getElementsByTagName !== "undefined" ) {
  12579. ret = context.getElementsByTagName( tag || "*" );
  12580. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  12581. ret = context.querySelectorAll( tag || "*" );
  12582. } else {
  12583. ret = [];
  12584. }
  12585. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  12586. return jQuery.merge( [ context ], ret );
  12587. }
  12588. return ret;
  12589. }
  12590. // Mark scripts as having already been evaluated
  12591. function setGlobalEval( elems, refElements ) {
  12592. var i = 0,
  12593. l = elems.length;
  12594. for ( ; i < l; i++ ) {
  12595. dataPriv.set(
  12596. elems[ i ],
  12597. "globalEval",
  12598. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  12599. );
  12600. }
  12601. }
  12602. var rhtml = /<|&#?\w+;/;
  12603. function buildFragment( elems, context, scripts, selection, ignored ) {
  12604. var elem, tmp, tag, wrap, attached, j,
  12605. fragment = context.createDocumentFragment(),
  12606. nodes = [],
  12607. i = 0,
  12608. l = elems.length;
  12609. for ( ; i < l; i++ ) {
  12610. elem = elems[ i ];
  12611. if ( elem || elem === 0 ) {
  12612. // Add nodes directly
  12613. if ( toType( elem ) === "object" ) {
  12614. // Support: Android <=4.0 only, PhantomJS 1 only
  12615. // push.apply(_, arraylike) throws on ancient WebKit
  12616. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  12617. // Convert non-html into a text node
  12618. } else if ( !rhtml.test( elem ) ) {
  12619. nodes.push( context.createTextNode( elem ) );
  12620. // Convert html into DOM nodes
  12621. } else {
  12622. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  12623. // Deserialize a standard representation
  12624. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  12625. wrap = wrapMap[ tag ] || wrapMap._default;
  12626. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  12627. // Descend through wrappers to the right content
  12628. j = wrap[ 0 ];
  12629. while ( j-- ) {
  12630. tmp = tmp.lastChild;
  12631. }
  12632. // Support: Android <=4.0 only, PhantomJS 1 only
  12633. // push.apply(_, arraylike) throws on ancient WebKit
  12634. jQuery.merge( nodes, tmp.childNodes );
  12635. // Remember the top-level container
  12636. tmp = fragment.firstChild;
  12637. // Ensure the created nodes are orphaned (#12392)
  12638. tmp.textContent = "";
  12639. }
  12640. }
  12641. }
  12642. // Remove wrapper from fragment
  12643. fragment.textContent = "";
  12644. i = 0;
  12645. while ( ( elem = nodes[ i++ ] ) ) {
  12646. // Skip elements already in the context collection (trac-4087)
  12647. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  12648. if ( ignored ) {
  12649. ignored.push( elem );
  12650. }
  12651. continue;
  12652. }
  12653. attached = isAttached( elem );
  12654. // Append to fragment
  12655. tmp = getAll( fragment.appendChild( elem ), "script" );
  12656. // Preserve script evaluation history
  12657. if ( attached ) {
  12658. setGlobalEval( tmp );
  12659. }
  12660. // Capture executables
  12661. if ( scripts ) {
  12662. j = 0;
  12663. while ( ( elem = tmp[ j++ ] ) ) {
  12664. if ( rscriptType.test( elem.type || "" ) ) {
  12665. scripts.push( elem );
  12666. }
  12667. }
  12668. }
  12669. }
  12670. return fragment;
  12671. }
  12672. ( function() {
  12673. var fragment = document.createDocumentFragment(),
  12674. div = fragment.appendChild( document.createElement( "div" ) ),
  12675. input = document.createElement( "input" );
  12676. // Support: Android 4.0 - 4.3 only
  12677. // Check state lost if the name is set (#11217)
  12678. // Support: Windows Web Apps (WWA)
  12679. // `name` and `type` must use .setAttribute for WWA (#14901)
  12680. input.setAttribute( "type", "radio" );
  12681. input.setAttribute( "checked", "checked" );
  12682. input.setAttribute( "name", "t" );
  12683. div.appendChild( input );
  12684. // Support: Android <=4.1 only
  12685. // Older WebKit doesn't clone checked state correctly in fragments
  12686. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  12687. // Support: IE <=11 only
  12688. // Make sure textarea (and checkbox) defaultValue is properly cloned
  12689. div.innerHTML = "<textarea>x</textarea>";
  12690. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  12691. } )();
  12692. var
  12693. rkeyEvent = /^key/,
  12694. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  12695. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  12696. function returnTrue() {
  12697. return true;
  12698. }
  12699. function returnFalse() {
  12700. return false;
  12701. }
  12702. // Support: IE <=9 - 11+
  12703. // focus() and blur() are asynchronous, except when they are no-op.
  12704. // So expect focus to be synchronous when the element is already active,
  12705. // and blur to be synchronous when the element is not already active.
  12706. // (focus and blur are always synchronous in other supported browsers,
  12707. // this just defines when we can count on it).
  12708. function expectSync( elem, type ) {
  12709. return ( elem === safeActiveElement() ) === ( type === "focus" );
  12710. }
  12711. // Support: IE <=9 only
  12712. // Accessing document.activeElement can throw unexpectedly
  12713. // https://bugs.jquery.com/ticket/13393
  12714. function safeActiveElement() {
  12715. try {
  12716. return document.activeElement;
  12717. } catch ( err ) { }
  12718. }
  12719. function on( elem, types, selector, data, fn, one ) {
  12720. var origFn, type;
  12721. // Types can be a map of types/handlers
  12722. if ( typeof types === "object" ) {
  12723. // ( types-Object, selector, data )
  12724. if ( typeof selector !== "string" ) {
  12725. // ( types-Object, data )
  12726. data = data || selector;
  12727. selector = undefined;
  12728. }
  12729. for ( type in types ) {
  12730. on( elem, type, selector, data, types[ type ], one );
  12731. }
  12732. return elem;
  12733. }
  12734. if ( data == null && fn == null ) {
  12735. // ( types, fn )
  12736. fn = selector;
  12737. data = selector = undefined;
  12738. } else if ( fn == null ) {
  12739. if ( typeof selector === "string" ) {
  12740. // ( types, selector, fn )
  12741. fn = data;
  12742. data = undefined;
  12743. } else {
  12744. // ( types, data, fn )
  12745. fn = data;
  12746. data = selector;
  12747. selector = undefined;
  12748. }
  12749. }
  12750. if ( fn === false ) {
  12751. fn = returnFalse;
  12752. } else if ( !fn ) {
  12753. return elem;
  12754. }
  12755. if ( one === 1 ) {
  12756. origFn = fn;
  12757. fn = function( event ) {
  12758. // Can use an empty set, since event contains the info
  12759. jQuery().off( event );
  12760. return origFn.apply( this, arguments );
  12761. };
  12762. // Use same guid so caller can remove using origFn
  12763. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  12764. }
  12765. return elem.each( function() {
  12766. jQuery.event.add( this, types, fn, data, selector );
  12767. } );
  12768. }
  12769. /*
  12770. * Helper functions for managing events -- not part of the public interface.
  12771. * Props to Dean Edwards' addEvent library for many of the ideas.
  12772. */
  12773. jQuery.event = {
  12774. global: {},
  12775. add: function( elem, types, handler, data, selector ) {
  12776. var handleObjIn, eventHandle, tmp,
  12777. events, t, handleObj,
  12778. special, handlers, type, namespaces, origType,
  12779. elemData = dataPriv.get( elem );
  12780. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  12781. if ( !elemData ) {
  12782. return;
  12783. }
  12784. // Caller can pass in an object of custom data in lieu of the handler
  12785. if ( handler.handler ) {
  12786. handleObjIn = handler;
  12787. handler = handleObjIn.handler;
  12788. selector = handleObjIn.selector;
  12789. }
  12790. // Ensure that invalid selectors throw exceptions at attach time
  12791. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  12792. if ( selector ) {
  12793. jQuery.find.matchesSelector( documentElement, selector );
  12794. }
  12795. // Make sure that the handler has a unique ID, used to find/remove it later
  12796. if ( !handler.guid ) {
  12797. handler.guid = jQuery.guid++;
  12798. }
  12799. // Init the element's event structure and main handler, if this is the first
  12800. if ( !( events = elemData.events ) ) {
  12801. events = elemData.events = {};
  12802. }
  12803. if ( !( eventHandle = elemData.handle ) ) {
  12804. eventHandle = elemData.handle = function( e ) {
  12805. // Discard the second event of a jQuery.event.trigger() and
  12806. // when an event is called after a page has unloaded
  12807. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  12808. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  12809. };
  12810. }
  12811. // Handle multiple events separated by a space
  12812. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12813. t = types.length;
  12814. while ( t-- ) {
  12815. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12816. type = origType = tmp[ 1 ];
  12817. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12818. // There *must* be a type, no attaching namespace-only handlers
  12819. if ( !type ) {
  12820. continue;
  12821. }
  12822. // If event changes its type, use the special event handlers for the changed type
  12823. special = jQuery.event.special[ type ] || {};
  12824. // If selector defined, determine special event api type, otherwise given type
  12825. type = ( selector ? special.delegateType : special.bindType ) || type;
  12826. // Update special based on newly reset type
  12827. special = jQuery.event.special[ type ] || {};
  12828. // handleObj is passed to all event handlers
  12829. handleObj = jQuery.extend( {
  12830. type: type,
  12831. origType: origType,
  12832. data: data,
  12833. handler: handler,
  12834. guid: handler.guid,
  12835. selector: selector,
  12836. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  12837. namespace: namespaces.join( "." )
  12838. }, handleObjIn );
  12839. // Init the event handler queue if we're the first
  12840. if ( !( handlers = events[ type ] ) ) {
  12841. handlers = events[ type ] = [];
  12842. handlers.delegateCount = 0;
  12843. // Only use addEventListener if the special events handler returns false
  12844. if ( !special.setup ||
  12845. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  12846. if ( elem.addEventListener ) {
  12847. elem.addEventListener( type, eventHandle );
  12848. }
  12849. }
  12850. }
  12851. if ( special.add ) {
  12852. special.add.call( elem, handleObj );
  12853. if ( !handleObj.handler.guid ) {
  12854. handleObj.handler.guid = handler.guid;
  12855. }
  12856. }
  12857. // Add to the element's handler list, delegates in front
  12858. if ( selector ) {
  12859. handlers.splice( handlers.delegateCount++, 0, handleObj );
  12860. } else {
  12861. handlers.push( handleObj );
  12862. }
  12863. // Keep track of which events have ever been used, for event optimization
  12864. jQuery.event.global[ type ] = true;
  12865. }
  12866. },
  12867. // Detach an event or set of events from an element
  12868. remove: function( elem, types, handler, selector, mappedTypes ) {
  12869. var j, origCount, tmp,
  12870. events, t, handleObj,
  12871. special, handlers, type, namespaces, origType,
  12872. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  12873. if ( !elemData || !( events = elemData.events ) ) {
  12874. return;
  12875. }
  12876. // Once for each type.namespace in types; type may be omitted
  12877. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12878. t = types.length;
  12879. while ( t-- ) {
  12880. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12881. type = origType = tmp[ 1 ];
  12882. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12883. // Unbind all events (on this namespace, if provided) for the element
  12884. if ( !type ) {
  12885. for ( type in events ) {
  12886. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  12887. }
  12888. continue;
  12889. }
  12890. special = jQuery.event.special[ type ] || {};
  12891. type = ( selector ? special.delegateType : special.bindType ) || type;
  12892. handlers = events[ type ] || [];
  12893. tmp = tmp[ 2 ] &&
  12894. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  12895. // Remove matching events
  12896. origCount = j = handlers.length;
  12897. while ( j-- ) {
  12898. handleObj = handlers[ j ];
  12899. if ( ( mappedTypes || origType === handleObj.origType ) &&
  12900. ( !handler || handler.guid === handleObj.guid ) &&
  12901. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  12902. ( !selector || selector === handleObj.selector ||
  12903. selector === "**" && handleObj.selector ) ) {
  12904. handlers.splice( j, 1 );
  12905. if ( handleObj.selector ) {
  12906. handlers.delegateCount--;
  12907. }
  12908. if ( special.remove ) {
  12909. special.remove.call( elem, handleObj );
  12910. }
  12911. }
  12912. }
  12913. // Remove generic event handler if we removed something and no more handlers exist
  12914. // (avoids potential for endless recursion during removal of special event handlers)
  12915. if ( origCount && !handlers.length ) {
  12916. if ( !special.teardown ||
  12917. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  12918. jQuery.removeEvent( elem, type, elemData.handle );
  12919. }
  12920. delete events[ type ];
  12921. }
  12922. }
  12923. // Remove data and the expando if it's no longer used
  12924. if ( jQuery.isEmptyObject( events ) ) {
  12925. dataPriv.remove( elem, "handle events" );
  12926. }
  12927. },
  12928. dispatch: function( nativeEvent ) {
  12929. // Make a writable jQuery.Event from the native event object
  12930. var event = jQuery.event.fix( nativeEvent );
  12931. var i, j, ret, matched, handleObj, handlerQueue,
  12932. args = new Array( arguments.length ),
  12933. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  12934. special = jQuery.event.special[ event.type ] || {};
  12935. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  12936. args[ 0 ] = event;
  12937. for ( i = 1; i < arguments.length; i++ ) {
  12938. args[ i ] = arguments[ i ];
  12939. }
  12940. event.delegateTarget = this;
  12941. // Call the preDispatch hook for the mapped type, and let it bail if desired
  12942. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  12943. return;
  12944. }
  12945. // Determine handlers
  12946. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  12947. // Run delegates first; they may want to stop propagation beneath us
  12948. i = 0;
  12949. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  12950. event.currentTarget = matched.elem;
  12951. j = 0;
  12952. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  12953. !event.isImmediatePropagationStopped() ) {
  12954. // If the event is namespaced, then each handler is only invoked if it is
  12955. // specially universal or its namespaces are a superset of the event's.
  12956. if ( !event.rnamespace || handleObj.namespace === false ||
  12957. event.rnamespace.test( handleObj.namespace ) ) {
  12958. event.handleObj = handleObj;
  12959. event.data = handleObj.data;
  12960. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  12961. handleObj.handler ).apply( matched.elem, args );
  12962. if ( ret !== undefined ) {
  12963. if ( ( event.result = ret ) === false ) {
  12964. event.preventDefault();
  12965. event.stopPropagation();
  12966. }
  12967. }
  12968. }
  12969. }
  12970. }
  12971. // Call the postDispatch hook for the mapped type
  12972. if ( special.postDispatch ) {
  12973. special.postDispatch.call( this, event );
  12974. }
  12975. return event.result;
  12976. },
  12977. handlers: function( event, handlers ) {
  12978. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  12979. handlerQueue = [],
  12980. delegateCount = handlers.delegateCount,
  12981. cur = event.target;
  12982. // Find delegate handlers
  12983. if ( delegateCount &&
  12984. // Support: IE <=9
  12985. // Black-hole SVG <use> instance trees (trac-13180)
  12986. cur.nodeType &&
  12987. // Support: Firefox <=42
  12988. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  12989. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  12990. // Support: IE 11 only
  12991. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  12992. !( event.type === "click" && event.button >= 1 ) ) {
  12993. for ( ; cur !== this; cur = cur.parentNode || this ) {
  12994. // Don't check non-elements (#13208)
  12995. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  12996. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  12997. matchedHandlers = [];
  12998. matchedSelectors = {};
  12999. for ( i = 0; i < delegateCount; i++ ) {
  13000. handleObj = handlers[ i ];
  13001. // Don't conflict with Object.prototype properties (#13203)
  13002. sel = handleObj.selector + " ";
  13003. if ( matchedSelectors[ sel ] === undefined ) {
  13004. matchedSelectors[ sel ] = handleObj.needsContext ?
  13005. jQuery( sel, this ).index( cur ) > -1 :
  13006. jQuery.find( sel, this, null, [ cur ] ).length;
  13007. }
  13008. if ( matchedSelectors[ sel ] ) {
  13009. matchedHandlers.push( handleObj );
  13010. }
  13011. }
  13012. if ( matchedHandlers.length ) {
  13013. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  13014. }
  13015. }
  13016. }
  13017. }
  13018. // Add the remaining (directly-bound) handlers
  13019. cur = this;
  13020. if ( delegateCount < handlers.length ) {
  13021. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  13022. }
  13023. return handlerQueue;
  13024. },
  13025. addProp: function( name, hook ) {
  13026. Object.defineProperty( jQuery.Event.prototype, name, {
  13027. enumerable: true,
  13028. configurable: true,
  13029. get: isFunction( hook ) ?
  13030. function() {
  13031. if ( this.originalEvent ) {
  13032. return hook( this.originalEvent );
  13033. }
  13034. } :
  13035. function() {
  13036. if ( this.originalEvent ) {
  13037. return this.originalEvent[ name ];
  13038. }
  13039. },
  13040. set: function( value ) {
  13041. Object.defineProperty( this, name, {
  13042. enumerable: true,
  13043. configurable: true,
  13044. writable: true,
  13045. value: value
  13046. } );
  13047. }
  13048. } );
  13049. },
  13050. fix: function( originalEvent ) {
  13051. return originalEvent[ jQuery.expando ] ?
  13052. originalEvent :
  13053. new jQuery.Event( originalEvent );
  13054. },
  13055. special: {
  13056. load: {
  13057. // Prevent triggered image.load events from bubbling to window.load
  13058. noBubble: true
  13059. },
  13060. click: {
  13061. // Utilize native event to ensure correct state for checkable inputs
  13062. setup: function( data ) {
  13063. // For mutual compressibility with _default, replace `this` access with a local var.
  13064. // `|| data` is dead code meant only to preserve the variable through minification.
  13065. var el = this || data;
  13066. // Claim the first handler
  13067. if ( rcheckableType.test( el.type ) &&
  13068. el.click && nodeName( el, "input" ) ) {
  13069. // dataPriv.set( el, "click", ... )
  13070. leverageNative( el, "click", returnTrue );
  13071. }
  13072. // Return false to allow normal processing in the caller
  13073. return false;
  13074. },
  13075. trigger: function( data ) {
  13076. // For mutual compressibility with _default, replace `this` access with a local var.
  13077. // `|| data` is dead code meant only to preserve the variable through minification.
  13078. var el = this || data;
  13079. // Force setup before triggering a click
  13080. if ( rcheckableType.test( el.type ) &&
  13081. el.click && nodeName( el, "input" ) ) {
  13082. leverageNative( el, "click" );
  13083. }
  13084. // Return non-false to allow normal event-path propagation
  13085. return true;
  13086. },
  13087. // For cross-browser consistency, suppress native .click() on links
  13088. // Also prevent it if we're currently inside a leveraged native-event stack
  13089. _default: function( event ) {
  13090. var target = event.target;
  13091. return rcheckableType.test( target.type ) &&
  13092. target.click && nodeName( target, "input" ) &&
  13093. dataPriv.get( target, "click" ) ||
  13094. nodeName( target, "a" );
  13095. }
  13096. },
  13097. beforeunload: {
  13098. postDispatch: function( event ) {
  13099. // Support: Firefox 20+
  13100. // Firefox doesn't alert if the returnValue field is not set.
  13101. if ( event.result !== undefined && event.originalEvent ) {
  13102. event.originalEvent.returnValue = event.result;
  13103. }
  13104. }
  13105. }
  13106. }
  13107. };
  13108. // Ensure the presence of an event listener that handles manually-triggered
  13109. // synthetic events by interrupting progress until reinvoked in response to
  13110. // *native* events that it fires directly, ensuring that state changes have
  13111. // already occurred before other listeners are invoked.
  13112. function leverageNative( el, type, expectSync ) {
  13113. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  13114. if ( !expectSync ) {
  13115. if ( dataPriv.get( el, type ) === undefined ) {
  13116. jQuery.event.add( el, type, returnTrue );
  13117. }
  13118. return;
  13119. }
  13120. // Register the controller as a special universal handler for all event namespaces
  13121. dataPriv.set( el, type, false );
  13122. jQuery.event.add( el, type, {
  13123. namespace: false,
  13124. handler: function( event ) {
  13125. var notAsync, result,
  13126. saved = dataPriv.get( this, type );
  13127. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  13128. // Interrupt processing of the outer synthetic .trigger()ed event
  13129. // Saved data should be false in such cases, but might be a leftover capture object
  13130. // from an async native handler (gh-4350)
  13131. if ( !saved.length ) {
  13132. // Store arguments for use when handling the inner native event
  13133. // There will always be at least one argument (an event object), so this array
  13134. // will not be confused with a leftover capture object.
  13135. saved = slice.call( arguments );
  13136. dataPriv.set( this, type, saved );
  13137. // Trigger the native event and capture its result
  13138. // Support: IE <=9 - 11+
  13139. // focus() and blur() are asynchronous
  13140. notAsync = expectSync( this, type );
  13141. this[ type ]();
  13142. result = dataPriv.get( this, type );
  13143. if ( saved !== result || notAsync ) {
  13144. dataPriv.set( this, type, false );
  13145. } else {
  13146. result = {};
  13147. }
  13148. if ( saved !== result ) {
  13149. // Cancel the outer synthetic event
  13150. event.stopImmediatePropagation();
  13151. event.preventDefault();
  13152. return result.value;
  13153. }
  13154. // If this is an inner synthetic event for an event with a bubbling surrogate
  13155. // (focus or blur), assume that the surrogate already propagated from triggering the
  13156. // native event and prevent that from happening again here.
  13157. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  13158. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  13159. // less bad than duplication.
  13160. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  13161. event.stopPropagation();
  13162. }
  13163. // If this is a native event triggered above, everything is now in order
  13164. // Fire an inner synthetic event with the original arguments
  13165. } else if ( saved.length ) {
  13166. // ...and capture the result
  13167. dataPriv.set( this, type, {
  13168. value: jQuery.event.trigger(
  13169. // Support: IE <=9 - 11+
  13170. // Extend with the prototype to reset the above stopImmediatePropagation()
  13171. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  13172. saved.slice( 1 ),
  13173. this
  13174. )
  13175. } );
  13176. // Abort handling of the native event
  13177. event.stopImmediatePropagation();
  13178. }
  13179. }
  13180. } );
  13181. }
  13182. jQuery.removeEvent = function( elem, type, handle ) {
  13183. // This "if" is needed for plain objects
  13184. if ( elem.removeEventListener ) {
  13185. elem.removeEventListener( type, handle );
  13186. }
  13187. };
  13188. jQuery.Event = function( src, props ) {
  13189. // Allow instantiation without the 'new' keyword
  13190. if ( !( this instanceof jQuery.Event ) ) {
  13191. return new jQuery.Event( src, props );
  13192. }
  13193. // Event object
  13194. if ( src && src.type ) {
  13195. this.originalEvent = src;
  13196. this.type = src.type;
  13197. // Events bubbling up the document may have been marked as prevented
  13198. // by a handler lower down the tree; reflect the correct value.
  13199. this.isDefaultPrevented = src.defaultPrevented ||
  13200. src.defaultPrevented === undefined &&
  13201. // Support: Android <=2.3 only
  13202. src.returnValue === false ?
  13203. returnTrue :
  13204. returnFalse;
  13205. // Create target properties
  13206. // Support: Safari <=6 - 7 only
  13207. // Target should not be a text node (#504, #13143)
  13208. this.target = ( src.target && src.target.nodeType === 3 ) ?
  13209. src.target.parentNode :
  13210. src.target;
  13211. this.currentTarget = src.currentTarget;
  13212. this.relatedTarget = src.relatedTarget;
  13213. // Event type
  13214. } else {
  13215. this.type = src;
  13216. }
  13217. // Put explicitly provided properties onto the event object
  13218. if ( props ) {
  13219. jQuery.extend( this, props );
  13220. }
  13221. // Create a timestamp if incoming event doesn't have one
  13222. this.timeStamp = src && src.timeStamp || Date.now();
  13223. // Mark it as fixed
  13224. this[ jQuery.expando ] = true;
  13225. };
  13226. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  13227. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  13228. jQuery.Event.prototype = {
  13229. constructor: jQuery.Event,
  13230. isDefaultPrevented: returnFalse,
  13231. isPropagationStopped: returnFalse,
  13232. isImmediatePropagationStopped: returnFalse,
  13233. isSimulated: false,
  13234. preventDefault: function() {
  13235. var e = this.originalEvent;
  13236. this.isDefaultPrevented = returnTrue;
  13237. if ( e && !this.isSimulated ) {
  13238. e.preventDefault();
  13239. }
  13240. },
  13241. stopPropagation: function() {
  13242. var e = this.originalEvent;
  13243. this.isPropagationStopped = returnTrue;
  13244. if ( e && !this.isSimulated ) {
  13245. e.stopPropagation();
  13246. }
  13247. },
  13248. stopImmediatePropagation: function() {
  13249. var e = this.originalEvent;
  13250. this.isImmediatePropagationStopped = returnTrue;
  13251. if ( e && !this.isSimulated ) {
  13252. e.stopImmediatePropagation();
  13253. }
  13254. this.stopPropagation();
  13255. }
  13256. };
  13257. // Includes all common event props including KeyEvent and MouseEvent specific props
  13258. jQuery.each( {
  13259. altKey: true,
  13260. bubbles: true,
  13261. cancelable: true,
  13262. changedTouches: true,
  13263. ctrlKey: true,
  13264. detail: true,
  13265. eventPhase: true,
  13266. metaKey: true,
  13267. pageX: true,
  13268. pageY: true,
  13269. shiftKey: true,
  13270. view: true,
  13271. "char": true,
  13272. code: true,
  13273. charCode: true,
  13274. key: true,
  13275. keyCode: true,
  13276. button: true,
  13277. buttons: true,
  13278. clientX: true,
  13279. clientY: true,
  13280. offsetX: true,
  13281. offsetY: true,
  13282. pointerId: true,
  13283. pointerType: true,
  13284. screenX: true,
  13285. screenY: true,
  13286. targetTouches: true,
  13287. toElement: true,
  13288. touches: true,
  13289. which: function( event ) {
  13290. var button = event.button;
  13291. // Add which for key events
  13292. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  13293. return event.charCode != null ? event.charCode : event.keyCode;
  13294. }
  13295. // Add which for click: 1 === left; 2 === middle; 3 === right
  13296. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  13297. if ( button & 1 ) {
  13298. return 1;
  13299. }
  13300. if ( button & 2 ) {
  13301. return 3;
  13302. }
  13303. if ( button & 4 ) {
  13304. return 2;
  13305. }
  13306. return 0;
  13307. }
  13308. return event.which;
  13309. }
  13310. }, jQuery.event.addProp );
  13311. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  13312. jQuery.event.special[ type ] = {
  13313. // Utilize native event if possible so blur/focus sequence is correct
  13314. setup: function() {
  13315. // Claim the first handler
  13316. // dataPriv.set( this, "focus", ... )
  13317. // dataPriv.set( this, "blur", ... )
  13318. leverageNative( this, type, expectSync );
  13319. // Return false to allow normal processing in the caller
  13320. return false;
  13321. },
  13322. trigger: function() {
  13323. // Force setup before trigger
  13324. leverageNative( this, type );
  13325. // Return non-false to allow normal event-path propagation
  13326. return true;
  13327. },
  13328. delegateType: delegateType
  13329. };
  13330. } );
  13331. // Create mouseenter/leave events using mouseover/out and event-time checks
  13332. // so that event delegation works in jQuery.
  13333. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  13334. //
  13335. // Support: Safari 7 only
  13336. // Safari sends mouseenter too often; see:
  13337. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  13338. // for the description of the bug (it existed in older Chrome versions as well).
  13339. jQuery.each( {
  13340. mouseenter: "mouseover",
  13341. mouseleave: "mouseout",
  13342. pointerenter: "pointerover",
  13343. pointerleave: "pointerout"
  13344. }, function( orig, fix ) {
  13345. jQuery.event.special[ orig ] = {
  13346. delegateType: fix,
  13347. bindType: fix,
  13348. handle: function( event ) {
  13349. var ret,
  13350. target = this,
  13351. related = event.relatedTarget,
  13352. handleObj = event.handleObj;
  13353. // For mouseenter/leave call the handler if related is outside the target.
  13354. // NB: No relatedTarget if the mouse left/entered the browser window
  13355. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  13356. event.type = handleObj.origType;
  13357. ret = handleObj.handler.apply( this, arguments );
  13358. event.type = fix;
  13359. }
  13360. return ret;
  13361. }
  13362. };
  13363. } );
  13364. jQuery.fn.extend( {
  13365. on: function( types, selector, data, fn ) {
  13366. return on( this, types, selector, data, fn );
  13367. },
  13368. one: function( types, selector, data, fn ) {
  13369. return on( this, types, selector, data, fn, 1 );
  13370. },
  13371. off: function( types, selector, fn ) {
  13372. var handleObj, type;
  13373. if ( types && types.preventDefault && types.handleObj ) {
  13374. // ( event ) dispatched jQuery.Event
  13375. handleObj = types.handleObj;
  13376. jQuery( types.delegateTarget ).off(
  13377. handleObj.namespace ?
  13378. handleObj.origType + "." + handleObj.namespace :
  13379. handleObj.origType,
  13380. handleObj.selector,
  13381. handleObj.handler
  13382. );
  13383. return this;
  13384. }
  13385. if ( typeof types === "object" ) {
  13386. // ( types-object [, selector] )
  13387. for ( type in types ) {
  13388. this.off( type, selector, types[ type ] );
  13389. }
  13390. return this;
  13391. }
  13392. if ( selector === false || typeof selector === "function" ) {
  13393. // ( types [, fn] )
  13394. fn = selector;
  13395. selector = undefined;
  13396. }
  13397. if ( fn === false ) {
  13398. fn = returnFalse;
  13399. }
  13400. return this.each( function() {
  13401. jQuery.event.remove( this, types, fn, selector );
  13402. } );
  13403. }
  13404. } );
  13405. var
  13406. /* eslint-disable max-len */
  13407. // See https://github.com/eslint/eslint/issues/3229
  13408. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  13409. /* eslint-enable */
  13410. // Support: IE <=10 - 11, Edge 12 - 13 only
  13411. // In IE/Edge using regex groups here causes severe slowdowns.
  13412. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  13413. rnoInnerhtml = /<script|<style|<link/i,
  13414. // checked="checked" or checked
  13415. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  13416. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  13417. // Prefer a tbody over its parent table for containing new rows
  13418. function manipulationTarget( elem, content ) {
  13419. if ( nodeName( elem, "table" ) &&
  13420. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  13421. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  13422. }
  13423. return elem;
  13424. }
  13425. // Replace/restore the type attribute of script elements for safe DOM manipulation
  13426. function disableScript( elem ) {
  13427. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  13428. return elem;
  13429. }
  13430. function restoreScript( elem ) {
  13431. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  13432. elem.type = elem.type.slice( 5 );
  13433. } else {
  13434. elem.removeAttribute( "type" );
  13435. }
  13436. return elem;
  13437. }
  13438. function cloneCopyEvent( src, dest ) {
  13439. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  13440. if ( dest.nodeType !== 1 ) {
  13441. return;
  13442. }
  13443. // 1. Copy private data: events, handlers, etc.
  13444. if ( dataPriv.hasData( src ) ) {
  13445. pdataOld = dataPriv.access( src );
  13446. pdataCur = dataPriv.set( dest, pdataOld );
  13447. events = pdataOld.events;
  13448. if ( events ) {
  13449. delete pdataCur.handle;
  13450. pdataCur.events = {};
  13451. for ( type in events ) {
  13452. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  13453. jQuery.event.add( dest, type, events[ type ][ i ] );
  13454. }
  13455. }
  13456. }
  13457. }
  13458. // 2. Copy user data
  13459. if ( dataUser.hasData( src ) ) {
  13460. udataOld = dataUser.access( src );
  13461. udataCur = jQuery.extend( {}, udataOld );
  13462. dataUser.set( dest, udataCur );
  13463. }
  13464. }
  13465. // Fix IE bugs, see support tests
  13466. function fixInput( src, dest ) {
  13467. var nodeName = dest.nodeName.toLowerCase();
  13468. // Fails to persist the checked state of a cloned checkbox or radio button.
  13469. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  13470. dest.checked = src.checked;
  13471. // Fails to return the selected option to the default selected state when cloning options
  13472. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  13473. dest.defaultValue = src.defaultValue;
  13474. }
  13475. }
  13476. function domManip( collection, args, callback, ignored ) {
  13477. // Flatten any nested arrays
  13478. args = concat.apply( [], args );
  13479. var fragment, first, scripts, hasScripts, node, doc,
  13480. i = 0,
  13481. l = collection.length,
  13482. iNoClone = l - 1,
  13483. value = args[ 0 ],
  13484. valueIsFunction = isFunction( value );
  13485. // We can't cloneNode fragments that contain checked, in WebKit
  13486. if ( valueIsFunction ||
  13487. ( l > 1 && typeof value === "string" &&
  13488. !support.checkClone && rchecked.test( value ) ) ) {
  13489. return collection.each( function( index ) {
  13490. var self = collection.eq( index );
  13491. if ( valueIsFunction ) {
  13492. args[ 0 ] = value.call( this, index, self.html() );
  13493. }
  13494. domManip( self, args, callback, ignored );
  13495. } );
  13496. }
  13497. if ( l ) {
  13498. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  13499. first = fragment.firstChild;
  13500. if ( fragment.childNodes.length === 1 ) {
  13501. fragment = first;
  13502. }
  13503. // Require either new content or an interest in ignored elements to invoke the callback
  13504. if ( first || ignored ) {
  13505. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  13506. hasScripts = scripts.length;
  13507. // Use the original fragment for the last item
  13508. // instead of the first because it can end up
  13509. // being emptied incorrectly in certain situations (#8070).
  13510. for ( ; i < l; i++ ) {
  13511. node = fragment;
  13512. if ( i !== iNoClone ) {
  13513. node = jQuery.clone( node, true, true );
  13514. // Keep references to cloned scripts for later restoration
  13515. if ( hasScripts ) {
  13516. // Support: Android <=4.0 only, PhantomJS 1 only
  13517. // push.apply(_, arraylike) throws on ancient WebKit
  13518. jQuery.merge( scripts, getAll( node, "script" ) );
  13519. }
  13520. }
  13521. callback.call( collection[ i ], node, i );
  13522. }
  13523. if ( hasScripts ) {
  13524. doc = scripts[ scripts.length - 1 ].ownerDocument;
  13525. // Reenable scripts
  13526. jQuery.map( scripts, restoreScript );
  13527. // Evaluate executable scripts on first document insertion
  13528. for ( i = 0; i < hasScripts; i++ ) {
  13529. node = scripts[ i ];
  13530. if ( rscriptType.test( node.type || "" ) &&
  13531. !dataPriv.access( node, "globalEval" ) &&
  13532. jQuery.contains( doc, node ) ) {
  13533. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  13534. // Optional AJAX dependency, but won't run scripts if not present
  13535. if ( jQuery._evalUrl && !node.noModule ) {
  13536. jQuery._evalUrl( node.src, {
  13537. nonce: node.nonce || node.getAttribute( "nonce" )
  13538. } );
  13539. }
  13540. } else {
  13541. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  13542. }
  13543. }
  13544. }
  13545. }
  13546. }
  13547. }
  13548. return collection;
  13549. }
  13550. function remove( elem, selector, keepData ) {
  13551. var node,
  13552. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  13553. i = 0;
  13554. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  13555. if ( !keepData && node.nodeType === 1 ) {
  13556. jQuery.cleanData( getAll( node ) );
  13557. }
  13558. if ( node.parentNode ) {
  13559. if ( keepData && isAttached( node ) ) {
  13560. setGlobalEval( getAll( node, "script" ) );
  13561. }
  13562. node.parentNode.removeChild( node );
  13563. }
  13564. }
  13565. return elem;
  13566. }
  13567. jQuery.extend( {
  13568. htmlPrefilter: function( html ) {
  13569. return html.replace( rxhtmlTag, "<$1></$2>" );
  13570. },
  13571. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  13572. var i, l, srcElements, destElements,
  13573. clone = elem.cloneNode( true ),
  13574. inPage = isAttached( elem );
  13575. // Fix IE cloning issues
  13576. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  13577. !jQuery.isXMLDoc( elem ) ) {
  13578. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  13579. destElements = getAll( clone );
  13580. srcElements = getAll( elem );
  13581. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13582. fixInput( srcElements[ i ], destElements[ i ] );
  13583. }
  13584. }
  13585. // Copy the events from the original to the clone
  13586. if ( dataAndEvents ) {
  13587. if ( deepDataAndEvents ) {
  13588. srcElements = srcElements || getAll( elem );
  13589. destElements = destElements || getAll( clone );
  13590. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13591. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  13592. }
  13593. } else {
  13594. cloneCopyEvent( elem, clone );
  13595. }
  13596. }
  13597. // Preserve script evaluation history
  13598. destElements = getAll( clone, "script" );
  13599. if ( destElements.length > 0 ) {
  13600. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  13601. }
  13602. // Return the cloned set
  13603. return clone;
  13604. },
  13605. cleanData: function( elems ) {
  13606. var data, elem, type,
  13607. special = jQuery.event.special,
  13608. i = 0;
  13609. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  13610. if ( acceptData( elem ) ) {
  13611. if ( ( data = elem[ dataPriv.expando ] ) ) {
  13612. if ( data.events ) {
  13613. for ( type in data.events ) {
  13614. if ( special[ type ] ) {
  13615. jQuery.event.remove( elem, type );
  13616. // This is a shortcut to avoid jQuery.event.remove's overhead
  13617. } else {
  13618. jQuery.removeEvent( elem, type, data.handle );
  13619. }
  13620. }
  13621. }
  13622. // Support: Chrome <=35 - 45+
  13623. // Assign undefined instead of using delete, see Data#remove
  13624. elem[ dataPriv.expando ] = undefined;
  13625. }
  13626. if ( elem[ dataUser.expando ] ) {
  13627. // Support: Chrome <=35 - 45+
  13628. // Assign undefined instead of using delete, see Data#remove
  13629. elem[ dataUser.expando ] = undefined;
  13630. }
  13631. }
  13632. }
  13633. }
  13634. } );
  13635. jQuery.fn.extend( {
  13636. detach: function( selector ) {
  13637. return remove( this, selector, true );
  13638. },
  13639. remove: function( selector ) {
  13640. return remove( this, selector );
  13641. },
  13642. text: function( value ) {
  13643. return access( this, function( value ) {
  13644. return value === undefined ?
  13645. jQuery.text( this ) :
  13646. this.empty().each( function() {
  13647. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13648. this.textContent = value;
  13649. }
  13650. } );
  13651. }, null, value, arguments.length );
  13652. },
  13653. append: function() {
  13654. return domManip( this, arguments, function( elem ) {
  13655. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13656. var target = manipulationTarget( this, elem );
  13657. target.appendChild( elem );
  13658. }
  13659. } );
  13660. },
  13661. prepend: function() {
  13662. return domManip( this, arguments, function( elem ) {
  13663. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13664. var target = manipulationTarget( this, elem );
  13665. target.insertBefore( elem, target.firstChild );
  13666. }
  13667. } );
  13668. },
  13669. before: function() {
  13670. return domManip( this, arguments, function( elem ) {
  13671. if ( this.parentNode ) {
  13672. this.parentNode.insertBefore( elem, this );
  13673. }
  13674. } );
  13675. },
  13676. after: function() {
  13677. return domManip( this, arguments, function( elem ) {
  13678. if ( this.parentNode ) {
  13679. this.parentNode.insertBefore( elem, this.nextSibling );
  13680. }
  13681. } );
  13682. },
  13683. empty: function() {
  13684. var elem,
  13685. i = 0;
  13686. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  13687. if ( elem.nodeType === 1 ) {
  13688. // Prevent memory leaks
  13689. jQuery.cleanData( getAll( elem, false ) );
  13690. // Remove any remaining nodes
  13691. elem.textContent = "";
  13692. }
  13693. }
  13694. return this;
  13695. },
  13696. clone: function( dataAndEvents, deepDataAndEvents ) {
  13697. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  13698. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  13699. return this.map( function() {
  13700. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  13701. } );
  13702. },
  13703. html: function( value ) {
  13704. return access( this, function( value ) {
  13705. var elem = this[ 0 ] || {},
  13706. i = 0,
  13707. l = this.length;
  13708. if ( value === undefined && elem.nodeType === 1 ) {
  13709. return elem.innerHTML;
  13710. }
  13711. // See if we can take a shortcut and just use innerHTML
  13712. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  13713. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  13714. value = jQuery.htmlPrefilter( value );
  13715. try {
  13716. for ( ; i < l; i++ ) {
  13717. elem = this[ i ] || {};
  13718. // Remove element nodes and prevent memory leaks
  13719. if ( elem.nodeType === 1 ) {
  13720. jQuery.cleanData( getAll( elem, false ) );
  13721. elem.innerHTML = value;
  13722. }
  13723. }
  13724. elem = 0;
  13725. // If using innerHTML throws an exception, use the fallback method
  13726. } catch ( e ) {}
  13727. }
  13728. if ( elem ) {
  13729. this.empty().append( value );
  13730. }
  13731. }, null, value, arguments.length );
  13732. },
  13733. replaceWith: function() {
  13734. var ignored = [];
  13735. // Make the changes, replacing each non-ignored context element with the new content
  13736. return domManip( this, arguments, function( elem ) {
  13737. var parent = this.parentNode;
  13738. if ( jQuery.inArray( this, ignored ) < 0 ) {
  13739. jQuery.cleanData( getAll( this ) );
  13740. if ( parent ) {
  13741. parent.replaceChild( elem, this );
  13742. }
  13743. }
  13744. // Force callback invocation
  13745. }, ignored );
  13746. }
  13747. } );
  13748. jQuery.each( {
  13749. appendTo: "append",
  13750. prependTo: "prepend",
  13751. insertBefore: "before",
  13752. insertAfter: "after",
  13753. replaceAll: "replaceWith"
  13754. }, function( name, original ) {
  13755. jQuery.fn[ name ] = function( selector ) {
  13756. var elems,
  13757. ret = [],
  13758. insert = jQuery( selector ),
  13759. last = insert.length - 1,
  13760. i = 0;
  13761. for ( ; i <= last; i++ ) {
  13762. elems = i === last ? this : this.clone( true );
  13763. jQuery( insert[ i ] )[ original ]( elems );
  13764. // Support: Android <=4.0 only, PhantomJS 1 only
  13765. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  13766. push.apply( ret, elems.get() );
  13767. }
  13768. return this.pushStack( ret );
  13769. };
  13770. } );
  13771. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  13772. var getStyles = function( elem ) {
  13773. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  13774. // IE throws on elements created in popups
  13775. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  13776. var view = elem.ownerDocument.defaultView;
  13777. if ( !view || !view.opener ) {
  13778. view = window;
  13779. }
  13780. return view.getComputedStyle( elem );
  13781. };
  13782. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  13783. ( function() {
  13784. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  13785. // so they're executed at the same time to save the second computation.
  13786. function computeStyleTests() {
  13787. // This is a singleton, we need to execute it only once
  13788. if ( !div ) {
  13789. return;
  13790. }
  13791. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  13792. "margin-top:1px;padding:0;border:0";
  13793. div.style.cssText =
  13794. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  13795. "margin:auto;border:1px;padding:1px;" +
  13796. "width:60%;top:1%";
  13797. documentElement.appendChild( container ).appendChild( div );
  13798. var divStyle = window.getComputedStyle( div );
  13799. pixelPositionVal = divStyle.top !== "1%";
  13800. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  13801. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  13802. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  13803. // Some styles come back with percentage values, even though they shouldn't
  13804. div.style.right = "60%";
  13805. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  13806. // Support: IE 9 - 11 only
  13807. // Detect misreporting of content dimensions for box-sizing:border-box elements
  13808. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  13809. // Support: IE 9 only
  13810. // Detect overflow:scroll screwiness (gh-3699)
  13811. // Support: Chrome <=64
  13812. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  13813. div.style.position = "absolute";
  13814. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  13815. documentElement.removeChild( container );
  13816. // Nullify the div so it wouldn't be stored in the memory and
  13817. // it will also be a sign that checks already performed
  13818. div = null;
  13819. }
  13820. function roundPixelMeasures( measure ) {
  13821. return Math.round( parseFloat( measure ) );
  13822. }
  13823. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  13824. reliableMarginLeftVal,
  13825. container = document.createElement( "div" ),
  13826. div = document.createElement( "div" );
  13827. // Finish early in limited (non-browser) environments
  13828. if ( !div.style ) {
  13829. return;
  13830. }
  13831. // Support: IE <=9 - 11 only
  13832. // Style of cloned element affects source element cloned (#8908)
  13833. div.style.backgroundClip = "content-box";
  13834. div.cloneNode( true ).style.backgroundClip = "";
  13835. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  13836. jQuery.extend( support, {
  13837. boxSizingReliable: function() {
  13838. computeStyleTests();
  13839. return boxSizingReliableVal;
  13840. },
  13841. pixelBoxStyles: function() {
  13842. computeStyleTests();
  13843. return pixelBoxStylesVal;
  13844. },
  13845. pixelPosition: function() {
  13846. computeStyleTests();
  13847. return pixelPositionVal;
  13848. },
  13849. reliableMarginLeft: function() {
  13850. computeStyleTests();
  13851. return reliableMarginLeftVal;
  13852. },
  13853. scrollboxSize: function() {
  13854. computeStyleTests();
  13855. return scrollboxSizeVal;
  13856. }
  13857. } );
  13858. } )();
  13859. function curCSS( elem, name, computed ) {
  13860. var width, minWidth, maxWidth, ret,
  13861. // Support: Firefox 51+
  13862. // Retrieving style before computed somehow
  13863. // fixes an issue with getting wrong values
  13864. // on detached elements
  13865. style = elem.style;
  13866. computed = computed || getStyles( elem );
  13867. // getPropertyValue is needed for:
  13868. // .css('filter') (IE 9 only, #12537)
  13869. // .css('--customProperty) (#3144)
  13870. if ( computed ) {
  13871. ret = computed.getPropertyValue( name ) || computed[ name ];
  13872. if ( ret === "" && !isAttached( elem ) ) {
  13873. ret = jQuery.style( elem, name );
  13874. }
  13875. // A tribute to the "awesome hack by Dean Edwards"
  13876. // Android Browser returns percentage for some values,
  13877. // but width seems to be reliably pixels.
  13878. // This is against the CSSOM draft spec:
  13879. // https://drafts.csswg.org/cssom/#resolved-values
  13880. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  13881. // Remember the original values
  13882. width = style.width;
  13883. minWidth = style.minWidth;
  13884. maxWidth = style.maxWidth;
  13885. // Put in the new values to get a computed value out
  13886. style.minWidth = style.maxWidth = style.width = ret;
  13887. ret = computed.width;
  13888. // Revert the changed values
  13889. style.width = width;
  13890. style.minWidth = minWidth;
  13891. style.maxWidth = maxWidth;
  13892. }
  13893. }
  13894. return ret !== undefined ?
  13895. // Support: IE <=9 - 11 only
  13896. // IE returns zIndex value as an integer.
  13897. ret + "" :
  13898. ret;
  13899. }
  13900. function addGetHookIf( conditionFn, hookFn ) {
  13901. // Define the hook, we'll check on the first run if it's really needed.
  13902. return {
  13903. get: function() {
  13904. if ( conditionFn() ) {
  13905. // Hook not needed (or it's not possible to use it due
  13906. // to missing dependency), remove it.
  13907. delete this.get;
  13908. return;
  13909. }
  13910. // Hook needed; redefine it so that the support test is not executed again.
  13911. return ( this.get = hookFn ).apply( this, arguments );
  13912. }
  13913. };
  13914. }
  13915. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  13916. emptyStyle = document.createElement( "div" ).style,
  13917. vendorProps = {};
  13918. // Return a vendor-prefixed property or undefined
  13919. function vendorPropName( name ) {
  13920. // Check for vendor prefixed names
  13921. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  13922. i = cssPrefixes.length;
  13923. while ( i-- ) {
  13924. name = cssPrefixes[ i ] + capName;
  13925. if ( name in emptyStyle ) {
  13926. return name;
  13927. }
  13928. }
  13929. }
  13930. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  13931. function finalPropName( name ) {
  13932. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  13933. if ( final ) {
  13934. return final;
  13935. }
  13936. if ( name in emptyStyle ) {
  13937. return name;
  13938. }
  13939. return vendorProps[ name ] = vendorPropName( name ) || name;
  13940. }
  13941. var
  13942. // Swappable if display is none or starts with table
  13943. // except "table", "table-cell", or "table-caption"
  13944. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  13945. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  13946. rcustomProp = /^--/,
  13947. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  13948. cssNormalTransform = {
  13949. letterSpacing: "0",
  13950. fontWeight: "400"
  13951. };
  13952. function setPositiveNumber( elem, value, subtract ) {
  13953. // Any relative (+/-) values have already been
  13954. // normalized at this point
  13955. var matches = rcssNum.exec( value );
  13956. return matches ?
  13957. // Guard against undefined "subtract", e.g., when used as in cssHooks
  13958. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  13959. value;
  13960. }
  13961. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  13962. var i = dimension === "width" ? 1 : 0,
  13963. extra = 0,
  13964. delta = 0;
  13965. // Adjustment may not be necessary
  13966. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  13967. return 0;
  13968. }
  13969. for ( ; i < 4; i += 2 ) {
  13970. // Both box models exclude margin
  13971. if ( box === "margin" ) {
  13972. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  13973. }
  13974. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  13975. if ( !isBorderBox ) {
  13976. // Add padding
  13977. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13978. // For "border" or "margin", add border
  13979. if ( box !== "padding" ) {
  13980. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13981. // But still keep track of it otherwise
  13982. } else {
  13983. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13984. }
  13985. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  13986. // "padding" or "margin"
  13987. } else {
  13988. // For "content", subtract padding
  13989. if ( box === "content" ) {
  13990. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13991. }
  13992. // For "content" or "padding", subtract border
  13993. if ( box !== "margin" ) {
  13994. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13995. }
  13996. }
  13997. }
  13998. // Account for positive content-box scroll gutter when requested by providing computedVal
  13999. if ( !isBorderBox && computedVal >= 0 ) {
  14000. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  14001. // Assuming integer scroll gutter, subtract the rest and round down
  14002. delta += Math.max( 0, Math.ceil(
  14003. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  14004. computedVal -
  14005. delta -
  14006. extra -
  14007. 0.5
  14008. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  14009. // Use an explicit zero to avoid NaN (gh-3964)
  14010. ) ) || 0;
  14011. }
  14012. return delta;
  14013. }
  14014. function getWidthOrHeight( elem, dimension, extra ) {
  14015. // Start with computed style
  14016. var styles = getStyles( elem ),
  14017. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  14018. // Fake content-box until we know it's needed to know the true value.
  14019. boxSizingNeeded = !support.boxSizingReliable() || extra,
  14020. isBorderBox = boxSizingNeeded &&
  14021. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  14022. valueIsBorderBox = isBorderBox,
  14023. val = curCSS( elem, dimension, styles ),
  14024. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  14025. // Support: Firefox <=54
  14026. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  14027. if ( rnumnonpx.test( val ) ) {
  14028. if ( !extra ) {
  14029. return val;
  14030. }
  14031. val = "auto";
  14032. }
  14033. // Fall back to offsetWidth/offsetHeight when value is "auto"
  14034. // This happens for inline elements with no explicit setting (gh-3571)
  14035. // Support: Android <=4.1 - 4.3 only
  14036. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  14037. // Support: IE 9-11 only
  14038. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  14039. // We use getClientRects() to check for hidden/disconnected.
  14040. // In those cases, the computed value can be trusted to be border-box
  14041. if ( ( !support.boxSizingReliable() && isBorderBox ||
  14042. val === "auto" ||
  14043. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  14044. elem.getClientRects().length ) {
  14045. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  14046. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  14047. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  14048. // retrieved value as a content box dimension.
  14049. valueIsBorderBox = offsetProp in elem;
  14050. if ( valueIsBorderBox ) {
  14051. val = elem[ offsetProp ];
  14052. }
  14053. }
  14054. // Normalize "" and auto
  14055. val = parseFloat( val ) || 0;
  14056. // Adjust for the element's box model
  14057. return ( val +
  14058. boxModelAdjustment(
  14059. elem,
  14060. dimension,
  14061. extra || ( isBorderBox ? "border" : "content" ),
  14062. valueIsBorderBox,
  14063. styles,
  14064. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  14065. val
  14066. )
  14067. ) + "px";
  14068. }
  14069. jQuery.extend( {
  14070. // Add in style property hooks for overriding the default
  14071. // behavior of getting and setting a style property
  14072. cssHooks: {
  14073. opacity: {
  14074. get: function( elem, computed ) {
  14075. if ( computed ) {
  14076. // We should always get a number back from opacity
  14077. var ret = curCSS( elem, "opacity" );
  14078. return ret === "" ? "1" : ret;
  14079. }
  14080. }
  14081. }
  14082. },
  14083. // Don't automatically add "px" to these possibly-unitless properties
  14084. cssNumber: {
  14085. "animationIterationCount": true,
  14086. "columnCount": true,
  14087. "fillOpacity": true,
  14088. "flexGrow": true,
  14089. "flexShrink": true,
  14090. "fontWeight": true,
  14091. "gridArea": true,
  14092. "gridColumn": true,
  14093. "gridColumnEnd": true,
  14094. "gridColumnStart": true,
  14095. "gridRow": true,
  14096. "gridRowEnd": true,
  14097. "gridRowStart": true,
  14098. "lineHeight": true,
  14099. "opacity": true,
  14100. "order": true,
  14101. "orphans": true,
  14102. "widows": true,
  14103. "zIndex": true,
  14104. "zoom": true
  14105. },
  14106. // Add in properties whose names you wish to fix before
  14107. // setting or getting the value
  14108. cssProps: {},
  14109. // Get and set the style property on a DOM Node
  14110. style: function( elem, name, value, extra ) {
  14111. // Don't set styles on text and comment nodes
  14112. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  14113. return;
  14114. }
  14115. // Make sure that we're working with the right name
  14116. var ret, type, hooks,
  14117. origName = camelCase( name ),
  14118. isCustomProp = rcustomProp.test( name ),
  14119. style = elem.style;
  14120. // Make sure that we're working with the right name. We don't
  14121. // want to query the value if it is a CSS custom property
  14122. // since they are user-defined.
  14123. if ( !isCustomProp ) {
  14124. name = finalPropName( origName );
  14125. }
  14126. // Gets hook for the prefixed version, then unprefixed version
  14127. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14128. // Check if we're setting a value
  14129. if ( value !== undefined ) {
  14130. type = typeof value;
  14131. // Convert "+=" or "-=" to relative numbers (#7345)
  14132. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  14133. value = adjustCSS( elem, name, ret );
  14134. // Fixes bug #9237
  14135. type = "number";
  14136. }
  14137. // Make sure that null and NaN values aren't set (#7116)
  14138. if ( value == null || value !== value ) {
  14139. return;
  14140. }
  14141. // If a number was passed in, add the unit (except for certain CSS properties)
  14142. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  14143. // "px" to a few hardcoded values.
  14144. if ( type === "number" && !isCustomProp ) {
  14145. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  14146. }
  14147. // background-* props affect original clone's values
  14148. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  14149. style[ name ] = "inherit";
  14150. }
  14151. // If a hook was provided, use that value, otherwise just set the specified value
  14152. if ( !hooks || !( "set" in hooks ) ||
  14153. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  14154. if ( isCustomProp ) {
  14155. style.setProperty( name, value );
  14156. } else {
  14157. style[ name ] = value;
  14158. }
  14159. }
  14160. } else {
  14161. // If a hook was provided get the non-computed value from there
  14162. if ( hooks && "get" in hooks &&
  14163. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  14164. return ret;
  14165. }
  14166. // Otherwise just get the value from the style object
  14167. return style[ name ];
  14168. }
  14169. },
  14170. css: function( elem, name, extra, styles ) {
  14171. var val, num, hooks,
  14172. origName = camelCase( name ),
  14173. isCustomProp = rcustomProp.test( name );
  14174. // Make sure that we're working with the right name. We don't
  14175. // want to modify the value if it is a CSS custom property
  14176. // since they are user-defined.
  14177. if ( !isCustomProp ) {
  14178. name = finalPropName( origName );
  14179. }
  14180. // Try prefixed name followed by the unprefixed name
  14181. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14182. // If a hook was provided get the computed value from there
  14183. if ( hooks && "get" in hooks ) {
  14184. val = hooks.get( elem, true, extra );
  14185. }
  14186. // Otherwise, if a way to get the computed value exists, use that
  14187. if ( val === undefined ) {
  14188. val = curCSS( elem, name, styles );
  14189. }
  14190. // Convert "normal" to computed value
  14191. if ( val === "normal" && name in cssNormalTransform ) {
  14192. val = cssNormalTransform[ name ];
  14193. }
  14194. // Make numeric if forced or a qualifier was provided and val looks numeric
  14195. if ( extra === "" || extra ) {
  14196. num = parseFloat( val );
  14197. return extra === true || isFinite( num ) ? num || 0 : val;
  14198. }
  14199. return val;
  14200. }
  14201. } );
  14202. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  14203. jQuery.cssHooks[ dimension ] = {
  14204. get: function( elem, computed, extra ) {
  14205. if ( computed ) {
  14206. // Certain elements can have dimension info if we invisibly show them
  14207. // but it must have a current display style that would benefit
  14208. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  14209. // Support: Safari 8+
  14210. // Table columns in Safari have non-zero offsetWidth & zero
  14211. // getBoundingClientRect().width unless display is changed.
  14212. // Support: IE <=11 only
  14213. // Running getBoundingClientRect on a disconnected node
  14214. // in IE throws an error.
  14215. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  14216. swap( elem, cssShow, function() {
  14217. return getWidthOrHeight( elem, dimension, extra );
  14218. } ) :
  14219. getWidthOrHeight( elem, dimension, extra );
  14220. }
  14221. },
  14222. set: function( elem, value, extra ) {
  14223. var matches,
  14224. styles = getStyles( elem ),
  14225. // Only read styles.position if the test has a chance to fail
  14226. // to avoid forcing a reflow.
  14227. scrollboxSizeBuggy = !support.scrollboxSize() &&
  14228. styles.position === "absolute",
  14229. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  14230. boxSizingNeeded = scrollboxSizeBuggy || extra,
  14231. isBorderBox = boxSizingNeeded &&
  14232. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  14233. subtract = extra ?
  14234. boxModelAdjustment(
  14235. elem,
  14236. dimension,
  14237. extra,
  14238. isBorderBox,
  14239. styles
  14240. ) :
  14241. 0;
  14242. // Account for unreliable border-box dimensions by comparing offset* to computed and
  14243. // faking a content-box to get border and padding (gh-3699)
  14244. if ( isBorderBox && scrollboxSizeBuggy ) {
  14245. subtract -= Math.ceil(
  14246. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  14247. parseFloat( styles[ dimension ] ) -
  14248. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  14249. 0.5
  14250. );
  14251. }
  14252. // Convert to pixels if value adjustment is needed
  14253. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  14254. ( matches[ 3 ] || "px" ) !== "px" ) {
  14255. elem.style[ dimension ] = value;
  14256. value = jQuery.css( elem, dimension );
  14257. }
  14258. return setPositiveNumber( elem, value, subtract );
  14259. }
  14260. };
  14261. } );
  14262. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  14263. function( elem, computed ) {
  14264. if ( computed ) {
  14265. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  14266. elem.getBoundingClientRect().left -
  14267. swap( elem, { marginLeft: 0 }, function() {
  14268. return elem.getBoundingClientRect().left;
  14269. } )
  14270. ) + "px";
  14271. }
  14272. }
  14273. );
  14274. // These hooks are used by animate to expand properties
  14275. jQuery.each( {
  14276. margin: "",
  14277. padding: "",
  14278. border: "Width"
  14279. }, function( prefix, suffix ) {
  14280. jQuery.cssHooks[ prefix + suffix ] = {
  14281. expand: function( value ) {
  14282. var i = 0,
  14283. expanded = {},
  14284. // Assumes a single number if not a string
  14285. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  14286. for ( ; i < 4; i++ ) {
  14287. expanded[ prefix + cssExpand[ i ] + suffix ] =
  14288. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  14289. }
  14290. return expanded;
  14291. }
  14292. };
  14293. if ( prefix !== "margin" ) {
  14294. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  14295. }
  14296. } );
  14297. jQuery.fn.extend( {
  14298. css: function( name, value ) {
  14299. return access( this, function( elem, name, value ) {
  14300. var styles, len,
  14301. map = {},
  14302. i = 0;
  14303. if ( Array.isArray( name ) ) {
  14304. styles = getStyles( elem );
  14305. len = name.length;
  14306. for ( ; i < len; i++ ) {
  14307. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  14308. }
  14309. return map;
  14310. }
  14311. return value !== undefined ?
  14312. jQuery.style( elem, name, value ) :
  14313. jQuery.css( elem, name );
  14314. }, name, value, arguments.length > 1 );
  14315. }
  14316. } );
  14317. function Tween( elem, options, prop, end, easing ) {
  14318. return new Tween.prototype.init( elem, options, prop, end, easing );
  14319. }
  14320. jQuery.Tween = Tween;
  14321. Tween.prototype = {
  14322. constructor: Tween,
  14323. init: function( elem, options, prop, end, easing, unit ) {
  14324. this.elem = elem;
  14325. this.prop = prop;
  14326. this.easing = easing || jQuery.easing._default;
  14327. this.options = options;
  14328. this.start = this.now = this.cur();
  14329. this.end = end;
  14330. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  14331. },
  14332. cur: function() {
  14333. var hooks = Tween.propHooks[ this.prop ];
  14334. return hooks && hooks.get ?
  14335. hooks.get( this ) :
  14336. Tween.propHooks._default.get( this );
  14337. },
  14338. run: function( percent ) {
  14339. var eased,
  14340. hooks = Tween.propHooks[ this.prop ];
  14341. if ( this.options.duration ) {
  14342. this.pos = eased = jQuery.easing[ this.easing ](
  14343. percent, this.options.duration * percent, 0, 1, this.options.duration
  14344. );
  14345. } else {
  14346. this.pos = eased = percent;
  14347. }
  14348. this.now = ( this.end - this.start ) * eased + this.start;
  14349. if ( this.options.step ) {
  14350. this.options.step.call( this.elem, this.now, this );
  14351. }
  14352. if ( hooks && hooks.set ) {
  14353. hooks.set( this );
  14354. } else {
  14355. Tween.propHooks._default.set( this );
  14356. }
  14357. return this;
  14358. }
  14359. };
  14360. Tween.prototype.init.prototype = Tween.prototype;
  14361. Tween.propHooks = {
  14362. _default: {
  14363. get: function( tween ) {
  14364. var result;
  14365. // Use a property on the element directly when it is not a DOM element,
  14366. // or when there is no matching style property that exists.
  14367. if ( tween.elem.nodeType !== 1 ||
  14368. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  14369. return tween.elem[ tween.prop ];
  14370. }
  14371. // Passing an empty string as a 3rd parameter to .css will automatically
  14372. // attempt a parseFloat and fallback to a string if the parse fails.
  14373. // Simple values such as "10px" are parsed to Float;
  14374. // complex values such as "rotate(1rad)" are returned as-is.
  14375. result = jQuery.css( tween.elem, tween.prop, "" );
  14376. // Empty strings, null, undefined and "auto" are converted to 0.
  14377. return !result || result === "auto" ? 0 : result;
  14378. },
  14379. set: function( tween ) {
  14380. // Use step hook for back compat.
  14381. // Use cssHook if its there.
  14382. // Use .style if available and use plain properties where available.
  14383. if ( jQuery.fx.step[ tween.prop ] ) {
  14384. jQuery.fx.step[ tween.prop ]( tween );
  14385. } else if ( tween.elem.nodeType === 1 && (
  14386. jQuery.cssHooks[ tween.prop ] ||
  14387. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  14388. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  14389. } else {
  14390. tween.elem[ tween.prop ] = tween.now;
  14391. }
  14392. }
  14393. }
  14394. };
  14395. // Support: IE <=9 only
  14396. // Panic based approach to setting things on disconnected nodes
  14397. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  14398. set: function( tween ) {
  14399. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  14400. tween.elem[ tween.prop ] = tween.now;
  14401. }
  14402. }
  14403. };
  14404. jQuery.easing = {
  14405. linear: function( p ) {
  14406. return p;
  14407. },
  14408. swing: function( p ) {
  14409. return 0.5 - Math.cos( p * Math.PI ) / 2;
  14410. },
  14411. _default: "swing"
  14412. };
  14413. jQuery.fx = Tween.prototype.init;
  14414. // Back compat <1.8 extension point
  14415. jQuery.fx.step = {};
  14416. var
  14417. fxNow, inProgress,
  14418. rfxtypes = /^(?:toggle|show|hide)$/,
  14419. rrun = /queueHooks$/;
  14420. function schedule() {
  14421. if ( inProgress ) {
  14422. if ( document.hidden === false && window.requestAnimationFrame ) {
  14423. window.requestAnimationFrame( schedule );
  14424. } else {
  14425. window.setTimeout( schedule, jQuery.fx.interval );
  14426. }
  14427. jQuery.fx.tick();
  14428. }
  14429. }
  14430. // Animations created synchronously will run synchronously
  14431. function createFxNow() {
  14432. window.setTimeout( function() {
  14433. fxNow = undefined;
  14434. } );
  14435. return ( fxNow = Date.now() );
  14436. }
  14437. // Generate parameters to create a standard animation
  14438. function genFx( type, includeWidth ) {
  14439. var which,
  14440. i = 0,
  14441. attrs = { height: type };
  14442. // If we include width, step value is 1 to do all cssExpand values,
  14443. // otherwise step value is 2 to skip over Left and Right
  14444. includeWidth = includeWidth ? 1 : 0;
  14445. for ( ; i < 4; i += 2 - includeWidth ) {
  14446. which = cssExpand[ i ];
  14447. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  14448. }
  14449. if ( includeWidth ) {
  14450. attrs.opacity = attrs.width = type;
  14451. }
  14452. return attrs;
  14453. }
  14454. function createTween( value, prop, animation ) {
  14455. var tween,
  14456. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  14457. index = 0,
  14458. length = collection.length;
  14459. for ( ; index < length; index++ ) {
  14460. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  14461. // We're done with this property
  14462. return tween;
  14463. }
  14464. }
  14465. }
  14466. function defaultPrefilter( elem, props, opts ) {
  14467. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  14468. isBox = "width" in props || "height" in props,
  14469. anim = this,
  14470. orig = {},
  14471. style = elem.style,
  14472. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  14473. dataShow = dataPriv.get( elem, "fxshow" );
  14474. // Queue-skipping animations hijack the fx hooks
  14475. if ( !opts.queue ) {
  14476. hooks = jQuery._queueHooks( elem, "fx" );
  14477. if ( hooks.unqueued == null ) {
  14478. hooks.unqueued = 0;
  14479. oldfire = hooks.empty.fire;
  14480. hooks.empty.fire = function() {
  14481. if ( !hooks.unqueued ) {
  14482. oldfire();
  14483. }
  14484. };
  14485. }
  14486. hooks.unqueued++;
  14487. anim.always( function() {
  14488. // Ensure the complete handler is called before this completes
  14489. anim.always( function() {
  14490. hooks.unqueued--;
  14491. if ( !jQuery.queue( elem, "fx" ).length ) {
  14492. hooks.empty.fire();
  14493. }
  14494. } );
  14495. } );
  14496. }
  14497. // Detect show/hide animations
  14498. for ( prop in props ) {
  14499. value = props[ prop ];
  14500. if ( rfxtypes.test( value ) ) {
  14501. delete props[ prop ];
  14502. toggle = toggle || value === "toggle";
  14503. if ( value === ( hidden ? "hide" : "show" ) ) {
  14504. // Pretend to be hidden if this is a "show" and
  14505. // there is still data from a stopped show/hide
  14506. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  14507. hidden = true;
  14508. // Ignore all other no-op show/hide data
  14509. } else {
  14510. continue;
  14511. }
  14512. }
  14513. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  14514. }
  14515. }
  14516. // Bail out if this is a no-op like .hide().hide()
  14517. propTween = !jQuery.isEmptyObject( props );
  14518. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  14519. return;
  14520. }
  14521. // Restrict "overflow" and "display" styles during box animations
  14522. if ( isBox && elem.nodeType === 1 ) {
  14523. // Support: IE <=9 - 11, Edge 12 - 15
  14524. // Record all 3 overflow attributes because IE does not infer the shorthand
  14525. // from identically-valued overflowX and overflowY and Edge just mirrors
  14526. // the overflowX value there.
  14527. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  14528. // Identify a display type, preferring old show/hide data over the CSS cascade
  14529. restoreDisplay = dataShow && dataShow.display;
  14530. if ( restoreDisplay == null ) {
  14531. restoreDisplay = dataPriv.get( elem, "display" );
  14532. }
  14533. display = jQuery.css( elem, "display" );
  14534. if ( display === "none" ) {
  14535. if ( restoreDisplay ) {
  14536. display = restoreDisplay;
  14537. } else {
  14538. // Get nonempty value(s) by temporarily forcing visibility
  14539. showHide( [ elem ], true );
  14540. restoreDisplay = elem.style.display || restoreDisplay;
  14541. display = jQuery.css( elem, "display" );
  14542. showHide( [ elem ] );
  14543. }
  14544. }
  14545. // Animate inline elements as inline-block
  14546. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  14547. if ( jQuery.css( elem, "float" ) === "none" ) {
  14548. // Restore the original display value at the end of pure show/hide animations
  14549. if ( !propTween ) {
  14550. anim.done( function() {
  14551. style.display = restoreDisplay;
  14552. } );
  14553. if ( restoreDisplay == null ) {
  14554. display = style.display;
  14555. restoreDisplay = display === "none" ? "" : display;
  14556. }
  14557. }
  14558. style.display = "inline-block";
  14559. }
  14560. }
  14561. }
  14562. if ( opts.overflow ) {
  14563. style.overflow = "hidden";
  14564. anim.always( function() {
  14565. style.overflow = opts.overflow[ 0 ];
  14566. style.overflowX = opts.overflow[ 1 ];
  14567. style.overflowY = opts.overflow[ 2 ];
  14568. } );
  14569. }
  14570. // Implement show/hide animations
  14571. propTween = false;
  14572. for ( prop in orig ) {
  14573. // General show/hide setup for this element animation
  14574. if ( !propTween ) {
  14575. if ( dataShow ) {
  14576. if ( "hidden" in dataShow ) {
  14577. hidden = dataShow.hidden;
  14578. }
  14579. } else {
  14580. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  14581. }
  14582. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  14583. if ( toggle ) {
  14584. dataShow.hidden = !hidden;
  14585. }
  14586. // Show elements before animating them
  14587. if ( hidden ) {
  14588. showHide( [ elem ], true );
  14589. }
  14590. /* eslint-disable no-loop-func */
  14591. anim.done( function() {
  14592. /* eslint-enable no-loop-func */
  14593. // The final step of a "hide" animation is actually hiding the element
  14594. if ( !hidden ) {
  14595. showHide( [ elem ] );
  14596. }
  14597. dataPriv.remove( elem, "fxshow" );
  14598. for ( prop in orig ) {
  14599. jQuery.style( elem, prop, orig[ prop ] );
  14600. }
  14601. } );
  14602. }
  14603. // Per-property setup
  14604. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  14605. if ( !( prop in dataShow ) ) {
  14606. dataShow[ prop ] = propTween.start;
  14607. if ( hidden ) {
  14608. propTween.end = propTween.start;
  14609. propTween.start = 0;
  14610. }
  14611. }
  14612. }
  14613. }
  14614. function propFilter( props, specialEasing ) {
  14615. var index, name, easing, value, hooks;
  14616. // camelCase, specialEasing and expand cssHook pass
  14617. for ( index in props ) {
  14618. name = camelCase( index );
  14619. easing = specialEasing[ name ];
  14620. value = props[ index ];
  14621. if ( Array.isArray( value ) ) {
  14622. easing = value[ 1 ];
  14623. value = props[ index ] = value[ 0 ];
  14624. }
  14625. if ( index !== name ) {
  14626. props[ name ] = value;
  14627. delete props[ index ];
  14628. }
  14629. hooks = jQuery.cssHooks[ name ];
  14630. if ( hooks && "expand" in hooks ) {
  14631. value = hooks.expand( value );
  14632. delete props[ name ];
  14633. // Not quite $.extend, this won't overwrite existing keys.
  14634. // Reusing 'index' because we have the correct "name"
  14635. for ( index in value ) {
  14636. if ( !( index in props ) ) {
  14637. props[ index ] = value[ index ];
  14638. specialEasing[ index ] = easing;
  14639. }
  14640. }
  14641. } else {
  14642. specialEasing[ name ] = easing;
  14643. }
  14644. }
  14645. }
  14646. function Animation( elem, properties, options ) {
  14647. var result,
  14648. stopped,
  14649. index = 0,
  14650. length = Animation.prefilters.length,
  14651. deferred = jQuery.Deferred().always( function() {
  14652. // Don't match elem in the :animated selector
  14653. delete tick.elem;
  14654. } ),
  14655. tick = function() {
  14656. if ( stopped ) {
  14657. return false;
  14658. }
  14659. var currentTime = fxNow || createFxNow(),
  14660. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  14661. // Support: Android 2.3 only
  14662. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  14663. temp = remaining / animation.duration || 0,
  14664. percent = 1 - temp,
  14665. index = 0,
  14666. length = animation.tweens.length;
  14667. for ( ; index < length; index++ ) {
  14668. animation.tweens[ index ].run( percent );
  14669. }
  14670. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  14671. // If there's more to do, yield
  14672. if ( percent < 1 && length ) {
  14673. return remaining;
  14674. }
  14675. // If this was an empty animation, synthesize a final progress notification
  14676. if ( !length ) {
  14677. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14678. }
  14679. // Resolve the animation and report its conclusion
  14680. deferred.resolveWith( elem, [ animation ] );
  14681. return false;
  14682. },
  14683. animation = deferred.promise( {
  14684. elem: elem,
  14685. props: jQuery.extend( {}, properties ),
  14686. opts: jQuery.extend( true, {
  14687. specialEasing: {},
  14688. easing: jQuery.easing._default
  14689. }, options ),
  14690. originalProperties: properties,
  14691. originalOptions: options,
  14692. startTime: fxNow || createFxNow(),
  14693. duration: options.duration,
  14694. tweens: [],
  14695. createTween: function( prop, end ) {
  14696. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  14697. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  14698. animation.tweens.push( tween );
  14699. return tween;
  14700. },
  14701. stop: function( gotoEnd ) {
  14702. var index = 0,
  14703. // If we are going to the end, we want to run all the tweens
  14704. // otherwise we skip this part
  14705. length = gotoEnd ? animation.tweens.length : 0;
  14706. if ( stopped ) {
  14707. return this;
  14708. }
  14709. stopped = true;
  14710. for ( ; index < length; index++ ) {
  14711. animation.tweens[ index ].run( 1 );
  14712. }
  14713. // Resolve when we played the last frame; otherwise, reject
  14714. if ( gotoEnd ) {
  14715. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14716. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  14717. } else {
  14718. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  14719. }
  14720. return this;
  14721. }
  14722. } ),
  14723. props = animation.props;
  14724. propFilter( props, animation.opts.specialEasing );
  14725. for ( ; index < length; index++ ) {
  14726. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  14727. if ( result ) {
  14728. if ( isFunction( result.stop ) ) {
  14729. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  14730. result.stop.bind( result );
  14731. }
  14732. return result;
  14733. }
  14734. }
  14735. jQuery.map( props, createTween, animation );
  14736. if ( isFunction( animation.opts.start ) ) {
  14737. animation.opts.start.call( elem, animation );
  14738. }
  14739. // Attach callbacks from options
  14740. animation
  14741. .progress( animation.opts.progress )
  14742. .done( animation.opts.done, animation.opts.complete )
  14743. .fail( animation.opts.fail )
  14744. .always( animation.opts.always );
  14745. jQuery.fx.timer(
  14746. jQuery.extend( tick, {
  14747. elem: elem,
  14748. anim: animation,
  14749. queue: animation.opts.queue
  14750. } )
  14751. );
  14752. return animation;
  14753. }
  14754. jQuery.Animation = jQuery.extend( Animation, {
  14755. tweeners: {
  14756. "*": [ function( prop, value ) {
  14757. var tween = this.createTween( prop, value );
  14758. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  14759. return tween;
  14760. } ]
  14761. },
  14762. tweener: function( props, callback ) {
  14763. if ( isFunction( props ) ) {
  14764. callback = props;
  14765. props = [ "*" ];
  14766. } else {
  14767. props = props.match( rnothtmlwhite );
  14768. }
  14769. var prop,
  14770. index = 0,
  14771. length = props.length;
  14772. for ( ; index < length; index++ ) {
  14773. prop = props[ index ];
  14774. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  14775. Animation.tweeners[ prop ].unshift( callback );
  14776. }
  14777. },
  14778. prefilters: [ defaultPrefilter ],
  14779. prefilter: function( callback, prepend ) {
  14780. if ( prepend ) {
  14781. Animation.prefilters.unshift( callback );
  14782. } else {
  14783. Animation.prefilters.push( callback );
  14784. }
  14785. }
  14786. } );
  14787. jQuery.speed = function( speed, easing, fn ) {
  14788. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  14789. complete: fn || !fn && easing ||
  14790. isFunction( speed ) && speed,
  14791. duration: speed,
  14792. easing: fn && easing || easing && !isFunction( easing ) && easing
  14793. };
  14794. // Go to the end state if fx are off
  14795. if ( jQuery.fx.off ) {
  14796. opt.duration = 0;
  14797. } else {
  14798. if ( typeof opt.duration !== "number" ) {
  14799. if ( opt.duration in jQuery.fx.speeds ) {
  14800. opt.duration = jQuery.fx.speeds[ opt.duration ];
  14801. } else {
  14802. opt.duration = jQuery.fx.speeds._default;
  14803. }
  14804. }
  14805. }
  14806. // Normalize opt.queue - true/undefined/null -> "fx"
  14807. if ( opt.queue == null || opt.queue === true ) {
  14808. opt.queue = "fx";
  14809. }
  14810. // Queueing
  14811. opt.old = opt.complete;
  14812. opt.complete = function() {
  14813. if ( isFunction( opt.old ) ) {
  14814. opt.old.call( this );
  14815. }
  14816. if ( opt.queue ) {
  14817. jQuery.dequeue( this, opt.queue );
  14818. }
  14819. };
  14820. return opt;
  14821. };
  14822. jQuery.fn.extend( {
  14823. fadeTo: function( speed, to, easing, callback ) {
  14824. // Show any hidden elements after setting opacity to 0
  14825. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  14826. // Animate to the value specified
  14827. .end().animate( { opacity: to }, speed, easing, callback );
  14828. },
  14829. animate: function( prop, speed, easing, callback ) {
  14830. var empty = jQuery.isEmptyObject( prop ),
  14831. optall = jQuery.speed( speed, easing, callback ),
  14832. doAnimation = function() {
  14833. // Operate on a copy of prop so per-property easing won't be lost
  14834. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  14835. // Empty animations, or finishing resolves immediately
  14836. if ( empty || dataPriv.get( this, "finish" ) ) {
  14837. anim.stop( true );
  14838. }
  14839. };
  14840. doAnimation.finish = doAnimation;
  14841. return empty || optall.queue === false ?
  14842. this.each( doAnimation ) :
  14843. this.queue( optall.queue, doAnimation );
  14844. },
  14845. stop: function( type, clearQueue, gotoEnd ) {
  14846. var stopQueue = function( hooks ) {
  14847. var stop = hooks.stop;
  14848. delete hooks.stop;
  14849. stop( gotoEnd );
  14850. };
  14851. if ( typeof type !== "string" ) {
  14852. gotoEnd = clearQueue;
  14853. clearQueue = type;
  14854. type = undefined;
  14855. }
  14856. if ( clearQueue && type !== false ) {
  14857. this.queue( type || "fx", [] );
  14858. }
  14859. return this.each( function() {
  14860. var dequeue = true,
  14861. index = type != null && type + "queueHooks",
  14862. timers = jQuery.timers,
  14863. data = dataPriv.get( this );
  14864. if ( index ) {
  14865. if ( data[ index ] && data[ index ].stop ) {
  14866. stopQueue( data[ index ] );
  14867. }
  14868. } else {
  14869. for ( index in data ) {
  14870. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  14871. stopQueue( data[ index ] );
  14872. }
  14873. }
  14874. }
  14875. for ( index = timers.length; index--; ) {
  14876. if ( timers[ index ].elem === this &&
  14877. ( type == null || timers[ index ].queue === type ) ) {
  14878. timers[ index ].anim.stop( gotoEnd );
  14879. dequeue = false;
  14880. timers.splice( index, 1 );
  14881. }
  14882. }
  14883. // Start the next in the queue if the last step wasn't forced.
  14884. // Timers currently will call their complete callbacks, which
  14885. // will dequeue but only if they were gotoEnd.
  14886. if ( dequeue || !gotoEnd ) {
  14887. jQuery.dequeue( this, type );
  14888. }
  14889. } );
  14890. },
  14891. finish: function( type ) {
  14892. if ( type !== false ) {
  14893. type = type || "fx";
  14894. }
  14895. return this.each( function() {
  14896. var index,
  14897. data = dataPriv.get( this ),
  14898. queue = data[ type + "queue" ],
  14899. hooks = data[ type + "queueHooks" ],
  14900. timers = jQuery.timers,
  14901. length = queue ? queue.length : 0;
  14902. // Enable finishing flag on private data
  14903. data.finish = true;
  14904. // Empty the queue first
  14905. jQuery.queue( this, type, [] );
  14906. if ( hooks && hooks.stop ) {
  14907. hooks.stop.call( this, true );
  14908. }
  14909. // Look for any active animations, and finish them
  14910. for ( index = timers.length; index--; ) {
  14911. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  14912. timers[ index ].anim.stop( true );
  14913. timers.splice( index, 1 );
  14914. }
  14915. }
  14916. // Look for any animations in the old queue and finish them
  14917. for ( index = 0; index < length; index++ ) {
  14918. if ( queue[ index ] && queue[ index ].finish ) {
  14919. queue[ index ].finish.call( this );
  14920. }
  14921. }
  14922. // Turn off finishing flag
  14923. delete data.finish;
  14924. } );
  14925. }
  14926. } );
  14927. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  14928. var cssFn = jQuery.fn[ name ];
  14929. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14930. return speed == null || typeof speed === "boolean" ?
  14931. cssFn.apply( this, arguments ) :
  14932. this.animate( genFx( name, true ), speed, easing, callback );
  14933. };
  14934. } );
  14935. // Generate shortcuts for custom animations
  14936. jQuery.each( {
  14937. slideDown: genFx( "show" ),
  14938. slideUp: genFx( "hide" ),
  14939. slideToggle: genFx( "toggle" ),
  14940. fadeIn: { opacity: "show" },
  14941. fadeOut: { opacity: "hide" },
  14942. fadeToggle: { opacity: "toggle" }
  14943. }, function( name, props ) {
  14944. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14945. return this.animate( props, speed, easing, callback );
  14946. };
  14947. } );
  14948. jQuery.timers = [];
  14949. jQuery.fx.tick = function() {
  14950. var timer,
  14951. i = 0,
  14952. timers = jQuery.timers;
  14953. fxNow = Date.now();
  14954. for ( ; i < timers.length; i++ ) {
  14955. timer = timers[ i ];
  14956. // Run the timer and safely remove it when done (allowing for external removal)
  14957. if ( !timer() && timers[ i ] === timer ) {
  14958. timers.splice( i--, 1 );
  14959. }
  14960. }
  14961. if ( !timers.length ) {
  14962. jQuery.fx.stop();
  14963. }
  14964. fxNow = undefined;
  14965. };
  14966. jQuery.fx.timer = function( timer ) {
  14967. jQuery.timers.push( timer );
  14968. jQuery.fx.start();
  14969. };
  14970. jQuery.fx.interval = 13;
  14971. jQuery.fx.start = function() {
  14972. if ( inProgress ) {
  14973. return;
  14974. }
  14975. inProgress = true;
  14976. schedule();
  14977. };
  14978. jQuery.fx.stop = function() {
  14979. inProgress = null;
  14980. };
  14981. jQuery.fx.speeds = {
  14982. slow: 600,
  14983. fast: 200,
  14984. // Default speed
  14985. _default: 400
  14986. };
  14987. // Based off of the plugin by Clint Helfers, with permission.
  14988. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  14989. jQuery.fn.delay = function( time, type ) {
  14990. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  14991. type = type || "fx";
  14992. return this.queue( type, function( next, hooks ) {
  14993. var timeout = window.setTimeout( next, time );
  14994. hooks.stop = function() {
  14995. window.clearTimeout( timeout );
  14996. };
  14997. } );
  14998. };
  14999. ( function() {
  15000. var input = document.createElement( "input" ),
  15001. select = document.createElement( "select" ),
  15002. opt = select.appendChild( document.createElement( "option" ) );
  15003. input.type = "checkbox";
  15004. // Support: Android <=4.3 only
  15005. // Default value for a checkbox should be "on"
  15006. support.checkOn = input.value !== "";
  15007. // Support: IE <=11 only
  15008. // Must access selectedIndex to make default options select
  15009. support.optSelected = opt.selected;
  15010. // Support: IE <=11 only
  15011. // An input loses its value after becoming a radio
  15012. input = document.createElement( "input" );
  15013. input.value = "t";
  15014. input.type = "radio";
  15015. support.radioValue = input.value === "t";
  15016. } )();
  15017. var boolHook,
  15018. attrHandle = jQuery.expr.attrHandle;
  15019. jQuery.fn.extend( {
  15020. attr: function( name, value ) {
  15021. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  15022. },
  15023. removeAttr: function( name ) {
  15024. return this.each( function() {
  15025. jQuery.removeAttr( this, name );
  15026. } );
  15027. }
  15028. } );
  15029. jQuery.extend( {
  15030. attr: function( elem, name, value ) {
  15031. var ret, hooks,
  15032. nType = elem.nodeType;
  15033. // Don't get/set attributes on text, comment and attribute nodes
  15034. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15035. return;
  15036. }
  15037. // Fallback to prop when attributes are not supported
  15038. if ( typeof elem.getAttribute === "undefined" ) {
  15039. return jQuery.prop( elem, name, value );
  15040. }
  15041. // Attribute hooks are determined by the lowercase version
  15042. // Grab necessary hook if one is defined
  15043. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15044. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  15045. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  15046. }
  15047. if ( value !== undefined ) {
  15048. if ( value === null ) {
  15049. jQuery.removeAttr( elem, name );
  15050. return;
  15051. }
  15052. if ( hooks && "set" in hooks &&
  15053. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15054. return ret;
  15055. }
  15056. elem.setAttribute( name, value + "" );
  15057. return value;
  15058. }
  15059. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15060. return ret;
  15061. }
  15062. ret = jQuery.find.attr( elem, name );
  15063. // Non-existent attributes return null, we normalize to undefined
  15064. return ret == null ? undefined : ret;
  15065. },
  15066. attrHooks: {
  15067. type: {
  15068. set: function( elem, value ) {
  15069. if ( !support.radioValue && value === "radio" &&
  15070. nodeName( elem, "input" ) ) {
  15071. var val = elem.value;
  15072. elem.setAttribute( "type", value );
  15073. if ( val ) {
  15074. elem.value = val;
  15075. }
  15076. return value;
  15077. }
  15078. }
  15079. }
  15080. },
  15081. removeAttr: function( elem, value ) {
  15082. var name,
  15083. i = 0,
  15084. // Attribute names can contain non-HTML whitespace characters
  15085. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  15086. attrNames = value && value.match( rnothtmlwhite );
  15087. if ( attrNames && elem.nodeType === 1 ) {
  15088. while ( ( name = attrNames[ i++ ] ) ) {
  15089. elem.removeAttribute( name );
  15090. }
  15091. }
  15092. }
  15093. } );
  15094. // Hooks for boolean attributes
  15095. boolHook = {
  15096. set: function( elem, value, name ) {
  15097. if ( value === false ) {
  15098. // Remove boolean attributes when set to false
  15099. jQuery.removeAttr( elem, name );
  15100. } else {
  15101. elem.setAttribute( name, name );
  15102. }
  15103. return name;
  15104. }
  15105. };
  15106. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  15107. var getter = attrHandle[ name ] || jQuery.find.attr;
  15108. attrHandle[ name ] = function( elem, name, isXML ) {
  15109. var ret, handle,
  15110. lowercaseName = name.toLowerCase();
  15111. if ( !isXML ) {
  15112. // Avoid an infinite loop by temporarily removing this function from the getter
  15113. handle = attrHandle[ lowercaseName ];
  15114. attrHandle[ lowercaseName ] = ret;
  15115. ret = getter( elem, name, isXML ) != null ?
  15116. lowercaseName :
  15117. null;
  15118. attrHandle[ lowercaseName ] = handle;
  15119. }
  15120. return ret;
  15121. };
  15122. } );
  15123. var rfocusable = /^(?:input|select|textarea|button)$/i,
  15124. rclickable = /^(?:a|area)$/i;
  15125. jQuery.fn.extend( {
  15126. prop: function( name, value ) {
  15127. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  15128. },
  15129. removeProp: function( name ) {
  15130. return this.each( function() {
  15131. delete this[ jQuery.propFix[ name ] || name ];
  15132. } );
  15133. }
  15134. } );
  15135. jQuery.extend( {
  15136. prop: function( elem, name, value ) {
  15137. var ret, hooks,
  15138. nType = elem.nodeType;
  15139. // Don't get/set properties on text, comment and attribute nodes
  15140. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15141. return;
  15142. }
  15143. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15144. // Fix name and attach hooks
  15145. name = jQuery.propFix[ name ] || name;
  15146. hooks = jQuery.propHooks[ name ];
  15147. }
  15148. if ( value !== undefined ) {
  15149. if ( hooks && "set" in hooks &&
  15150. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15151. return ret;
  15152. }
  15153. return ( elem[ name ] = value );
  15154. }
  15155. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15156. return ret;
  15157. }
  15158. return elem[ name ];
  15159. },
  15160. propHooks: {
  15161. tabIndex: {
  15162. get: function( elem ) {
  15163. // Support: IE <=9 - 11 only
  15164. // elem.tabIndex doesn't always return the
  15165. // correct value when it hasn't been explicitly set
  15166. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  15167. // Use proper attribute retrieval(#12072)
  15168. var tabindex = jQuery.find.attr( elem, "tabindex" );
  15169. if ( tabindex ) {
  15170. return parseInt( tabindex, 10 );
  15171. }
  15172. if (
  15173. rfocusable.test( elem.nodeName ) ||
  15174. rclickable.test( elem.nodeName ) &&
  15175. elem.href
  15176. ) {
  15177. return 0;
  15178. }
  15179. return -1;
  15180. }
  15181. }
  15182. },
  15183. propFix: {
  15184. "for": "htmlFor",
  15185. "class": "className"
  15186. }
  15187. } );
  15188. // Support: IE <=11 only
  15189. // Accessing the selectedIndex property
  15190. // forces the browser to respect setting selected
  15191. // on the option
  15192. // The getter ensures a default option is selected
  15193. // when in an optgroup
  15194. // eslint rule "no-unused-expressions" is disabled for this code
  15195. // since it considers such accessions noop
  15196. if ( !support.optSelected ) {
  15197. jQuery.propHooks.selected = {
  15198. get: function( elem ) {
  15199. /* eslint no-unused-expressions: "off" */
  15200. var parent = elem.parentNode;
  15201. if ( parent && parent.parentNode ) {
  15202. parent.parentNode.selectedIndex;
  15203. }
  15204. return null;
  15205. },
  15206. set: function( elem ) {
  15207. /* eslint no-unused-expressions: "off" */
  15208. var parent = elem.parentNode;
  15209. if ( parent ) {
  15210. parent.selectedIndex;
  15211. if ( parent.parentNode ) {
  15212. parent.parentNode.selectedIndex;
  15213. }
  15214. }
  15215. }
  15216. };
  15217. }
  15218. jQuery.each( [
  15219. "tabIndex",
  15220. "readOnly",
  15221. "maxLength",
  15222. "cellSpacing",
  15223. "cellPadding",
  15224. "rowSpan",
  15225. "colSpan",
  15226. "useMap",
  15227. "frameBorder",
  15228. "contentEditable"
  15229. ], function() {
  15230. jQuery.propFix[ this.toLowerCase() ] = this;
  15231. } );
  15232. // Strip and collapse whitespace according to HTML spec
  15233. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  15234. function stripAndCollapse( value ) {
  15235. var tokens = value.match( rnothtmlwhite ) || [];
  15236. return tokens.join( " " );
  15237. }
  15238. function getClass( elem ) {
  15239. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  15240. }
  15241. function classesToArray( value ) {
  15242. if ( Array.isArray( value ) ) {
  15243. return value;
  15244. }
  15245. if ( typeof value === "string" ) {
  15246. return value.match( rnothtmlwhite ) || [];
  15247. }
  15248. return [];
  15249. }
  15250. jQuery.fn.extend( {
  15251. addClass: function( value ) {
  15252. var classes, elem, cur, curValue, clazz, j, finalValue,
  15253. i = 0;
  15254. if ( isFunction( value ) ) {
  15255. return this.each( function( j ) {
  15256. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  15257. } );
  15258. }
  15259. classes = classesToArray( value );
  15260. if ( classes.length ) {
  15261. while ( ( elem = this[ i++ ] ) ) {
  15262. curValue = getClass( elem );
  15263. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15264. if ( cur ) {
  15265. j = 0;
  15266. while ( ( clazz = classes[ j++ ] ) ) {
  15267. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  15268. cur += clazz + " ";
  15269. }
  15270. }
  15271. // Only assign if different to avoid unneeded rendering.
  15272. finalValue = stripAndCollapse( cur );
  15273. if ( curValue !== finalValue ) {
  15274. elem.setAttribute( "class", finalValue );
  15275. }
  15276. }
  15277. }
  15278. }
  15279. return this;
  15280. },
  15281. removeClass: function( value ) {
  15282. var classes, elem, cur, curValue, clazz, j, finalValue,
  15283. i = 0;
  15284. if ( isFunction( value ) ) {
  15285. return this.each( function( j ) {
  15286. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  15287. } );
  15288. }
  15289. if ( !arguments.length ) {
  15290. return this.attr( "class", "" );
  15291. }
  15292. classes = classesToArray( value );
  15293. if ( classes.length ) {
  15294. while ( ( elem = this[ i++ ] ) ) {
  15295. curValue = getClass( elem );
  15296. // This expression is here for better compressibility (see addClass)
  15297. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15298. if ( cur ) {
  15299. j = 0;
  15300. while ( ( clazz = classes[ j++ ] ) ) {
  15301. // Remove *all* instances
  15302. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  15303. cur = cur.replace( " " + clazz + " ", " " );
  15304. }
  15305. }
  15306. // Only assign if different to avoid unneeded rendering.
  15307. finalValue = stripAndCollapse( cur );
  15308. if ( curValue !== finalValue ) {
  15309. elem.setAttribute( "class", finalValue );
  15310. }
  15311. }
  15312. }
  15313. }
  15314. return this;
  15315. },
  15316. toggleClass: function( value, stateVal ) {
  15317. var type = typeof value,
  15318. isValidValue = type === "string" || Array.isArray( value );
  15319. if ( typeof stateVal === "boolean" && isValidValue ) {
  15320. return stateVal ? this.addClass( value ) : this.removeClass( value );
  15321. }
  15322. if ( isFunction( value ) ) {
  15323. return this.each( function( i ) {
  15324. jQuery( this ).toggleClass(
  15325. value.call( this, i, getClass( this ), stateVal ),
  15326. stateVal
  15327. );
  15328. } );
  15329. }
  15330. return this.each( function() {
  15331. var className, i, self, classNames;
  15332. if ( isValidValue ) {
  15333. // Toggle individual class names
  15334. i = 0;
  15335. self = jQuery( this );
  15336. classNames = classesToArray( value );
  15337. while ( ( className = classNames[ i++ ] ) ) {
  15338. // Check each className given, space separated list
  15339. if ( self.hasClass( className ) ) {
  15340. self.removeClass( className );
  15341. } else {
  15342. self.addClass( className );
  15343. }
  15344. }
  15345. // Toggle whole class name
  15346. } else if ( value === undefined || type === "boolean" ) {
  15347. className = getClass( this );
  15348. if ( className ) {
  15349. // Store className if set
  15350. dataPriv.set( this, "__className__", className );
  15351. }
  15352. // If the element has a class name or if we're passed `false`,
  15353. // then remove the whole classname (if there was one, the above saved it).
  15354. // Otherwise bring back whatever was previously saved (if anything),
  15355. // falling back to the empty string if nothing was stored.
  15356. if ( this.setAttribute ) {
  15357. this.setAttribute( "class",
  15358. className || value === false ?
  15359. "" :
  15360. dataPriv.get( this, "__className__" ) || ""
  15361. );
  15362. }
  15363. }
  15364. } );
  15365. },
  15366. hasClass: function( selector ) {
  15367. var className, elem,
  15368. i = 0;
  15369. className = " " + selector + " ";
  15370. while ( ( elem = this[ i++ ] ) ) {
  15371. if ( elem.nodeType === 1 &&
  15372. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  15373. return true;
  15374. }
  15375. }
  15376. return false;
  15377. }
  15378. } );
  15379. var rreturn = /\r/g;
  15380. jQuery.fn.extend( {
  15381. val: function( value ) {
  15382. var hooks, ret, valueIsFunction,
  15383. elem = this[ 0 ];
  15384. if ( !arguments.length ) {
  15385. if ( elem ) {
  15386. hooks = jQuery.valHooks[ elem.type ] ||
  15387. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  15388. if ( hooks &&
  15389. "get" in hooks &&
  15390. ( ret = hooks.get( elem, "value" ) ) !== undefined
  15391. ) {
  15392. return ret;
  15393. }
  15394. ret = elem.value;
  15395. // Handle most common string cases
  15396. if ( typeof ret === "string" ) {
  15397. return ret.replace( rreturn, "" );
  15398. }
  15399. // Handle cases where value is null/undef or number
  15400. return ret == null ? "" : ret;
  15401. }
  15402. return;
  15403. }
  15404. valueIsFunction = isFunction( value );
  15405. return this.each( function( i ) {
  15406. var val;
  15407. if ( this.nodeType !== 1 ) {
  15408. return;
  15409. }
  15410. if ( valueIsFunction ) {
  15411. val = value.call( this, i, jQuery( this ).val() );
  15412. } else {
  15413. val = value;
  15414. }
  15415. // Treat null/undefined as ""; convert numbers to string
  15416. if ( val == null ) {
  15417. val = "";
  15418. } else if ( typeof val === "number" ) {
  15419. val += "";
  15420. } else if ( Array.isArray( val ) ) {
  15421. val = jQuery.map( val, function( value ) {
  15422. return value == null ? "" : value + "";
  15423. } );
  15424. }
  15425. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  15426. // If set returns undefined, fall back to normal setting
  15427. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  15428. this.value = val;
  15429. }
  15430. } );
  15431. }
  15432. } );
  15433. jQuery.extend( {
  15434. valHooks: {
  15435. option: {
  15436. get: function( elem ) {
  15437. var val = jQuery.find.attr( elem, "value" );
  15438. return val != null ?
  15439. val :
  15440. // Support: IE <=10 - 11 only
  15441. // option.text throws exceptions (#14686, #14858)
  15442. // Strip and collapse whitespace
  15443. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  15444. stripAndCollapse( jQuery.text( elem ) );
  15445. }
  15446. },
  15447. select: {
  15448. get: function( elem ) {
  15449. var value, option, i,
  15450. options = elem.options,
  15451. index = elem.selectedIndex,
  15452. one = elem.type === "select-one",
  15453. values = one ? null : [],
  15454. max = one ? index + 1 : options.length;
  15455. if ( index < 0 ) {
  15456. i = max;
  15457. } else {
  15458. i = one ? index : 0;
  15459. }
  15460. // Loop through all the selected options
  15461. for ( ; i < max; i++ ) {
  15462. option = options[ i ];
  15463. // Support: IE <=9 only
  15464. // IE8-9 doesn't update selected after form reset (#2551)
  15465. if ( ( option.selected || i === index ) &&
  15466. // Don't return options that are disabled or in a disabled optgroup
  15467. !option.disabled &&
  15468. ( !option.parentNode.disabled ||
  15469. !nodeName( option.parentNode, "optgroup" ) ) ) {
  15470. // Get the specific value for the option
  15471. value = jQuery( option ).val();
  15472. // We don't need an array for one selects
  15473. if ( one ) {
  15474. return value;
  15475. }
  15476. // Multi-Selects return an array
  15477. values.push( value );
  15478. }
  15479. }
  15480. return values;
  15481. },
  15482. set: function( elem, value ) {
  15483. var optionSet, option,
  15484. options = elem.options,
  15485. values = jQuery.makeArray( value ),
  15486. i = options.length;
  15487. while ( i-- ) {
  15488. option = options[ i ];
  15489. /* eslint-disable no-cond-assign */
  15490. if ( option.selected =
  15491. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  15492. ) {
  15493. optionSet = true;
  15494. }
  15495. /* eslint-enable no-cond-assign */
  15496. }
  15497. // Force browsers to behave consistently when non-matching value is set
  15498. if ( !optionSet ) {
  15499. elem.selectedIndex = -1;
  15500. }
  15501. return values;
  15502. }
  15503. }
  15504. }
  15505. } );
  15506. // Radios and checkboxes getter/setter
  15507. jQuery.each( [ "radio", "checkbox" ], function() {
  15508. jQuery.valHooks[ this ] = {
  15509. set: function( elem, value ) {
  15510. if ( Array.isArray( value ) ) {
  15511. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  15512. }
  15513. }
  15514. };
  15515. if ( !support.checkOn ) {
  15516. jQuery.valHooks[ this ].get = function( elem ) {
  15517. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  15518. };
  15519. }
  15520. } );
  15521. // Return jQuery for attributes-only inclusion
  15522. support.focusin = "onfocusin" in window;
  15523. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  15524. stopPropagationCallback = function( e ) {
  15525. e.stopPropagation();
  15526. };
  15527. jQuery.extend( jQuery.event, {
  15528. trigger: function( event, data, elem, onlyHandlers ) {
  15529. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  15530. eventPath = [ elem || document ],
  15531. type = hasOwn.call( event, "type" ) ? event.type : event,
  15532. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  15533. cur = lastElement = tmp = elem = elem || document;
  15534. // Don't do events on text and comment nodes
  15535. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  15536. return;
  15537. }
  15538. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  15539. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  15540. return;
  15541. }
  15542. if ( type.indexOf( "." ) > -1 ) {
  15543. // Namespaced trigger; create a regexp to match event type in handle()
  15544. namespaces = type.split( "." );
  15545. type = namespaces.shift();
  15546. namespaces.sort();
  15547. }
  15548. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  15549. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  15550. event = event[ jQuery.expando ] ?
  15551. event :
  15552. new jQuery.Event( type, typeof event === "object" && event );
  15553. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  15554. event.isTrigger = onlyHandlers ? 2 : 3;
  15555. event.namespace = namespaces.join( "." );
  15556. event.rnamespace = event.namespace ?
  15557. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  15558. null;
  15559. // Clean up the event in case it is being reused
  15560. event.result = undefined;
  15561. if ( !event.target ) {
  15562. event.target = elem;
  15563. }
  15564. // Clone any incoming data and prepend the event, creating the handler arg list
  15565. data = data == null ?
  15566. [ event ] :
  15567. jQuery.makeArray( data, [ event ] );
  15568. // Allow special events to draw outside the lines
  15569. special = jQuery.event.special[ type ] || {};
  15570. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  15571. return;
  15572. }
  15573. // Determine event propagation path in advance, per W3C events spec (#9951)
  15574. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  15575. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  15576. bubbleType = special.delegateType || type;
  15577. if ( !rfocusMorph.test( bubbleType + type ) ) {
  15578. cur = cur.parentNode;
  15579. }
  15580. for ( ; cur; cur = cur.parentNode ) {
  15581. eventPath.push( cur );
  15582. tmp = cur;
  15583. }
  15584. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  15585. if ( tmp === ( elem.ownerDocument || document ) ) {
  15586. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  15587. }
  15588. }
  15589. // Fire handlers on the event path
  15590. i = 0;
  15591. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  15592. lastElement = cur;
  15593. event.type = i > 1 ?
  15594. bubbleType :
  15595. special.bindType || type;
  15596. // jQuery handler
  15597. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  15598. dataPriv.get( cur, "handle" );
  15599. if ( handle ) {
  15600. handle.apply( cur, data );
  15601. }
  15602. // Native handler
  15603. handle = ontype && cur[ ontype ];
  15604. if ( handle && handle.apply && acceptData( cur ) ) {
  15605. event.result = handle.apply( cur, data );
  15606. if ( event.result === false ) {
  15607. event.preventDefault();
  15608. }
  15609. }
  15610. }
  15611. event.type = type;
  15612. // If nobody prevented the default action, do it now
  15613. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  15614. if ( ( !special._default ||
  15615. special._default.apply( eventPath.pop(), data ) === false ) &&
  15616. acceptData( elem ) ) {
  15617. // Call a native DOM method on the target with the same name as the event.
  15618. // Don't do default actions on window, that's where global variables be (#6170)
  15619. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  15620. // Don't re-trigger an onFOO event when we call its FOO() method
  15621. tmp = elem[ ontype ];
  15622. if ( tmp ) {
  15623. elem[ ontype ] = null;
  15624. }
  15625. // Prevent re-triggering of the same event, since we already bubbled it above
  15626. jQuery.event.triggered = type;
  15627. if ( event.isPropagationStopped() ) {
  15628. lastElement.addEventListener( type, stopPropagationCallback );
  15629. }
  15630. elem[ type ]();
  15631. if ( event.isPropagationStopped() ) {
  15632. lastElement.removeEventListener( type, stopPropagationCallback );
  15633. }
  15634. jQuery.event.triggered = undefined;
  15635. if ( tmp ) {
  15636. elem[ ontype ] = tmp;
  15637. }
  15638. }
  15639. }
  15640. }
  15641. return event.result;
  15642. },
  15643. // Piggyback on a donor event to simulate a different one
  15644. // Used only for `focus(in | out)` events
  15645. simulate: function( type, elem, event ) {
  15646. var e = jQuery.extend(
  15647. new jQuery.Event(),
  15648. event,
  15649. {
  15650. type: type,
  15651. isSimulated: true
  15652. }
  15653. );
  15654. jQuery.event.trigger( e, null, elem );
  15655. }
  15656. } );
  15657. jQuery.fn.extend( {
  15658. trigger: function( type, data ) {
  15659. return this.each( function() {
  15660. jQuery.event.trigger( type, data, this );
  15661. } );
  15662. },
  15663. triggerHandler: function( type, data ) {
  15664. var elem = this[ 0 ];
  15665. if ( elem ) {
  15666. return jQuery.event.trigger( type, data, elem, true );
  15667. }
  15668. }
  15669. } );
  15670. // Support: Firefox <=44
  15671. // Firefox doesn't have focus(in | out) events
  15672. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  15673. //
  15674. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  15675. // focus(in | out) events fire after focus & blur events,
  15676. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  15677. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  15678. if ( !support.focusin ) {
  15679. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  15680. // Attach a single capturing handler on the document while someone wants focusin/focusout
  15681. var handler = function( event ) {
  15682. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  15683. };
  15684. jQuery.event.special[ fix ] = {
  15685. setup: function() {
  15686. var doc = this.ownerDocument || this,
  15687. attaches = dataPriv.access( doc, fix );
  15688. if ( !attaches ) {
  15689. doc.addEventListener( orig, handler, true );
  15690. }
  15691. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  15692. },
  15693. teardown: function() {
  15694. var doc = this.ownerDocument || this,
  15695. attaches = dataPriv.access( doc, fix ) - 1;
  15696. if ( !attaches ) {
  15697. doc.removeEventListener( orig, handler, true );
  15698. dataPriv.remove( doc, fix );
  15699. } else {
  15700. dataPriv.access( doc, fix, attaches );
  15701. }
  15702. }
  15703. };
  15704. } );
  15705. }
  15706. var location = window.location;
  15707. var nonce = Date.now();
  15708. var rquery = ( /\?/ );
  15709. // Cross-browser xml parsing
  15710. jQuery.parseXML = function( data ) {
  15711. var xml;
  15712. if ( !data || typeof data !== "string" ) {
  15713. return null;
  15714. }
  15715. // Support: IE 9 - 11 only
  15716. // IE throws on parseFromString with invalid input.
  15717. try {
  15718. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  15719. } catch ( e ) {
  15720. xml = undefined;
  15721. }
  15722. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  15723. jQuery.error( "Invalid XML: " + data );
  15724. }
  15725. return xml;
  15726. };
  15727. var
  15728. rbracket = /\[\]$/,
  15729. rCRLF = /\r?\n/g,
  15730. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  15731. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  15732. function buildParams( prefix, obj, traditional, add ) {
  15733. var name;
  15734. if ( Array.isArray( obj ) ) {
  15735. // Serialize array item.
  15736. jQuery.each( obj, function( i, v ) {
  15737. if ( traditional || rbracket.test( prefix ) ) {
  15738. // Treat each array item as a scalar.
  15739. add( prefix, v );
  15740. } else {
  15741. // Item is non-scalar (array or object), encode its numeric index.
  15742. buildParams(
  15743. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  15744. v,
  15745. traditional,
  15746. add
  15747. );
  15748. }
  15749. } );
  15750. } else if ( !traditional && toType( obj ) === "object" ) {
  15751. // Serialize object item.
  15752. for ( name in obj ) {
  15753. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  15754. }
  15755. } else {
  15756. // Serialize scalar item.
  15757. add( prefix, obj );
  15758. }
  15759. }
  15760. // Serialize an array of form elements or a set of
  15761. // key/values into a query string
  15762. jQuery.param = function( a, traditional ) {
  15763. var prefix,
  15764. s = [],
  15765. add = function( key, valueOrFunction ) {
  15766. // If value is a function, invoke it and use its return value
  15767. var value = isFunction( valueOrFunction ) ?
  15768. valueOrFunction() :
  15769. valueOrFunction;
  15770. s[ s.length ] = encodeURIComponent( key ) + "=" +
  15771. encodeURIComponent( value == null ? "" : value );
  15772. };
  15773. if ( a == null ) {
  15774. return "";
  15775. }
  15776. // If an array was passed in, assume that it is an array of form elements.
  15777. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  15778. // Serialize the form elements
  15779. jQuery.each( a, function() {
  15780. add( this.name, this.value );
  15781. } );
  15782. } else {
  15783. // If traditional, encode the "old" way (the way 1.3.2 or older
  15784. // did it), otherwise encode params recursively.
  15785. for ( prefix in a ) {
  15786. buildParams( prefix, a[ prefix ], traditional, add );
  15787. }
  15788. }
  15789. // Return the resulting serialization
  15790. return s.join( "&" );
  15791. };
  15792. jQuery.fn.extend( {
  15793. serialize: function() {
  15794. return jQuery.param( this.serializeArray() );
  15795. },
  15796. serializeArray: function() {
  15797. return this.map( function() {
  15798. // Can add propHook for "elements" to filter or add form elements
  15799. var elements = jQuery.prop( this, "elements" );
  15800. return elements ? jQuery.makeArray( elements ) : this;
  15801. } )
  15802. .filter( function() {
  15803. var type = this.type;
  15804. // Use .is( ":disabled" ) so that fieldset[disabled] works
  15805. return this.name && !jQuery( this ).is( ":disabled" ) &&
  15806. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  15807. ( this.checked || !rcheckableType.test( type ) );
  15808. } )
  15809. .map( function( i, elem ) {
  15810. var val = jQuery( this ).val();
  15811. if ( val == null ) {
  15812. return null;
  15813. }
  15814. if ( Array.isArray( val ) ) {
  15815. return jQuery.map( val, function( val ) {
  15816. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15817. } );
  15818. }
  15819. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15820. } ).get();
  15821. }
  15822. } );
  15823. var
  15824. r20 = /%20/g,
  15825. rhash = /#.*$/,
  15826. rantiCache = /([?&])_=[^&]*/,
  15827. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  15828. // #7653, #8125, #8152: local protocol detection
  15829. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  15830. rnoContent = /^(?:GET|HEAD)$/,
  15831. rprotocol = /^\/\//,
  15832. /* Prefilters
  15833. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  15834. * 2) These are called:
  15835. * - BEFORE asking for a transport
  15836. * - AFTER param serialization (s.data is a string if s.processData is true)
  15837. * 3) key is the dataType
  15838. * 4) the catchall symbol "*" can be used
  15839. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  15840. */
  15841. prefilters = {},
  15842. /* Transports bindings
  15843. * 1) key is the dataType
  15844. * 2) the catchall symbol "*" can be used
  15845. * 3) selection will start with transport dataType and THEN go to "*" if needed
  15846. */
  15847. transports = {},
  15848. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  15849. allTypes = "*/".concat( "*" ),
  15850. // Anchor tag for parsing the document origin
  15851. originAnchor = document.createElement( "a" );
  15852. originAnchor.href = location.href;
  15853. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  15854. function addToPrefiltersOrTransports( structure ) {
  15855. // dataTypeExpression is optional and defaults to "*"
  15856. return function( dataTypeExpression, func ) {
  15857. if ( typeof dataTypeExpression !== "string" ) {
  15858. func = dataTypeExpression;
  15859. dataTypeExpression = "*";
  15860. }
  15861. var dataType,
  15862. i = 0,
  15863. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  15864. if ( isFunction( func ) ) {
  15865. // For each dataType in the dataTypeExpression
  15866. while ( ( dataType = dataTypes[ i++ ] ) ) {
  15867. // Prepend if requested
  15868. if ( dataType[ 0 ] === "+" ) {
  15869. dataType = dataType.slice( 1 ) || "*";
  15870. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  15871. // Otherwise append
  15872. } else {
  15873. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  15874. }
  15875. }
  15876. }
  15877. };
  15878. }
  15879. // Base inspection function for prefilters and transports
  15880. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  15881. var inspected = {},
  15882. seekingTransport = ( structure === transports );
  15883. function inspect( dataType ) {
  15884. var selected;
  15885. inspected[ dataType ] = true;
  15886. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  15887. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  15888. if ( typeof dataTypeOrTransport === "string" &&
  15889. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  15890. options.dataTypes.unshift( dataTypeOrTransport );
  15891. inspect( dataTypeOrTransport );
  15892. return false;
  15893. } else if ( seekingTransport ) {
  15894. return !( selected = dataTypeOrTransport );
  15895. }
  15896. } );
  15897. return selected;
  15898. }
  15899. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  15900. }
  15901. // A special extend for ajax options
  15902. // that takes "flat" options (not to be deep extended)
  15903. // Fixes #9887
  15904. function ajaxExtend( target, src ) {
  15905. var key, deep,
  15906. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  15907. for ( key in src ) {
  15908. if ( src[ key ] !== undefined ) {
  15909. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  15910. }
  15911. }
  15912. if ( deep ) {
  15913. jQuery.extend( true, target, deep );
  15914. }
  15915. return target;
  15916. }
  15917. /* Handles responses to an ajax request:
  15918. * - finds the right dataType (mediates between content-type and expected dataType)
  15919. * - returns the corresponding response
  15920. */
  15921. function ajaxHandleResponses( s, jqXHR, responses ) {
  15922. var ct, type, finalDataType, firstDataType,
  15923. contents = s.contents,
  15924. dataTypes = s.dataTypes;
  15925. // Remove auto dataType and get content-type in the process
  15926. while ( dataTypes[ 0 ] === "*" ) {
  15927. dataTypes.shift();
  15928. if ( ct === undefined ) {
  15929. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  15930. }
  15931. }
  15932. // Check if we're dealing with a known content-type
  15933. if ( ct ) {
  15934. for ( type in contents ) {
  15935. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  15936. dataTypes.unshift( type );
  15937. break;
  15938. }
  15939. }
  15940. }
  15941. // Check to see if we have a response for the expected dataType
  15942. if ( dataTypes[ 0 ] in responses ) {
  15943. finalDataType = dataTypes[ 0 ];
  15944. } else {
  15945. // Try convertible dataTypes
  15946. for ( type in responses ) {
  15947. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  15948. finalDataType = type;
  15949. break;
  15950. }
  15951. if ( !firstDataType ) {
  15952. firstDataType = type;
  15953. }
  15954. }
  15955. // Or just use first one
  15956. finalDataType = finalDataType || firstDataType;
  15957. }
  15958. // If we found a dataType
  15959. // We add the dataType to the list if needed
  15960. // and return the corresponding response
  15961. if ( finalDataType ) {
  15962. if ( finalDataType !== dataTypes[ 0 ] ) {
  15963. dataTypes.unshift( finalDataType );
  15964. }
  15965. return responses[ finalDataType ];
  15966. }
  15967. }
  15968. /* Chain conversions given the request and the original response
  15969. * Also sets the responseXXX fields on the jqXHR instance
  15970. */
  15971. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  15972. var conv2, current, conv, tmp, prev,
  15973. converters = {},
  15974. // Work with a copy of dataTypes in case we need to modify it for conversion
  15975. dataTypes = s.dataTypes.slice();
  15976. // Create converters map with lowercased keys
  15977. if ( dataTypes[ 1 ] ) {
  15978. for ( conv in s.converters ) {
  15979. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  15980. }
  15981. }
  15982. current = dataTypes.shift();
  15983. // Convert to each sequential dataType
  15984. while ( current ) {
  15985. if ( s.responseFields[ current ] ) {
  15986. jqXHR[ s.responseFields[ current ] ] = response;
  15987. }
  15988. // Apply the dataFilter if provided
  15989. if ( !prev && isSuccess && s.dataFilter ) {
  15990. response = s.dataFilter( response, s.dataType );
  15991. }
  15992. prev = current;
  15993. current = dataTypes.shift();
  15994. if ( current ) {
  15995. // There's only work to do if current dataType is non-auto
  15996. if ( current === "*" ) {
  15997. current = prev;
  15998. // Convert response if prev dataType is non-auto and differs from current
  15999. } else if ( prev !== "*" && prev !== current ) {
  16000. // Seek a direct converter
  16001. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  16002. // If none found, seek a pair
  16003. if ( !conv ) {
  16004. for ( conv2 in converters ) {
  16005. // If conv2 outputs current
  16006. tmp = conv2.split( " " );
  16007. if ( tmp[ 1 ] === current ) {
  16008. // If prev can be converted to accepted input
  16009. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  16010. converters[ "* " + tmp[ 0 ] ];
  16011. if ( conv ) {
  16012. // Condense equivalence converters
  16013. if ( conv === true ) {
  16014. conv = converters[ conv2 ];
  16015. // Otherwise, insert the intermediate dataType
  16016. } else if ( converters[ conv2 ] !== true ) {
  16017. current = tmp[ 0 ];
  16018. dataTypes.unshift( tmp[ 1 ] );
  16019. }
  16020. break;
  16021. }
  16022. }
  16023. }
  16024. }
  16025. // Apply converter (if not an equivalence)
  16026. if ( conv !== true ) {
  16027. // Unless errors are allowed to bubble, catch and return them
  16028. if ( conv && s.throws ) {
  16029. response = conv( response );
  16030. } else {
  16031. try {
  16032. response = conv( response );
  16033. } catch ( e ) {
  16034. return {
  16035. state: "parsererror",
  16036. error: conv ? e : "No conversion from " + prev + " to " + current
  16037. };
  16038. }
  16039. }
  16040. }
  16041. }
  16042. }
  16043. }
  16044. return { state: "success", data: response };
  16045. }
  16046. jQuery.extend( {
  16047. // Counter for holding the number of active queries
  16048. active: 0,
  16049. // Last-Modified header cache for next request
  16050. lastModified: {},
  16051. etag: {},
  16052. ajaxSettings: {
  16053. url: location.href,
  16054. type: "GET",
  16055. isLocal: rlocalProtocol.test( location.protocol ),
  16056. global: true,
  16057. processData: true,
  16058. async: true,
  16059. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  16060. /*
  16061. timeout: 0,
  16062. data: null,
  16063. dataType: null,
  16064. username: null,
  16065. password: null,
  16066. cache: null,
  16067. throws: false,
  16068. traditional: false,
  16069. headers: {},
  16070. */
  16071. accepts: {
  16072. "*": allTypes,
  16073. text: "text/plain",
  16074. html: "text/html",
  16075. xml: "application/xml, text/xml",
  16076. json: "application/json, text/javascript"
  16077. },
  16078. contents: {
  16079. xml: /\bxml\b/,
  16080. html: /\bhtml/,
  16081. json: /\bjson\b/
  16082. },
  16083. responseFields: {
  16084. xml: "responseXML",
  16085. text: "responseText",
  16086. json: "responseJSON"
  16087. },
  16088. // Data converters
  16089. // Keys separate source (or catchall "*") and destination types with a single space
  16090. converters: {
  16091. // Convert anything to text
  16092. "* text": String,
  16093. // Text to html (true = no transformation)
  16094. "text html": true,
  16095. // Evaluate text as a json expression
  16096. "text json": JSON.parse,
  16097. // Parse text as xml
  16098. "text xml": jQuery.parseXML
  16099. },
  16100. // For options that shouldn't be deep extended:
  16101. // you can add your own custom options here if
  16102. // and when you create one that shouldn't be
  16103. // deep extended (see ajaxExtend)
  16104. flatOptions: {
  16105. url: true,
  16106. context: true
  16107. }
  16108. },
  16109. // Creates a full fledged settings object into target
  16110. // with both ajaxSettings and settings fields.
  16111. // If target is omitted, writes into ajaxSettings.
  16112. ajaxSetup: function( target, settings ) {
  16113. return settings ?
  16114. // Building a settings object
  16115. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  16116. // Extending ajaxSettings
  16117. ajaxExtend( jQuery.ajaxSettings, target );
  16118. },
  16119. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  16120. ajaxTransport: addToPrefiltersOrTransports( transports ),
  16121. // Main method
  16122. ajax: function( url, options ) {
  16123. // If url is an object, simulate pre-1.5 signature
  16124. if ( typeof url === "object" ) {
  16125. options = url;
  16126. url = undefined;
  16127. }
  16128. // Force options to be an object
  16129. options = options || {};
  16130. var transport,
  16131. // URL without anti-cache param
  16132. cacheURL,
  16133. // Response headers
  16134. responseHeadersString,
  16135. responseHeaders,
  16136. // timeout handle
  16137. timeoutTimer,
  16138. // Url cleanup var
  16139. urlAnchor,
  16140. // Request state (becomes false upon send and true upon completion)
  16141. completed,
  16142. // To know if global events are to be dispatched
  16143. fireGlobals,
  16144. // Loop variable
  16145. i,
  16146. // uncached part of the url
  16147. uncached,
  16148. // Create the final options object
  16149. s = jQuery.ajaxSetup( {}, options ),
  16150. // Callbacks context
  16151. callbackContext = s.context || s,
  16152. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  16153. globalEventContext = s.context &&
  16154. ( callbackContext.nodeType || callbackContext.jquery ) ?
  16155. jQuery( callbackContext ) :
  16156. jQuery.event,
  16157. // Deferreds
  16158. deferred = jQuery.Deferred(),
  16159. completeDeferred = jQuery.Callbacks( "once memory" ),
  16160. // Status-dependent callbacks
  16161. statusCode = s.statusCode || {},
  16162. // Headers (they are sent all at once)
  16163. requestHeaders = {},
  16164. requestHeadersNames = {},
  16165. // Default abort message
  16166. strAbort = "canceled",
  16167. // Fake xhr
  16168. jqXHR = {
  16169. readyState: 0,
  16170. // Builds headers hashtable if needed
  16171. getResponseHeader: function( key ) {
  16172. var match;
  16173. if ( completed ) {
  16174. if ( !responseHeaders ) {
  16175. responseHeaders = {};
  16176. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  16177. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  16178. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  16179. .concat( match[ 2 ] );
  16180. }
  16181. }
  16182. match = responseHeaders[ key.toLowerCase() + " " ];
  16183. }
  16184. return match == null ? null : match.join( ", " );
  16185. },
  16186. // Raw string
  16187. getAllResponseHeaders: function() {
  16188. return completed ? responseHeadersString : null;
  16189. },
  16190. // Caches the header
  16191. setRequestHeader: function( name, value ) {
  16192. if ( completed == null ) {
  16193. name = requestHeadersNames[ name.toLowerCase() ] =
  16194. requestHeadersNames[ name.toLowerCase() ] || name;
  16195. requestHeaders[ name ] = value;
  16196. }
  16197. return this;
  16198. },
  16199. // Overrides response content-type header
  16200. overrideMimeType: function( type ) {
  16201. if ( completed == null ) {
  16202. s.mimeType = type;
  16203. }
  16204. return this;
  16205. },
  16206. // Status-dependent callbacks
  16207. statusCode: function( map ) {
  16208. var code;
  16209. if ( map ) {
  16210. if ( completed ) {
  16211. // Execute the appropriate callbacks
  16212. jqXHR.always( map[ jqXHR.status ] );
  16213. } else {
  16214. // Lazy-add the new callbacks in a way that preserves old ones
  16215. for ( code in map ) {
  16216. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  16217. }
  16218. }
  16219. }
  16220. return this;
  16221. },
  16222. // Cancel the request
  16223. abort: function( statusText ) {
  16224. var finalText = statusText || strAbort;
  16225. if ( transport ) {
  16226. transport.abort( finalText );
  16227. }
  16228. done( 0, finalText );
  16229. return this;
  16230. }
  16231. };
  16232. // Attach deferreds
  16233. deferred.promise( jqXHR );
  16234. // Add protocol if not provided (prefilters might expect it)
  16235. // Handle falsy url in the settings object (#10093: consistency with old signature)
  16236. // We also use the url parameter if available
  16237. s.url = ( ( url || s.url || location.href ) + "" )
  16238. .replace( rprotocol, location.protocol + "//" );
  16239. // Alias method option to type as per ticket #12004
  16240. s.type = options.method || options.type || s.method || s.type;
  16241. // Extract dataTypes list
  16242. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  16243. // A cross-domain request is in order when the origin doesn't match the current origin.
  16244. if ( s.crossDomain == null ) {
  16245. urlAnchor = document.createElement( "a" );
  16246. // Support: IE <=8 - 11, Edge 12 - 15
  16247. // IE throws exception on accessing the href property if url is malformed,
  16248. // e.g. http://example.com:80x/
  16249. try {
  16250. urlAnchor.href = s.url;
  16251. // Support: IE <=8 - 11 only
  16252. // Anchor's host property isn't correctly set when s.url is relative
  16253. urlAnchor.href = urlAnchor.href;
  16254. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  16255. urlAnchor.protocol + "//" + urlAnchor.host;
  16256. } catch ( e ) {
  16257. // If there is an error parsing the URL, assume it is crossDomain,
  16258. // it can be rejected by the transport if it is invalid
  16259. s.crossDomain = true;
  16260. }
  16261. }
  16262. // Convert data if not already a string
  16263. if ( s.data && s.processData && typeof s.data !== "string" ) {
  16264. s.data = jQuery.param( s.data, s.traditional );
  16265. }
  16266. // Apply prefilters
  16267. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  16268. // If request was aborted inside a prefilter, stop there
  16269. if ( completed ) {
  16270. return jqXHR;
  16271. }
  16272. // We can fire global events as of now if asked to
  16273. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  16274. fireGlobals = jQuery.event && s.global;
  16275. // Watch for a new set of requests
  16276. if ( fireGlobals && jQuery.active++ === 0 ) {
  16277. jQuery.event.trigger( "ajaxStart" );
  16278. }
  16279. // Uppercase the type
  16280. s.type = s.type.toUpperCase();
  16281. // Determine if request has content
  16282. s.hasContent = !rnoContent.test( s.type );
  16283. // Save the URL in case we're toying with the If-Modified-Since
  16284. // and/or If-None-Match header later on
  16285. // Remove hash to simplify url manipulation
  16286. cacheURL = s.url.replace( rhash, "" );
  16287. // More options handling for requests with no content
  16288. if ( !s.hasContent ) {
  16289. // Remember the hash so we can put it back
  16290. uncached = s.url.slice( cacheURL.length );
  16291. // If data is available and should be processed, append data to url
  16292. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  16293. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  16294. // #9682: remove data so that it's not used in an eventual retry
  16295. delete s.data;
  16296. }
  16297. // Add or update anti-cache param if needed
  16298. if ( s.cache === false ) {
  16299. cacheURL = cacheURL.replace( rantiCache, "$1" );
  16300. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  16301. }
  16302. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  16303. s.url = cacheURL + uncached;
  16304. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  16305. } else if ( s.data && s.processData &&
  16306. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  16307. s.data = s.data.replace( r20, "+" );
  16308. }
  16309. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16310. if ( s.ifModified ) {
  16311. if ( jQuery.lastModified[ cacheURL ] ) {
  16312. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  16313. }
  16314. if ( jQuery.etag[ cacheURL ] ) {
  16315. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  16316. }
  16317. }
  16318. // Set the correct header, if data is being sent
  16319. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  16320. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  16321. }
  16322. // Set the Accepts header for the server, depending on the dataType
  16323. jqXHR.setRequestHeader(
  16324. "Accept",
  16325. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  16326. s.accepts[ s.dataTypes[ 0 ] ] +
  16327. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  16328. s.accepts[ "*" ]
  16329. );
  16330. // Check for headers option
  16331. for ( i in s.headers ) {
  16332. jqXHR.setRequestHeader( i, s.headers[ i ] );
  16333. }
  16334. // Allow custom headers/mimetypes and early abort
  16335. if ( s.beforeSend &&
  16336. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  16337. // Abort if not done already and return
  16338. return jqXHR.abort();
  16339. }
  16340. // Aborting is no longer a cancellation
  16341. strAbort = "abort";
  16342. // Install callbacks on deferreds
  16343. completeDeferred.add( s.complete );
  16344. jqXHR.done( s.success );
  16345. jqXHR.fail( s.error );
  16346. // Get transport
  16347. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  16348. // If no transport, we auto-abort
  16349. if ( !transport ) {
  16350. done( -1, "No Transport" );
  16351. } else {
  16352. jqXHR.readyState = 1;
  16353. // Send global event
  16354. if ( fireGlobals ) {
  16355. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  16356. }
  16357. // If request was aborted inside ajaxSend, stop there
  16358. if ( completed ) {
  16359. return jqXHR;
  16360. }
  16361. // Timeout
  16362. if ( s.async && s.timeout > 0 ) {
  16363. timeoutTimer = window.setTimeout( function() {
  16364. jqXHR.abort( "timeout" );
  16365. }, s.timeout );
  16366. }
  16367. try {
  16368. completed = false;
  16369. transport.send( requestHeaders, done );
  16370. } catch ( e ) {
  16371. // Rethrow post-completion exceptions
  16372. if ( completed ) {
  16373. throw e;
  16374. }
  16375. // Propagate others as results
  16376. done( -1, e );
  16377. }
  16378. }
  16379. // Callback for when everything is done
  16380. function done( status, nativeStatusText, responses, headers ) {
  16381. var isSuccess, success, error, response, modified,
  16382. statusText = nativeStatusText;
  16383. // Ignore repeat invocations
  16384. if ( completed ) {
  16385. return;
  16386. }
  16387. completed = true;
  16388. // Clear timeout if it exists
  16389. if ( timeoutTimer ) {
  16390. window.clearTimeout( timeoutTimer );
  16391. }
  16392. // Dereference transport for early garbage collection
  16393. // (no matter how long the jqXHR object will be used)
  16394. transport = undefined;
  16395. // Cache response headers
  16396. responseHeadersString = headers || "";
  16397. // Set readyState
  16398. jqXHR.readyState = status > 0 ? 4 : 0;
  16399. // Determine if successful
  16400. isSuccess = status >= 200 && status < 300 || status === 304;
  16401. // Get response data
  16402. if ( responses ) {
  16403. response = ajaxHandleResponses( s, jqXHR, responses );
  16404. }
  16405. // Convert no matter what (that way responseXXX fields are always set)
  16406. response = ajaxConvert( s, response, jqXHR, isSuccess );
  16407. // If successful, handle type chaining
  16408. if ( isSuccess ) {
  16409. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16410. if ( s.ifModified ) {
  16411. modified = jqXHR.getResponseHeader( "Last-Modified" );
  16412. if ( modified ) {
  16413. jQuery.lastModified[ cacheURL ] = modified;
  16414. }
  16415. modified = jqXHR.getResponseHeader( "etag" );
  16416. if ( modified ) {
  16417. jQuery.etag[ cacheURL ] = modified;
  16418. }
  16419. }
  16420. // if no content
  16421. if ( status === 204 || s.type === "HEAD" ) {
  16422. statusText = "nocontent";
  16423. // if not modified
  16424. } else if ( status === 304 ) {
  16425. statusText = "notmodified";
  16426. // If we have data, let's convert it
  16427. } else {
  16428. statusText = response.state;
  16429. success = response.data;
  16430. error = response.error;
  16431. isSuccess = !error;
  16432. }
  16433. } else {
  16434. // Extract error from statusText and normalize for non-aborts
  16435. error = statusText;
  16436. if ( status || !statusText ) {
  16437. statusText = "error";
  16438. if ( status < 0 ) {
  16439. status = 0;
  16440. }
  16441. }
  16442. }
  16443. // Set data for the fake xhr object
  16444. jqXHR.status = status;
  16445. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  16446. // Success/Error
  16447. if ( isSuccess ) {
  16448. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  16449. } else {
  16450. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  16451. }
  16452. // Status-dependent callbacks
  16453. jqXHR.statusCode( statusCode );
  16454. statusCode = undefined;
  16455. if ( fireGlobals ) {
  16456. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  16457. [ jqXHR, s, isSuccess ? success : error ] );
  16458. }
  16459. // Complete
  16460. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  16461. if ( fireGlobals ) {
  16462. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  16463. // Handle the global AJAX counter
  16464. if ( !( --jQuery.active ) ) {
  16465. jQuery.event.trigger( "ajaxStop" );
  16466. }
  16467. }
  16468. }
  16469. return jqXHR;
  16470. },
  16471. getJSON: function( url, data, callback ) {
  16472. return jQuery.get( url, data, callback, "json" );
  16473. },
  16474. getScript: function( url, callback ) {
  16475. return jQuery.get( url, undefined, callback, "script" );
  16476. }
  16477. } );
  16478. jQuery.each( [ "get", "post" ], function( i, method ) {
  16479. jQuery[ method ] = function( url, data, callback, type ) {
  16480. // Shift arguments if data argument was omitted
  16481. if ( isFunction( data ) ) {
  16482. type = type || callback;
  16483. callback = data;
  16484. data = undefined;
  16485. }
  16486. // The url can be an options object (which then must have .url)
  16487. return jQuery.ajax( jQuery.extend( {
  16488. url: url,
  16489. type: method,
  16490. dataType: type,
  16491. data: data,
  16492. success: callback
  16493. }, jQuery.isPlainObject( url ) && url ) );
  16494. };
  16495. } );
  16496. jQuery._evalUrl = function( url, options ) {
  16497. return jQuery.ajax( {
  16498. url: url,
  16499. // Make this explicit, since user can override this through ajaxSetup (#11264)
  16500. type: "GET",
  16501. dataType: "script",
  16502. cache: true,
  16503. async: false,
  16504. global: false,
  16505. // Only evaluate the response if it is successful (gh-4126)
  16506. // dataFilter is not invoked for failure responses, so using it instead
  16507. // of the default converter is kludgy but it works.
  16508. converters: {
  16509. "text script": function() {}
  16510. },
  16511. dataFilter: function( response ) {
  16512. jQuery.globalEval( response, options );
  16513. }
  16514. } );
  16515. };
  16516. jQuery.fn.extend( {
  16517. wrapAll: function( html ) {
  16518. var wrap;
  16519. if ( this[ 0 ] ) {
  16520. if ( isFunction( html ) ) {
  16521. html = html.call( this[ 0 ] );
  16522. }
  16523. // The elements to wrap the target around
  16524. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  16525. if ( this[ 0 ].parentNode ) {
  16526. wrap.insertBefore( this[ 0 ] );
  16527. }
  16528. wrap.map( function() {
  16529. var elem = this;
  16530. while ( elem.firstElementChild ) {
  16531. elem = elem.firstElementChild;
  16532. }
  16533. return elem;
  16534. } ).append( this );
  16535. }
  16536. return this;
  16537. },
  16538. wrapInner: function( html ) {
  16539. if ( isFunction( html ) ) {
  16540. return this.each( function( i ) {
  16541. jQuery( this ).wrapInner( html.call( this, i ) );
  16542. } );
  16543. }
  16544. return this.each( function() {
  16545. var self = jQuery( this ),
  16546. contents = self.contents();
  16547. if ( contents.length ) {
  16548. contents.wrapAll( html );
  16549. } else {
  16550. self.append( html );
  16551. }
  16552. } );
  16553. },
  16554. wrap: function( html ) {
  16555. var htmlIsFunction = isFunction( html );
  16556. return this.each( function( i ) {
  16557. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  16558. } );
  16559. },
  16560. unwrap: function( selector ) {
  16561. this.parent( selector ).not( "body" ).each( function() {
  16562. jQuery( this ).replaceWith( this.childNodes );
  16563. } );
  16564. return this;
  16565. }
  16566. } );
  16567. jQuery.expr.pseudos.hidden = function( elem ) {
  16568. return !jQuery.expr.pseudos.visible( elem );
  16569. };
  16570. jQuery.expr.pseudos.visible = function( elem ) {
  16571. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  16572. };
  16573. jQuery.ajaxSettings.xhr = function() {
  16574. try {
  16575. return new window.XMLHttpRequest();
  16576. } catch ( e ) {}
  16577. };
  16578. var xhrSuccessStatus = {
  16579. // File protocol always yields status code 0, assume 200
  16580. 0: 200,
  16581. // Support: IE <=9 only
  16582. // #1450: sometimes IE returns 1223 when it should be 204
  16583. 1223: 204
  16584. },
  16585. xhrSupported = jQuery.ajaxSettings.xhr();
  16586. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  16587. support.ajax = xhrSupported = !!xhrSupported;
  16588. jQuery.ajaxTransport( function( options ) {
  16589. var callback, errorCallback;
  16590. // Cross domain only allowed if supported through XMLHttpRequest
  16591. if ( support.cors || xhrSupported && !options.crossDomain ) {
  16592. return {
  16593. send: function( headers, complete ) {
  16594. var i,
  16595. xhr = options.xhr();
  16596. xhr.open(
  16597. options.type,
  16598. options.url,
  16599. options.async,
  16600. options.username,
  16601. options.password
  16602. );
  16603. // Apply custom fields if provided
  16604. if ( options.xhrFields ) {
  16605. for ( i in options.xhrFields ) {
  16606. xhr[ i ] = options.xhrFields[ i ];
  16607. }
  16608. }
  16609. // Override mime type if needed
  16610. if ( options.mimeType && xhr.overrideMimeType ) {
  16611. xhr.overrideMimeType( options.mimeType );
  16612. }
  16613. // X-Requested-With header
  16614. // For cross-domain requests, seeing as conditions for a preflight are
  16615. // akin to a jigsaw puzzle, we simply never set it to be sure.
  16616. // (it can always be set on a per-request basis or even using ajaxSetup)
  16617. // For same-domain requests, won't change header if already provided.
  16618. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  16619. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  16620. }
  16621. // Set headers
  16622. for ( i in headers ) {
  16623. xhr.setRequestHeader( i, headers[ i ] );
  16624. }
  16625. // Callback
  16626. callback = function( type ) {
  16627. return function() {
  16628. if ( callback ) {
  16629. callback = errorCallback = xhr.onload =
  16630. xhr.onerror = xhr.onabort = xhr.ontimeout =
  16631. xhr.onreadystatechange = null;
  16632. if ( type === "abort" ) {
  16633. xhr.abort();
  16634. } else if ( type === "error" ) {
  16635. // Support: IE <=9 only
  16636. // On a manual native abort, IE9 throws
  16637. // errors on any property access that is not readyState
  16638. if ( typeof xhr.status !== "number" ) {
  16639. complete( 0, "error" );
  16640. } else {
  16641. complete(
  16642. // File: protocol always yields status 0; see #8605, #14207
  16643. xhr.status,
  16644. xhr.statusText
  16645. );
  16646. }
  16647. } else {
  16648. complete(
  16649. xhrSuccessStatus[ xhr.status ] || xhr.status,
  16650. xhr.statusText,
  16651. // Support: IE <=9 only
  16652. // IE9 has no XHR2 but throws on binary (trac-11426)
  16653. // For XHR2 non-text, let the caller handle it (gh-2498)
  16654. ( xhr.responseType || "text" ) !== "text" ||
  16655. typeof xhr.responseText !== "string" ?
  16656. { binary: xhr.response } :
  16657. { text: xhr.responseText },
  16658. xhr.getAllResponseHeaders()
  16659. );
  16660. }
  16661. }
  16662. };
  16663. };
  16664. // Listen to events
  16665. xhr.onload = callback();
  16666. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  16667. // Support: IE 9 only
  16668. // Use onreadystatechange to replace onabort
  16669. // to handle uncaught aborts
  16670. if ( xhr.onabort !== undefined ) {
  16671. xhr.onabort = errorCallback;
  16672. } else {
  16673. xhr.onreadystatechange = function() {
  16674. // Check readyState before timeout as it changes
  16675. if ( xhr.readyState === 4 ) {
  16676. // Allow onerror to be called first,
  16677. // but that will not handle a native abort
  16678. // Also, save errorCallback to a variable
  16679. // as xhr.onerror cannot be accessed
  16680. window.setTimeout( function() {
  16681. if ( callback ) {
  16682. errorCallback();
  16683. }
  16684. } );
  16685. }
  16686. };
  16687. }
  16688. // Create the abort callback
  16689. callback = callback( "abort" );
  16690. try {
  16691. // Do send the request (this may raise an exception)
  16692. xhr.send( options.hasContent && options.data || null );
  16693. } catch ( e ) {
  16694. // #14683: Only rethrow if this hasn't been notified as an error yet
  16695. if ( callback ) {
  16696. throw e;
  16697. }
  16698. }
  16699. },
  16700. abort: function() {
  16701. if ( callback ) {
  16702. callback();
  16703. }
  16704. }
  16705. };
  16706. }
  16707. } );
  16708. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  16709. jQuery.ajaxPrefilter( function( s ) {
  16710. if ( s.crossDomain ) {
  16711. s.contents.script = false;
  16712. }
  16713. } );
  16714. // Install script dataType
  16715. jQuery.ajaxSetup( {
  16716. accepts: {
  16717. script: "text/javascript, application/javascript, " +
  16718. "application/ecmascript, application/x-ecmascript"
  16719. },
  16720. contents: {
  16721. script: /\b(?:java|ecma)script\b/
  16722. },
  16723. converters: {
  16724. "text script": function( text ) {
  16725. jQuery.globalEval( text );
  16726. return text;
  16727. }
  16728. }
  16729. } );
  16730. // Handle cache's special case and crossDomain
  16731. jQuery.ajaxPrefilter( "script", function( s ) {
  16732. if ( s.cache === undefined ) {
  16733. s.cache = false;
  16734. }
  16735. if ( s.crossDomain ) {
  16736. s.type = "GET";
  16737. }
  16738. } );
  16739. // Bind script tag hack transport
  16740. jQuery.ajaxTransport( "script", function( s ) {
  16741. // This transport only deals with cross domain or forced-by-attrs requests
  16742. if ( s.crossDomain || s.scriptAttrs ) {
  16743. var script, callback;
  16744. return {
  16745. send: function( _, complete ) {
  16746. script = jQuery( "<script>" )
  16747. .attr( s.scriptAttrs || {} )
  16748. .prop( { charset: s.scriptCharset, src: s.url } )
  16749. .on( "load error", callback = function( evt ) {
  16750. script.remove();
  16751. callback = null;
  16752. if ( evt ) {
  16753. complete( evt.type === "error" ? 404 : 200, evt.type );
  16754. }
  16755. } );
  16756. // Use native DOM manipulation to avoid our domManip AJAX trickery
  16757. document.head.appendChild( script[ 0 ] );
  16758. },
  16759. abort: function() {
  16760. if ( callback ) {
  16761. callback();
  16762. }
  16763. }
  16764. };
  16765. }
  16766. } );
  16767. var oldCallbacks = [],
  16768. rjsonp = /(=)\?(?=&|$)|\?\?/;
  16769. // Default jsonp settings
  16770. jQuery.ajaxSetup( {
  16771. jsonp: "callback",
  16772. jsonpCallback: function() {
  16773. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  16774. this[ callback ] = true;
  16775. return callback;
  16776. }
  16777. } );
  16778. // Detect, normalize options and install callbacks for jsonp requests
  16779. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  16780. var callbackName, overwritten, responseContainer,
  16781. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  16782. "url" :
  16783. typeof s.data === "string" &&
  16784. ( s.contentType || "" )
  16785. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  16786. rjsonp.test( s.data ) && "data"
  16787. );
  16788. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  16789. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  16790. // Get callback name, remembering preexisting value associated with it
  16791. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  16792. s.jsonpCallback() :
  16793. s.jsonpCallback;
  16794. // Insert callback into url or form data
  16795. if ( jsonProp ) {
  16796. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  16797. } else if ( s.jsonp !== false ) {
  16798. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  16799. }
  16800. // Use data converter to retrieve json after script execution
  16801. s.converters[ "script json" ] = function() {
  16802. if ( !responseContainer ) {
  16803. jQuery.error( callbackName + " was not called" );
  16804. }
  16805. return responseContainer[ 0 ];
  16806. };
  16807. // Force json dataType
  16808. s.dataTypes[ 0 ] = "json";
  16809. // Install callback
  16810. overwritten = window[ callbackName ];
  16811. window[ callbackName ] = function() {
  16812. responseContainer = arguments;
  16813. };
  16814. // Clean-up function (fires after converters)
  16815. jqXHR.always( function() {
  16816. // If previous value didn't exist - remove it
  16817. if ( overwritten === undefined ) {
  16818. jQuery( window ).removeProp( callbackName );
  16819. // Otherwise restore preexisting value
  16820. } else {
  16821. window[ callbackName ] = overwritten;
  16822. }
  16823. // Save back as free
  16824. if ( s[ callbackName ] ) {
  16825. // Make sure that re-using the options doesn't screw things around
  16826. s.jsonpCallback = originalSettings.jsonpCallback;
  16827. // Save the callback name for future use
  16828. oldCallbacks.push( callbackName );
  16829. }
  16830. // Call if it was a function and we have a response
  16831. if ( responseContainer && isFunction( overwritten ) ) {
  16832. overwritten( responseContainer[ 0 ] );
  16833. }
  16834. responseContainer = overwritten = undefined;
  16835. } );
  16836. // Delegate to script
  16837. return "script";
  16838. }
  16839. } );
  16840. // Support: Safari 8 only
  16841. // In Safari 8 documents created via document.implementation.createHTMLDocument
  16842. // collapse sibling forms: the second one becomes a child of the first one.
  16843. // Because of that, this security measure has to be disabled in Safari 8.
  16844. // https://bugs.webkit.org/show_bug.cgi?id=137337
  16845. support.createHTMLDocument = ( function() {
  16846. var body = document.implementation.createHTMLDocument( "" ).body;
  16847. body.innerHTML = "<form></form><form></form>";
  16848. return body.childNodes.length === 2;
  16849. } )();
  16850. // Argument "data" should be string of html
  16851. // context (optional): If specified, the fragment will be created in this context,
  16852. // defaults to document
  16853. // keepScripts (optional): If true, will include scripts passed in the html string
  16854. jQuery.parseHTML = function( data, context, keepScripts ) {
  16855. if ( typeof data !== "string" ) {
  16856. return [];
  16857. }
  16858. if ( typeof context === "boolean" ) {
  16859. keepScripts = context;
  16860. context = false;
  16861. }
  16862. var base, parsed, scripts;
  16863. if ( !context ) {
  16864. // Stop scripts or inline event handlers from being executed immediately
  16865. // by using document.implementation
  16866. if ( support.createHTMLDocument ) {
  16867. context = document.implementation.createHTMLDocument( "" );
  16868. // Set the base href for the created document
  16869. // so any parsed elements with URLs
  16870. // are based on the document's URL (gh-2965)
  16871. base = context.createElement( "base" );
  16872. base.href = document.location.href;
  16873. context.head.appendChild( base );
  16874. } else {
  16875. context = document;
  16876. }
  16877. }
  16878. parsed = rsingleTag.exec( data );
  16879. scripts = !keepScripts && [];
  16880. // Single tag
  16881. if ( parsed ) {
  16882. return [ context.createElement( parsed[ 1 ] ) ];
  16883. }
  16884. parsed = buildFragment( [ data ], context, scripts );
  16885. if ( scripts && scripts.length ) {
  16886. jQuery( scripts ).remove();
  16887. }
  16888. return jQuery.merge( [], parsed.childNodes );
  16889. };
  16890. /**
  16891. * Load a url into a page
  16892. */
  16893. jQuery.fn.load = function( url, params, callback ) {
  16894. var selector, type, response,
  16895. self = this,
  16896. off = url.indexOf( " " );
  16897. if ( off > -1 ) {
  16898. selector = stripAndCollapse( url.slice( off ) );
  16899. url = url.slice( 0, off );
  16900. }
  16901. // If it's a function
  16902. if ( isFunction( params ) ) {
  16903. // We assume that it's the callback
  16904. callback = params;
  16905. params = undefined;
  16906. // Otherwise, build a param string
  16907. } else if ( params && typeof params === "object" ) {
  16908. type = "POST";
  16909. }
  16910. // If we have elements to modify, make the request
  16911. if ( self.length > 0 ) {
  16912. jQuery.ajax( {
  16913. url: url,
  16914. // If "type" variable is undefined, then "GET" method will be used.
  16915. // Make value of this field explicit since
  16916. // user can override it through ajaxSetup method
  16917. type: type || "GET",
  16918. dataType: "html",
  16919. data: params
  16920. } ).done( function( responseText ) {
  16921. // Save response for use in complete callback
  16922. response = arguments;
  16923. self.html( selector ?
  16924. // If a selector was specified, locate the right elements in a dummy div
  16925. // Exclude scripts to avoid IE 'Permission Denied' errors
  16926. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  16927. // Otherwise use the full result
  16928. responseText );
  16929. // If the request succeeds, this function gets "data", "status", "jqXHR"
  16930. // but they are ignored because response was set above.
  16931. // If it fails, this function gets "jqXHR", "status", "error"
  16932. } ).always( callback && function( jqXHR, status ) {
  16933. self.each( function() {
  16934. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  16935. } );
  16936. } );
  16937. }
  16938. return this;
  16939. };
  16940. // Attach a bunch of functions for handling common AJAX events
  16941. jQuery.each( [
  16942. "ajaxStart",
  16943. "ajaxStop",
  16944. "ajaxComplete",
  16945. "ajaxError",
  16946. "ajaxSuccess",
  16947. "ajaxSend"
  16948. ], function( i, type ) {
  16949. jQuery.fn[ type ] = function( fn ) {
  16950. return this.on( type, fn );
  16951. };
  16952. } );
  16953. jQuery.expr.pseudos.animated = function( elem ) {
  16954. return jQuery.grep( jQuery.timers, function( fn ) {
  16955. return elem === fn.elem;
  16956. } ).length;
  16957. };
  16958. jQuery.offset = {
  16959. setOffset: function( elem, options, i ) {
  16960. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  16961. position = jQuery.css( elem, "position" ),
  16962. curElem = jQuery( elem ),
  16963. props = {};
  16964. // Set position first, in-case top/left are set even on static elem
  16965. if ( position === "static" ) {
  16966. elem.style.position = "relative";
  16967. }
  16968. curOffset = curElem.offset();
  16969. curCSSTop = jQuery.css( elem, "top" );
  16970. curCSSLeft = jQuery.css( elem, "left" );
  16971. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  16972. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  16973. // Need to be able to calculate position if either
  16974. // top or left is auto and position is either absolute or fixed
  16975. if ( calculatePosition ) {
  16976. curPosition = curElem.position();
  16977. curTop = curPosition.top;
  16978. curLeft = curPosition.left;
  16979. } else {
  16980. curTop = parseFloat( curCSSTop ) || 0;
  16981. curLeft = parseFloat( curCSSLeft ) || 0;
  16982. }
  16983. if ( isFunction( options ) ) {
  16984. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  16985. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  16986. }
  16987. if ( options.top != null ) {
  16988. props.top = ( options.top - curOffset.top ) + curTop;
  16989. }
  16990. if ( options.left != null ) {
  16991. props.left = ( options.left - curOffset.left ) + curLeft;
  16992. }
  16993. if ( "using" in options ) {
  16994. options.using.call( elem, props );
  16995. } else {
  16996. curElem.css( props );
  16997. }
  16998. }
  16999. };
  17000. jQuery.fn.extend( {
  17001. // offset() relates an element's border box to the document origin
  17002. offset: function( options ) {
  17003. // Preserve chaining for setter
  17004. if ( arguments.length ) {
  17005. return options === undefined ?
  17006. this :
  17007. this.each( function( i ) {
  17008. jQuery.offset.setOffset( this, options, i );
  17009. } );
  17010. }
  17011. var rect, win,
  17012. elem = this[ 0 ];
  17013. if ( !elem ) {
  17014. return;
  17015. }
  17016. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  17017. // Support: IE <=11 only
  17018. // Running getBoundingClientRect on a
  17019. // disconnected node in IE throws an error
  17020. if ( !elem.getClientRects().length ) {
  17021. return { top: 0, left: 0 };
  17022. }
  17023. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  17024. rect = elem.getBoundingClientRect();
  17025. win = elem.ownerDocument.defaultView;
  17026. return {
  17027. top: rect.top + win.pageYOffset,
  17028. left: rect.left + win.pageXOffset
  17029. };
  17030. },
  17031. // position() relates an element's margin box to its offset parent's padding box
  17032. // This corresponds to the behavior of CSS absolute positioning
  17033. position: function() {
  17034. if ( !this[ 0 ] ) {
  17035. return;
  17036. }
  17037. var offsetParent, offset, doc,
  17038. elem = this[ 0 ],
  17039. parentOffset = { top: 0, left: 0 };
  17040. // position:fixed elements are offset from the viewport, which itself always has zero offset
  17041. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  17042. // Assume position:fixed implies availability of getBoundingClientRect
  17043. offset = elem.getBoundingClientRect();
  17044. } else {
  17045. offset = this.offset();
  17046. // Account for the *real* offset parent, which can be the document or its root element
  17047. // when a statically positioned element is identified
  17048. doc = elem.ownerDocument;
  17049. offsetParent = elem.offsetParent || doc.documentElement;
  17050. while ( offsetParent &&
  17051. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  17052. jQuery.css( offsetParent, "position" ) === "static" ) {
  17053. offsetParent = offsetParent.parentNode;
  17054. }
  17055. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  17056. // Incorporate borders into its offset, since they are outside its content origin
  17057. parentOffset = jQuery( offsetParent ).offset();
  17058. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  17059. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  17060. }
  17061. }
  17062. // Subtract parent offsets and element margins
  17063. return {
  17064. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  17065. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  17066. };
  17067. },
  17068. // This method will return documentElement in the following cases:
  17069. // 1) For the element inside the iframe without offsetParent, this method will return
  17070. // documentElement of the parent window
  17071. // 2) For the hidden or detached element
  17072. // 3) For body or html element, i.e. in case of the html node - it will return itself
  17073. //
  17074. // but those exceptions were never presented as a real life use-cases
  17075. // and might be considered as more preferable results.
  17076. //
  17077. // This logic, however, is not guaranteed and can change at any point in the future
  17078. offsetParent: function() {
  17079. return this.map( function() {
  17080. var offsetParent = this.offsetParent;
  17081. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  17082. offsetParent = offsetParent.offsetParent;
  17083. }
  17084. return offsetParent || documentElement;
  17085. } );
  17086. }
  17087. } );
  17088. // Create scrollLeft and scrollTop methods
  17089. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  17090. var top = "pageYOffset" === prop;
  17091. jQuery.fn[ method ] = function( val ) {
  17092. return access( this, function( elem, method, val ) {
  17093. // Coalesce documents and windows
  17094. var win;
  17095. if ( isWindow( elem ) ) {
  17096. win = elem;
  17097. } else if ( elem.nodeType === 9 ) {
  17098. win = elem.defaultView;
  17099. }
  17100. if ( val === undefined ) {
  17101. return win ? win[ prop ] : elem[ method ];
  17102. }
  17103. if ( win ) {
  17104. win.scrollTo(
  17105. !top ? val : win.pageXOffset,
  17106. top ? val : win.pageYOffset
  17107. );
  17108. } else {
  17109. elem[ method ] = val;
  17110. }
  17111. }, method, val, arguments.length );
  17112. };
  17113. } );
  17114. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  17115. // Add the top/left cssHooks using jQuery.fn.position
  17116. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  17117. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  17118. // getComputedStyle returns percent when specified for top/left/bottom/right;
  17119. // rather than make the css module depend on the offset module, just check for it here
  17120. jQuery.each( [ "top", "left" ], function( i, prop ) {
  17121. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  17122. function( elem, computed ) {
  17123. if ( computed ) {
  17124. computed = curCSS( elem, prop );
  17125. // If curCSS returns percentage, fallback to offset
  17126. return rnumnonpx.test( computed ) ?
  17127. jQuery( elem ).position()[ prop ] + "px" :
  17128. computed;
  17129. }
  17130. }
  17131. );
  17132. } );
  17133. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  17134. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  17135. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  17136. function( defaultExtra, funcName ) {
  17137. // Margin is only for outerHeight, outerWidth
  17138. jQuery.fn[ funcName ] = function( margin, value ) {
  17139. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  17140. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  17141. return access( this, function( elem, type, value ) {
  17142. var doc;
  17143. if ( isWindow( elem ) ) {
  17144. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  17145. return funcName.indexOf( "outer" ) === 0 ?
  17146. elem[ "inner" + name ] :
  17147. elem.document.documentElement[ "client" + name ];
  17148. }
  17149. // Get document width or height
  17150. if ( elem.nodeType === 9 ) {
  17151. doc = elem.documentElement;
  17152. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  17153. // whichever is greatest
  17154. return Math.max(
  17155. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  17156. elem.body[ "offset" + name ], doc[ "offset" + name ],
  17157. doc[ "client" + name ]
  17158. );
  17159. }
  17160. return value === undefined ?
  17161. // Get width or height on the element, requesting but not forcing parseFloat
  17162. jQuery.css( elem, type, extra ) :
  17163. // Set width or height on the element
  17164. jQuery.style( elem, type, value, extra );
  17165. }, type, chainable ? margin : undefined, chainable );
  17166. };
  17167. } );
  17168. } );
  17169. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  17170. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  17171. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  17172. function( i, name ) {
  17173. // Handle event binding
  17174. jQuery.fn[ name ] = function( data, fn ) {
  17175. return arguments.length > 0 ?
  17176. this.on( name, null, data, fn ) :
  17177. this.trigger( name );
  17178. };
  17179. } );
  17180. jQuery.fn.extend( {
  17181. hover: function( fnOver, fnOut ) {
  17182. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  17183. }
  17184. } );
  17185. jQuery.fn.extend( {
  17186. bind: function( types, data, fn ) {
  17187. return this.on( types, null, data, fn );
  17188. },
  17189. unbind: function( types, fn ) {
  17190. return this.off( types, null, fn );
  17191. },
  17192. delegate: function( selector, types, data, fn ) {
  17193. return this.on( types, selector, data, fn );
  17194. },
  17195. undelegate: function( selector, types, fn ) {
  17196. // ( namespace ) or ( selector, types [, fn] )
  17197. return arguments.length === 1 ?
  17198. this.off( selector, "**" ) :
  17199. this.off( types, selector || "**", fn );
  17200. }
  17201. } );
  17202. // Bind a function to a context, optionally partially applying any
  17203. // arguments.
  17204. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  17205. // However, it is not slated for removal any time soon
  17206. jQuery.proxy = function( fn, context ) {
  17207. var tmp, args, proxy;
  17208. if ( typeof context === "string" ) {
  17209. tmp = fn[ context ];
  17210. context = fn;
  17211. fn = tmp;
  17212. }
  17213. // Quick check to determine if target is callable, in the spec
  17214. // this throws a TypeError, but we will just return undefined.
  17215. if ( !isFunction( fn ) ) {
  17216. return undefined;
  17217. }
  17218. // Simulated bind
  17219. args = slice.call( arguments, 2 );
  17220. proxy = function() {
  17221. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  17222. };
  17223. // Set the guid of unique handler to the same of original handler, so it can be removed
  17224. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  17225. return proxy;
  17226. };
  17227. jQuery.holdReady = function( hold ) {
  17228. if ( hold ) {
  17229. jQuery.readyWait++;
  17230. } else {
  17231. jQuery.ready( true );
  17232. }
  17233. };
  17234. jQuery.isArray = Array.isArray;
  17235. jQuery.parseJSON = JSON.parse;
  17236. jQuery.nodeName = nodeName;
  17237. jQuery.isFunction = isFunction;
  17238. jQuery.isWindow = isWindow;
  17239. jQuery.camelCase = camelCase;
  17240. jQuery.type = toType;
  17241. jQuery.now = Date.now;
  17242. jQuery.isNumeric = function( obj ) {
  17243. // As of jQuery 3.0, isNumeric is limited to
  17244. // strings and numbers (primitives or objects)
  17245. // that can be coerced to finite numbers (gh-2662)
  17246. var type = jQuery.type( obj );
  17247. return ( type === "number" || type === "string" ) &&
  17248. // parseFloat NaNs numeric-cast false positives ("")
  17249. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  17250. // subtraction forces infinities to NaN
  17251. !isNaN( obj - parseFloat( obj ) );
  17252. };
  17253. // Register as a named AMD module, since jQuery can be concatenated with other
  17254. // files that may use define, but not via a proper concatenation script that
  17255. // understands anonymous AMD modules. A named AMD is safest and most robust
  17256. // way to register. Lowercase jquery is used because AMD module names are
  17257. // derived from file names, and jQuery is normally delivered in a lowercase
  17258. // file name. Do this after creating the global so that if an AMD module wants
  17259. // to call noConflict to hide this version of jQuery, it will work.
  17260. // Note that for maximum portability, libraries that are not jQuery should
  17261. // declare themselves as anonymous modules, and avoid setting a global if an
  17262. // AMD loader is present. jQuery is a special case. For more information, see
  17263. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  17264. if ( true ) {
  17265. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  17266. return jQuery;
  17267. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  17268. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  17269. }
  17270. var
  17271. // Map over jQuery in case of overwrite
  17272. _jQuery = window.jQuery,
  17273. // Map over the $ in case of overwrite
  17274. _$ = window.$;
  17275. jQuery.noConflict = function( deep ) {
  17276. if ( window.$ === jQuery ) {
  17277. window.$ = _$;
  17278. }
  17279. if ( deep && window.jQuery === jQuery ) {
  17280. window.jQuery = _jQuery;
  17281. }
  17282. return jQuery;
  17283. };
  17284. // Expose jQuery and $ identifiers, even in AMD
  17285. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  17286. // and CommonJS for browser emulators (#13566)
  17287. if ( !noGlobal ) {
  17288. window.jQuery = window.$ = jQuery;
  17289. }
  17290. return jQuery;
  17291. } );
  17292. /***/ }),
  17293. /***/ "./node_modules/laravel-echo/dist/echo.js":
  17294. /*!************************************************!*\
  17295. !*** ./node_modules/laravel-echo/dist/echo.js ***!
  17296. \************************************************/
  17297. /*! exports provided: default */
  17298. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  17299. "use strict";
  17300. __webpack_require__.r(__webpack_exports__);
  17301. var classCallCheck = function (instance, Constructor) {
  17302. if (!(instance instanceof Constructor)) {
  17303. throw new TypeError("Cannot call a class as a function");
  17304. }
  17305. };
  17306. var createClass = function () {
  17307. function defineProperties(target, props) {
  17308. for (var i = 0; i < props.length; i++) {
  17309. var descriptor = props[i];
  17310. descriptor.enumerable = descriptor.enumerable || false;
  17311. descriptor.configurable = true;
  17312. if ("value" in descriptor) descriptor.writable = true;
  17313. Object.defineProperty(target, descriptor.key, descriptor);
  17314. }
  17315. }
  17316. return function (Constructor, protoProps, staticProps) {
  17317. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  17318. if (staticProps) defineProperties(Constructor, staticProps);
  17319. return Constructor;
  17320. };
  17321. }();
  17322. var _extends = Object.assign || function (target) {
  17323. for (var i = 1; i < arguments.length; i++) {
  17324. var source = arguments[i];
  17325. for (var key in source) {
  17326. if (Object.prototype.hasOwnProperty.call(source, key)) {
  17327. target[key] = source[key];
  17328. }
  17329. }
  17330. }
  17331. return target;
  17332. };
  17333. var inherits = function (subClass, superClass) {
  17334. if (typeof superClass !== "function" && superClass !== null) {
  17335. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  17336. }
  17337. subClass.prototype = Object.create(superClass && superClass.prototype, {
  17338. constructor: {
  17339. value: subClass,
  17340. enumerable: false,
  17341. writable: true,
  17342. configurable: true
  17343. }
  17344. });
  17345. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  17346. };
  17347. var possibleConstructorReturn = function (self, call) {
  17348. if (!self) {
  17349. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  17350. }
  17351. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  17352. };
  17353. var Connector = function () {
  17354. /**
  17355. * Create a new class instance.
  17356. */
  17357. function Connector(options) {
  17358. classCallCheck(this, Connector);
  17359. /**
  17360. * Default connector options.
  17361. */
  17362. this._defaultOptions = {
  17363. auth: {
  17364. headers: {}
  17365. },
  17366. authEndpoint: '/broadcasting/auth',
  17367. broadcaster: 'pusher',
  17368. csrfToken: null,
  17369. host: null,
  17370. key: null,
  17371. namespace: 'App.Events'
  17372. };
  17373. this.setOptions(options);
  17374. this.connect();
  17375. }
  17376. /**
  17377. * Merge the custom options with the defaults.
  17378. */
  17379. createClass(Connector, [{
  17380. key: 'setOptions',
  17381. value: function setOptions(options) {
  17382. this.options = _extends(this._defaultOptions, options);
  17383. if (this.csrfToken()) {
  17384. this.options.auth.headers['X-CSRF-TOKEN'] = this.csrfToken();
  17385. }
  17386. return options;
  17387. }
  17388. /**
  17389. * Extract the CSRF token from the page.
  17390. */
  17391. }, {
  17392. key: 'csrfToken',
  17393. value: function csrfToken() {
  17394. var selector = void 0;
  17395. if (typeof window !== 'undefined' && window['Laravel'] && window['Laravel'].csrfToken) {
  17396. return window['Laravel'].csrfToken;
  17397. } else if (this.options.csrfToken) {
  17398. return this.options.csrfToken;
  17399. } else if (typeof document !== 'undefined' && typeof document.querySelector === 'function' && (selector = document.querySelector('meta[name="csrf-token"]'))) {
  17400. return selector.getAttribute('content');
  17401. }
  17402. return null;
  17403. }
  17404. }]);
  17405. return Connector;
  17406. }();
  17407. /**
  17408. * This class represents a basic channel.
  17409. */
  17410. var Channel = function () {
  17411. function Channel() {
  17412. classCallCheck(this, Channel);
  17413. }
  17414. createClass(Channel, [{
  17415. key: 'listenForWhisper',
  17416. /**
  17417. * Listen for a whisper event on the channel instance.
  17418. */
  17419. value: function listenForWhisper(event, callback) {
  17420. return this.listen('.client-' + event, callback);
  17421. }
  17422. /**
  17423. * Listen for an event on the channel instance.
  17424. */
  17425. }, {
  17426. key: 'notification',
  17427. value: function notification(callback) {
  17428. return this.listen('.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated', callback);
  17429. }
  17430. /**
  17431. * Stop listening for a whispser event on the channel instance.
  17432. */
  17433. }, {
  17434. key: 'stopListeningForWhisper',
  17435. value: function stopListeningForWhisper(event) {
  17436. return this.stopListening('.client-' + event);
  17437. }
  17438. }]);
  17439. return Channel;
  17440. }();
  17441. /**
  17442. * Event name formatter
  17443. */
  17444. var EventFormatter = function () {
  17445. /**
  17446. * Create a new class instance.
  17447. */
  17448. function EventFormatter(namespace) {
  17449. classCallCheck(this, EventFormatter);
  17450. this.setNamespace(namespace);
  17451. }
  17452. /**
  17453. * Format the given event name.
  17454. */
  17455. createClass(EventFormatter, [{
  17456. key: 'format',
  17457. value: function format(event) {
  17458. if (event.charAt(0) === '.' || event.charAt(0) === '\\') {
  17459. return event.substr(1);
  17460. } else if (this.namespace) {
  17461. event = this.namespace + '.' + event;
  17462. }
  17463. return event.replace(/\./g, '\\');
  17464. }
  17465. /**
  17466. * Set the event namespace.
  17467. */
  17468. }, {
  17469. key: 'setNamespace',
  17470. value: function setNamespace(value) {
  17471. this.namespace = value;
  17472. }
  17473. }]);
  17474. return EventFormatter;
  17475. }();
  17476. /**
  17477. * This class represents a Pusher channel.
  17478. */
  17479. var PusherChannel = function (_Channel) {
  17480. inherits(PusherChannel, _Channel);
  17481. /**
  17482. * Create a new class instance.
  17483. */
  17484. function PusherChannel(pusher, name, options) {
  17485. classCallCheck(this, PusherChannel);
  17486. var _this = possibleConstructorReturn(this, (PusherChannel.__proto__ || Object.getPrototypeOf(PusherChannel)).call(this));
  17487. _this.name = name;
  17488. _this.pusher = pusher;
  17489. _this.options = options;
  17490. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17491. _this.subscribe();
  17492. return _this;
  17493. }
  17494. /**
  17495. * Subscribe to a Pusher channel.
  17496. */
  17497. createClass(PusherChannel, [{
  17498. key: 'subscribe',
  17499. value: function subscribe() {
  17500. this.subscription = this.pusher.subscribe(this.name);
  17501. }
  17502. /**
  17503. * Unsubscribe from a Pusher channel.
  17504. */
  17505. }, {
  17506. key: 'unsubscribe',
  17507. value: function unsubscribe() {
  17508. this.pusher.unsubscribe(this.name);
  17509. }
  17510. /**
  17511. * Listen for an event on the channel instance.
  17512. */
  17513. }, {
  17514. key: 'listen',
  17515. value: function listen(event, callback) {
  17516. this.on(this.eventFormatter.format(event), callback);
  17517. return this;
  17518. }
  17519. /**
  17520. * Stop listening for an event on the channel instance.
  17521. */
  17522. }, {
  17523. key: 'stopListening',
  17524. value: function stopListening(event) {
  17525. this.subscription.unbind(this.eventFormatter.format(event));
  17526. return this;
  17527. }
  17528. /**
  17529. * Bind a channel to an event.
  17530. */
  17531. }, {
  17532. key: 'on',
  17533. value: function on(event, callback) {
  17534. this.subscription.bind(event, callback);
  17535. return this;
  17536. }
  17537. }]);
  17538. return PusherChannel;
  17539. }(Channel);
  17540. /**
  17541. * This class represents a Pusher private channel.
  17542. */
  17543. var PusherPrivateChannel = function (_PusherChannel) {
  17544. inherits(PusherPrivateChannel, _PusherChannel);
  17545. function PusherPrivateChannel() {
  17546. classCallCheck(this, PusherPrivateChannel);
  17547. return possibleConstructorReturn(this, (PusherPrivateChannel.__proto__ || Object.getPrototypeOf(PusherPrivateChannel)).apply(this, arguments));
  17548. }
  17549. createClass(PusherPrivateChannel, [{
  17550. key: 'whisper',
  17551. /**
  17552. * Trigger client event on the channel.
  17553. */
  17554. value: function whisper(eventName, data) {
  17555. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17556. return this;
  17557. }
  17558. }]);
  17559. return PusherPrivateChannel;
  17560. }(PusherChannel);
  17561. /**
  17562. * This class represents a Pusher presence channel.
  17563. */
  17564. var PusherPresenceChannel = function (_PusherChannel) {
  17565. inherits(PusherPresenceChannel, _PusherChannel);
  17566. function PusherPresenceChannel() {
  17567. classCallCheck(this, PusherPresenceChannel);
  17568. return possibleConstructorReturn(this, (PusherPresenceChannel.__proto__ || Object.getPrototypeOf(PusherPresenceChannel)).apply(this, arguments));
  17569. }
  17570. createClass(PusherPresenceChannel, [{
  17571. key: 'here',
  17572. /**
  17573. * Register a callback to be called anytime the member list changes.
  17574. */
  17575. value: function here(callback) {
  17576. this.on('pusher:subscription_succeeded', function (data) {
  17577. callback(Object.keys(data.members).map(function (k) {
  17578. return data.members[k];
  17579. }));
  17580. });
  17581. return this;
  17582. }
  17583. /**
  17584. * Listen for someone joining the channel.
  17585. */
  17586. }, {
  17587. key: 'joining',
  17588. value: function joining(callback) {
  17589. this.on('pusher:member_added', function (member) {
  17590. callback(member.info);
  17591. });
  17592. return this;
  17593. }
  17594. /**
  17595. * Listen for someone leaving the channel.
  17596. */
  17597. }, {
  17598. key: 'leaving',
  17599. value: function leaving(callback) {
  17600. this.on('pusher:member_removed', function (member) {
  17601. callback(member.info);
  17602. });
  17603. return this;
  17604. }
  17605. /**
  17606. * Trigger client event on the channel.
  17607. */
  17608. }, {
  17609. key: 'whisper',
  17610. value: function whisper(eventName, data) {
  17611. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17612. return this;
  17613. }
  17614. }]);
  17615. return PusherPresenceChannel;
  17616. }(PusherChannel);
  17617. /**
  17618. * This class represents a Socket.io channel.
  17619. */
  17620. var SocketIoChannel = function (_Channel) {
  17621. inherits(SocketIoChannel, _Channel);
  17622. /**
  17623. * Create a new class instance.
  17624. */
  17625. function SocketIoChannel(socket, name, options) {
  17626. classCallCheck(this, SocketIoChannel);
  17627. /**
  17628. * The event callbacks applied to the channel.
  17629. */
  17630. var _this = possibleConstructorReturn(this, (SocketIoChannel.__proto__ || Object.getPrototypeOf(SocketIoChannel)).call(this));
  17631. _this.events = {};
  17632. _this.name = name;
  17633. _this.socket = socket;
  17634. _this.options = options;
  17635. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17636. _this.subscribe();
  17637. _this.configureReconnector();
  17638. return _this;
  17639. }
  17640. /**
  17641. * Subscribe to a Socket.io channel.
  17642. */
  17643. createClass(SocketIoChannel, [{
  17644. key: 'subscribe',
  17645. value: function subscribe() {
  17646. this.socket.emit('subscribe', {
  17647. channel: this.name,
  17648. auth: this.options.auth || {}
  17649. });
  17650. }
  17651. /**
  17652. * Unsubscribe from channel and ubind event callbacks.
  17653. */
  17654. }, {
  17655. key: 'unsubscribe',
  17656. value: function unsubscribe() {
  17657. this.unbind();
  17658. this.socket.emit('unsubscribe', {
  17659. channel: this.name,
  17660. auth: this.options.auth || {}
  17661. });
  17662. }
  17663. /**
  17664. * Listen for an event on the channel instance.
  17665. */
  17666. }, {
  17667. key: 'listen',
  17668. value: function listen(event, callback) {
  17669. this.on(this.eventFormatter.format(event), callback);
  17670. return this;
  17671. }
  17672. /**
  17673. * Stop listening for an event on the channel instance.
  17674. */
  17675. }, {
  17676. key: 'stopListening',
  17677. value: function stopListening(event) {
  17678. var name = this.eventFormatter.format(event);
  17679. this.socket.removeListener(name);
  17680. delete this.events[name];
  17681. return this;
  17682. }
  17683. /**
  17684. * Bind the channel's socket to an event and store the callback.
  17685. */
  17686. }, {
  17687. key: 'on',
  17688. value: function on(event, callback) {
  17689. var _this2 = this;
  17690. var listener = function listener(channel, data) {
  17691. if (_this2.name == channel) {
  17692. callback(data);
  17693. }
  17694. };
  17695. this.socket.on(event, listener);
  17696. this.bind(event, listener);
  17697. }
  17698. /**
  17699. * Attach a 'reconnect' listener and bind the event.
  17700. */
  17701. }, {
  17702. key: 'configureReconnector',
  17703. value: function configureReconnector() {
  17704. var _this3 = this;
  17705. var listener = function listener() {
  17706. _this3.subscribe();
  17707. };
  17708. this.socket.on('reconnect', listener);
  17709. this.bind('reconnect', listener);
  17710. }
  17711. /**
  17712. * Bind the channel's socket to an event and store the callback.
  17713. */
  17714. }, {
  17715. key: 'bind',
  17716. value: function bind(event, callback) {
  17717. this.events[event] = this.events[event] || [];
  17718. this.events[event].push(callback);
  17719. }
  17720. /**
  17721. * Unbind the channel's socket from all stored event callbacks.
  17722. */
  17723. }, {
  17724. key: 'unbind',
  17725. value: function unbind() {
  17726. var _this4 = this;
  17727. Object.keys(this.events).forEach(function (event) {
  17728. _this4.events[event].forEach(function (callback) {
  17729. _this4.socket.removeListener(event, callback);
  17730. });
  17731. delete _this4.events[event];
  17732. });
  17733. }
  17734. }]);
  17735. return SocketIoChannel;
  17736. }(Channel);
  17737. /**
  17738. * This class represents a Socket.io presence channel.
  17739. */
  17740. var SocketIoPrivateChannel = function (_SocketIoChannel) {
  17741. inherits(SocketIoPrivateChannel, _SocketIoChannel);
  17742. function SocketIoPrivateChannel() {
  17743. classCallCheck(this, SocketIoPrivateChannel);
  17744. return possibleConstructorReturn(this, (SocketIoPrivateChannel.__proto__ || Object.getPrototypeOf(SocketIoPrivateChannel)).apply(this, arguments));
  17745. }
  17746. createClass(SocketIoPrivateChannel, [{
  17747. key: 'whisper',
  17748. /**
  17749. * Trigger client event on the channel.
  17750. */
  17751. value: function whisper(eventName, data) {
  17752. this.socket.emit('client event', {
  17753. channel: this.name,
  17754. event: 'client-' + eventName,
  17755. data: data
  17756. });
  17757. return this;
  17758. }
  17759. }]);
  17760. return SocketIoPrivateChannel;
  17761. }(SocketIoChannel);
  17762. /**
  17763. * This class represents a Socket.io presence channel.
  17764. */
  17765. var SocketIoPresenceChannel = function (_SocketIoPrivateChann) {
  17766. inherits(SocketIoPresenceChannel, _SocketIoPrivateChann);
  17767. function SocketIoPresenceChannel() {
  17768. classCallCheck(this, SocketIoPresenceChannel);
  17769. return possibleConstructorReturn(this, (SocketIoPresenceChannel.__proto__ || Object.getPrototypeOf(SocketIoPresenceChannel)).apply(this, arguments));
  17770. }
  17771. createClass(SocketIoPresenceChannel, [{
  17772. key: 'here',
  17773. /**
  17774. * Register a callback to be called anytime the member list changes.
  17775. */
  17776. value: function here(callback) {
  17777. this.on('presence:subscribed', function (members) {
  17778. callback(members.map(function (m) {
  17779. return m.user_info;
  17780. }));
  17781. });
  17782. return this;
  17783. }
  17784. /**
  17785. * Listen for someone joining the channel.
  17786. */
  17787. }, {
  17788. key: 'joining',
  17789. value: function joining(callback) {
  17790. this.on('presence:joining', function (member) {
  17791. return callback(member.user_info);
  17792. });
  17793. return this;
  17794. }
  17795. /**
  17796. * Listen for someone leaving the channel.
  17797. */
  17798. }, {
  17799. key: 'leaving',
  17800. value: function leaving(callback) {
  17801. this.on('presence:leaving', function (member) {
  17802. return callback(member.user_info);
  17803. });
  17804. return this;
  17805. }
  17806. }]);
  17807. return SocketIoPresenceChannel;
  17808. }(SocketIoPrivateChannel);
  17809. /**
  17810. * This class represents a null channel.
  17811. */
  17812. var NullChannel = function (_Channel) {
  17813. inherits(NullChannel, _Channel);
  17814. function NullChannel() {
  17815. classCallCheck(this, NullChannel);
  17816. return possibleConstructorReturn(this, (NullChannel.__proto__ || Object.getPrototypeOf(NullChannel)).apply(this, arguments));
  17817. }
  17818. createClass(NullChannel, [{
  17819. key: 'subscribe',
  17820. /**
  17821. * Subscribe to a channel.
  17822. */
  17823. value: function subscribe() {}
  17824. //
  17825. /**
  17826. * Unsubscribe from a channel.
  17827. */
  17828. }, {
  17829. key: 'unsubscribe',
  17830. value: function unsubscribe() {}
  17831. //
  17832. /**
  17833. * Listen for an event on the channel instance.
  17834. */
  17835. }, {
  17836. key: 'listen',
  17837. value: function listen(event, callback) {
  17838. return this;
  17839. }
  17840. /**
  17841. * Stop listening for an event on the channel instance.
  17842. */
  17843. }, {
  17844. key: 'stopListening',
  17845. value: function stopListening(event) {
  17846. return this;
  17847. }
  17848. /**
  17849. * Bind a channel to an event.
  17850. */
  17851. }, {
  17852. key: 'on',
  17853. value: function on(event, callback) {
  17854. return this;
  17855. }
  17856. }]);
  17857. return NullChannel;
  17858. }(Channel);
  17859. /**
  17860. * This class represents a null private channel.
  17861. */
  17862. var NullPrivateChannel = function (_NullChannel) {
  17863. inherits(NullPrivateChannel, _NullChannel);
  17864. function NullPrivateChannel() {
  17865. classCallCheck(this, NullPrivateChannel);
  17866. return possibleConstructorReturn(this, (NullPrivateChannel.__proto__ || Object.getPrototypeOf(NullPrivateChannel)).apply(this, arguments));
  17867. }
  17868. createClass(NullPrivateChannel, [{
  17869. key: 'whisper',
  17870. /**
  17871. * Trigger client event on the channel.
  17872. */
  17873. value: function whisper(eventName, data) {
  17874. return this;
  17875. }
  17876. }]);
  17877. return NullPrivateChannel;
  17878. }(NullChannel);
  17879. /**
  17880. * This class represents a null presence channel.
  17881. */
  17882. var NullPresenceChannel = function (_NullChannel) {
  17883. inherits(NullPresenceChannel, _NullChannel);
  17884. function NullPresenceChannel() {
  17885. classCallCheck(this, NullPresenceChannel);
  17886. return possibleConstructorReturn(this, (NullPresenceChannel.__proto__ || Object.getPrototypeOf(NullPresenceChannel)).apply(this, arguments));
  17887. }
  17888. createClass(NullPresenceChannel, [{
  17889. key: 'here',
  17890. /**
  17891. * Register a callback to be called anytime the member list changes.
  17892. */
  17893. value: function here(callback) {
  17894. return this;
  17895. }
  17896. /**
  17897. * Listen for someone joining the channel.
  17898. */
  17899. }, {
  17900. key: 'joining',
  17901. value: function joining(callback) {
  17902. return this;
  17903. }
  17904. /**
  17905. * Listen for someone leaving the channel.
  17906. */
  17907. }, {
  17908. key: 'leaving',
  17909. value: function leaving(callback) {
  17910. return this;
  17911. }
  17912. /**
  17913. * Trigger client event on the channel.
  17914. */
  17915. }, {
  17916. key: 'whisper',
  17917. value: function whisper(eventName, data) {
  17918. return this;
  17919. }
  17920. }]);
  17921. return NullPresenceChannel;
  17922. }(NullChannel);
  17923. /**
  17924. * This class creates a connector to Pusher.
  17925. */
  17926. var PusherConnector = function (_Connector) {
  17927. inherits(PusherConnector, _Connector);
  17928. function PusherConnector() {
  17929. classCallCheck(this, PusherConnector);
  17930. /**
  17931. * All of the subscribed channel names.
  17932. */
  17933. var _this = possibleConstructorReturn(this, (PusherConnector.__proto__ || Object.getPrototypeOf(PusherConnector)).apply(this, arguments));
  17934. _this.channels = {};
  17935. return _this;
  17936. }
  17937. /**
  17938. * Create a fresh Pusher connection.
  17939. */
  17940. createClass(PusherConnector, [{
  17941. key: 'connect',
  17942. value: function connect() {
  17943. if (typeof this.options.client !== 'undefined') {
  17944. this.pusher = this.options.client;
  17945. } else {
  17946. this.pusher = new Pusher(this.options.key, this.options);
  17947. }
  17948. }
  17949. /**
  17950. * Listen for an event on a channel instance.
  17951. */
  17952. }, {
  17953. key: 'listen',
  17954. value: function listen(name, event, callback) {
  17955. return this.channel(name).listen(event, callback);
  17956. }
  17957. /**
  17958. * Get a channel instance by name.
  17959. */
  17960. }, {
  17961. key: 'channel',
  17962. value: function channel(name) {
  17963. if (!this.channels[name]) {
  17964. this.channels[name] = new PusherChannel(this.pusher, name, this.options);
  17965. }
  17966. return this.channels[name];
  17967. }
  17968. /**
  17969. * Get a private channel instance by name.
  17970. */
  17971. }, {
  17972. key: 'privateChannel',
  17973. value: function privateChannel(name) {
  17974. if (!this.channels['private-' + name]) {
  17975. this.channels['private-' + name] = new PusherPrivateChannel(this.pusher, 'private-' + name, this.options);
  17976. }
  17977. return this.channels['private-' + name];
  17978. }
  17979. /**
  17980. * Get a presence channel instance by name.
  17981. */
  17982. }, {
  17983. key: 'presenceChannel',
  17984. value: function presenceChannel(name) {
  17985. if (!this.channels['presence-' + name]) {
  17986. this.channels['presence-' + name] = new PusherPresenceChannel(this.pusher, 'presence-' + name, this.options);
  17987. }
  17988. return this.channels['presence-' + name];
  17989. }
  17990. /**
  17991. * Leave the given channel, as well as its private and presence variants.
  17992. */
  17993. }, {
  17994. key: 'leave',
  17995. value: function leave(name) {
  17996. var _this2 = this;
  17997. var channels = [name, 'private-' + name, 'presence-' + name];
  17998. channels.forEach(function (name, index) {
  17999. _this2.leaveChannel(name);
  18000. });
  18001. }
  18002. /**
  18003. * Leave the given channel.
  18004. */
  18005. }, {
  18006. key: 'leaveChannel',
  18007. value: function leaveChannel(name) {
  18008. if (this.channels[name]) {
  18009. this.channels[name].unsubscribe();
  18010. delete this.channels[name];
  18011. }
  18012. }
  18013. /**
  18014. * Get the socket ID for the connection.
  18015. */
  18016. }, {
  18017. key: 'socketId',
  18018. value: function socketId() {
  18019. return this.pusher.connection.socket_id;
  18020. }
  18021. /**
  18022. * Disconnect Pusher connection.
  18023. */
  18024. }, {
  18025. key: 'disconnect',
  18026. value: function disconnect() {
  18027. this.pusher.disconnect();
  18028. }
  18029. }]);
  18030. return PusherConnector;
  18031. }(Connector);
  18032. /**
  18033. * This class creates a connnector to a Socket.io server.
  18034. */
  18035. var SocketIoConnector = function (_Connector) {
  18036. inherits(SocketIoConnector, _Connector);
  18037. function SocketIoConnector() {
  18038. classCallCheck(this, SocketIoConnector);
  18039. /**
  18040. * All of the subscribed channel names.
  18041. */
  18042. var _this = possibleConstructorReturn(this, (SocketIoConnector.__proto__ || Object.getPrototypeOf(SocketIoConnector)).apply(this, arguments));
  18043. _this.channels = {};
  18044. return _this;
  18045. }
  18046. /**
  18047. * Create a fresh Socket.io connection.
  18048. */
  18049. createClass(SocketIoConnector, [{
  18050. key: 'connect',
  18051. value: function connect() {
  18052. var io = this.getSocketIO();
  18053. this.socket = io(this.options.host, this.options);
  18054. return this.socket;
  18055. }
  18056. /**
  18057. * Get socket.io module from global scope or options.
  18058. */
  18059. }, {
  18060. key: 'getSocketIO',
  18061. value: function getSocketIO() {
  18062. if (typeof this.options.client !== 'undefined') {
  18063. return this.options.client;
  18064. }
  18065. if (typeof io !== 'undefined') {
  18066. return io;
  18067. }
  18068. throw new Error('Socket.io client not found. Should be globally available or passed via options.client');
  18069. }
  18070. /**
  18071. * Listen for an event on a channel instance.
  18072. */
  18073. }, {
  18074. key: 'listen',
  18075. value: function listen(name, event, callback) {
  18076. return this.channel(name).listen(event, callback);
  18077. }
  18078. /**
  18079. * Get a channel instance by name.
  18080. */
  18081. }, {
  18082. key: 'channel',
  18083. value: function channel(name) {
  18084. if (!this.channels[name]) {
  18085. this.channels[name] = new SocketIoChannel(this.socket, name, this.options);
  18086. }
  18087. return this.channels[name];
  18088. }
  18089. /**
  18090. * Get a private channel instance by name.
  18091. */
  18092. }, {
  18093. key: 'privateChannel',
  18094. value: function privateChannel(name) {
  18095. if (!this.channels['private-' + name]) {
  18096. this.channels['private-' + name] = new SocketIoPrivateChannel(this.socket, 'private-' + name, this.options);
  18097. }
  18098. return this.channels['private-' + name];
  18099. }
  18100. /**
  18101. * Get a presence channel instance by name.
  18102. */
  18103. }, {
  18104. key: 'presenceChannel',
  18105. value: function presenceChannel(name) {
  18106. if (!this.channels['presence-' + name]) {
  18107. this.channels['presence-' + name] = new SocketIoPresenceChannel(this.socket, 'presence-' + name, this.options);
  18108. }
  18109. return this.channels['presence-' + name];
  18110. }
  18111. /**
  18112. * Leave the given channel, as well as its private and presence variants.
  18113. */
  18114. }, {
  18115. key: 'leave',
  18116. value: function leave(name) {
  18117. var _this2 = this;
  18118. var channels = [name, 'private-' + name, 'presence-' + name];
  18119. channels.forEach(function (name) {
  18120. _this2.leaveChannel(name);
  18121. });
  18122. }
  18123. /**
  18124. * Leave the given channel.
  18125. */
  18126. }, {
  18127. key: 'leaveChannel',
  18128. value: function leaveChannel(name) {
  18129. if (this.channels[name]) {
  18130. this.channels[name].unsubscribe();
  18131. delete this.channels[name];
  18132. }
  18133. }
  18134. /**
  18135. * Get the socket ID for the connection.
  18136. */
  18137. }, {
  18138. key: 'socketId',
  18139. value: function socketId() {
  18140. return this.socket.id;
  18141. }
  18142. /**
  18143. * Disconnect Socketio connection.
  18144. */
  18145. }, {
  18146. key: 'disconnect',
  18147. value: function disconnect() {
  18148. this.socket.disconnect();
  18149. }
  18150. }]);
  18151. return SocketIoConnector;
  18152. }(Connector);
  18153. /**
  18154. * This class creates a null connector.
  18155. */
  18156. var NullConnector = function (_Connector) {
  18157. inherits(NullConnector, _Connector);
  18158. function NullConnector() {
  18159. classCallCheck(this, NullConnector);
  18160. /**
  18161. * All of the subscribed channel names.
  18162. */
  18163. var _this = possibleConstructorReturn(this, (NullConnector.__proto__ || Object.getPrototypeOf(NullConnector)).apply(this, arguments));
  18164. _this.channels = {};
  18165. return _this;
  18166. }
  18167. /**
  18168. * Create a fresh connection.
  18169. */
  18170. createClass(NullConnector, [{
  18171. key: 'connect',
  18172. value: function connect() {}
  18173. //
  18174. /**
  18175. * Listen for an event on a channel instance.
  18176. */
  18177. }, {
  18178. key: 'listen',
  18179. value: function listen(name, event, callback) {
  18180. return new NullChannel();
  18181. }
  18182. /**
  18183. * Get a channel instance by name.
  18184. */
  18185. }, {
  18186. key: 'channel',
  18187. value: function channel(name) {
  18188. return new NullChannel();
  18189. }
  18190. /**
  18191. * Get a private channel instance by name.
  18192. */
  18193. }, {
  18194. key: 'privateChannel',
  18195. value: function privateChannel(name) {
  18196. return new NullPrivateChannel();
  18197. }
  18198. /**
  18199. * Get a presence channel instance by name.
  18200. */
  18201. }, {
  18202. key: 'presenceChannel',
  18203. value: function presenceChannel(name) {
  18204. return new NullPresenceChannel();
  18205. }
  18206. /**
  18207. * Leave the given channel, as well as its private and presence variants.
  18208. */
  18209. }, {
  18210. key: 'leave',
  18211. value: function leave(name) {}
  18212. //
  18213. /**
  18214. * Leave the given channel.
  18215. */
  18216. }, {
  18217. key: 'leaveChannel',
  18218. value: function leaveChannel(name) {}
  18219. //
  18220. /**
  18221. * Get the socket ID for the connection.
  18222. */
  18223. }, {
  18224. key: 'socketId',
  18225. value: function socketId() {
  18226. return 'fake-socket-id';
  18227. }
  18228. /**
  18229. * Disconnect the connection.
  18230. */
  18231. }, {
  18232. key: 'disconnect',
  18233. value: function disconnect() {
  18234. //
  18235. }
  18236. }]);
  18237. return NullConnector;
  18238. }(Connector);
  18239. /**
  18240. * This class is the primary API for interacting with broadcasting.
  18241. */
  18242. var Echo = function () {
  18243. /**
  18244. * Create a new class instance.
  18245. */
  18246. function Echo(options) {
  18247. classCallCheck(this, Echo);
  18248. this.options = options;
  18249. this.connect();
  18250. if (!this.options.withoutInterceptors) {
  18251. this.registerInterceptors();
  18252. }
  18253. }
  18254. /**
  18255. * Get a channel instance by name.
  18256. */
  18257. createClass(Echo, [{
  18258. key: 'channel',
  18259. value: function channel(_channel) {
  18260. return this.connector.channel(_channel);
  18261. }
  18262. /**
  18263. * Create a new connection.
  18264. */
  18265. }, {
  18266. key: 'connect',
  18267. value: function connect() {
  18268. if (this.options.broadcaster == 'pusher') {
  18269. this.connector = new PusherConnector(this.options);
  18270. } else if (this.options.broadcaster == 'socket.io') {
  18271. this.connector = new SocketIoConnector(this.options);
  18272. } else if (this.options.broadcaster == 'null') {
  18273. this.connector = new NullConnector(this.options);
  18274. } else if (typeof this.options.broadcaster == 'function') {
  18275. this.connector = new this.options.broadcaster(this.options);
  18276. }
  18277. }
  18278. /**
  18279. * Disconnect from the Echo server.
  18280. */
  18281. }, {
  18282. key: 'disconnect',
  18283. value: function disconnect() {
  18284. this.connector.disconnect();
  18285. }
  18286. /**
  18287. * Get a presence channel instance by name.
  18288. */
  18289. }, {
  18290. key: 'join',
  18291. value: function join(channel) {
  18292. return this.connector.presenceChannel(channel);
  18293. }
  18294. /**
  18295. * Leave the given channel, as well as its private and presence variants.
  18296. */
  18297. }, {
  18298. key: 'leave',
  18299. value: function leave(channel) {
  18300. this.connector.leave(channel);
  18301. }
  18302. /**
  18303. * Leave the given channel.
  18304. */
  18305. }, {
  18306. key: 'leaveChannel',
  18307. value: function leaveChannel(channel) {
  18308. this.connector.leaveChannel(channel);
  18309. }
  18310. /**
  18311. * Listen for an event on a channel instance.
  18312. */
  18313. }, {
  18314. key: 'listen',
  18315. value: function listen(channel, event, callback) {
  18316. return this.connector.listen(channel, event, callback);
  18317. }
  18318. /**
  18319. * Get a private channel instance by name.
  18320. */
  18321. }, {
  18322. key: 'private',
  18323. value: function _private(channel) {
  18324. return this.connector.privateChannel(channel);
  18325. }
  18326. /**
  18327. * Get the Socket ID for the connection.
  18328. */
  18329. }, {
  18330. key: 'socketId',
  18331. value: function socketId() {
  18332. return this.connector.socketId();
  18333. }
  18334. /**
  18335. * Register 3rd party request interceptiors. These are used to automatically
  18336. * send a connections socket id to a Laravel app with a X-Socket-Id header.
  18337. */
  18338. }, {
  18339. key: 'registerInterceptors',
  18340. value: function registerInterceptors() {
  18341. if (typeof Vue === 'function' && Vue.http) {
  18342. this.registerVueRequestInterceptor();
  18343. }
  18344. if (typeof axios === 'function') {
  18345. this.registerAxiosRequestInterceptor();
  18346. }
  18347. if (typeof jQuery === 'function') {
  18348. this.registerjQueryAjaxSetup();
  18349. }
  18350. }
  18351. /**
  18352. * Register a Vue HTTP interceptor to add the X-Socket-ID header.
  18353. */
  18354. }, {
  18355. key: 'registerVueRequestInterceptor',
  18356. value: function registerVueRequestInterceptor() {
  18357. var _this = this;
  18358. Vue.http.interceptors.push(function (request, next) {
  18359. if (_this.socketId()) {
  18360. request.headers.set('X-Socket-ID', _this.socketId());
  18361. }
  18362. next();
  18363. });
  18364. }
  18365. /**
  18366. * Register an Axios HTTP interceptor to add the X-Socket-ID header.
  18367. */
  18368. }, {
  18369. key: 'registerAxiosRequestInterceptor',
  18370. value: function registerAxiosRequestInterceptor() {
  18371. var _this2 = this;
  18372. axios.interceptors.request.use(function (config) {
  18373. if (_this2.socketId()) {
  18374. config.headers['X-Socket-Id'] = _this2.socketId();
  18375. }
  18376. return config;
  18377. });
  18378. }
  18379. /**
  18380. * Register jQuery AjaxPrefilter to add the X-Socket-ID header.
  18381. */
  18382. }, {
  18383. key: 'registerjQueryAjaxSetup',
  18384. value: function registerjQueryAjaxSetup() {
  18385. var _this3 = this;
  18386. if (typeof jQuery.ajax != 'undefined') {
  18387. jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {
  18388. if (_this3.socketId()) {
  18389. xhr.setRequestHeader('X-Socket-Id', _this3.socketId());
  18390. }
  18391. });
  18392. }
  18393. }
  18394. }]);
  18395. return Echo;
  18396. }();
  18397. /* harmony default export */ __webpack_exports__["default"] = (Echo);
  18398. /***/ }),
  18399. /***/ "./node_modules/lodash/lodash.js":
  18400. /*!***************************************!*\
  18401. !*** ./node_modules/lodash/lodash.js ***!
  18402. \***************************************/
  18403. /*! no static exports found */
  18404. /***/ (function(module, exports, __webpack_require__) {
  18405. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  18406. * @license
  18407. * Lodash <https://lodash.com/>
  18408. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  18409. * Released under MIT license <https://lodash.com/license>
  18410. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  18411. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  18412. */
  18413. ;(function() {
  18414. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  18415. var undefined;
  18416. /** Used as the semantic version number. */
  18417. var VERSION = '4.17.15';
  18418. /** Used as the size to enable large array optimizations. */
  18419. var LARGE_ARRAY_SIZE = 200;
  18420. /** Error message constants. */
  18421. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  18422. FUNC_ERROR_TEXT = 'Expected a function';
  18423. /** Used to stand-in for `undefined` hash values. */
  18424. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  18425. /** Used as the maximum memoize cache size. */
  18426. var MAX_MEMOIZE_SIZE = 500;
  18427. /** Used as the internal argument placeholder. */
  18428. var PLACEHOLDER = '__lodash_placeholder__';
  18429. /** Used to compose bitmasks for cloning. */
  18430. var CLONE_DEEP_FLAG = 1,
  18431. CLONE_FLAT_FLAG = 2,
  18432. CLONE_SYMBOLS_FLAG = 4;
  18433. /** Used to compose bitmasks for value comparisons. */
  18434. var COMPARE_PARTIAL_FLAG = 1,
  18435. COMPARE_UNORDERED_FLAG = 2;
  18436. /** Used to compose bitmasks for function metadata. */
  18437. var WRAP_BIND_FLAG = 1,
  18438. WRAP_BIND_KEY_FLAG = 2,
  18439. WRAP_CURRY_BOUND_FLAG = 4,
  18440. WRAP_CURRY_FLAG = 8,
  18441. WRAP_CURRY_RIGHT_FLAG = 16,
  18442. WRAP_PARTIAL_FLAG = 32,
  18443. WRAP_PARTIAL_RIGHT_FLAG = 64,
  18444. WRAP_ARY_FLAG = 128,
  18445. WRAP_REARG_FLAG = 256,
  18446. WRAP_FLIP_FLAG = 512;
  18447. /** Used as default options for `_.truncate`. */
  18448. var DEFAULT_TRUNC_LENGTH = 30,
  18449. DEFAULT_TRUNC_OMISSION = '...';
  18450. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  18451. var HOT_COUNT = 800,
  18452. HOT_SPAN = 16;
  18453. /** Used to indicate the type of lazy iteratees. */
  18454. var LAZY_FILTER_FLAG = 1,
  18455. LAZY_MAP_FLAG = 2,
  18456. LAZY_WHILE_FLAG = 3;
  18457. /** Used as references for various `Number` constants. */
  18458. var INFINITY = 1 / 0,
  18459. MAX_SAFE_INTEGER = 9007199254740991,
  18460. MAX_INTEGER = 1.7976931348623157e+308,
  18461. NAN = 0 / 0;
  18462. /** Used as references for the maximum length and index of an array. */
  18463. var MAX_ARRAY_LENGTH = 4294967295,
  18464. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  18465. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  18466. /** Used to associate wrap methods with their bit flags. */
  18467. var wrapFlags = [
  18468. ['ary', WRAP_ARY_FLAG],
  18469. ['bind', WRAP_BIND_FLAG],
  18470. ['bindKey', WRAP_BIND_KEY_FLAG],
  18471. ['curry', WRAP_CURRY_FLAG],
  18472. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  18473. ['flip', WRAP_FLIP_FLAG],
  18474. ['partial', WRAP_PARTIAL_FLAG],
  18475. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  18476. ['rearg', WRAP_REARG_FLAG]
  18477. ];
  18478. /** `Object#toString` result references. */
  18479. var argsTag = '[object Arguments]',
  18480. arrayTag = '[object Array]',
  18481. asyncTag = '[object AsyncFunction]',
  18482. boolTag = '[object Boolean]',
  18483. dateTag = '[object Date]',
  18484. domExcTag = '[object DOMException]',
  18485. errorTag = '[object Error]',
  18486. funcTag = '[object Function]',
  18487. genTag = '[object GeneratorFunction]',
  18488. mapTag = '[object Map]',
  18489. numberTag = '[object Number]',
  18490. nullTag = '[object Null]',
  18491. objectTag = '[object Object]',
  18492. promiseTag = '[object Promise]',
  18493. proxyTag = '[object Proxy]',
  18494. regexpTag = '[object RegExp]',
  18495. setTag = '[object Set]',
  18496. stringTag = '[object String]',
  18497. symbolTag = '[object Symbol]',
  18498. undefinedTag = '[object Undefined]',
  18499. weakMapTag = '[object WeakMap]',
  18500. weakSetTag = '[object WeakSet]';
  18501. var arrayBufferTag = '[object ArrayBuffer]',
  18502. dataViewTag = '[object DataView]',
  18503. float32Tag = '[object Float32Array]',
  18504. float64Tag = '[object Float64Array]',
  18505. int8Tag = '[object Int8Array]',
  18506. int16Tag = '[object Int16Array]',
  18507. int32Tag = '[object Int32Array]',
  18508. uint8Tag = '[object Uint8Array]',
  18509. uint8ClampedTag = '[object Uint8ClampedArray]',
  18510. uint16Tag = '[object Uint16Array]',
  18511. uint32Tag = '[object Uint32Array]';
  18512. /** Used to match empty string literals in compiled template source. */
  18513. var reEmptyStringLeading = /\b__p \+= '';/g,
  18514. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  18515. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  18516. /** Used to match HTML entities and HTML characters. */
  18517. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  18518. reUnescapedHtml = /[&<>"']/g,
  18519. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  18520. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  18521. /** Used to match template delimiters. */
  18522. var reEscape = /<%-([\s\S]+?)%>/g,
  18523. reEvaluate = /<%([\s\S]+?)%>/g,
  18524. reInterpolate = /<%=([\s\S]+?)%>/g;
  18525. /** Used to match property names within property paths. */
  18526. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  18527. reIsPlainProp = /^\w*$/,
  18528. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  18529. /**
  18530. * Used to match `RegExp`
  18531. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  18532. */
  18533. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  18534. reHasRegExpChar = RegExp(reRegExpChar.source);
  18535. /** Used to match leading and trailing whitespace. */
  18536. var reTrim = /^\s+|\s+$/g,
  18537. reTrimStart = /^\s+/,
  18538. reTrimEnd = /\s+$/;
  18539. /** Used to match wrap detail comments. */
  18540. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  18541. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  18542. reSplitDetails = /,? & /;
  18543. /** Used to match words composed of alphanumeric characters. */
  18544. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  18545. /** Used to match backslashes in property paths. */
  18546. var reEscapeChar = /\\(\\)?/g;
  18547. /**
  18548. * Used to match
  18549. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  18550. */
  18551. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  18552. /** Used to match `RegExp` flags from their coerced string values. */
  18553. var reFlags = /\w*$/;
  18554. /** Used to detect bad signed hexadecimal string values. */
  18555. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  18556. /** Used to detect binary string values. */
  18557. var reIsBinary = /^0b[01]+$/i;
  18558. /** Used to detect host constructors (Safari). */
  18559. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  18560. /** Used to detect octal string values. */
  18561. var reIsOctal = /^0o[0-7]+$/i;
  18562. /** Used to detect unsigned integer values. */
  18563. var reIsUint = /^(?:0|[1-9]\d*)$/;
  18564. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  18565. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  18566. /** Used to ensure capturing order of template delimiters. */
  18567. var reNoMatch = /($^)/;
  18568. /** Used to match unescaped characters in compiled string literals. */
  18569. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  18570. /** Used to compose unicode character classes. */
  18571. var rsAstralRange = '\\ud800-\\udfff',
  18572. rsComboMarksRange = '\\u0300-\\u036f',
  18573. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  18574. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  18575. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  18576. rsDingbatRange = '\\u2700-\\u27bf',
  18577. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  18578. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  18579. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  18580. rsPunctuationRange = '\\u2000-\\u206f',
  18581. 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',
  18582. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  18583. rsVarRange = '\\ufe0e\\ufe0f',
  18584. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  18585. /** Used to compose unicode capture groups. */
  18586. var rsApos = "['\u2019]",
  18587. rsAstral = '[' + rsAstralRange + ']',
  18588. rsBreak = '[' + rsBreakRange + ']',
  18589. rsCombo = '[' + rsComboRange + ']',
  18590. rsDigits = '\\d+',
  18591. rsDingbat = '[' + rsDingbatRange + ']',
  18592. rsLower = '[' + rsLowerRange + ']',
  18593. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  18594. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  18595. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  18596. rsNonAstral = '[^' + rsAstralRange + ']',
  18597. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  18598. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  18599. rsUpper = '[' + rsUpperRange + ']',
  18600. rsZWJ = '\\u200d';
  18601. /** Used to compose unicode regexes. */
  18602. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  18603. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  18604. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  18605. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  18606. reOptMod = rsModifier + '?',
  18607. rsOptVar = '[' + rsVarRange + ']?',
  18608. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  18609. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  18610. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  18611. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  18612. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  18613. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  18614. /** Used to match apostrophes. */
  18615. var reApos = RegExp(rsApos, 'g');
  18616. /**
  18617. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  18618. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  18619. */
  18620. var reComboMark = RegExp(rsCombo, 'g');
  18621. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  18622. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  18623. /** Used to match complex or compound words. */
  18624. var reUnicodeWord = RegExp([
  18625. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  18626. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  18627. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  18628. rsUpper + '+' + rsOptContrUpper,
  18629. rsOrdUpper,
  18630. rsOrdLower,
  18631. rsDigits,
  18632. rsEmoji
  18633. ].join('|'), 'g');
  18634. /** 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/). */
  18635. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  18636. /** Used to detect strings that need a more robust regexp to match words. */
  18637. 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 ]/;
  18638. /** Used to assign default `context` object properties. */
  18639. var contextProps = [
  18640. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  18641. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  18642. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  18643. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  18644. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  18645. ];
  18646. /** Used to make template sourceURLs easier to identify. */
  18647. var templateCounter = -1;
  18648. /** Used to identify `toStringTag` values of typed arrays. */
  18649. var typedArrayTags = {};
  18650. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  18651. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  18652. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  18653. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  18654. typedArrayTags[uint32Tag] = true;
  18655. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  18656. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  18657. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  18658. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  18659. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  18660. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  18661. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  18662. typedArrayTags[weakMapTag] = false;
  18663. /** Used to identify `toStringTag` values supported by `_.clone`. */
  18664. var cloneableTags = {};
  18665. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  18666. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  18667. cloneableTags[boolTag] = cloneableTags[dateTag] =
  18668. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  18669. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  18670. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  18671. cloneableTags[numberTag] = cloneableTags[objectTag] =
  18672. cloneableTags[regexpTag] = cloneableTags[setTag] =
  18673. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  18674. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  18675. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  18676. cloneableTags[errorTag] = cloneableTags[funcTag] =
  18677. cloneableTags[weakMapTag] = false;
  18678. /** Used to map Latin Unicode letters to basic Latin letters. */
  18679. var deburredLetters = {
  18680. // Latin-1 Supplement block.
  18681. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  18682. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  18683. '\xc7': 'C', '\xe7': 'c',
  18684. '\xd0': 'D', '\xf0': 'd',
  18685. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  18686. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  18687. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  18688. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  18689. '\xd1': 'N', '\xf1': 'n',
  18690. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  18691. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  18692. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  18693. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  18694. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  18695. '\xc6': 'Ae', '\xe6': 'ae',
  18696. '\xde': 'Th', '\xfe': 'th',
  18697. '\xdf': 'ss',
  18698. // Latin Extended-A block.
  18699. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  18700. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  18701. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  18702. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  18703. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  18704. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  18705. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  18706. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  18707. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  18708. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  18709. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  18710. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  18711. '\u0134': 'J', '\u0135': 'j',
  18712. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  18713. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  18714. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  18715. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  18716. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  18717. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  18718. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  18719. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  18720. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  18721. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  18722. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  18723. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  18724. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  18725. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  18726. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  18727. '\u0174': 'W', '\u0175': 'w',
  18728. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  18729. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  18730. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  18731. '\u0132': 'IJ', '\u0133': 'ij',
  18732. '\u0152': 'Oe', '\u0153': 'oe',
  18733. '\u0149': "'n", '\u017f': 's'
  18734. };
  18735. /** Used to map characters to HTML entities. */
  18736. var htmlEscapes = {
  18737. '&': '&amp;',
  18738. '<': '&lt;',
  18739. '>': '&gt;',
  18740. '"': '&quot;',
  18741. "'": '&#39;'
  18742. };
  18743. /** Used to map HTML entities to characters. */
  18744. var htmlUnescapes = {
  18745. '&amp;': '&',
  18746. '&lt;': '<',
  18747. '&gt;': '>',
  18748. '&quot;': '"',
  18749. '&#39;': "'"
  18750. };
  18751. /** Used to escape characters for inclusion in compiled string literals. */
  18752. var stringEscapes = {
  18753. '\\': '\\',
  18754. "'": "'",
  18755. '\n': 'n',
  18756. '\r': 'r',
  18757. '\u2028': 'u2028',
  18758. '\u2029': 'u2029'
  18759. };
  18760. /** Built-in method references without a dependency on `root`. */
  18761. var freeParseFloat = parseFloat,
  18762. freeParseInt = parseInt;
  18763. /** Detect free variable `global` from Node.js. */
  18764. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  18765. /** Detect free variable `self`. */
  18766. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  18767. /** Used as a reference to the global object. */
  18768. var root = freeGlobal || freeSelf || Function('return this')();
  18769. /** Detect free variable `exports`. */
  18770. var freeExports = true && exports && !exports.nodeType && exports;
  18771. /** Detect free variable `module`. */
  18772. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  18773. /** Detect the popular CommonJS extension `module.exports`. */
  18774. var moduleExports = freeModule && freeModule.exports === freeExports;
  18775. /** Detect free variable `process` from Node.js. */
  18776. var freeProcess = moduleExports && freeGlobal.process;
  18777. /** Used to access faster Node.js helpers. */
  18778. var nodeUtil = (function() {
  18779. try {
  18780. // Use `util.types` for Node.js 10+.
  18781. var types = freeModule && freeModule.require && freeModule.require('util').types;
  18782. if (types) {
  18783. return types;
  18784. }
  18785. // Legacy `process.binding('util')` for Node.js < 10.
  18786. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  18787. } catch (e) {}
  18788. }());
  18789. /* Node.js helper references. */
  18790. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  18791. nodeIsDate = nodeUtil && nodeUtil.isDate,
  18792. nodeIsMap = nodeUtil && nodeUtil.isMap,
  18793. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  18794. nodeIsSet = nodeUtil && nodeUtil.isSet,
  18795. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  18796. /*--------------------------------------------------------------------------*/
  18797. /**
  18798. * A faster alternative to `Function#apply`, this function invokes `func`
  18799. * with the `this` binding of `thisArg` and the arguments of `args`.
  18800. *
  18801. * @private
  18802. * @param {Function} func The function to invoke.
  18803. * @param {*} thisArg The `this` binding of `func`.
  18804. * @param {Array} args The arguments to invoke `func` with.
  18805. * @returns {*} Returns the result of `func`.
  18806. */
  18807. function apply(func, thisArg, args) {
  18808. switch (args.length) {
  18809. case 0: return func.call(thisArg);
  18810. case 1: return func.call(thisArg, args[0]);
  18811. case 2: return func.call(thisArg, args[0], args[1]);
  18812. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  18813. }
  18814. return func.apply(thisArg, args);
  18815. }
  18816. /**
  18817. * A specialized version of `baseAggregator` for arrays.
  18818. *
  18819. * @private
  18820. * @param {Array} [array] The array to iterate over.
  18821. * @param {Function} setter The function to set `accumulator` values.
  18822. * @param {Function} iteratee The iteratee to transform keys.
  18823. * @param {Object} accumulator The initial aggregated object.
  18824. * @returns {Function} Returns `accumulator`.
  18825. */
  18826. function arrayAggregator(array, setter, iteratee, accumulator) {
  18827. var index = -1,
  18828. length = array == null ? 0 : array.length;
  18829. while (++index < length) {
  18830. var value = array[index];
  18831. setter(accumulator, value, iteratee(value), array);
  18832. }
  18833. return accumulator;
  18834. }
  18835. /**
  18836. * A specialized version of `_.forEach` for arrays without support for
  18837. * iteratee shorthands.
  18838. *
  18839. * @private
  18840. * @param {Array} [array] The array to iterate over.
  18841. * @param {Function} iteratee The function invoked per iteration.
  18842. * @returns {Array} Returns `array`.
  18843. */
  18844. function arrayEach(array, iteratee) {
  18845. var index = -1,
  18846. length = array == null ? 0 : array.length;
  18847. while (++index < length) {
  18848. if (iteratee(array[index], index, array) === false) {
  18849. break;
  18850. }
  18851. }
  18852. return array;
  18853. }
  18854. /**
  18855. * A specialized version of `_.forEachRight` for arrays without support for
  18856. * iteratee shorthands.
  18857. *
  18858. * @private
  18859. * @param {Array} [array] The array to iterate over.
  18860. * @param {Function} iteratee The function invoked per iteration.
  18861. * @returns {Array} Returns `array`.
  18862. */
  18863. function arrayEachRight(array, iteratee) {
  18864. var length = array == null ? 0 : array.length;
  18865. while (length--) {
  18866. if (iteratee(array[length], length, array) === false) {
  18867. break;
  18868. }
  18869. }
  18870. return array;
  18871. }
  18872. /**
  18873. * A specialized version of `_.every` for arrays without support for
  18874. * iteratee shorthands.
  18875. *
  18876. * @private
  18877. * @param {Array} [array] The array to iterate over.
  18878. * @param {Function} predicate The function invoked per iteration.
  18879. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  18880. * else `false`.
  18881. */
  18882. function arrayEvery(array, predicate) {
  18883. var index = -1,
  18884. length = array == null ? 0 : array.length;
  18885. while (++index < length) {
  18886. if (!predicate(array[index], index, array)) {
  18887. return false;
  18888. }
  18889. }
  18890. return true;
  18891. }
  18892. /**
  18893. * A specialized version of `_.filter` for arrays without support for
  18894. * iteratee shorthands.
  18895. *
  18896. * @private
  18897. * @param {Array} [array] The array to iterate over.
  18898. * @param {Function} predicate The function invoked per iteration.
  18899. * @returns {Array} Returns the new filtered array.
  18900. */
  18901. function arrayFilter(array, predicate) {
  18902. var index = -1,
  18903. length = array == null ? 0 : array.length,
  18904. resIndex = 0,
  18905. result = [];
  18906. while (++index < length) {
  18907. var value = array[index];
  18908. if (predicate(value, index, array)) {
  18909. result[resIndex++] = value;
  18910. }
  18911. }
  18912. return result;
  18913. }
  18914. /**
  18915. * A specialized version of `_.includes` for arrays without support for
  18916. * specifying an index to search from.
  18917. *
  18918. * @private
  18919. * @param {Array} [array] The array to inspect.
  18920. * @param {*} target The value to search for.
  18921. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18922. */
  18923. function arrayIncludes(array, value) {
  18924. var length = array == null ? 0 : array.length;
  18925. return !!length && baseIndexOf(array, value, 0) > -1;
  18926. }
  18927. /**
  18928. * This function is like `arrayIncludes` except that it accepts a comparator.
  18929. *
  18930. * @private
  18931. * @param {Array} [array] The array to inspect.
  18932. * @param {*} target The value to search for.
  18933. * @param {Function} comparator The comparator invoked per element.
  18934. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18935. */
  18936. function arrayIncludesWith(array, value, comparator) {
  18937. var index = -1,
  18938. length = array == null ? 0 : array.length;
  18939. while (++index < length) {
  18940. if (comparator(value, array[index])) {
  18941. return true;
  18942. }
  18943. }
  18944. return false;
  18945. }
  18946. /**
  18947. * A specialized version of `_.map` for arrays without support for iteratee
  18948. * shorthands.
  18949. *
  18950. * @private
  18951. * @param {Array} [array] The array to iterate over.
  18952. * @param {Function} iteratee The function invoked per iteration.
  18953. * @returns {Array} Returns the new mapped array.
  18954. */
  18955. function arrayMap(array, iteratee) {
  18956. var index = -1,
  18957. length = array == null ? 0 : array.length,
  18958. result = Array(length);
  18959. while (++index < length) {
  18960. result[index] = iteratee(array[index], index, array);
  18961. }
  18962. return result;
  18963. }
  18964. /**
  18965. * Appends the elements of `values` to `array`.
  18966. *
  18967. * @private
  18968. * @param {Array} array The array to modify.
  18969. * @param {Array} values The values to append.
  18970. * @returns {Array} Returns `array`.
  18971. */
  18972. function arrayPush(array, values) {
  18973. var index = -1,
  18974. length = values.length,
  18975. offset = array.length;
  18976. while (++index < length) {
  18977. array[offset + index] = values[index];
  18978. }
  18979. return array;
  18980. }
  18981. /**
  18982. * A specialized version of `_.reduce` for arrays without support for
  18983. * iteratee shorthands.
  18984. *
  18985. * @private
  18986. * @param {Array} [array] The array to iterate over.
  18987. * @param {Function} iteratee The function invoked per iteration.
  18988. * @param {*} [accumulator] The initial value.
  18989. * @param {boolean} [initAccum] Specify using the first element of `array` as
  18990. * the initial value.
  18991. * @returns {*} Returns the accumulated value.
  18992. */
  18993. function arrayReduce(array, iteratee, accumulator, initAccum) {
  18994. var index = -1,
  18995. length = array == null ? 0 : array.length;
  18996. if (initAccum && length) {
  18997. accumulator = array[++index];
  18998. }
  18999. while (++index < length) {
  19000. accumulator = iteratee(accumulator, array[index], index, array);
  19001. }
  19002. return accumulator;
  19003. }
  19004. /**
  19005. * A specialized version of `_.reduceRight` for arrays without support for
  19006. * iteratee shorthands.
  19007. *
  19008. * @private
  19009. * @param {Array} [array] The array to iterate over.
  19010. * @param {Function} iteratee The function invoked per iteration.
  19011. * @param {*} [accumulator] The initial value.
  19012. * @param {boolean} [initAccum] Specify using the last element of `array` as
  19013. * the initial value.
  19014. * @returns {*} Returns the accumulated value.
  19015. */
  19016. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  19017. var length = array == null ? 0 : array.length;
  19018. if (initAccum && length) {
  19019. accumulator = array[--length];
  19020. }
  19021. while (length--) {
  19022. accumulator = iteratee(accumulator, array[length], length, array);
  19023. }
  19024. return accumulator;
  19025. }
  19026. /**
  19027. * A specialized version of `_.some` for arrays without support for iteratee
  19028. * shorthands.
  19029. *
  19030. * @private
  19031. * @param {Array} [array] The array to iterate over.
  19032. * @param {Function} predicate The function invoked per iteration.
  19033. * @returns {boolean} Returns `true` if any element passes the predicate check,
  19034. * else `false`.
  19035. */
  19036. function arraySome(array, predicate) {
  19037. var index = -1,
  19038. length = array == null ? 0 : array.length;
  19039. while (++index < length) {
  19040. if (predicate(array[index], index, array)) {
  19041. return true;
  19042. }
  19043. }
  19044. return false;
  19045. }
  19046. /**
  19047. * Gets the size of an ASCII `string`.
  19048. *
  19049. * @private
  19050. * @param {string} string The string inspect.
  19051. * @returns {number} Returns the string size.
  19052. */
  19053. var asciiSize = baseProperty('length');
  19054. /**
  19055. * Converts an ASCII `string` to an array.
  19056. *
  19057. * @private
  19058. * @param {string} string The string to convert.
  19059. * @returns {Array} Returns the converted array.
  19060. */
  19061. function asciiToArray(string) {
  19062. return string.split('');
  19063. }
  19064. /**
  19065. * Splits an ASCII `string` into an array of its words.
  19066. *
  19067. * @private
  19068. * @param {string} The string to inspect.
  19069. * @returns {Array} Returns the words of `string`.
  19070. */
  19071. function asciiWords(string) {
  19072. return string.match(reAsciiWord) || [];
  19073. }
  19074. /**
  19075. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  19076. * without support for iteratee shorthands, which iterates over `collection`
  19077. * using `eachFunc`.
  19078. *
  19079. * @private
  19080. * @param {Array|Object} collection The collection to inspect.
  19081. * @param {Function} predicate The function invoked per iteration.
  19082. * @param {Function} eachFunc The function to iterate over `collection`.
  19083. * @returns {*} Returns the found element or its key, else `undefined`.
  19084. */
  19085. function baseFindKey(collection, predicate, eachFunc) {
  19086. var result;
  19087. eachFunc(collection, function(value, key, collection) {
  19088. if (predicate(value, key, collection)) {
  19089. result = key;
  19090. return false;
  19091. }
  19092. });
  19093. return result;
  19094. }
  19095. /**
  19096. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  19097. * support for iteratee shorthands.
  19098. *
  19099. * @private
  19100. * @param {Array} array The array to inspect.
  19101. * @param {Function} predicate The function invoked per iteration.
  19102. * @param {number} fromIndex The index to search from.
  19103. * @param {boolean} [fromRight] Specify iterating from right to left.
  19104. * @returns {number} Returns the index of the matched value, else `-1`.
  19105. */
  19106. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  19107. var length = array.length,
  19108. index = fromIndex + (fromRight ? 1 : -1);
  19109. while ((fromRight ? index-- : ++index < length)) {
  19110. if (predicate(array[index], index, array)) {
  19111. return index;
  19112. }
  19113. }
  19114. return -1;
  19115. }
  19116. /**
  19117. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  19118. *
  19119. * @private
  19120. * @param {Array} array The array to inspect.
  19121. * @param {*} value The value to search for.
  19122. * @param {number} fromIndex The index to search from.
  19123. * @returns {number} Returns the index of the matched value, else `-1`.
  19124. */
  19125. function baseIndexOf(array, value, fromIndex) {
  19126. return value === value
  19127. ? strictIndexOf(array, value, fromIndex)
  19128. : baseFindIndex(array, baseIsNaN, fromIndex);
  19129. }
  19130. /**
  19131. * This function is like `baseIndexOf` except that it accepts a comparator.
  19132. *
  19133. * @private
  19134. * @param {Array} array The array to inspect.
  19135. * @param {*} value The value to search for.
  19136. * @param {number} fromIndex The index to search from.
  19137. * @param {Function} comparator The comparator invoked per element.
  19138. * @returns {number} Returns the index of the matched value, else `-1`.
  19139. */
  19140. function baseIndexOfWith(array, value, fromIndex, comparator) {
  19141. var index = fromIndex - 1,
  19142. length = array.length;
  19143. while (++index < length) {
  19144. if (comparator(array[index], value)) {
  19145. return index;
  19146. }
  19147. }
  19148. return -1;
  19149. }
  19150. /**
  19151. * The base implementation of `_.isNaN` without support for number objects.
  19152. *
  19153. * @private
  19154. * @param {*} value The value to check.
  19155. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  19156. */
  19157. function baseIsNaN(value) {
  19158. return value !== value;
  19159. }
  19160. /**
  19161. * The base implementation of `_.mean` and `_.meanBy` without support for
  19162. * iteratee shorthands.
  19163. *
  19164. * @private
  19165. * @param {Array} array The array to iterate over.
  19166. * @param {Function} iteratee The function invoked per iteration.
  19167. * @returns {number} Returns the mean.
  19168. */
  19169. function baseMean(array, iteratee) {
  19170. var length = array == null ? 0 : array.length;
  19171. return length ? (baseSum(array, iteratee) / length) : NAN;
  19172. }
  19173. /**
  19174. * The base implementation of `_.property` without support for deep paths.
  19175. *
  19176. * @private
  19177. * @param {string} key The key of the property to get.
  19178. * @returns {Function} Returns the new accessor function.
  19179. */
  19180. function baseProperty(key) {
  19181. return function(object) {
  19182. return object == null ? undefined : object[key];
  19183. };
  19184. }
  19185. /**
  19186. * The base implementation of `_.propertyOf` without support for deep paths.
  19187. *
  19188. * @private
  19189. * @param {Object} object The object to query.
  19190. * @returns {Function} Returns the new accessor function.
  19191. */
  19192. function basePropertyOf(object) {
  19193. return function(key) {
  19194. return object == null ? undefined : object[key];
  19195. };
  19196. }
  19197. /**
  19198. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  19199. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  19200. *
  19201. * @private
  19202. * @param {Array|Object} collection The collection to iterate over.
  19203. * @param {Function} iteratee The function invoked per iteration.
  19204. * @param {*} accumulator The initial value.
  19205. * @param {boolean} initAccum Specify using the first or last element of
  19206. * `collection` as the initial value.
  19207. * @param {Function} eachFunc The function to iterate over `collection`.
  19208. * @returns {*} Returns the accumulated value.
  19209. */
  19210. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  19211. eachFunc(collection, function(value, index, collection) {
  19212. accumulator = initAccum
  19213. ? (initAccum = false, value)
  19214. : iteratee(accumulator, value, index, collection);
  19215. });
  19216. return accumulator;
  19217. }
  19218. /**
  19219. * The base implementation of `_.sortBy` which uses `comparer` to define the
  19220. * sort order of `array` and replaces criteria objects with their corresponding
  19221. * values.
  19222. *
  19223. * @private
  19224. * @param {Array} array The array to sort.
  19225. * @param {Function} comparer The function to define sort order.
  19226. * @returns {Array} Returns `array`.
  19227. */
  19228. function baseSortBy(array, comparer) {
  19229. var length = array.length;
  19230. array.sort(comparer);
  19231. while (length--) {
  19232. array[length] = array[length].value;
  19233. }
  19234. return array;
  19235. }
  19236. /**
  19237. * The base implementation of `_.sum` and `_.sumBy` without support for
  19238. * iteratee shorthands.
  19239. *
  19240. * @private
  19241. * @param {Array} array The array to iterate over.
  19242. * @param {Function} iteratee The function invoked per iteration.
  19243. * @returns {number} Returns the sum.
  19244. */
  19245. function baseSum(array, iteratee) {
  19246. var result,
  19247. index = -1,
  19248. length = array.length;
  19249. while (++index < length) {
  19250. var current = iteratee(array[index]);
  19251. if (current !== undefined) {
  19252. result = result === undefined ? current : (result + current);
  19253. }
  19254. }
  19255. return result;
  19256. }
  19257. /**
  19258. * The base implementation of `_.times` without support for iteratee shorthands
  19259. * or max array length checks.
  19260. *
  19261. * @private
  19262. * @param {number} n The number of times to invoke `iteratee`.
  19263. * @param {Function} iteratee The function invoked per iteration.
  19264. * @returns {Array} Returns the array of results.
  19265. */
  19266. function baseTimes(n, iteratee) {
  19267. var index = -1,
  19268. result = Array(n);
  19269. while (++index < n) {
  19270. result[index] = iteratee(index);
  19271. }
  19272. return result;
  19273. }
  19274. /**
  19275. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  19276. * of key-value pairs for `object` corresponding to the property names of `props`.
  19277. *
  19278. * @private
  19279. * @param {Object} object The object to query.
  19280. * @param {Array} props The property names to get values for.
  19281. * @returns {Object} Returns the key-value pairs.
  19282. */
  19283. function baseToPairs(object, props) {
  19284. return arrayMap(props, function(key) {
  19285. return [key, object[key]];
  19286. });
  19287. }
  19288. /**
  19289. * The base implementation of `_.unary` without support for storing metadata.
  19290. *
  19291. * @private
  19292. * @param {Function} func The function to cap arguments for.
  19293. * @returns {Function} Returns the new capped function.
  19294. */
  19295. function baseUnary(func) {
  19296. return function(value) {
  19297. return func(value);
  19298. };
  19299. }
  19300. /**
  19301. * The base implementation of `_.values` and `_.valuesIn` which creates an
  19302. * array of `object` property values corresponding to the property names
  19303. * of `props`.
  19304. *
  19305. * @private
  19306. * @param {Object} object The object to query.
  19307. * @param {Array} props The property names to get values for.
  19308. * @returns {Object} Returns the array of property values.
  19309. */
  19310. function baseValues(object, props) {
  19311. return arrayMap(props, function(key) {
  19312. return object[key];
  19313. });
  19314. }
  19315. /**
  19316. * Checks if a `cache` value for `key` exists.
  19317. *
  19318. * @private
  19319. * @param {Object} cache The cache to query.
  19320. * @param {string} key The key of the entry to check.
  19321. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19322. */
  19323. function cacheHas(cache, key) {
  19324. return cache.has(key);
  19325. }
  19326. /**
  19327. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  19328. * that is not found in the character symbols.
  19329. *
  19330. * @private
  19331. * @param {Array} strSymbols The string symbols to inspect.
  19332. * @param {Array} chrSymbols The character symbols to find.
  19333. * @returns {number} Returns the index of the first unmatched string symbol.
  19334. */
  19335. function charsStartIndex(strSymbols, chrSymbols) {
  19336. var index = -1,
  19337. length = strSymbols.length;
  19338. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19339. return index;
  19340. }
  19341. /**
  19342. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  19343. * that is not found in the character symbols.
  19344. *
  19345. * @private
  19346. * @param {Array} strSymbols The string symbols to inspect.
  19347. * @param {Array} chrSymbols The character symbols to find.
  19348. * @returns {number} Returns the index of the last unmatched string symbol.
  19349. */
  19350. function charsEndIndex(strSymbols, chrSymbols) {
  19351. var index = strSymbols.length;
  19352. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19353. return index;
  19354. }
  19355. /**
  19356. * Gets the number of `placeholder` occurrences in `array`.
  19357. *
  19358. * @private
  19359. * @param {Array} array The array to inspect.
  19360. * @param {*} placeholder The placeholder to search for.
  19361. * @returns {number} Returns the placeholder count.
  19362. */
  19363. function countHolders(array, placeholder) {
  19364. var length = array.length,
  19365. result = 0;
  19366. while (length--) {
  19367. if (array[length] === placeholder) {
  19368. ++result;
  19369. }
  19370. }
  19371. return result;
  19372. }
  19373. /**
  19374. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  19375. * letters to basic Latin letters.
  19376. *
  19377. * @private
  19378. * @param {string} letter The matched letter to deburr.
  19379. * @returns {string} Returns the deburred letter.
  19380. */
  19381. var deburrLetter = basePropertyOf(deburredLetters);
  19382. /**
  19383. * Used by `_.escape` to convert characters to HTML entities.
  19384. *
  19385. * @private
  19386. * @param {string} chr The matched character to escape.
  19387. * @returns {string} Returns the escaped character.
  19388. */
  19389. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  19390. /**
  19391. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  19392. *
  19393. * @private
  19394. * @param {string} chr The matched character to escape.
  19395. * @returns {string} Returns the escaped character.
  19396. */
  19397. function escapeStringChar(chr) {
  19398. return '\\' + stringEscapes[chr];
  19399. }
  19400. /**
  19401. * Gets the value at `key` of `object`.
  19402. *
  19403. * @private
  19404. * @param {Object} [object] The object to query.
  19405. * @param {string} key The key of the property to get.
  19406. * @returns {*} Returns the property value.
  19407. */
  19408. function getValue(object, key) {
  19409. return object == null ? undefined : object[key];
  19410. }
  19411. /**
  19412. * Checks if `string` contains Unicode symbols.
  19413. *
  19414. * @private
  19415. * @param {string} string The string to inspect.
  19416. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  19417. */
  19418. function hasUnicode(string) {
  19419. return reHasUnicode.test(string);
  19420. }
  19421. /**
  19422. * Checks if `string` contains a word composed of Unicode symbols.
  19423. *
  19424. * @private
  19425. * @param {string} string The string to inspect.
  19426. * @returns {boolean} Returns `true` if a word is found, else `false`.
  19427. */
  19428. function hasUnicodeWord(string) {
  19429. return reHasUnicodeWord.test(string);
  19430. }
  19431. /**
  19432. * Converts `iterator` to an array.
  19433. *
  19434. * @private
  19435. * @param {Object} iterator The iterator to convert.
  19436. * @returns {Array} Returns the converted array.
  19437. */
  19438. function iteratorToArray(iterator) {
  19439. var data,
  19440. result = [];
  19441. while (!(data = iterator.next()).done) {
  19442. result.push(data.value);
  19443. }
  19444. return result;
  19445. }
  19446. /**
  19447. * Converts `map` to its key-value pairs.
  19448. *
  19449. * @private
  19450. * @param {Object} map The map to convert.
  19451. * @returns {Array} Returns the key-value pairs.
  19452. */
  19453. function mapToArray(map) {
  19454. var index = -1,
  19455. result = Array(map.size);
  19456. map.forEach(function(value, key) {
  19457. result[++index] = [key, value];
  19458. });
  19459. return result;
  19460. }
  19461. /**
  19462. * Creates a unary function that invokes `func` with its argument transformed.
  19463. *
  19464. * @private
  19465. * @param {Function} func The function to wrap.
  19466. * @param {Function} transform The argument transform.
  19467. * @returns {Function} Returns the new function.
  19468. */
  19469. function overArg(func, transform) {
  19470. return function(arg) {
  19471. return func(transform(arg));
  19472. };
  19473. }
  19474. /**
  19475. * Replaces all `placeholder` elements in `array` with an internal placeholder
  19476. * and returns an array of their indexes.
  19477. *
  19478. * @private
  19479. * @param {Array} array The array to modify.
  19480. * @param {*} placeholder The placeholder to replace.
  19481. * @returns {Array} Returns the new array of placeholder indexes.
  19482. */
  19483. function replaceHolders(array, placeholder) {
  19484. var index = -1,
  19485. length = array.length,
  19486. resIndex = 0,
  19487. result = [];
  19488. while (++index < length) {
  19489. var value = array[index];
  19490. if (value === placeholder || value === PLACEHOLDER) {
  19491. array[index] = PLACEHOLDER;
  19492. result[resIndex++] = index;
  19493. }
  19494. }
  19495. return result;
  19496. }
  19497. /**
  19498. * Converts `set` to an array of its values.
  19499. *
  19500. * @private
  19501. * @param {Object} set The set to convert.
  19502. * @returns {Array} Returns the values.
  19503. */
  19504. function setToArray(set) {
  19505. var index = -1,
  19506. result = Array(set.size);
  19507. set.forEach(function(value) {
  19508. result[++index] = value;
  19509. });
  19510. return result;
  19511. }
  19512. /**
  19513. * Converts `set` to its value-value pairs.
  19514. *
  19515. * @private
  19516. * @param {Object} set The set to convert.
  19517. * @returns {Array} Returns the value-value pairs.
  19518. */
  19519. function setToPairs(set) {
  19520. var index = -1,
  19521. result = Array(set.size);
  19522. set.forEach(function(value) {
  19523. result[++index] = [value, value];
  19524. });
  19525. return result;
  19526. }
  19527. /**
  19528. * A specialized version of `_.indexOf` which performs strict equality
  19529. * comparisons of values, i.e. `===`.
  19530. *
  19531. * @private
  19532. * @param {Array} array The array to inspect.
  19533. * @param {*} value The value to search for.
  19534. * @param {number} fromIndex The index to search from.
  19535. * @returns {number} Returns the index of the matched value, else `-1`.
  19536. */
  19537. function strictIndexOf(array, value, fromIndex) {
  19538. var index = fromIndex - 1,
  19539. length = array.length;
  19540. while (++index < length) {
  19541. if (array[index] === value) {
  19542. return index;
  19543. }
  19544. }
  19545. return -1;
  19546. }
  19547. /**
  19548. * A specialized version of `_.lastIndexOf` which performs strict equality
  19549. * comparisons of values, i.e. `===`.
  19550. *
  19551. * @private
  19552. * @param {Array} array The array to inspect.
  19553. * @param {*} value The value to search for.
  19554. * @param {number} fromIndex The index to search from.
  19555. * @returns {number} Returns the index of the matched value, else `-1`.
  19556. */
  19557. function strictLastIndexOf(array, value, fromIndex) {
  19558. var index = fromIndex + 1;
  19559. while (index--) {
  19560. if (array[index] === value) {
  19561. return index;
  19562. }
  19563. }
  19564. return index;
  19565. }
  19566. /**
  19567. * Gets the number of symbols in `string`.
  19568. *
  19569. * @private
  19570. * @param {string} string The string to inspect.
  19571. * @returns {number} Returns the string size.
  19572. */
  19573. function stringSize(string) {
  19574. return hasUnicode(string)
  19575. ? unicodeSize(string)
  19576. : asciiSize(string);
  19577. }
  19578. /**
  19579. * Converts `string` to an array.
  19580. *
  19581. * @private
  19582. * @param {string} string The string to convert.
  19583. * @returns {Array} Returns the converted array.
  19584. */
  19585. function stringToArray(string) {
  19586. return hasUnicode(string)
  19587. ? unicodeToArray(string)
  19588. : asciiToArray(string);
  19589. }
  19590. /**
  19591. * Used by `_.unescape` to convert HTML entities to characters.
  19592. *
  19593. * @private
  19594. * @param {string} chr The matched character to unescape.
  19595. * @returns {string} Returns the unescaped character.
  19596. */
  19597. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  19598. /**
  19599. * Gets the size of a Unicode `string`.
  19600. *
  19601. * @private
  19602. * @param {string} string The string inspect.
  19603. * @returns {number} Returns the string size.
  19604. */
  19605. function unicodeSize(string) {
  19606. var result = reUnicode.lastIndex = 0;
  19607. while (reUnicode.test(string)) {
  19608. ++result;
  19609. }
  19610. return result;
  19611. }
  19612. /**
  19613. * Converts a Unicode `string` to an array.
  19614. *
  19615. * @private
  19616. * @param {string} string The string to convert.
  19617. * @returns {Array} Returns the converted array.
  19618. */
  19619. function unicodeToArray(string) {
  19620. return string.match(reUnicode) || [];
  19621. }
  19622. /**
  19623. * Splits a Unicode `string` into an array of its words.
  19624. *
  19625. * @private
  19626. * @param {string} The string to inspect.
  19627. * @returns {Array} Returns the words of `string`.
  19628. */
  19629. function unicodeWords(string) {
  19630. return string.match(reUnicodeWord) || [];
  19631. }
  19632. /*--------------------------------------------------------------------------*/
  19633. /**
  19634. * Create a new pristine `lodash` function using the `context` object.
  19635. *
  19636. * @static
  19637. * @memberOf _
  19638. * @since 1.1.0
  19639. * @category Util
  19640. * @param {Object} [context=root] The context object.
  19641. * @returns {Function} Returns a new `lodash` function.
  19642. * @example
  19643. *
  19644. * _.mixin({ 'foo': _.constant('foo') });
  19645. *
  19646. * var lodash = _.runInContext();
  19647. * lodash.mixin({ 'bar': lodash.constant('bar') });
  19648. *
  19649. * _.isFunction(_.foo);
  19650. * // => true
  19651. * _.isFunction(_.bar);
  19652. * // => false
  19653. *
  19654. * lodash.isFunction(lodash.foo);
  19655. * // => false
  19656. * lodash.isFunction(lodash.bar);
  19657. * // => true
  19658. *
  19659. * // Create a suped-up `defer` in Node.js.
  19660. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  19661. */
  19662. var runInContext = (function runInContext(context) {
  19663. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  19664. /** Built-in constructor references. */
  19665. var Array = context.Array,
  19666. Date = context.Date,
  19667. Error = context.Error,
  19668. Function = context.Function,
  19669. Math = context.Math,
  19670. Object = context.Object,
  19671. RegExp = context.RegExp,
  19672. String = context.String,
  19673. TypeError = context.TypeError;
  19674. /** Used for built-in method references. */
  19675. var arrayProto = Array.prototype,
  19676. funcProto = Function.prototype,
  19677. objectProto = Object.prototype;
  19678. /** Used to detect overreaching core-js shims. */
  19679. var coreJsData = context['__core-js_shared__'];
  19680. /** Used to resolve the decompiled source of functions. */
  19681. var funcToString = funcProto.toString;
  19682. /** Used to check objects for own properties. */
  19683. var hasOwnProperty = objectProto.hasOwnProperty;
  19684. /** Used to generate unique IDs. */
  19685. var idCounter = 0;
  19686. /** Used to detect methods masquerading as native. */
  19687. var maskSrcKey = (function() {
  19688. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  19689. return uid ? ('Symbol(src)_1.' + uid) : '';
  19690. }());
  19691. /**
  19692. * Used to resolve the
  19693. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  19694. * of values.
  19695. */
  19696. var nativeObjectToString = objectProto.toString;
  19697. /** Used to infer the `Object` constructor. */
  19698. var objectCtorString = funcToString.call(Object);
  19699. /** Used to restore the original `_` reference in `_.noConflict`. */
  19700. var oldDash = root._;
  19701. /** Used to detect if a method is native. */
  19702. var reIsNative = RegExp('^' +
  19703. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  19704. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  19705. );
  19706. /** Built-in value references. */
  19707. var Buffer = moduleExports ? context.Buffer : undefined,
  19708. Symbol = context.Symbol,
  19709. Uint8Array = context.Uint8Array,
  19710. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  19711. getPrototype = overArg(Object.getPrototypeOf, Object),
  19712. objectCreate = Object.create,
  19713. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  19714. splice = arrayProto.splice,
  19715. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  19716. symIterator = Symbol ? Symbol.iterator : undefined,
  19717. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  19718. var defineProperty = (function() {
  19719. try {
  19720. var func = getNative(Object, 'defineProperty');
  19721. func({}, '', {});
  19722. return func;
  19723. } catch (e) {}
  19724. }());
  19725. /** Mocked built-ins. */
  19726. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  19727. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  19728. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  19729. /* Built-in method references for those with the same name as other `lodash` methods. */
  19730. var nativeCeil = Math.ceil,
  19731. nativeFloor = Math.floor,
  19732. nativeGetSymbols = Object.getOwnPropertySymbols,
  19733. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  19734. nativeIsFinite = context.isFinite,
  19735. nativeJoin = arrayProto.join,
  19736. nativeKeys = overArg(Object.keys, Object),
  19737. nativeMax = Math.max,
  19738. nativeMin = Math.min,
  19739. nativeNow = Date.now,
  19740. nativeParseInt = context.parseInt,
  19741. nativeRandom = Math.random,
  19742. nativeReverse = arrayProto.reverse;
  19743. /* Built-in method references that are verified to be native. */
  19744. var DataView = getNative(context, 'DataView'),
  19745. Map = getNative(context, 'Map'),
  19746. Promise = getNative(context, 'Promise'),
  19747. Set = getNative(context, 'Set'),
  19748. WeakMap = getNative(context, 'WeakMap'),
  19749. nativeCreate = getNative(Object, 'create');
  19750. /** Used to store function metadata. */
  19751. var metaMap = WeakMap && new WeakMap;
  19752. /** Used to lookup unminified function names. */
  19753. var realNames = {};
  19754. /** Used to detect maps, sets, and weakmaps. */
  19755. var dataViewCtorString = toSource(DataView),
  19756. mapCtorString = toSource(Map),
  19757. promiseCtorString = toSource(Promise),
  19758. setCtorString = toSource(Set),
  19759. weakMapCtorString = toSource(WeakMap);
  19760. /** Used to convert symbols to primitives and strings. */
  19761. var symbolProto = Symbol ? Symbol.prototype : undefined,
  19762. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  19763. symbolToString = symbolProto ? symbolProto.toString : undefined;
  19764. /*------------------------------------------------------------------------*/
  19765. /**
  19766. * Creates a `lodash` object which wraps `value` to enable implicit method
  19767. * chain sequences. Methods that operate on and return arrays, collections,
  19768. * and functions can be chained together. Methods that retrieve a single value
  19769. * or may return a primitive value will automatically end the chain sequence
  19770. * and return the unwrapped value. Otherwise, the value must be unwrapped
  19771. * with `_#value`.
  19772. *
  19773. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  19774. * enabled using `_.chain`.
  19775. *
  19776. * The execution of chained methods is lazy, that is, it's deferred until
  19777. * `_#value` is implicitly or explicitly called.
  19778. *
  19779. * Lazy evaluation allows several methods to support shortcut fusion.
  19780. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  19781. * the creation of intermediate arrays and can greatly reduce the number of
  19782. * iteratee executions. Sections of a chain sequence qualify for shortcut
  19783. * fusion if the section is applied to an array and iteratees accept only
  19784. * one argument. The heuristic for whether a section qualifies for shortcut
  19785. * fusion is subject to change.
  19786. *
  19787. * Chaining is supported in custom builds as long as the `_#value` method is
  19788. * directly or indirectly included in the build.
  19789. *
  19790. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  19791. *
  19792. * The wrapper `Array` methods are:
  19793. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  19794. *
  19795. * The wrapper `String` methods are:
  19796. * `replace` and `split`
  19797. *
  19798. * The wrapper methods that support shortcut fusion are:
  19799. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  19800. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  19801. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  19802. *
  19803. * The chainable wrapper methods are:
  19804. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  19805. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  19806. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  19807. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  19808. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  19809. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  19810. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  19811. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  19812. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  19813. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  19814. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  19815. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  19816. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  19817. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  19818. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  19819. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  19820. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  19821. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  19822. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  19823. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  19824. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  19825. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  19826. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  19827. * `zipObject`, `zipObjectDeep`, and `zipWith`
  19828. *
  19829. * The wrapper methods that are **not** chainable by default are:
  19830. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  19831. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  19832. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  19833. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  19834. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  19835. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  19836. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  19837. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  19838. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  19839. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  19840. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  19841. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  19842. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  19843. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  19844. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  19845. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  19846. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  19847. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  19848. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  19849. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  19850. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  19851. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  19852. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  19853. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  19854. * `upperFirst`, `value`, and `words`
  19855. *
  19856. * @name _
  19857. * @constructor
  19858. * @category Seq
  19859. * @param {*} value The value to wrap in a `lodash` instance.
  19860. * @returns {Object} Returns the new `lodash` wrapper instance.
  19861. * @example
  19862. *
  19863. * function square(n) {
  19864. * return n * n;
  19865. * }
  19866. *
  19867. * var wrapped = _([1, 2, 3]);
  19868. *
  19869. * // Returns an unwrapped value.
  19870. * wrapped.reduce(_.add);
  19871. * // => 6
  19872. *
  19873. * // Returns a wrapped value.
  19874. * var squares = wrapped.map(square);
  19875. *
  19876. * _.isArray(squares);
  19877. * // => false
  19878. *
  19879. * _.isArray(squares.value());
  19880. * // => true
  19881. */
  19882. function lodash(value) {
  19883. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  19884. if (value instanceof LodashWrapper) {
  19885. return value;
  19886. }
  19887. if (hasOwnProperty.call(value, '__wrapped__')) {
  19888. return wrapperClone(value);
  19889. }
  19890. }
  19891. return new LodashWrapper(value);
  19892. }
  19893. /**
  19894. * The base implementation of `_.create` without support for assigning
  19895. * properties to the created object.
  19896. *
  19897. * @private
  19898. * @param {Object} proto The object to inherit from.
  19899. * @returns {Object} Returns the new object.
  19900. */
  19901. var baseCreate = (function() {
  19902. function object() {}
  19903. return function(proto) {
  19904. if (!isObject(proto)) {
  19905. return {};
  19906. }
  19907. if (objectCreate) {
  19908. return objectCreate(proto);
  19909. }
  19910. object.prototype = proto;
  19911. var result = new object;
  19912. object.prototype = undefined;
  19913. return result;
  19914. };
  19915. }());
  19916. /**
  19917. * The function whose prototype chain sequence wrappers inherit from.
  19918. *
  19919. * @private
  19920. */
  19921. function baseLodash() {
  19922. // No operation performed.
  19923. }
  19924. /**
  19925. * The base constructor for creating `lodash` wrapper objects.
  19926. *
  19927. * @private
  19928. * @param {*} value The value to wrap.
  19929. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  19930. */
  19931. function LodashWrapper(value, chainAll) {
  19932. this.__wrapped__ = value;
  19933. this.__actions__ = [];
  19934. this.__chain__ = !!chainAll;
  19935. this.__index__ = 0;
  19936. this.__values__ = undefined;
  19937. }
  19938. /**
  19939. * By default, the template delimiters used by lodash are like those in
  19940. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  19941. * following template settings to use alternative delimiters.
  19942. *
  19943. * @static
  19944. * @memberOf _
  19945. * @type {Object}
  19946. */
  19947. lodash.templateSettings = {
  19948. /**
  19949. * Used to detect `data` property values to be HTML-escaped.
  19950. *
  19951. * @memberOf _.templateSettings
  19952. * @type {RegExp}
  19953. */
  19954. 'escape': reEscape,
  19955. /**
  19956. * Used to detect code to be evaluated.
  19957. *
  19958. * @memberOf _.templateSettings
  19959. * @type {RegExp}
  19960. */
  19961. 'evaluate': reEvaluate,
  19962. /**
  19963. * Used to detect `data` property values to inject.
  19964. *
  19965. * @memberOf _.templateSettings
  19966. * @type {RegExp}
  19967. */
  19968. 'interpolate': reInterpolate,
  19969. /**
  19970. * Used to reference the data object in the template text.
  19971. *
  19972. * @memberOf _.templateSettings
  19973. * @type {string}
  19974. */
  19975. 'variable': '',
  19976. /**
  19977. * Used to import variables into the compiled template.
  19978. *
  19979. * @memberOf _.templateSettings
  19980. * @type {Object}
  19981. */
  19982. 'imports': {
  19983. /**
  19984. * A reference to the `lodash` function.
  19985. *
  19986. * @memberOf _.templateSettings.imports
  19987. * @type {Function}
  19988. */
  19989. '_': lodash
  19990. }
  19991. };
  19992. // Ensure wrappers are instances of `baseLodash`.
  19993. lodash.prototype = baseLodash.prototype;
  19994. lodash.prototype.constructor = lodash;
  19995. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  19996. LodashWrapper.prototype.constructor = LodashWrapper;
  19997. /*------------------------------------------------------------------------*/
  19998. /**
  19999. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  20000. *
  20001. * @private
  20002. * @constructor
  20003. * @param {*} value The value to wrap.
  20004. */
  20005. function LazyWrapper(value) {
  20006. this.__wrapped__ = value;
  20007. this.__actions__ = [];
  20008. this.__dir__ = 1;
  20009. this.__filtered__ = false;
  20010. this.__iteratees__ = [];
  20011. this.__takeCount__ = MAX_ARRAY_LENGTH;
  20012. this.__views__ = [];
  20013. }
  20014. /**
  20015. * Creates a clone of the lazy wrapper object.
  20016. *
  20017. * @private
  20018. * @name clone
  20019. * @memberOf LazyWrapper
  20020. * @returns {Object} Returns the cloned `LazyWrapper` object.
  20021. */
  20022. function lazyClone() {
  20023. var result = new LazyWrapper(this.__wrapped__);
  20024. result.__actions__ = copyArray(this.__actions__);
  20025. result.__dir__ = this.__dir__;
  20026. result.__filtered__ = this.__filtered__;
  20027. result.__iteratees__ = copyArray(this.__iteratees__);
  20028. result.__takeCount__ = this.__takeCount__;
  20029. result.__views__ = copyArray(this.__views__);
  20030. return result;
  20031. }
  20032. /**
  20033. * Reverses the direction of lazy iteration.
  20034. *
  20035. * @private
  20036. * @name reverse
  20037. * @memberOf LazyWrapper
  20038. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  20039. */
  20040. function lazyReverse() {
  20041. if (this.__filtered__) {
  20042. var result = new LazyWrapper(this);
  20043. result.__dir__ = -1;
  20044. result.__filtered__ = true;
  20045. } else {
  20046. result = this.clone();
  20047. result.__dir__ *= -1;
  20048. }
  20049. return result;
  20050. }
  20051. /**
  20052. * Extracts the unwrapped value from its lazy wrapper.
  20053. *
  20054. * @private
  20055. * @name value
  20056. * @memberOf LazyWrapper
  20057. * @returns {*} Returns the unwrapped value.
  20058. */
  20059. function lazyValue() {
  20060. var array = this.__wrapped__.value(),
  20061. dir = this.__dir__,
  20062. isArr = isArray(array),
  20063. isRight = dir < 0,
  20064. arrLength = isArr ? array.length : 0,
  20065. view = getView(0, arrLength, this.__views__),
  20066. start = view.start,
  20067. end = view.end,
  20068. length = end - start,
  20069. index = isRight ? end : (start - 1),
  20070. iteratees = this.__iteratees__,
  20071. iterLength = iteratees.length,
  20072. resIndex = 0,
  20073. takeCount = nativeMin(length, this.__takeCount__);
  20074. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  20075. return baseWrapperValue(array, this.__actions__);
  20076. }
  20077. var result = [];
  20078. outer:
  20079. while (length-- && resIndex < takeCount) {
  20080. index += dir;
  20081. var iterIndex = -1,
  20082. value = array[index];
  20083. while (++iterIndex < iterLength) {
  20084. var data = iteratees[iterIndex],
  20085. iteratee = data.iteratee,
  20086. type = data.type,
  20087. computed = iteratee(value);
  20088. if (type == LAZY_MAP_FLAG) {
  20089. value = computed;
  20090. } else if (!computed) {
  20091. if (type == LAZY_FILTER_FLAG) {
  20092. continue outer;
  20093. } else {
  20094. break outer;
  20095. }
  20096. }
  20097. }
  20098. result[resIndex++] = value;
  20099. }
  20100. return result;
  20101. }
  20102. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  20103. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  20104. LazyWrapper.prototype.constructor = LazyWrapper;
  20105. /*------------------------------------------------------------------------*/
  20106. /**
  20107. * Creates a hash object.
  20108. *
  20109. * @private
  20110. * @constructor
  20111. * @param {Array} [entries] The key-value pairs to cache.
  20112. */
  20113. function Hash(entries) {
  20114. var index = -1,
  20115. length = entries == null ? 0 : entries.length;
  20116. this.clear();
  20117. while (++index < length) {
  20118. var entry = entries[index];
  20119. this.set(entry[0], entry[1]);
  20120. }
  20121. }
  20122. /**
  20123. * Removes all key-value entries from the hash.
  20124. *
  20125. * @private
  20126. * @name clear
  20127. * @memberOf Hash
  20128. */
  20129. function hashClear() {
  20130. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  20131. this.size = 0;
  20132. }
  20133. /**
  20134. * Removes `key` and its value from the hash.
  20135. *
  20136. * @private
  20137. * @name delete
  20138. * @memberOf Hash
  20139. * @param {Object} hash The hash to modify.
  20140. * @param {string} key The key of the value to remove.
  20141. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20142. */
  20143. function hashDelete(key) {
  20144. var result = this.has(key) && delete this.__data__[key];
  20145. this.size -= result ? 1 : 0;
  20146. return result;
  20147. }
  20148. /**
  20149. * Gets the hash value for `key`.
  20150. *
  20151. * @private
  20152. * @name get
  20153. * @memberOf Hash
  20154. * @param {string} key The key of the value to get.
  20155. * @returns {*} Returns the entry value.
  20156. */
  20157. function hashGet(key) {
  20158. var data = this.__data__;
  20159. if (nativeCreate) {
  20160. var result = data[key];
  20161. return result === HASH_UNDEFINED ? undefined : result;
  20162. }
  20163. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  20164. }
  20165. /**
  20166. * Checks if a hash value for `key` exists.
  20167. *
  20168. * @private
  20169. * @name has
  20170. * @memberOf Hash
  20171. * @param {string} key The key of the entry to check.
  20172. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20173. */
  20174. function hashHas(key) {
  20175. var data = this.__data__;
  20176. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  20177. }
  20178. /**
  20179. * Sets the hash `key` to `value`.
  20180. *
  20181. * @private
  20182. * @name set
  20183. * @memberOf Hash
  20184. * @param {string} key The key of the value to set.
  20185. * @param {*} value The value to set.
  20186. * @returns {Object} Returns the hash instance.
  20187. */
  20188. function hashSet(key, value) {
  20189. var data = this.__data__;
  20190. this.size += this.has(key) ? 0 : 1;
  20191. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  20192. return this;
  20193. }
  20194. // Add methods to `Hash`.
  20195. Hash.prototype.clear = hashClear;
  20196. Hash.prototype['delete'] = hashDelete;
  20197. Hash.prototype.get = hashGet;
  20198. Hash.prototype.has = hashHas;
  20199. Hash.prototype.set = hashSet;
  20200. /*------------------------------------------------------------------------*/
  20201. /**
  20202. * Creates an list cache object.
  20203. *
  20204. * @private
  20205. * @constructor
  20206. * @param {Array} [entries] The key-value pairs to cache.
  20207. */
  20208. function ListCache(entries) {
  20209. var index = -1,
  20210. length = entries == null ? 0 : entries.length;
  20211. this.clear();
  20212. while (++index < length) {
  20213. var entry = entries[index];
  20214. this.set(entry[0], entry[1]);
  20215. }
  20216. }
  20217. /**
  20218. * Removes all key-value entries from the list cache.
  20219. *
  20220. * @private
  20221. * @name clear
  20222. * @memberOf ListCache
  20223. */
  20224. function listCacheClear() {
  20225. this.__data__ = [];
  20226. this.size = 0;
  20227. }
  20228. /**
  20229. * Removes `key` and its value from the list cache.
  20230. *
  20231. * @private
  20232. * @name delete
  20233. * @memberOf ListCache
  20234. * @param {string} key The key of the value to remove.
  20235. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20236. */
  20237. function listCacheDelete(key) {
  20238. var data = this.__data__,
  20239. index = assocIndexOf(data, key);
  20240. if (index < 0) {
  20241. return false;
  20242. }
  20243. var lastIndex = data.length - 1;
  20244. if (index == lastIndex) {
  20245. data.pop();
  20246. } else {
  20247. splice.call(data, index, 1);
  20248. }
  20249. --this.size;
  20250. return true;
  20251. }
  20252. /**
  20253. * Gets the list cache value for `key`.
  20254. *
  20255. * @private
  20256. * @name get
  20257. * @memberOf ListCache
  20258. * @param {string} key The key of the value to get.
  20259. * @returns {*} Returns the entry value.
  20260. */
  20261. function listCacheGet(key) {
  20262. var data = this.__data__,
  20263. index = assocIndexOf(data, key);
  20264. return index < 0 ? undefined : data[index][1];
  20265. }
  20266. /**
  20267. * Checks if a list cache value for `key` exists.
  20268. *
  20269. * @private
  20270. * @name has
  20271. * @memberOf ListCache
  20272. * @param {string} key The key of the entry to check.
  20273. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20274. */
  20275. function listCacheHas(key) {
  20276. return assocIndexOf(this.__data__, key) > -1;
  20277. }
  20278. /**
  20279. * Sets the list cache `key` to `value`.
  20280. *
  20281. * @private
  20282. * @name set
  20283. * @memberOf ListCache
  20284. * @param {string} key The key of the value to set.
  20285. * @param {*} value The value to set.
  20286. * @returns {Object} Returns the list cache instance.
  20287. */
  20288. function listCacheSet(key, value) {
  20289. var data = this.__data__,
  20290. index = assocIndexOf(data, key);
  20291. if (index < 0) {
  20292. ++this.size;
  20293. data.push([key, value]);
  20294. } else {
  20295. data[index][1] = value;
  20296. }
  20297. return this;
  20298. }
  20299. // Add methods to `ListCache`.
  20300. ListCache.prototype.clear = listCacheClear;
  20301. ListCache.prototype['delete'] = listCacheDelete;
  20302. ListCache.prototype.get = listCacheGet;
  20303. ListCache.prototype.has = listCacheHas;
  20304. ListCache.prototype.set = listCacheSet;
  20305. /*------------------------------------------------------------------------*/
  20306. /**
  20307. * Creates a map cache object to store key-value pairs.
  20308. *
  20309. * @private
  20310. * @constructor
  20311. * @param {Array} [entries] The key-value pairs to cache.
  20312. */
  20313. function MapCache(entries) {
  20314. var index = -1,
  20315. length = entries == null ? 0 : entries.length;
  20316. this.clear();
  20317. while (++index < length) {
  20318. var entry = entries[index];
  20319. this.set(entry[0], entry[1]);
  20320. }
  20321. }
  20322. /**
  20323. * Removes all key-value entries from the map.
  20324. *
  20325. * @private
  20326. * @name clear
  20327. * @memberOf MapCache
  20328. */
  20329. function mapCacheClear() {
  20330. this.size = 0;
  20331. this.__data__ = {
  20332. 'hash': new Hash,
  20333. 'map': new (Map || ListCache),
  20334. 'string': new Hash
  20335. };
  20336. }
  20337. /**
  20338. * Removes `key` and its value from the map.
  20339. *
  20340. * @private
  20341. * @name delete
  20342. * @memberOf MapCache
  20343. * @param {string} key The key of the value to remove.
  20344. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20345. */
  20346. function mapCacheDelete(key) {
  20347. var result = getMapData(this, key)['delete'](key);
  20348. this.size -= result ? 1 : 0;
  20349. return result;
  20350. }
  20351. /**
  20352. * Gets the map value for `key`.
  20353. *
  20354. * @private
  20355. * @name get
  20356. * @memberOf MapCache
  20357. * @param {string} key The key of the value to get.
  20358. * @returns {*} Returns the entry value.
  20359. */
  20360. function mapCacheGet(key) {
  20361. return getMapData(this, key).get(key);
  20362. }
  20363. /**
  20364. * Checks if a map value for `key` exists.
  20365. *
  20366. * @private
  20367. * @name has
  20368. * @memberOf MapCache
  20369. * @param {string} key The key of the entry to check.
  20370. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20371. */
  20372. function mapCacheHas(key) {
  20373. return getMapData(this, key).has(key);
  20374. }
  20375. /**
  20376. * Sets the map `key` to `value`.
  20377. *
  20378. * @private
  20379. * @name set
  20380. * @memberOf MapCache
  20381. * @param {string} key The key of the value to set.
  20382. * @param {*} value The value to set.
  20383. * @returns {Object} Returns the map cache instance.
  20384. */
  20385. function mapCacheSet(key, value) {
  20386. var data = getMapData(this, key),
  20387. size = data.size;
  20388. data.set(key, value);
  20389. this.size += data.size == size ? 0 : 1;
  20390. return this;
  20391. }
  20392. // Add methods to `MapCache`.
  20393. MapCache.prototype.clear = mapCacheClear;
  20394. MapCache.prototype['delete'] = mapCacheDelete;
  20395. MapCache.prototype.get = mapCacheGet;
  20396. MapCache.prototype.has = mapCacheHas;
  20397. MapCache.prototype.set = mapCacheSet;
  20398. /*------------------------------------------------------------------------*/
  20399. /**
  20400. *
  20401. * Creates an array cache object to store unique values.
  20402. *
  20403. * @private
  20404. * @constructor
  20405. * @param {Array} [values] The values to cache.
  20406. */
  20407. function SetCache(values) {
  20408. var index = -1,
  20409. length = values == null ? 0 : values.length;
  20410. this.__data__ = new MapCache;
  20411. while (++index < length) {
  20412. this.add(values[index]);
  20413. }
  20414. }
  20415. /**
  20416. * Adds `value` to the array cache.
  20417. *
  20418. * @private
  20419. * @name add
  20420. * @memberOf SetCache
  20421. * @alias push
  20422. * @param {*} value The value to cache.
  20423. * @returns {Object} Returns the cache instance.
  20424. */
  20425. function setCacheAdd(value) {
  20426. this.__data__.set(value, HASH_UNDEFINED);
  20427. return this;
  20428. }
  20429. /**
  20430. * Checks if `value` is in the array cache.
  20431. *
  20432. * @private
  20433. * @name has
  20434. * @memberOf SetCache
  20435. * @param {*} value The value to search for.
  20436. * @returns {number} Returns `true` if `value` is found, else `false`.
  20437. */
  20438. function setCacheHas(value) {
  20439. return this.__data__.has(value);
  20440. }
  20441. // Add methods to `SetCache`.
  20442. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  20443. SetCache.prototype.has = setCacheHas;
  20444. /*------------------------------------------------------------------------*/
  20445. /**
  20446. * Creates a stack cache object to store key-value pairs.
  20447. *
  20448. * @private
  20449. * @constructor
  20450. * @param {Array} [entries] The key-value pairs to cache.
  20451. */
  20452. function Stack(entries) {
  20453. var data = this.__data__ = new ListCache(entries);
  20454. this.size = data.size;
  20455. }
  20456. /**
  20457. * Removes all key-value entries from the stack.
  20458. *
  20459. * @private
  20460. * @name clear
  20461. * @memberOf Stack
  20462. */
  20463. function stackClear() {
  20464. this.__data__ = new ListCache;
  20465. this.size = 0;
  20466. }
  20467. /**
  20468. * Removes `key` and its value from the stack.
  20469. *
  20470. * @private
  20471. * @name delete
  20472. * @memberOf Stack
  20473. * @param {string} key The key of the value to remove.
  20474. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20475. */
  20476. function stackDelete(key) {
  20477. var data = this.__data__,
  20478. result = data['delete'](key);
  20479. this.size = data.size;
  20480. return result;
  20481. }
  20482. /**
  20483. * Gets the stack value for `key`.
  20484. *
  20485. * @private
  20486. * @name get
  20487. * @memberOf Stack
  20488. * @param {string} key The key of the value to get.
  20489. * @returns {*} Returns the entry value.
  20490. */
  20491. function stackGet(key) {
  20492. return this.__data__.get(key);
  20493. }
  20494. /**
  20495. * Checks if a stack value for `key` exists.
  20496. *
  20497. * @private
  20498. * @name has
  20499. * @memberOf Stack
  20500. * @param {string} key The key of the entry to check.
  20501. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20502. */
  20503. function stackHas(key) {
  20504. return this.__data__.has(key);
  20505. }
  20506. /**
  20507. * Sets the stack `key` to `value`.
  20508. *
  20509. * @private
  20510. * @name set
  20511. * @memberOf Stack
  20512. * @param {string} key The key of the value to set.
  20513. * @param {*} value The value to set.
  20514. * @returns {Object} Returns the stack cache instance.
  20515. */
  20516. function stackSet(key, value) {
  20517. var data = this.__data__;
  20518. if (data instanceof ListCache) {
  20519. var pairs = data.__data__;
  20520. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  20521. pairs.push([key, value]);
  20522. this.size = ++data.size;
  20523. return this;
  20524. }
  20525. data = this.__data__ = new MapCache(pairs);
  20526. }
  20527. data.set(key, value);
  20528. this.size = data.size;
  20529. return this;
  20530. }
  20531. // Add methods to `Stack`.
  20532. Stack.prototype.clear = stackClear;
  20533. Stack.prototype['delete'] = stackDelete;
  20534. Stack.prototype.get = stackGet;
  20535. Stack.prototype.has = stackHas;
  20536. Stack.prototype.set = stackSet;
  20537. /*------------------------------------------------------------------------*/
  20538. /**
  20539. * Creates an array of the enumerable property names of the array-like `value`.
  20540. *
  20541. * @private
  20542. * @param {*} value The value to query.
  20543. * @param {boolean} inherited Specify returning inherited property names.
  20544. * @returns {Array} Returns the array of property names.
  20545. */
  20546. function arrayLikeKeys(value, inherited) {
  20547. var isArr = isArray(value),
  20548. isArg = !isArr && isArguments(value),
  20549. isBuff = !isArr && !isArg && isBuffer(value),
  20550. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  20551. skipIndexes = isArr || isArg || isBuff || isType,
  20552. result = skipIndexes ? baseTimes(value.length, String) : [],
  20553. length = result.length;
  20554. for (var key in value) {
  20555. if ((inherited || hasOwnProperty.call(value, key)) &&
  20556. !(skipIndexes && (
  20557. // Safari 9 has enumerable `arguments.length` in strict mode.
  20558. key == 'length' ||
  20559. // Node.js 0.10 has enumerable non-index properties on buffers.
  20560. (isBuff && (key == 'offset' || key == 'parent')) ||
  20561. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  20562. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  20563. // Skip index properties.
  20564. isIndex(key, length)
  20565. ))) {
  20566. result.push(key);
  20567. }
  20568. }
  20569. return result;
  20570. }
  20571. /**
  20572. * A specialized version of `_.sample` for arrays.
  20573. *
  20574. * @private
  20575. * @param {Array} array The array to sample.
  20576. * @returns {*} Returns the random element.
  20577. */
  20578. function arraySample(array) {
  20579. var length = array.length;
  20580. return length ? array[baseRandom(0, length - 1)] : undefined;
  20581. }
  20582. /**
  20583. * A specialized version of `_.sampleSize` for arrays.
  20584. *
  20585. * @private
  20586. * @param {Array} array The array to sample.
  20587. * @param {number} n The number of elements to sample.
  20588. * @returns {Array} Returns the random elements.
  20589. */
  20590. function arraySampleSize(array, n) {
  20591. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  20592. }
  20593. /**
  20594. * A specialized version of `_.shuffle` for arrays.
  20595. *
  20596. * @private
  20597. * @param {Array} array The array to shuffle.
  20598. * @returns {Array} Returns the new shuffled array.
  20599. */
  20600. function arrayShuffle(array) {
  20601. return shuffleSelf(copyArray(array));
  20602. }
  20603. /**
  20604. * This function is like `assignValue` except that it doesn't assign
  20605. * `undefined` values.
  20606. *
  20607. * @private
  20608. * @param {Object} object The object to modify.
  20609. * @param {string} key The key of the property to assign.
  20610. * @param {*} value The value to assign.
  20611. */
  20612. function assignMergeValue(object, key, value) {
  20613. if ((value !== undefined && !eq(object[key], value)) ||
  20614. (value === undefined && !(key in object))) {
  20615. baseAssignValue(object, key, value);
  20616. }
  20617. }
  20618. /**
  20619. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  20620. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20621. * for equality comparisons.
  20622. *
  20623. * @private
  20624. * @param {Object} object The object to modify.
  20625. * @param {string} key The key of the property to assign.
  20626. * @param {*} value The value to assign.
  20627. */
  20628. function assignValue(object, key, value) {
  20629. var objValue = object[key];
  20630. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  20631. (value === undefined && !(key in object))) {
  20632. baseAssignValue(object, key, value);
  20633. }
  20634. }
  20635. /**
  20636. * Gets the index at which the `key` is found in `array` of key-value pairs.
  20637. *
  20638. * @private
  20639. * @param {Array} array The array to inspect.
  20640. * @param {*} key The key to search for.
  20641. * @returns {number} Returns the index of the matched value, else `-1`.
  20642. */
  20643. function assocIndexOf(array, key) {
  20644. var length = array.length;
  20645. while (length--) {
  20646. if (eq(array[length][0], key)) {
  20647. return length;
  20648. }
  20649. }
  20650. return -1;
  20651. }
  20652. /**
  20653. * Aggregates elements of `collection` on `accumulator` with keys transformed
  20654. * by `iteratee` and values set by `setter`.
  20655. *
  20656. * @private
  20657. * @param {Array|Object} collection The collection to iterate over.
  20658. * @param {Function} setter The function to set `accumulator` values.
  20659. * @param {Function} iteratee The iteratee to transform keys.
  20660. * @param {Object} accumulator The initial aggregated object.
  20661. * @returns {Function} Returns `accumulator`.
  20662. */
  20663. function baseAggregator(collection, setter, iteratee, accumulator) {
  20664. baseEach(collection, function(value, key, collection) {
  20665. setter(accumulator, value, iteratee(value), collection);
  20666. });
  20667. return accumulator;
  20668. }
  20669. /**
  20670. * The base implementation of `_.assign` without support for multiple sources
  20671. * or `customizer` functions.
  20672. *
  20673. * @private
  20674. * @param {Object} object The destination object.
  20675. * @param {Object} source The source object.
  20676. * @returns {Object} Returns `object`.
  20677. */
  20678. function baseAssign(object, source) {
  20679. return object && copyObject(source, keys(source), object);
  20680. }
  20681. /**
  20682. * The base implementation of `_.assignIn` without support for multiple sources
  20683. * or `customizer` functions.
  20684. *
  20685. * @private
  20686. * @param {Object} object The destination object.
  20687. * @param {Object} source The source object.
  20688. * @returns {Object} Returns `object`.
  20689. */
  20690. function baseAssignIn(object, source) {
  20691. return object && copyObject(source, keysIn(source), object);
  20692. }
  20693. /**
  20694. * The base implementation of `assignValue` and `assignMergeValue` without
  20695. * value checks.
  20696. *
  20697. * @private
  20698. * @param {Object} object The object to modify.
  20699. * @param {string} key The key of the property to assign.
  20700. * @param {*} value The value to assign.
  20701. */
  20702. function baseAssignValue(object, key, value) {
  20703. if (key == '__proto__' && defineProperty) {
  20704. defineProperty(object, key, {
  20705. 'configurable': true,
  20706. 'enumerable': true,
  20707. 'value': value,
  20708. 'writable': true
  20709. });
  20710. } else {
  20711. object[key] = value;
  20712. }
  20713. }
  20714. /**
  20715. * The base implementation of `_.at` without support for individual paths.
  20716. *
  20717. * @private
  20718. * @param {Object} object The object to iterate over.
  20719. * @param {string[]} paths The property paths to pick.
  20720. * @returns {Array} Returns the picked elements.
  20721. */
  20722. function baseAt(object, paths) {
  20723. var index = -1,
  20724. length = paths.length,
  20725. result = Array(length),
  20726. skip = object == null;
  20727. while (++index < length) {
  20728. result[index] = skip ? undefined : get(object, paths[index]);
  20729. }
  20730. return result;
  20731. }
  20732. /**
  20733. * The base implementation of `_.clamp` which doesn't coerce arguments.
  20734. *
  20735. * @private
  20736. * @param {number} number The number to clamp.
  20737. * @param {number} [lower] The lower bound.
  20738. * @param {number} upper The upper bound.
  20739. * @returns {number} Returns the clamped number.
  20740. */
  20741. function baseClamp(number, lower, upper) {
  20742. if (number === number) {
  20743. if (upper !== undefined) {
  20744. number = number <= upper ? number : upper;
  20745. }
  20746. if (lower !== undefined) {
  20747. number = number >= lower ? number : lower;
  20748. }
  20749. }
  20750. return number;
  20751. }
  20752. /**
  20753. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  20754. * traversed objects.
  20755. *
  20756. * @private
  20757. * @param {*} value The value to clone.
  20758. * @param {boolean} bitmask The bitmask flags.
  20759. * 1 - Deep clone
  20760. * 2 - Flatten inherited properties
  20761. * 4 - Clone symbols
  20762. * @param {Function} [customizer] The function to customize cloning.
  20763. * @param {string} [key] The key of `value`.
  20764. * @param {Object} [object] The parent object of `value`.
  20765. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  20766. * @returns {*} Returns the cloned value.
  20767. */
  20768. function baseClone(value, bitmask, customizer, key, object, stack) {
  20769. var result,
  20770. isDeep = bitmask & CLONE_DEEP_FLAG,
  20771. isFlat = bitmask & CLONE_FLAT_FLAG,
  20772. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  20773. if (customizer) {
  20774. result = object ? customizer(value, key, object, stack) : customizer(value);
  20775. }
  20776. if (result !== undefined) {
  20777. return result;
  20778. }
  20779. if (!isObject(value)) {
  20780. return value;
  20781. }
  20782. var isArr = isArray(value);
  20783. if (isArr) {
  20784. result = initCloneArray(value);
  20785. if (!isDeep) {
  20786. return copyArray(value, result);
  20787. }
  20788. } else {
  20789. var tag = getTag(value),
  20790. isFunc = tag == funcTag || tag == genTag;
  20791. if (isBuffer(value)) {
  20792. return cloneBuffer(value, isDeep);
  20793. }
  20794. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  20795. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  20796. if (!isDeep) {
  20797. return isFlat
  20798. ? copySymbolsIn(value, baseAssignIn(result, value))
  20799. : copySymbols(value, baseAssign(result, value));
  20800. }
  20801. } else {
  20802. if (!cloneableTags[tag]) {
  20803. return object ? value : {};
  20804. }
  20805. result = initCloneByTag(value, tag, isDeep);
  20806. }
  20807. }
  20808. // Check for circular references and return its corresponding clone.
  20809. stack || (stack = new Stack);
  20810. var stacked = stack.get(value);
  20811. if (stacked) {
  20812. return stacked;
  20813. }
  20814. stack.set(value, result);
  20815. if (isSet(value)) {
  20816. value.forEach(function(subValue) {
  20817. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  20818. });
  20819. } else if (isMap(value)) {
  20820. value.forEach(function(subValue, key) {
  20821. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20822. });
  20823. }
  20824. var keysFunc = isFull
  20825. ? (isFlat ? getAllKeysIn : getAllKeys)
  20826. : (isFlat ? keysIn : keys);
  20827. var props = isArr ? undefined : keysFunc(value);
  20828. arrayEach(props || value, function(subValue, key) {
  20829. if (props) {
  20830. key = subValue;
  20831. subValue = value[key];
  20832. }
  20833. // Recursively populate clone (susceptible to call stack limits).
  20834. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20835. });
  20836. return result;
  20837. }
  20838. /**
  20839. * The base implementation of `_.conforms` which doesn't clone `source`.
  20840. *
  20841. * @private
  20842. * @param {Object} source The object of property predicates to conform to.
  20843. * @returns {Function} Returns the new spec function.
  20844. */
  20845. function baseConforms(source) {
  20846. var props = keys(source);
  20847. return function(object) {
  20848. return baseConformsTo(object, source, props);
  20849. };
  20850. }
  20851. /**
  20852. * The base implementation of `_.conformsTo` which accepts `props` to check.
  20853. *
  20854. * @private
  20855. * @param {Object} object The object to inspect.
  20856. * @param {Object} source The object of property predicates to conform to.
  20857. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  20858. */
  20859. function baseConformsTo(object, source, props) {
  20860. var length = props.length;
  20861. if (object == null) {
  20862. return !length;
  20863. }
  20864. object = Object(object);
  20865. while (length--) {
  20866. var key = props[length],
  20867. predicate = source[key],
  20868. value = object[key];
  20869. if ((value === undefined && !(key in object)) || !predicate(value)) {
  20870. return false;
  20871. }
  20872. }
  20873. return true;
  20874. }
  20875. /**
  20876. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  20877. * to provide to `func`.
  20878. *
  20879. * @private
  20880. * @param {Function} func The function to delay.
  20881. * @param {number} wait The number of milliseconds to delay invocation.
  20882. * @param {Array} args The arguments to provide to `func`.
  20883. * @returns {number|Object} Returns the timer id or timeout object.
  20884. */
  20885. function baseDelay(func, wait, args) {
  20886. if (typeof func != 'function') {
  20887. throw new TypeError(FUNC_ERROR_TEXT);
  20888. }
  20889. return setTimeout(function() { func.apply(undefined, args); }, wait);
  20890. }
  20891. /**
  20892. * The base implementation of methods like `_.difference` without support
  20893. * for excluding multiple arrays or iteratee shorthands.
  20894. *
  20895. * @private
  20896. * @param {Array} array The array to inspect.
  20897. * @param {Array} values The values to exclude.
  20898. * @param {Function} [iteratee] The iteratee invoked per element.
  20899. * @param {Function} [comparator] The comparator invoked per element.
  20900. * @returns {Array} Returns the new array of filtered values.
  20901. */
  20902. function baseDifference(array, values, iteratee, comparator) {
  20903. var index = -1,
  20904. includes = arrayIncludes,
  20905. isCommon = true,
  20906. length = array.length,
  20907. result = [],
  20908. valuesLength = values.length;
  20909. if (!length) {
  20910. return result;
  20911. }
  20912. if (iteratee) {
  20913. values = arrayMap(values, baseUnary(iteratee));
  20914. }
  20915. if (comparator) {
  20916. includes = arrayIncludesWith;
  20917. isCommon = false;
  20918. }
  20919. else if (values.length >= LARGE_ARRAY_SIZE) {
  20920. includes = cacheHas;
  20921. isCommon = false;
  20922. values = new SetCache(values);
  20923. }
  20924. outer:
  20925. while (++index < length) {
  20926. var value = array[index],
  20927. computed = iteratee == null ? value : iteratee(value);
  20928. value = (comparator || value !== 0) ? value : 0;
  20929. if (isCommon && computed === computed) {
  20930. var valuesIndex = valuesLength;
  20931. while (valuesIndex--) {
  20932. if (values[valuesIndex] === computed) {
  20933. continue outer;
  20934. }
  20935. }
  20936. result.push(value);
  20937. }
  20938. else if (!includes(values, computed, comparator)) {
  20939. result.push(value);
  20940. }
  20941. }
  20942. return result;
  20943. }
  20944. /**
  20945. * The base implementation of `_.forEach` without support for iteratee shorthands.
  20946. *
  20947. * @private
  20948. * @param {Array|Object} collection The collection to iterate over.
  20949. * @param {Function} iteratee The function invoked per iteration.
  20950. * @returns {Array|Object} Returns `collection`.
  20951. */
  20952. var baseEach = createBaseEach(baseForOwn);
  20953. /**
  20954. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  20955. *
  20956. * @private
  20957. * @param {Array|Object} collection The collection to iterate over.
  20958. * @param {Function} iteratee The function invoked per iteration.
  20959. * @returns {Array|Object} Returns `collection`.
  20960. */
  20961. var baseEachRight = createBaseEach(baseForOwnRight, true);
  20962. /**
  20963. * The base implementation of `_.every` without support for iteratee shorthands.
  20964. *
  20965. * @private
  20966. * @param {Array|Object} collection The collection to iterate over.
  20967. * @param {Function} predicate The function invoked per iteration.
  20968. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  20969. * else `false`
  20970. */
  20971. function baseEvery(collection, predicate) {
  20972. var result = true;
  20973. baseEach(collection, function(value, index, collection) {
  20974. result = !!predicate(value, index, collection);
  20975. return result;
  20976. });
  20977. return result;
  20978. }
  20979. /**
  20980. * The base implementation of methods like `_.max` and `_.min` which accepts a
  20981. * `comparator` to determine the extremum value.
  20982. *
  20983. * @private
  20984. * @param {Array} array The array to iterate over.
  20985. * @param {Function} iteratee The iteratee invoked per iteration.
  20986. * @param {Function} comparator The comparator used to compare values.
  20987. * @returns {*} Returns the extremum value.
  20988. */
  20989. function baseExtremum(array, iteratee, comparator) {
  20990. var index = -1,
  20991. length = array.length;
  20992. while (++index < length) {
  20993. var value = array[index],
  20994. current = iteratee(value);
  20995. if (current != null && (computed === undefined
  20996. ? (current === current && !isSymbol(current))
  20997. : comparator(current, computed)
  20998. )) {
  20999. var computed = current,
  21000. result = value;
  21001. }
  21002. }
  21003. return result;
  21004. }
  21005. /**
  21006. * The base implementation of `_.fill` without an iteratee call guard.
  21007. *
  21008. * @private
  21009. * @param {Array} array The array to fill.
  21010. * @param {*} value The value to fill `array` with.
  21011. * @param {number} [start=0] The start position.
  21012. * @param {number} [end=array.length] The end position.
  21013. * @returns {Array} Returns `array`.
  21014. */
  21015. function baseFill(array, value, start, end) {
  21016. var length = array.length;
  21017. start = toInteger(start);
  21018. if (start < 0) {
  21019. start = -start > length ? 0 : (length + start);
  21020. }
  21021. end = (end === undefined || end > length) ? length : toInteger(end);
  21022. if (end < 0) {
  21023. end += length;
  21024. }
  21025. end = start > end ? 0 : toLength(end);
  21026. while (start < end) {
  21027. array[start++] = value;
  21028. }
  21029. return array;
  21030. }
  21031. /**
  21032. * The base implementation of `_.filter` without support for iteratee shorthands.
  21033. *
  21034. * @private
  21035. * @param {Array|Object} collection The collection to iterate over.
  21036. * @param {Function} predicate The function invoked per iteration.
  21037. * @returns {Array} Returns the new filtered array.
  21038. */
  21039. function baseFilter(collection, predicate) {
  21040. var result = [];
  21041. baseEach(collection, function(value, index, collection) {
  21042. if (predicate(value, index, collection)) {
  21043. result.push(value);
  21044. }
  21045. });
  21046. return result;
  21047. }
  21048. /**
  21049. * The base implementation of `_.flatten` with support for restricting flattening.
  21050. *
  21051. * @private
  21052. * @param {Array} array The array to flatten.
  21053. * @param {number} depth The maximum recursion depth.
  21054. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  21055. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  21056. * @param {Array} [result=[]] The initial result value.
  21057. * @returns {Array} Returns the new flattened array.
  21058. */
  21059. function baseFlatten(array, depth, predicate, isStrict, result) {
  21060. var index = -1,
  21061. length = array.length;
  21062. predicate || (predicate = isFlattenable);
  21063. result || (result = []);
  21064. while (++index < length) {
  21065. var value = array[index];
  21066. if (depth > 0 && predicate(value)) {
  21067. if (depth > 1) {
  21068. // Recursively flatten arrays (susceptible to call stack limits).
  21069. baseFlatten(value, depth - 1, predicate, isStrict, result);
  21070. } else {
  21071. arrayPush(result, value);
  21072. }
  21073. } else if (!isStrict) {
  21074. result[result.length] = value;
  21075. }
  21076. }
  21077. return result;
  21078. }
  21079. /**
  21080. * The base implementation of `baseForOwn` which iterates over `object`
  21081. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  21082. * Iteratee functions may exit iteration early by explicitly returning `false`.
  21083. *
  21084. * @private
  21085. * @param {Object} object The object to iterate over.
  21086. * @param {Function} iteratee The function invoked per iteration.
  21087. * @param {Function} keysFunc The function to get the keys of `object`.
  21088. * @returns {Object} Returns `object`.
  21089. */
  21090. var baseFor = createBaseFor();
  21091. /**
  21092. * This function is like `baseFor` except that it iterates over properties
  21093. * in the opposite order.
  21094. *
  21095. * @private
  21096. * @param {Object} object The object to iterate over.
  21097. * @param {Function} iteratee The function invoked per iteration.
  21098. * @param {Function} keysFunc The function to get the keys of `object`.
  21099. * @returns {Object} Returns `object`.
  21100. */
  21101. var baseForRight = createBaseFor(true);
  21102. /**
  21103. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  21104. *
  21105. * @private
  21106. * @param {Object} object The object to iterate over.
  21107. * @param {Function} iteratee The function invoked per iteration.
  21108. * @returns {Object} Returns `object`.
  21109. */
  21110. function baseForOwn(object, iteratee) {
  21111. return object && baseFor(object, iteratee, keys);
  21112. }
  21113. /**
  21114. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  21115. *
  21116. * @private
  21117. * @param {Object} object The object to iterate over.
  21118. * @param {Function} iteratee The function invoked per iteration.
  21119. * @returns {Object} Returns `object`.
  21120. */
  21121. function baseForOwnRight(object, iteratee) {
  21122. return object && baseForRight(object, iteratee, keys);
  21123. }
  21124. /**
  21125. * The base implementation of `_.functions` which creates an array of
  21126. * `object` function property names filtered from `props`.
  21127. *
  21128. * @private
  21129. * @param {Object} object The object to inspect.
  21130. * @param {Array} props The property names to filter.
  21131. * @returns {Array} Returns the function names.
  21132. */
  21133. function baseFunctions(object, props) {
  21134. return arrayFilter(props, function(key) {
  21135. return isFunction(object[key]);
  21136. });
  21137. }
  21138. /**
  21139. * The base implementation of `_.get` without support for default values.
  21140. *
  21141. * @private
  21142. * @param {Object} object The object to query.
  21143. * @param {Array|string} path The path of the property to get.
  21144. * @returns {*} Returns the resolved value.
  21145. */
  21146. function baseGet(object, path) {
  21147. path = castPath(path, object);
  21148. var index = 0,
  21149. length = path.length;
  21150. while (object != null && index < length) {
  21151. object = object[toKey(path[index++])];
  21152. }
  21153. return (index && index == length) ? object : undefined;
  21154. }
  21155. /**
  21156. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  21157. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  21158. * symbols of `object`.
  21159. *
  21160. * @private
  21161. * @param {Object} object The object to query.
  21162. * @param {Function} keysFunc The function to get the keys of `object`.
  21163. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  21164. * @returns {Array} Returns the array of property names and symbols.
  21165. */
  21166. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  21167. var result = keysFunc(object);
  21168. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  21169. }
  21170. /**
  21171. * The base implementation of `getTag` without fallbacks for buggy environments.
  21172. *
  21173. * @private
  21174. * @param {*} value The value to query.
  21175. * @returns {string} Returns the `toStringTag`.
  21176. */
  21177. function baseGetTag(value) {
  21178. if (value == null) {
  21179. return value === undefined ? undefinedTag : nullTag;
  21180. }
  21181. return (symToStringTag && symToStringTag in Object(value))
  21182. ? getRawTag(value)
  21183. : objectToString(value);
  21184. }
  21185. /**
  21186. * The base implementation of `_.gt` which doesn't coerce arguments.
  21187. *
  21188. * @private
  21189. * @param {*} value The value to compare.
  21190. * @param {*} other The other value to compare.
  21191. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  21192. * else `false`.
  21193. */
  21194. function baseGt(value, other) {
  21195. return value > other;
  21196. }
  21197. /**
  21198. * The base implementation of `_.has` without support for deep paths.
  21199. *
  21200. * @private
  21201. * @param {Object} [object] The object to query.
  21202. * @param {Array|string} key The key to check.
  21203. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21204. */
  21205. function baseHas(object, key) {
  21206. return object != null && hasOwnProperty.call(object, key);
  21207. }
  21208. /**
  21209. * The base implementation of `_.hasIn` without support for deep paths.
  21210. *
  21211. * @private
  21212. * @param {Object} [object] The object to query.
  21213. * @param {Array|string} key The key to check.
  21214. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21215. */
  21216. function baseHasIn(object, key) {
  21217. return object != null && key in Object(object);
  21218. }
  21219. /**
  21220. * The base implementation of `_.inRange` which doesn't coerce arguments.
  21221. *
  21222. * @private
  21223. * @param {number} number The number to check.
  21224. * @param {number} start The start of the range.
  21225. * @param {number} end The end of the range.
  21226. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  21227. */
  21228. function baseInRange(number, start, end) {
  21229. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  21230. }
  21231. /**
  21232. * The base implementation of methods like `_.intersection`, without support
  21233. * for iteratee shorthands, that accepts an array of arrays to inspect.
  21234. *
  21235. * @private
  21236. * @param {Array} arrays The arrays to inspect.
  21237. * @param {Function} [iteratee] The iteratee invoked per element.
  21238. * @param {Function} [comparator] The comparator invoked per element.
  21239. * @returns {Array} Returns the new array of shared values.
  21240. */
  21241. function baseIntersection(arrays, iteratee, comparator) {
  21242. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  21243. length = arrays[0].length,
  21244. othLength = arrays.length,
  21245. othIndex = othLength,
  21246. caches = Array(othLength),
  21247. maxLength = Infinity,
  21248. result = [];
  21249. while (othIndex--) {
  21250. var array = arrays[othIndex];
  21251. if (othIndex && iteratee) {
  21252. array = arrayMap(array, baseUnary(iteratee));
  21253. }
  21254. maxLength = nativeMin(array.length, maxLength);
  21255. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  21256. ? new SetCache(othIndex && array)
  21257. : undefined;
  21258. }
  21259. array = arrays[0];
  21260. var index = -1,
  21261. seen = caches[0];
  21262. outer:
  21263. while (++index < length && result.length < maxLength) {
  21264. var value = array[index],
  21265. computed = iteratee ? iteratee(value) : value;
  21266. value = (comparator || value !== 0) ? value : 0;
  21267. if (!(seen
  21268. ? cacheHas(seen, computed)
  21269. : includes(result, computed, comparator)
  21270. )) {
  21271. othIndex = othLength;
  21272. while (--othIndex) {
  21273. var cache = caches[othIndex];
  21274. if (!(cache
  21275. ? cacheHas(cache, computed)
  21276. : includes(arrays[othIndex], computed, comparator))
  21277. ) {
  21278. continue outer;
  21279. }
  21280. }
  21281. if (seen) {
  21282. seen.push(computed);
  21283. }
  21284. result.push(value);
  21285. }
  21286. }
  21287. return result;
  21288. }
  21289. /**
  21290. * The base implementation of `_.invert` and `_.invertBy` which inverts
  21291. * `object` with values transformed by `iteratee` and set by `setter`.
  21292. *
  21293. * @private
  21294. * @param {Object} object The object to iterate over.
  21295. * @param {Function} setter The function to set `accumulator` values.
  21296. * @param {Function} iteratee The iteratee to transform values.
  21297. * @param {Object} accumulator The initial inverted object.
  21298. * @returns {Function} Returns `accumulator`.
  21299. */
  21300. function baseInverter(object, setter, iteratee, accumulator) {
  21301. baseForOwn(object, function(value, key, object) {
  21302. setter(accumulator, iteratee(value), key, object);
  21303. });
  21304. return accumulator;
  21305. }
  21306. /**
  21307. * The base implementation of `_.invoke` without support for individual
  21308. * method arguments.
  21309. *
  21310. * @private
  21311. * @param {Object} object The object to query.
  21312. * @param {Array|string} path The path of the method to invoke.
  21313. * @param {Array} args The arguments to invoke the method with.
  21314. * @returns {*} Returns the result of the invoked method.
  21315. */
  21316. function baseInvoke(object, path, args) {
  21317. path = castPath(path, object);
  21318. object = parent(object, path);
  21319. var func = object == null ? object : object[toKey(last(path))];
  21320. return func == null ? undefined : apply(func, object, args);
  21321. }
  21322. /**
  21323. * The base implementation of `_.isArguments`.
  21324. *
  21325. * @private
  21326. * @param {*} value The value to check.
  21327. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  21328. */
  21329. function baseIsArguments(value) {
  21330. return isObjectLike(value) && baseGetTag(value) == argsTag;
  21331. }
  21332. /**
  21333. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  21334. *
  21335. * @private
  21336. * @param {*} value The value to check.
  21337. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  21338. */
  21339. function baseIsArrayBuffer(value) {
  21340. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  21341. }
  21342. /**
  21343. * The base implementation of `_.isDate` without Node.js optimizations.
  21344. *
  21345. * @private
  21346. * @param {*} value The value to check.
  21347. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  21348. */
  21349. function baseIsDate(value) {
  21350. return isObjectLike(value) && baseGetTag(value) == dateTag;
  21351. }
  21352. /**
  21353. * The base implementation of `_.isEqual` which supports partial comparisons
  21354. * and tracks traversed objects.
  21355. *
  21356. * @private
  21357. * @param {*} value The value to compare.
  21358. * @param {*} other The other value to compare.
  21359. * @param {boolean} bitmask The bitmask flags.
  21360. * 1 - Unordered comparison
  21361. * 2 - Partial comparison
  21362. * @param {Function} [customizer] The function to customize comparisons.
  21363. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  21364. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  21365. */
  21366. function baseIsEqual(value, other, bitmask, customizer, stack) {
  21367. if (value === other) {
  21368. return true;
  21369. }
  21370. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  21371. return value !== value && other !== other;
  21372. }
  21373. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  21374. }
  21375. /**
  21376. * A specialized version of `baseIsEqual` for arrays and objects which performs
  21377. * deep comparisons and tracks traversed objects enabling objects with circular
  21378. * references to be compared.
  21379. *
  21380. * @private
  21381. * @param {Object} object The object to compare.
  21382. * @param {Object} other The other object to compare.
  21383. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  21384. * @param {Function} customizer The function to customize comparisons.
  21385. * @param {Function} equalFunc The function to determine equivalents of values.
  21386. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  21387. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  21388. */
  21389. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  21390. var objIsArr = isArray(object),
  21391. othIsArr = isArray(other),
  21392. objTag = objIsArr ? arrayTag : getTag(object),
  21393. othTag = othIsArr ? arrayTag : getTag(other);
  21394. objTag = objTag == argsTag ? objectTag : objTag;
  21395. othTag = othTag == argsTag ? objectTag : othTag;
  21396. var objIsObj = objTag == objectTag,
  21397. othIsObj = othTag == objectTag,
  21398. isSameTag = objTag == othTag;
  21399. if (isSameTag && isBuffer(object)) {
  21400. if (!isBuffer(other)) {
  21401. return false;
  21402. }
  21403. objIsArr = true;
  21404. objIsObj = false;
  21405. }
  21406. if (isSameTag && !objIsObj) {
  21407. stack || (stack = new Stack);
  21408. return (objIsArr || isTypedArray(object))
  21409. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  21410. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  21411. }
  21412. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  21413. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  21414. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  21415. if (objIsWrapped || othIsWrapped) {
  21416. var objUnwrapped = objIsWrapped ? object.value() : object,
  21417. othUnwrapped = othIsWrapped ? other.value() : other;
  21418. stack || (stack = new Stack);
  21419. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  21420. }
  21421. }
  21422. if (!isSameTag) {
  21423. return false;
  21424. }
  21425. stack || (stack = new Stack);
  21426. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  21427. }
  21428. /**
  21429. * The base implementation of `_.isMap` without Node.js optimizations.
  21430. *
  21431. * @private
  21432. * @param {*} value The value to check.
  21433. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  21434. */
  21435. function baseIsMap(value) {
  21436. return isObjectLike(value) && getTag(value) == mapTag;
  21437. }
  21438. /**
  21439. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  21440. *
  21441. * @private
  21442. * @param {Object} object The object to inspect.
  21443. * @param {Object} source The object of property values to match.
  21444. * @param {Array} matchData The property names, values, and compare flags to match.
  21445. * @param {Function} [customizer] The function to customize comparisons.
  21446. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  21447. */
  21448. function baseIsMatch(object, source, matchData, customizer) {
  21449. var index = matchData.length,
  21450. length = index,
  21451. noCustomizer = !customizer;
  21452. if (object == null) {
  21453. return !length;
  21454. }
  21455. object = Object(object);
  21456. while (index--) {
  21457. var data = matchData[index];
  21458. if ((noCustomizer && data[2])
  21459. ? data[1] !== object[data[0]]
  21460. : !(data[0] in object)
  21461. ) {
  21462. return false;
  21463. }
  21464. }
  21465. while (++index < length) {
  21466. data = matchData[index];
  21467. var key = data[0],
  21468. objValue = object[key],
  21469. srcValue = data[1];
  21470. if (noCustomizer && data[2]) {
  21471. if (objValue === undefined && !(key in object)) {
  21472. return false;
  21473. }
  21474. } else {
  21475. var stack = new Stack;
  21476. if (customizer) {
  21477. var result = customizer(objValue, srcValue, key, object, source, stack);
  21478. }
  21479. if (!(result === undefined
  21480. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  21481. : result
  21482. )) {
  21483. return false;
  21484. }
  21485. }
  21486. }
  21487. return true;
  21488. }
  21489. /**
  21490. * The base implementation of `_.isNative` without bad shim checks.
  21491. *
  21492. * @private
  21493. * @param {*} value The value to check.
  21494. * @returns {boolean} Returns `true` if `value` is a native function,
  21495. * else `false`.
  21496. */
  21497. function baseIsNative(value) {
  21498. if (!isObject(value) || isMasked(value)) {
  21499. return false;
  21500. }
  21501. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  21502. return pattern.test(toSource(value));
  21503. }
  21504. /**
  21505. * The base implementation of `_.isRegExp` without Node.js optimizations.
  21506. *
  21507. * @private
  21508. * @param {*} value The value to check.
  21509. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  21510. */
  21511. function baseIsRegExp(value) {
  21512. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  21513. }
  21514. /**
  21515. * The base implementation of `_.isSet` without Node.js optimizations.
  21516. *
  21517. * @private
  21518. * @param {*} value The value to check.
  21519. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  21520. */
  21521. function baseIsSet(value) {
  21522. return isObjectLike(value) && getTag(value) == setTag;
  21523. }
  21524. /**
  21525. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  21526. *
  21527. * @private
  21528. * @param {*} value The value to check.
  21529. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  21530. */
  21531. function baseIsTypedArray(value) {
  21532. return isObjectLike(value) &&
  21533. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  21534. }
  21535. /**
  21536. * The base implementation of `_.iteratee`.
  21537. *
  21538. * @private
  21539. * @param {*} [value=_.identity] The value to convert to an iteratee.
  21540. * @returns {Function} Returns the iteratee.
  21541. */
  21542. function baseIteratee(value) {
  21543. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  21544. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  21545. if (typeof value == 'function') {
  21546. return value;
  21547. }
  21548. if (value == null) {
  21549. return identity;
  21550. }
  21551. if (typeof value == 'object') {
  21552. return isArray(value)
  21553. ? baseMatchesProperty(value[0], value[1])
  21554. : baseMatches(value);
  21555. }
  21556. return property(value);
  21557. }
  21558. /**
  21559. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  21560. *
  21561. * @private
  21562. * @param {Object} object The object to query.
  21563. * @returns {Array} Returns the array of property names.
  21564. */
  21565. function baseKeys(object) {
  21566. if (!isPrototype(object)) {
  21567. return nativeKeys(object);
  21568. }
  21569. var result = [];
  21570. for (var key in Object(object)) {
  21571. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  21572. result.push(key);
  21573. }
  21574. }
  21575. return result;
  21576. }
  21577. /**
  21578. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  21579. *
  21580. * @private
  21581. * @param {Object} object The object to query.
  21582. * @returns {Array} Returns the array of property names.
  21583. */
  21584. function baseKeysIn(object) {
  21585. if (!isObject(object)) {
  21586. return nativeKeysIn(object);
  21587. }
  21588. var isProto = isPrototype(object),
  21589. result = [];
  21590. for (var key in object) {
  21591. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  21592. result.push(key);
  21593. }
  21594. }
  21595. return result;
  21596. }
  21597. /**
  21598. * The base implementation of `_.lt` which doesn't coerce arguments.
  21599. *
  21600. * @private
  21601. * @param {*} value The value to compare.
  21602. * @param {*} other The other value to compare.
  21603. * @returns {boolean} Returns `true` if `value` is less than `other`,
  21604. * else `false`.
  21605. */
  21606. function baseLt(value, other) {
  21607. return value < other;
  21608. }
  21609. /**
  21610. * The base implementation of `_.map` without support for iteratee shorthands.
  21611. *
  21612. * @private
  21613. * @param {Array|Object} collection The collection to iterate over.
  21614. * @param {Function} iteratee The function invoked per iteration.
  21615. * @returns {Array} Returns the new mapped array.
  21616. */
  21617. function baseMap(collection, iteratee) {
  21618. var index = -1,
  21619. result = isArrayLike(collection) ? Array(collection.length) : [];
  21620. baseEach(collection, function(value, key, collection) {
  21621. result[++index] = iteratee(value, key, collection);
  21622. });
  21623. return result;
  21624. }
  21625. /**
  21626. * The base implementation of `_.matches` which doesn't clone `source`.
  21627. *
  21628. * @private
  21629. * @param {Object} source The object of property values to match.
  21630. * @returns {Function} Returns the new spec function.
  21631. */
  21632. function baseMatches(source) {
  21633. var matchData = getMatchData(source);
  21634. if (matchData.length == 1 && matchData[0][2]) {
  21635. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  21636. }
  21637. return function(object) {
  21638. return object === source || baseIsMatch(object, source, matchData);
  21639. };
  21640. }
  21641. /**
  21642. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  21643. *
  21644. * @private
  21645. * @param {string} path The path of the property to get.
  21646. * @param {*} srcValue The value to match.
  21647. * @returns {Function} Returns the new spec function.
  21648. */
  21649. function baseMatchesProperty(path, srcValue) {
  21650. if (isKey(path) && isStrictComparable(srcValue)) {
  21651. return matchesStrictComparable(toKey(path), srcValue);
  21652. }
  21653. return function(object) {
  21654. var objValue = get(object, path);
  21655. return (objValue === undefined && objValue === srcValue)
  21656. ? hasIn(object, path)
  21657. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  21658. };
  21659. }
  21660. /**
  21661. * The base implementation of `_.merge` without support for multiple sources.
  21662. *
  21663. * @private
  21664. * @param {Object} object The destination object.
  21665. * @param {Object} source The source object.
  21666. * @param {number} srcIndex The index of `source`.
  21667. * @param {Function} [customizer] The function to customize merged values.
  21668. * @param {Object} [stack] Tracks traversed source values and their merged
  21669. * counterparts.
  21670. */
  21671. function baseMerge(object, source, srcIndex, customizer, stack) {
  21672. if (object === source) {
  21673. return;
  21674. }
  21675. baseFor(source, function(srcValue, key) {
  21676. stack || (stack = new Stack);
  21677. if (isObject(srcValue)) {
  21678. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  21679. }
  21680. else {
  21681. var newValue = customizer
  21682. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  21683. : undefined;
  21684. if (newValue === undefined) {
  21685. newValue = srcValue;
  21686. }
  21687. assignMergeValue(object, key, newValue);
  21688. }
  21689. }, keysIn);
  21690. }
  21691. /**
  21692. * A specialized version of `baseMerge` for arrays and objects which performs
  21693. * deep merges and tracks traversed objects enabling objects with circular
  21694. * references to be merged.
  21695. *
  21696. * @private
  21697. * @param {Object} object The destination object.
  21698. * @param {Object} source The source object.
  21699. * @param {string} key The key of the value to merge.
  21700. * @param {number} srcIndex The index of `source`.
  21701. * @param {Function} mergeFunc The function to merge values.
  21702. * @param {Function} [customizer] The function to customize assigned values.
  21703. * @param {Object} [stack] Tracks traversed source values and their merged
  21704. * counterparts.
  21705. */
  21706. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  21707. var objValue = safeGet(object, key),
  21708. srcValue = safeGet(source, key),
  21709. stacked = stack.get(srcValue);
  21710. if (stacked) {
  21711. assignMergeValue(object, key, stacked);
  21712. return;
  21713. }
  21714. var newValue = customizer
  21715. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  21716. : undefined;
  21717. var isCommon = newValue === undefined;
  21718. if (isCommon) {
  21719. var isArr = isArray(srcValue),
  21720. isBuff = !isArr && isBuffer(srcValue),
  21721. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  21722. newValue = srcValue;
  21723. if (isArr || isBuff || isTyped) {
  21724. if (isArray(objValue)) {
  21725. newValue = objValue;
  21726. }
  21727. else if (isArrayLikeObject(objValue)) {
  21728. newValue = copyArray(objValue);
  21729. }
  21730. else if (isBuff) {
  21731. isCommon = false;
  21732. newValue = cloneBuffer(srcValue, true);
  21733. }
  21734. else if (isTyped) {
  21735. isCommon = false;
  21736. newValue = cloneTypedArray(srcValue, true);
  21737. }
  21738. else {
  21739. newValue = [];
  21740. }
  21741. }
  21742. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  21743. newValue = objValue;
  21744. if (isArguments(objValue)) {
  21745. newValue = toPlainObject(objValue);
  21746. }
  21747. else if (!isObject(objValue) || isFunction(objValue)) {
  21748. newValue = initCloneObject(srcValue);
  21749. }
  21750. }
  21751. else {
  21752. isCommon = false;
  21753. }
  21754. }
  21755. if (isCommon) {
  21756. // Recursively merge objects and arrays (susceptible to call stack limits).
  21757. stack.set(srcValue, newValue);
  21758. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  21759. stack['delete'](srcValue);
  21760. }
  21761. assignMergeValue(object, key, newValue);
  21762. }
  21763. /**
  21764. * The base implementation of `_.nth` which doesn't coerce arguments.
  21765. *
  21766. * @private
  21767. * @param {Array} array The array to query.
  21768. * @param {number} n The index of the element to return.
  21769. * @returns {*} Returns the nth element of `array`.
  21770. */
  21771. function baseNth(array, n) {
  21772. var length = array.length;
  21773. if (!length) {
  21774. return;
  21775. }
  21776. n += n < 0 ? length : 0;
  21777. return isIndex(n, length) ? array[n] : undefined;
  21778. }
  21779. /**
  21780. * The base implementation of `_.orderBy` without param guards.
  21781. *
  21782. * @private
  21783. * @param {Array|Object} collection The collection to iterate over.
  21784. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  21785. * @param {string[]} orders The sort orders of `iteratees`.
  21786. * @returns {Array} Returns the new sorted array.
  21787. */
  21788. function baseOrderBy(collection, iteratees, orders) {
  21789. var index = -1;
  21790. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  21791. var result = baseMap(collection, function(value, key, collection) {
  21792. var criteria = arrayMap(iteratees, function(iteratee) {
  21793. return iteratee(value);
  21794. });
  21795. return { 'criteria': criteria, 'index': ++index, 'value': value };
  21796. });
  21797. return baseSortBy(result, function(object, other) {
  21798. return compareMultiple(object, other, orders);
  21799. });
  21800. }
  21801. /**
  21802. * The base implementation of `_.pick` without support for individual
  21803. * property identifiers.
  21804. *
  21805. * @private
  21806. * @param {Object} object The source object.
  21807. * @param {string[]} paths The property paths to pick.
  21808. * @returns {Object} Returns the new object.
  21809. */
  21810. function basePick(object, paths) {
  21811. return basePickBy(object, paths, function(value, path) {
  21812. return hasIn(object, path);
  21813. });
  21814. }
  21815. /**
  21816. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  21817. *
  21818. * @private
  21819. * @param {Object} object The source object.
  21820. * @param {string[]} paths The property paths to pick.
  21821. * @param {Function} predicate The function invoked per property.
  21822. * @returns {Object} Returns the new object.
  21823. */
  21824. function basePickBy(object, paths, predicate) {
  21825. var index = -1,
  21826. length = paths.length,
  21827. result = {};
  21828. while (++index < length) {
  21829. var path = paths[index],
  21830. value = baseGet(object, path);
  21831. if (predicate(value, path)) {
  21832. baseSet(result, castPath(path, object), value);
  21833. }
  21834. }
  21835. return result;
  21836. }
  21837. /**
  21838. * A specialized version of `baseProperty` which supports deep paths.
  21839. *
  21840. * @private
  21841. * @param {Array|string} path The path of the property to get.
  21842. * @returns {Function} Returns the new accessor function.
  21843. */
  21844. function basePropertyDeep(path) {
  21845. return function(object) {
  21846. return baseGet(object, path);
  21847. };
  21848. }
  21849. /**
  21850. * The base implementation of `_.pullAllBy` without support for iteratee
  21851. * shorthands.
  21852. *
  21853. * @private
  21854. * @param {Array} array The array to modify.
  21855. * @param {Array} values The values to remove.
  21856. * @param {Function} [iteratee] The iteratee invoked per element.
  21857. * @param {Function} [comparator] The comparator invoked per element.
  21858. * @returns {Array} Returns `array`.
  21859. */
  21860. function basePullAll(array, values, iteratee, comparator) {
  21861. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  21862. index = -1,
  21863. length = values.length,
  21864. seen = array;
  21865. if (array === values) {
  21866. values = copyArray(values);
  21867. }
  21868. if (iteratee) {
  21869. seen = arrayMap(array, baseUnary(iteratee));
  21870. }
  21871. while (++index < length) {
  21872. var fromIndex = 0,
  21873. value = values[index],
  21874. computed = iteratee ? iteratee(value) : value;
  21875. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  21876. if (seen !== array) {
  21877. splice.call(seen, fromIndex, 1);
  21878. }
  21879. splice.call(array, fromIndex, 1);
  21880. }
  21881. }
  21882. return array;
  21883. }
  21884. /**
  21885. * The base implementation of `_.pullAt` without support for individual
  21886. * indexes or capturing the removed elements.
  21887. *
  21888. * @private
  21889. * @param {Array} array The array to modify.
  21890. * @param {number[]} indexes The indexes of elements to remove.
  21891. * @returns {Array} Returns `array`.
  21892. */
  21893. function basePullAt(array, indexes) {
  21894. var length = array ? indexes.length : 0,
  21895. lastIndex = length - 1;
  21896. while (length--) {
  21897. var index = indexes[length];
  21898. if (length == lastIndex || index !== previous) {
  21899. var previous = index;
  21900. if (isIndex(index)) {
  21901. splice.call(array, index, 1);
  21902. } else {
  21903. baseUnset(array, index);
  21904. }
  21905. }
  21906. }
  21907. return array;
  21908. }
  21909. /**
  21910. * The base implementation of `_.random` without support for returning
  21911. * floating-point numbers.
  21912. *
  21913. * @private
  21914. * @param {number} lower The lower bound.
  21915. * @param {number} upper The upper bound.
  21916. * @returns {number} Returns the random number.
  21917. */
  21918. function baseRandom(lower, upper) {
  21919. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  21920. }
  21921. /**
  21922. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  21923. * coerce arguments.
  21924. *
  21925. * @private
  21926. * @param {number} start The start of the range.
  21927. * @param {number} end The end of the range.
  21928. * @param {number} step The value to increment or decrement by.
  21929. * @param {boolean} [fromRight] Specify iterating from right to left.
  21930. * @returns {Array} Returns the range of numbers.
  21931. */
  21932. function baseRange(start, end, step, fromRight) {
  21933. var index = -1,
  21934. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  21935. result = Array(length);
  21936. while (length--) {
  21937. result[fromRight ? length : ++index] = start;
  21938. start += step;
  21939. }
  21940. return result;
  21941. }
  21942. /**
  21943. * The base implementation of `_.repeat` which doesn't coerce arguments.
  21944. *
  21945. * @private
  21946. * @param {string} string The string to repeat.
  21947. * @param {number} n The number of times to repeat the string.
  21948. * @returns {string} Returns the repeated string.
  21949. */
  21950. function baseRepeat(string, n) {
  21951. var result = '';
  21952. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  21953. return result;
  21954. }
  21955. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  21956. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  21957. do {
  21958. if (n % 2) {
  21959. result += string;
  21960. }
  21961. n = nativeFloor(n / 2);
  21962. if (n) {
  21963. string += string;
  21964. }
  21965. } while (n);
  21966. return result;
  21967. }
  21968. /**
  21969. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  21970. *
  21971. * @private
  21972. * @param {Function} func The function to apply a rest parameter to.
  21973. * @param {number} [start=func.length-1] The start position of the rest parameter.
  21974. * @returns {Function} Returns the new function.
  21975. */
  21976. function baseRest(func, start) {
  21977. return setToString(overRest(func, start, identity), func + '');
  21978. }
  21979. /**
  21980. * The base implementation of `_.sample`.
  21981. *
  21982. * @private
  21983. * @param {Array|Object} collection The collection to sample.
  21984. * @returns {*} Returns the random element.
  21985. */
  21986. function baseSample(collection) {
  21987. return arraySample(values(collection));
  21988. }
  21989. /**
  21990. * The base implementation of `_.sampleSize` without param guards.
  21991. *
  21992. * @private
  21993. * @param {Array|Object} collection The collection to sample.
  21994. * @param {number} n The number of elements to sample.
  21995. * @returns {Array} Returns the random elements.
  21996. */
  21997. function baseSampleSize(collection, n) {
  21998. var array = values(collection);
  21999. return shuffleSelf(array, baseClamp(n, 0, array.length));
  22000. }
  22001. /**
  22002. * The base implementation of `_.set`.
  22003. *
  22004. * @private
  22005. * @param {Object} object The object to modify.
  22006. * @param {Array|string} path The path of the property to set.
  22007. * @param {*} value The value to set.
  22008. * @param {Function} [customizer] The function to customize path creation.
  22009. * @returns {Object} Returns `object`.
  22010. */
  22011. function baseSet(object, path, value, customizer) {
  22012. if (!isObject(object)) {
  22013. return object;
  22014. }
  22015. path = castPath(path, object);
  22016. var index = -1,
  22017. length = path.length,
  22018. lastIndex = length - 1,
  22019. nested = object;
  22020. while (nested != null && ++index < length) {
  22021. var key = toKey(path[index]),
  22022. newValue = value;
  22023. if (index != lastIndex) {
  22024. var objValue = nested[key];
  22025. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  22026. if (newValue === undefined) {
  22027. newValue = isObject(objValue)
  22028. ? objValue
  22029. : (isIndex(path[index + 1]) ? [] : {});
  22030. }
  22031. }
  22032. assignValue(nested, key, newValue);
  22033. nested = nested[key];
  22034. }
  22035. return object;
  22036. }
  22037. /**
  22038. * The base implementation of `setData` without support for hot loop shorting.
  22039. *
  22040. * @private
  22041. * @param {Function} func The function to associate metadata with.
  22042. * @param {*} data The metadata.
  22043. * @returns {Function} Returns `func`.
  22044. */
  22045. var baseSetData = !metaMap ? identity : function(func, data) {
  22046. metaMap.set(func, data);
  22047. return func;
  22048. };
  22049. /**
  22050. * The base implementation of `setToString` without support for hot loop shorting.
  22051. *
  22052. * @private
  22053. * @param {Function} func The function to modify.
  22054. * @param {Function} string The `toString` result.
  22055. * @returns {Function} Returns `func`.
  22056. */
  22057. var baseSetToString = !defineProperty ? identity : function(func, string) {
  22058. return defineProperty(func, 'toString', {
  22059. 'configurable': true,
  22060. 'enumerable': false,
  22061. 'value': constant(string),
  22062. 'writable': true
  22063. });
  22064. };
  22065. /**
  22066. * The base implementation of `_.shuffle`.
  22067. *
  22068. * @private
  22069. * @param {Array|Object} collection The collection to shuffle.
  22070. * @returns {Array} Returns the new shuffled array.
  22071. */
  22072. function baseShuffle(collection) {
  22073. return shuffleSelf(values(collection));
  22074. }
  22075. /**
  22076. * The base implementation of `_.slice` without an iteratee call guard.
  22077. *
  22078. * @private
  22079. * @param {Array} array The array to slice.
  22080. * @param {number} [start=0] The start position.
  22081. * @param {number} [end=array.length] The end position.
  22082. * @returns {Array} Returns the slice of `array`.
  22083. */
  22084. function baseSlice(array, start, end) {
  22085. var index = -1,
  22086. length = array.length;
  22087. if (start < 0) {
  22088. start = -start > length ? 0 : (length + start);
  22089. }
  22090. end = end > length ? length : end;
  22091. if (end < 0) {
  22092. end += length;
  22093. }
  22094. length = start > end ? 0 : ((end - start) >>> 0);
  22095. start >>>= 0;
  22096. var result = Array(length);
  22097. while (++index < length) {
  22098. result[index] = array[index + start];
  22099. }
  22100. return result;
  22101. }
  22102. /**
  22103. * The base implementation of `_.some` without support for iteratee shorthands.
  22104. *
  22105. * @private
  22106. * @param {Array|Object} collection The collection to iterate over.
  22107. * @param {Function} predicate The function invoked per iteration.
  22108. * @returns {boolean} Returns `true` if any element passes the predicate check,
  22109. * else `false`.
  22110. */
  22111. function baseSome(collection, predicate) {
  22112. var result;
  22113. baseEach(collection, function(value, index, collection) {
  22114. result = predicate(value, index, collection);
  22115. return !result;
  22116. });
  22117. return !!result;
  22118. }
  22119. /**
  22120. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  22121. * performs a binary search of `array` to determine the index at which `value`
  22122. * should be inserted into `array` in order to maintain its sort order.
  22123. *
  22124. * @private
  22125. * @param {Array} array The sorted array to inspect.
  22126. * @param {*} value The value to evaluate.
  22127. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22128. * @returns {number} Returns the index at which `value` should be inserted
  22129. * into `array`.
  22130. */
  22131. function baseSortedIndex(array, value, retHighest) {
  22132. var low = 0,
  22133. high = array == null ? low : array.length;
  22134. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  22135. while (low < high) {
  22136. var mid = (low + high) >>> 1,
  22137. computed = array[mid];
  22138. if (computed !== null && !isSymbol(computed) &&
  22139. (retHighest ? (computed <= value) : (computed < value))) {
  22140. low = mid + 1;
  22141. } else {
  22142. high = mid;
  22143. }
  22144. }
  22145. return high;
  22146. }
  22147. return baseSortedIndexBy(array, value, identity, retHighest);
  22148. }
  22149. /**
  22150. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  22151. * which invokes `iteratee` for `value` and each element of `array` to compute
  22152. * their sort ranking. The iteratee is invoked with one argument; (value).
  22153. *
  22154. * @private
  22155. * @param {Array} array The sorted array to inspect.
  22156. * @param {*} value The value to evaluate.
  22157. * @param {Function} iteratee The iteratee invoked per element.
  22158. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22159. * @returns {number} Returns the index at which `value` should be inserted
  22160. * into `array`.
  22161. */
  22162. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  22163. value = iteratee(value);
  22164. var low = 0,
  22165. high = array == null ? 0 : array.length,
  22166. valIsNaN = value !== value,
  22167. valIsNull = value === null,
  22168. valIsSymbol = isSymbol(value),
  22169. valIsUndefined = value === undefined;
  22170. while (low < high) {
  22171. var mid = nativeFloor((low + high) / 2),
  22172. computed = iteratee(array[mid]),
  22173. othIsDefined = computed !== undefined,
  22174. othIsNull = computed === null,
  22175. othIsReflexive = computed === computed,
  22176. othIsSymbol = isSymbol(computed);
  22177. if (valIsNaN) {
  22178. var setLow = retHighest || othIsReflexive;
  22179. } else if (valIsUndefined) {
  22180. setLow = othIsReflexive && (retHighest || othIsDefined);
  22181. } else if (valIsNull) {
  22182. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  22183. } else if (valIsSymbol) {
  22184. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  22185. } else if (othIsNull || othIsSymbol) {
  22186. setLow = false;
  22187. } else {
  22188. setLow = retHighest ? (computed <= value) : (computed < value);
  22189. }
  22190. if (setLow) {
  22191. low = mid + 1;
  22192. } else {
  22193. high = mid;
  22194. }
  22195. }
  22196. return nativeMin(high, MAX_ARRAY_INDEX);
  22197. }
  22198. /**
  22199. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  22200. * support for iteratee shorthands.
  22201. *
  22202. * @private
  22203. * @param {Array} array The array to inspect.
  22204. * @param {Function} [iteratee] The iteratee invoked per element.
  22205. * @returns {Array} Returns the new duplicate free array.
  22206. */
  22207. function baseSortedUniq(array, iteratee) {
  22208. var index = -1,
  22209. length = array.length,
  22210. resIndex = 0,
  22211. result = [];
  22212. while (++index < length) {
  22213. var value = array[index],
  22214. computed = iteratee ? iteratee(value) : value;
  22215. if (!index || !eq(computed, seen)) {
  22216. var seen = computed;
  22217. result[resIndex++] = value === 0 ? 0 : value;
  22218. }
  22219. }
  22220. return result;
  22221. }
  22222. /**
  22223. * The base implementation of `_.toNumber` which doesn't ensure correct
  22224. * conversions of binary, hexadecimal, or octal string values.
  22225. *
  22226. * @private
  22227. * @param {*} value The value to process.
  22228. * @returns {number} Returns the number.
  22229. */
  22230. function baseToNumber(value) {
  22231. if (typeof value == 'number') {
  22232. return value;
  22233. }
  22234. if (isSymbol(value)) {
  22235. return NAN;
  22236. }
  22237. return +value;
  22238. }
  22239. /**
  22240. * The base implementation of `_.toString` which doesn't convert nullish
  22241. * values to empty strings.
  22242. *
  22243. * @private
  22244. * @param {*} value The value to process.
  22245. * @returns {string} Returns the string.
  22246. */
  22247. function baseToString(value) {
  22248. // Exit early for strings to avoid a performance hit in some environments.
  22249. if (typeof value == 'string') {
  22250. return value;
  22251. }
  22252. if (isArray(value)) {
  22253. // Recursively convert values (susceptible to call stack limits).
  22254. return arrayMap(value, baseToString) + '';
  22255. }
  22256. if (isSymbol(value)) {
  22257. return symbolToString ? symbolToString.call(value) : '';
  22258. }
  22259. var result = (value + '');
  22260. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  22261. }
  22262. /**
  22263. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  22264. *
  22265. * @private
  22266. * @param {Array} array The array to inspect.
  22267. * @param {Function} [iteratee] The iteratee invoked per element.
  22268. * @param {Function} [comparator] The comparator invoked per element.
  22269. * @returns {Array} Returns the new duplicate free array.
  22270. */
  22271. function baseUniq(array, iteratee, comparator) {
  22272. var index = -1,
  22273. includes = arrayIncludes,
  22274. length = array.length,
  22275. isCommon = true,
  22276. result = [],
  22277. seen = result;
  22278. if (comparator) {
  22279. isCommon = false;
  22280. includes = arrayIncludesWith;
  22281. }
  22282. else if (length >= LARGE_ARRAY_SIZE) {
  22283. var set = iteratee ? null : createSet(array);
  22284. if (set) {
  22285. return setToArray(set);
  22286. }
  22287. isCommon = false;
  22288. includes = cacheHas;
  22289. seen = new SetCache;
  22290. }
  22291. else {
  22292. seen = iteratee ? [] : result;
  22293. }
  22294. outer:
  22295. while (++index < length) {
  22296. var value = array[index],
  22297. computed = iteratee ? iteratee(value) : value;
  22298. value = (comparator || value !== 0) ? value : 0;
  22299. if (isCommon && computed === computed) {
  22300. var seenIndex = seen.length;
  22301. while (seenIndex--) {
  22302. if (seen[seenIndex] === computed) {
  22303. continue outer;
  22304. }
  22305. }
  22306. if (iteratee) {
  22307. seen.push(computed);
  22308. }
  22309. result.push(value);
  22310. }
  22311. else if (!includes(seen, computed, comparator)) {
  22312. if (seen !== result) {
  22313. seen.push(computed);
  22314. }
  22315. result.push(value);
  22316. }
  22317. }
  22318. return result;
  22319. }
  22320. /**
  22321. * The base implementation of `_.unset`.
  22322. *
  22323. * @private
  22324. * @param {Object} object The object to modify.
  22325. * @param {Array|string} path The property path to unset.
  22326. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  22327. */
  22328. function baseUnset(object, path) {
  22329. path = castPath(path, object);
  22330. object = parent(object, path);
  22331. return object == null || delete object[toKey(last(path))];
  22332. }
  22333. /**
  22334. * The base implementation of `_.update`.
  22335. *
  22336. * @private
  22337. * @param {Object} object The object to modify.
  22338. * @param {Array|string} path The path of the property to update.
  22339. * @param {Function} updater The function to produce the updated value.
  22340. * @param {Function} [customizer] The function to customize path creation.
  22341. * @returns {Object} Returns `object`.
  22342. */
  22343. function baseUpdate(object, path, updater, customizer) {
  22344. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  22345. }
  22346. /**
  22347. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  22348. * without support for iteratee shorthands.
  22349. *
  22350. * @private
  22351. * @param {Array} array The array to query.
  22352. * @param {Function} predicate The function invoked per iteration.
  22353. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  22354. * @param {boolean} [fromRight] Specify iterating from right to left.
  22355. * @returns {Array} Returns the slice of `array`.
  22356. */
  22357. function baseWhile(array, predicate, isDrop, fromRight) {
  22358. var length = array.length,
  22359. index = fromRight ? length : -1;
  22360. while ((fromRight ? index-- : ++index < length) &&
  22361. predicate(array[index], index, array)) {}
  22362. return isDrop
  22363. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  22364. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  22365. }
  22366. /**
  22367. * The base implementation of `wrapperValue` which returns the result of
  22368. * performing a sequence of actions on the unwrapped `value`, where each
  22369. * successive action is supplied the return value of the previous.
  22370. *
  22371. * @private
  22372. * @param {*} value The unwrapped value.
  22373. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  22374. * @returns {*} Returns the resolved value.
  22375. */
  22376. function baseWrapperValue(value, actions) {
  22377. var result = value;
  22378. if (result instanceof LazyWrapper) {
  22379. result = result.value();
  22380. }
  22381. return arrayReduce(actions, function(result, action) {
  22382. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  22383. }, result);
  22384. }
  22385. /**
  22386. * The base implementation of methods like `_.xor`, without support for
  22387. * iteratee shorthands, that accepts an array of arrays to inspect.
  22388. *
  22389. * @private
  22390. * @param {Array} arrays The arrays to inspect.
  22391. * @param {Function} [iteratee] The iteratee invoked per element.
  22392. * @param {Function} [comparator] The comparator invoked per element.
  22393. * @returns {Array} Returns the new array of values.
  22394. */
  22395. function baseXor(arrays, iteratee, comparator) {
  22396. var length = arrays.length;
  22397. if (length < 2) {
  22398. return length ? baseUniq(arrays[0]) : [];
  22399. }
  22400. var index = -1,
  22401. result = Array(length);
  22402. while (++index < length) {
  22403. var array = arrays[index],
  22404. othIndex = -1;
  22405. while (++othIndex < length) {
  22406. if (othIndex != index) {
  22407. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  22408. }
  22409. }
  22410. }
  22411. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  22412. }
  22413. /**
  22414. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  22415. *
  22416. * @private
  22417. * @param {Array} props The property identifiers.
  22418. * @param {Array} values The property values.
  22419. * @param {Function} assignFunc The function to assign values.
  22420. * @returns {Object} Returns the new object.
  22421. */
  22422. function baseZipObject(props, values, assignFunc) {
  22423. var index = -1,
  22424. length = props.length,
  22425. valsLength = values.length,
  22426. result = {};
  22427. while (++index < length) {
  22428. var value = index < valsLength ? values[index] : undefined;
  22429. assignFunc(result, props[index], value);
  22430. }
  22431. return result;
  22432. }
  22433. /**
  22434. * Casts `value` to an empty array if it's not an array like object.
  22435. *
  22436. * @private
  22437. * @param {*} value The value to inspect.
  22438. * @returns {Array|Object} Returns the cast array-like object.
  22439. */
  22440. function castArrayLikeObject(value) {
  22441. return isArrayLikeObject(value) ? value : [];
  22442. }
  22443. /**
  22444. * Casts `value` to `identity` if it's not a function.
  22445. *
  22446. * @private
  22447. * @param {*} value The value to inspect.
  22448. * @returns {Function} Returns cast function.
  22449. */
  22450. function castFunction(value) {
  22451. return typeof value == 'function' ? value : identity;
  22452. }
  22453. /**
  22454. * Casts `value` to a path array if it's not one.
  22455. *
  22456. * @private
  22457. * @param {*} value The value to inspect.
  22458. * @param {Object} [object] The object to query keys on.
  22459. * @returns {Array} Returns the cast property path array.
  22460. */
  22461. function castPath(value, object) {
  22462. if (isArray(value)) {
  22463. return value;
  22464. }
  22465. return isKey(value, object) ? [value] : stringToPath(toString(value));
  22466. }
  22467. /**
  22468. * A `baseRest` alias which can be replaced with `identity` by module
  22469. * replacement plugins.
  22470. *
  22471. * @private
  22472. * @type {Function}
  22473. * @param {Function} func The function to apply a rest parameter to.
  22474. * @returns {Function} Returns the new function.
  22475. */
  22476. var castRest = baseRest;
  22477. /**
  22478. * Casts `array` to a slice if it's needed.
  22479. *
  22480. * @private
  22481. * @param {Array} array The array to inspect.
  22482. * @param {number} start The start position.
  22483. * @param {number} [end=array.length] The end position.
  22484. * @returns {Array} Returns the cast slice.
  22485. */
  22486. function castSlice(array, start, end) {
  22487. var length = array.length;
  22488. end = end === undefined ? length : end;
  22489. return (!start && end >= length) ? array : baseSlice(array, start, end);
  22490. }
  22491. /**
  22492. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  22493. *
  22494. * @private
  22495. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  22496. */
  22497. var clearTimeout = ctxClearTimeout || function(id) {
  22498. return root.clearTimeout(id);
  22499. };
  22500. /**
  22501. * Creates a clone of `buffer`.
  22502. *
  22503. * @private
  22504. * @param {Buffer} buffer The buffer to clone.
  22505. * @param {boolean} [isDeep] Specify a deep clone.
  22506. * @returns {Buffer} Returns the cloned buffer.
  22507. */
  22508. function cloneBuffer(buffer, isDeep) {
  22509. if (isDeep) {
  22510. return buffer.slice();
  22511. }
  22512. var length = buffer.length,
  22513. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  22514. buffer.copy(result);
  22515. return result;
  22516. }
  22517. /**
  22518. * Creates a clone of `arrayBuffer`.
  22519. *
  22520. * @private
  22521. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  22522. * @returns {ArrayBuffer} Returns the cloned array buffer.
  22523. */
  22524. function cloneArrayBuffer(arrayBuffer) {
  22525. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  22526. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  22527. return result;
  22528. }
  22529. /**
  22530. * Creates a clone of `dataView`.
  22531. *
  22532. * @private
  22533. * @param {Object} dataView The data view to clone.
  22534. * @param {boolean} [isDeep] Specify a deep clone.
  22535. * @returns {Object} Returns the cloned data view.
  22536. */
  22537. function cloneDataView(dataView, isDeep) {
  22538. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  22539. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  22540. }
  22541. /**
  22542. * Creates a clone of `regexp`.
  22543. *
  22544. * @private
  22545. * @param {Object} regexp The regexp to clone.
  22546. * @returns {Object} Returns the cloned regexp.
  22547. */
  22548. function cloneRegExp(regexp) {
  22549. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  22550. result.lastIndex = regexp.lastIndex;
  22551. return result;
  22552. }
  22553. /**
  22554. * Creates a clone of the `symbol` object.
  22555. *
  22556. * @private
  22557. * @param {Object} symbol The symbol object to clone.
  22558. * @returns {Object} Returns the cloned symbol object.
  22559. */
  22560. function cloneSymbol(symbol) {
  22561. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  22562. }
  22563. /**
  22564. * Creates a clone of `typedArray`.
  22565. *
  22566. * @private
  22567. * @param {Object} typedArray The typed array to clone.
  22568. * @param {boolean} [isDeep] Specify a deep clone.
  22569. * @returns {Object} Returns the cloned typed array.
  22570. */
  22571. function cloneTypedArray(typedArray, isDeep) {
  22572. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  22573. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  22574. }
  22575. /**
  22576. * Compares values to sort them in ascending order.
  22577. *
  22578. * @private
  22579. * @param {*} value The value to compare.
  22580. * @param {*} other The other value to compare.
  22581. * @returns {number} Returns the sort order indicator for `value`.
  22582. */
  22583. function compareAscending(value, other) {
  22584. if (value !== other) {
  22585. var valIsDefined = value !== undefined,
  22586. valIsNull = value === null,
  22587. valIsReflexive = value === value,
  22588. valIsSymbol = isSymbol(value);
  22589. var othIsDefined = other !== undefined,
  22590. othIsNull = other === null,
  22591. othIsReflexive = other === other,
  22592. othIsSymbol = isSymbol(other);
  22593. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  22594. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  22595. (valIsNull && othIsDefined && othIsReflexive) ||
  22596. (!valIsDefined && othIsReflexive) ||
  22597. !valIsReflexive) {
  22598. return 1;
  22599. }
  22600. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  22601. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  22602. (othIsNull && valIsDefined && valIsReflexive) ||
  22603. (!othIsDefined && valIsReflexive) ||
  22604. !othIsReflexive) {
  22605. return -1;
  22606. }
  22607. }
  22608. return 0;
  22609. }
  22610. /**
  22611. * Used by `_.orderBy` to compare multiple properties of a value to another
  22612. * and stable sort them.
  22613. *
  22614. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  22615. * specify an order of "desc" for descending or "asc" for ascending sort order
  22616. * of corresponding values.
  22617. *
  22618. * @private
  22619. * @param {Object} object The object to compare.
  22620. * @param {Object} other The other object to compare.
  22621. * @param {boolean[]|string[]} orders The order to sort by for each property.
  22622. * @returns {number} Returns the sort order indicator for `object`.
  22623. */
  22624. function compareMultiple(object, other, orders) {
  22625. var index = -1,
  22626. objCriteria = object.criteria,
  22627. othCriteria = other.criteria,
  22628. length = objCriteria.length,
  22629. ordersLength = orders.length;
  22630. while (++index < length) {
  22631. var result = compareAscending(objCriteria[index], othCriteria[index]);
  22632. if (result) {
  22633. if (index >= ordersLength) {
  22634. return result;
  22635. }
  22636. var order = orders[index];
  22637. return result * (order == 'desc' ? -1 : 1);
  22638. }
  22639. }
  22640. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  22641. // that causes it, under certain circumstances, to provide the same value for
  22642. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  22643. // for more details.
  22644. //
  22645. // This also ensures a stable sort in V8 and other engines.
  22646. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  22647. return object.index - other.index;
  22648. }
  22649. /**
  22650. * Creates an array that is the composition of partially applied arguments,
  22651. * placeholders, and provided arguments into a single array of arguments.
  22652. *
  22653. * @private
  22654. * @param {Array} args The provided arguments.
  22655. * @param {Array} partials The arguments to prepend to those provided.
  22656. * @param {Array} holders The `partials` placeholder indexes.
  22657. * @params {boolean} [isCurried] Specify composing for a curried function.
  22658. * @returns {Array} Returns the new array of composed arguments.
  22659. */
  22660. function composeArgs(args, partials, holders, isCurried) {
  22661. var argsIndex = -1,
  22662. argsLength = args.length,
  22663. holdersLength = holders.length,
  22664. leftIndex = -1,
  22665. leftLength = partials.length,
  22666. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22667. result = Array(leftLength + rangeLength),
  22668. isUncurried = !isCurried;
  22669. while (++leftIndex < leftLength) {
  22670. result[leftIndex] = partials[leftIndex];
  22671. }
  22672. while (++argsIndex < holdersLength) {
  22673. if (isUncurried || argsIndex < argsLength) {
  22674. result[holders[argsIndex]] = args[argsIndex];
  22675. }
  22676. }
  22677. while (rangeLength--) {
  22678. result[leftIndex++] = args[argsIndex++];
  22679. }
  22680. return result;
  22681. }
  22682. /**
  22683. * This function is like `composeArgs` except that the arguments composition
  22684. * is tailored for `_.partialRight`.
  22685. *
  22686. * @private
  22687. * @param {Array} args The provided arguments.
  22688. * @param {Array} partials The arguments to append to those provided.
  22689. * @param {Array} holders The `partials` placeholder indexes.
  22690. * @params {boolean} [isCurried] Specify composing for a curried function.
  22691. * @returns {Array} Returns the new array of composed arguments.
  22692. */
  22693. function composeArgsRight(args, partials, holders, isCurried) {
  22694. var argsIndex = -1,
  22695. argsLength = args.length,
  22696. holdersIndex = -1,
  22697. holdersLength = holders.length,
  22698. rightIndex = -1,
  22699. rightLength = partials.length,
  22700. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22701. result = Array(rangeLength + rightLength),
  22702. isUncurried = !isCurried;
  22703. while (++argsIndex < rangeLength) {
  22704. result[argsIndex] = args[argsIndex];
  22705. }
  22706. var offset = argsIndex;
  22707. while (++rightIndex < rightLength) {
  22708. result[offset + rightIndex] = partials[rightIndex];
  22709. }
  22710. while (++holdersIndex < holdersLength) {
  22711. if (isUncurried || argsIndex < argsLength) {
  22712. result[offset + holders[holdersIndex]] = args[argsIndex++];
  22713. }
  22714. }
  22715. return result;
  22716. }
  22717. /**
  22718. * Copies the values of `source` to `array`.
  22719. *
  22720. * @private
  22721. * @param {Array} source The array to copy values from.
  22722. * @param {Array} [array=[]] The array to copy values to.
  22723. * @returns {Array} Returns `array`.
  22724. */
  22725. function copyArray(source, array) {
  22726. var index = -1,
  22727. length = source.length;
  22728. array || (array = Array(length));
  22729. while (++index < length) {
  22730. array[index] = source[index];
  22731. }
  22732. return array;
  22733. }
  22734. /**
  22735. * Copies properties of `source` to `object`.
  22736. *
  22737. * @private
  22738. * @param {Object} source The object to copy properties from.
  22739. * @param {Array} props The property identifiers to copy.
  22740. * @param {Object} [object={}] The object to copy properties to.
  22741. * @param {Function} [customizer] The function to customize copied values.
  22742. * @returns {Object} Returns `object`.
  22743. */
  22744. function copyObject(source, props, object, customizer) {
  22745. var isNew = !object;
  22746. object || (object = {});
  22747. var index = -1,
  22748. length = props.length;
  22749. while (++index < length) {
  22750. var key = props[index];
  22751. var newValue = customizer
  22752. ? customizer(object[key], source[key], key, object, source)
  22753. : undefined;
  22754. if (newValue === undefined) {
  22755. newValue = source[key];
  22756. }
  22757. if (isNew) {
  22758. baseAssignValue(object, key, newValue);
  22759. } else {
  22760. assignValue(object, key, newValue);
  22761. }
  22762. }
  22763. return object;
  22764. }
  22765. /**
  22766. * Copies own symbols of `source` to `object`.
  22767. *
  22768. * @private
  22769. * @param {Object} source The object to copy symbols from.
  22770. * @param {Object} [object={}] The object to copy symbols to.
  22771. * @returns {Object} Returns `object`.
  22772. */
  22773. function copySymbols(source, object) {
  22774. return copyObject(source, getSymbols(source), object);
  22775. }
  22776. /**
  22777. * Copies own and inherited symbols of `source` to `object`.
  22778. *
  22779. * @private
  22780. * @param {Object} source The object to copy symbols from.
  22781. * @param {Object} [object={}] The object to copy symbols to.
  22782. * @returns {Object} Returns `object`.
  22783. */
  22784. function copySymbolsIn(source, object) {
  22785. return copyObject(source, getSymbolsIn(source), object);
  22786. }
  22787. /**
  22788. * Creates a function like `_.groupBy`.
  22789. *
  22790. * @private
  22791. * @param {Function} setter The function to set accumulator values.
  22792. * @param {Function} [initializer] The accumulator object initializer.
  22793. * @returns {Function} Returns the new aggregator function.
  22794. */
  22795. function createAggregator(setter, initializer) {
  22796. return function(collection, iteratee) {
  22797. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  22798. accumulator = initializer ? initializer() : {};
  22799. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  22800. };
  22801. }
  22802. /**
  22803. * Creates a function like `_.assign`.
  22804. *
  22805. * @private
  22806. * @param {Function} assigner The function to assign values.
  22807. * @returns {Function} Returns the new assigner function.
  22808. */
  22809. function createAssigner(assigner) {
  22810. return baseRest(function(object, sources) {
  22811. var index = -1,
  22812. length = sources.length,
  22813. customizer = length > 1 ? sources[length - 1] : undefined,
  22814. guard = length > 2 ? sources[2] : undefined;
  22815. customizer = (assigner.length > 3 && typeof customizer == 'function')
  22816. ? (length--, customizer)
  22817. : undefined;
  22818. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  22819. customizer = length < 3 ? undefined : customizer;
  22820. length = 1;
  22821. }
  22822. object = Object(object);
  22823. while (++index < length) {
  22824. var source = sources[index];
  22825. if (source) {
  22826. assigner(object, source, index, customizer);
  22827. }
  22828. }
  22829. return object;
  22830. });
  22831. }
  22832. /**
  22833. * Creates a `baseEach` or `baseEachRight` function.
  22834. *
  22835. * @private
  22836. * @param {Function} eachFunc The function to iterate over a collection.
  22837. * @param {boolean} [fromRight] Specify iterating from right to left.
  22838. * @returns {Function} Returns the new base function.
  22839. */
  22840. function createBaseEach(eachFunc, fromRight) {
  22841. return function(collection, iteratee) {
  22842. if (collection == null) {
  22843. return collection;
  22844. }
  22845. if (!isArrayLike(collection)) {
  22846. return eachFunc(collection, iteratee);
  22847. }
  22848. var length = collection.length,
  22849. index = fromRight ? length : -1,
  22850. iterable = Object(collection);
  22851. while ((fromRight ? index-- : ++index < length)) {
  22852. if (iteratee(iterable[index], index, iterable) === false) {
  22853. break;
  22854. }
  22855. }
  22856. return collection;
  22857. };
  22858. }
  22859. /**
  22860. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  22861. *
  22862. * @private
  22863. * @param {boolean} [fromRight] Specify iterating from right to left.
  22864. * @returns {Function} Returns the new base function.
  22865. */
  22866. function createBaseFor(fromRight) {
  22867. return function(object, iteratee, keysFunc) {
  22868. var index = -1,
  22869. iterable = Object(object),
  22870. props = keysFunc(object),
  22871. length = props.length;
  22872. while (length--) {
  22873. var key = props[fromRight ? length : ++index];
  22874. if (iteratee(iterable[key], key, iterable) === false) {
  22875. break;
  22876. }
  22877. }
  22878. return object;
  22879. };
  22880. }
  22881. /**
  22882. * Creates a function that wraps `func` to invoke it with the optional `this`
  22883. * binding of `thisArg`.
  22884. *
  22885. * @private
  22886. * @param {Function} func The function to wrap.
  22887. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22888. * @param {*} [thisArg] The `this` binding of `func`.
  22889. * @returns {Function} Returns the new wrapped function.
  22890. */
  22891. function createBind(func, bitmask, thisArg) {
  22892. var isBind = bitmask & WRAP_BIND_FLAG,
  22893. Ctor = createCtor(func);
  22894. function wrapper() {
  22895. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22896. return fn.apply(isBind ? thisArg : this, arguments);
  22897. }
  22898. return wrapper;
  22899. }
  22900. /**
  22901. * Creates a function like `_.lowerFirst`.
  22902. *
  22903. * @private
  22904. * @param {string} methodName The name of the `String` case method to use.
  22905. * @returns {Function} Returns the new case function.
  22906. */
  22907. function createCaseFirst(methodName) {
  22908. return function(string) {
  22909. string = toString(string);
  22910. var strSymbols = hasUnicode(string)
  22911. ? stringToArray(string)
  22912. : undefined;
  22913. var chr = strSymbols
  22914. ? strSymbols[0]
  22915. : string.charAt(0);
  22916. var trailing = strSymbols
  22917. ? castSlice(strSymbols, 1).join('')
  22918. : string.slice(1);
  22919. return chr[methodName]() + trailing;
  22920. };
  22921. }
  22922. /**
  22923. * Creates a function like `_.camelCase`.
  22924. *
  22925. * @private
  22926. * @param {Function} callback The function to combine each word.
  22927. * @returns {Function} Returns the new compounder function.
  22928. */
  22929. function createCompounder(callback) {
  22930. return function(string) {
  22931. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  22932. };
  22933. }
  22934. /**
  22935. * Creates a function that produces an instance of `Ctor` regardless of
  22936. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  22937. *
  22938. * @private
  22939. * @param {Function} Ctor The constructor to wrap.
  22940. * @returns {Function} Returns the new wrapped function.
  22941. */
  22942. function createCtor(Ctor) {
  22943. return function() {
  22944. // Use a `switch` statement to work with class constructors. See
  22945. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  22946. // for more details.
  22947. var args = arguments;
  22948. switch (args.length) {
  22949. case 0: return new Ctor;
  22950. case 1: return new Ctor(args[0]);
  22951. case 2: return new Ctor(args[0], args[1]);
  22952. case 3: return new Ctor(args[0], args[1], args[2]);
  22953. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  22954. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  22955. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  22956. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  22957. }
  22958. var thisBinding = baseCreate(Ctor.prototype),
  22959. result = Ctor.apply(thisBinding, args);
  22960. // Mimic the constructor's `return` behavior.
  22961. // See https://es5.github.io/#x13.2.2 for more details.
  22962. return isObject(result) ? result : thisBinding;
  22963. };
  22964. }
  22965. /**
  22966. * Creates a function that wraps `func` to enable currying.
  22967. *
  22968. * @private
  22969. * @param {Function} func The function to wrap.
  22970. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22971. * @param {number} arity The arity of `func`.
  22972. * @returns {Function} Returns the new wrapped function.
  22973. */
  22974. function createCurry(func, bitmask, arity) {
  22975. var Ctor = createCtor(func);
  22976. function wrapper() {
  22977. var length = arguments.length,
  22978. args = Array(length),
  22979. index = length,
  22980. placeholder = getHolder(wrapper);
  22981. while (index--) {
  22982. args[index] = arguments[index];
  22983. }
  22984. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  22985. ? []
  22986. : replaceHolders(args, placeholder);
  22987. length -= holders.length;
  22988. if (length < arity) {
  22989. return createRecurry(
  22990. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  22991. args, holders, undefined, undefined, arity - length);
  22992. }
  22993. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22994. return apply(fn, this, args);
  22995. }
  22996. return wrapper;
  22997. }
  22998. /**
  22999. * Creates a `_.find` or `_.findLast` function.
  23000. *
  23001. * @private
  23002. * @param {Function} findIndexFunc The function to find the collection index.
  23003. * @returns {Function} Returns the new find function.
  23004. */
  23005. function createFind(findIndexFunc) {
  23006. return function(collection, predicate, fromIndex) {
  23007. var iterable = Object(collection);
  23008. if (!isArrayLike(collection)) {
  23009. var iteratee = getIteratee(predicate, 3);
  23010. collection = keys(collection);
  23011. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  23012. }
  23013. var index = findIndexFunc(collection, predicate, fromIndex);
  23014. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  23015. };
  23016. }
  23017. /**
  23018. * Creates a `_.flow` or `_.flowRight` function.
  23019. *
  23020. * @private
  23021. * @param {boolean} [fromRight] Specify iterating from right to left.
  23022. * @returns {Function} Returns the new flow function.
  23023. */
  23024. function createFlow(fromRight) {
  23025. return flatRest(function(funcs) {
  23026. var length = funcs.length,
  23027. index = length,
  23028. prereq = LodashWrapper.prototype.thru;
  23029. if (fromRight) {
  23030. funcs.reverse();
  23031. }
  23032. while (index--) {
  23033. var func = funcs[index];
  23034. if (typeof func != 'function') {
  23035. throw new TypeError(FUNC_ERROR_TEXT);
  23036. }
  23037. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  23038. var wrapper = new LodashWrapper([], true);
  23039. }
  23040. }
  23041. index = wrapper ? index : length;
  23042. while (++index < length) {
  23043. func = funcs[index];
  23044. var funcName = getFuncName(func),
  23045. data = funcName == 'wrapper' ? getData(func) : undefined;
  23046. if (data && isLaziable(data[0]) &&
  23047. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  23048. !data[4].length && data[9] == 1
  23049. ) {
  23050. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  23051. } else {
  23052. wrapper = (func.length == 1 && isLaziable(func))
  23053. ? wrapper[funcName]()
  23054. : wrapper.thru(func);
  23055. }
  23056. }
  23057. return function() {
  23058. var args = arguments,
  23059. value = args[0];
  23060. if (wrapper && args.length == 1 && isArray(value)) {
  23061. return wrapper.plant(value).value();
  23062. }
  23063. var index = 0,
  23064. result = length ? funcs[index].apply(this, args) : value;
  23065. while (++index < length) {
  23066. result = funcs[index].call(this, result);
  23067. }
  23068. return result;
  23069. };
  23070. });
  23071. }
  23072. /**
  23073. * Creates a function that wraps `func` to invoke it with optional `this`
  23074. * binding of `thisArg`, partial application, and currying.
  23075. *
  23076. * @private
  23077. * @param {Function|string} func The function or method name to wrap.
  23078. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23079. * @param {*} [thisArg] The `this` binding of `func`.
  23080. * @param {Array} [partials] The arguments to prepend to those provided to
  23081. * the new function.
  23082. * @param {Array} [holders] The `partials` placeholder indexes.
  23083. * @param {Array} [partialsRight] The arguments to append to those provided
  23084. * to the new function.
  23085. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  23086. * @param {Array} [argPos] The argument positions of the new function.
  23087. * @param {number} [ary] The arity cap of `func`.
  23088. * @param {number} [arity] The arity of `func`.
  23089. * @returns {Function} Returns the new wrapped function.
  23090. */
  23091. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  23092. var isAry = bitmask & WRAP_ARY_FLAG,
  23093. isBind = bitmask & WRAP_BIND_FLAG,
  23094. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  23095. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  23096. isFlip = bitmask & WRAP_FLIP_FLAG,
  23097. Ctor = isBindKey ? undefined : createCtor(func);
  23098. function wrapper() {
  23099. var length = arguments.length,
  23100. args = Array(length),
  23101. index = length;
  23102. while (index--) {
  23103. args[index] = arguments[index];
  23104. }
  23105. if (isCurried) {
  23106. var placeholder = getHolder(wrapper),
  23107. holdersCount = countHolders(args, placeholder);
  23108. }
  23109. if (partials) {
  23110. args = composeArgs(args, partials, holders, isCurried);
  23111. }
  23112. if (partialsRight) {
  23113. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  23114. }
  23115. length -= holdersCount;
  23116. if (isCurried && length < arity) {
  23117. var newHolders = replaceHolders(args, placeholder);
  23118. return createRecurry(
  23119. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  23120. args, newHolders, argPos, ary, arity - length
  23121. );
  23122. }
  23123. var thisBinding = isBind ? thisArg : this,
  23124. fn = isBindKey ? thisBinding[func] : func;
  23125. length = args.length;
  23126. if (argPos) {
  23127. args = reorder(args, argPos);
  23128. } else if (isFlip && length > 1) {
  23129. args.reverse();
  23130. }
  23131. if (isAry && ary < length) {
  23132. args.length = ary;
  23133. }
  23134. if (this && this !== root && this instanceof wrapper) {
  23135. fn = Ctor || createCtor(fn);
  23136. }
  23137. return fn.apply(thisBinding, args);
  23138. }
  23139. return wrapper;
  23140. }
  23141. /**
  23142. * Creates a function like `_.invertBy`.
  23143. *
  23144. * @private
  23145. * @param {Function} setter The function to set accumulator values.
  23146. * @param {Function} toIteratee The function to resolve iteratees.
  23147. * @returns {Function} Returns the new inverter function.
  23148. */
  23149. function createInverter(setter, toIteratee) {
  23150. return function(object, iteratee) {
  23151. return baseInverter(object, setter, toIteratee(iteratee), {});
  23152. };
  23153. }
  23154. /**
  23155. * Creates a function that performs a mathematical operation on two values.
  23156. *
  23157. * @private
  23158. * @param {Function} operator The function to perform the operation.
  23159. * @param {number} [defaultValue] The value used for `undefined` arguments.
  23160. * @returns {Function} Returns the new mathematical operation function.
  23161. */
  23162. function createMathOperation(operator, defaultValue) {
  23163. return function(value, other) {
  23164. var result;
  23165. if (value === undefined && other === undefined) {
  23166. return defaultValue;
  23167. }
  23168. if (value !== undefined) {
  23169. result = value;
  23170. }
  23171. if (other !== undefined) {
  23172. if (result === undefined) {
  23173. return other;
  23174. }
  23175. if (typeof value == 'string' || typeof other == 'string') {
  23176. value = baseToString(value);
  23177. other = baseToString(other);
  23178. } else {
  23179. value = baseToNumber(value);
  23180. other = baseToNumber(other);
  23181. }
  23182. result = operator(value, other);
  23183. }
  23184. return result;
  23185. };
  23186. }
  23187. /**
  23188. * Creates a function like `_.over`.
  23189. *
  23190. * @private
  23191. * @param {Function} arrayFunc The function to iterate over iteratees.
  23192. * @returns {Function} Returns the new over function.
  23193. */
  23194. function createOver(arrayFunc) {
  23195. return flatRest(function(iteratees) {
  23196. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  23197. return baseRest(function(args) {
  23198. var thisArg = this;
  23199. return arrayFunc(iteratees, function(iteratee) {
  23200. return apply(iteratee, thisArg, args);
  23201. });
  23202. });
  23203. });
  23204. }
  23205. /**
  23206. * Creates the padding for `string` based on `length`. The `chars` string
  23207. * is truncated if the number of characters exceeds `length`.
  23208. *
  23209. * @private
  23210. * @param {number} length The padding length.
  23211. * @param {string} [chars=' '] The string used as padding.
  23212. * @returns {string} Returns the padding for `string`.
  23213. */
  23214. function createPadding(length, chars) {
  23215. chars = chars === undefined ? ' ' : baseToString(chars);
  23216. var charsLength = chars.length;
  23217. if (charsLength < 2) {
  23218. return charsLength ? baseRepeat(chars, length) : chars;
  23219. }
  23220. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  23221. return hasUnicode(chars)
  23222. ? castSlice(stringToArray(result), 0, length).join('')
  23223. : result.slice(0, length);
  23224. }
  23225. /**
  23226. * Creates a function that wraps `func` to invoke it with the `this` binding
  23227. * of `thisArg` and `partials` prepended to the arguments it receives.
  23228. *
  23229. * @private
  23230. * @param {Function} func The function to wrap.
  23231. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23232. * @param {*} thisArg The `this` binding of `func`.
  23233. * @param {Array} partials The arguments to prepend to those provided to
  23234. * the new function.
  23235. * @returns {Function} Returns the new wrapped function.
  23236. */
  23237. function createPartial(func, bitmask, thisArg, partials) {
  23238. var isBind = bitmask & WRAP_BIND_FLAG,
  23239. Ctor = createCtor(func);
  23240. function wrapper() {
  23241. var argsIndex = -1,
  23242. argsLength = arguments.length,
  23243. leftIndex = -1,
  23244. leftLength = partials.length,
  23245. args = Array(leftLength + argsLength),
  23246. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23247. while (++leftIndex < leftLength) {
  23248. args[leftIndex] = partials[leftIndex];
  23249. }
  23250. while (argsLength--) {
  23251. args[leftIndex++] = arguments[++argsIndex];
  23252. }
  23253. return apply(fn, isBind ? thisArg : this, args);
  23254. }
  23255. return wrapper;
  23256. }
  23257. /**
  23258. * Creates a `_.range` or `_.rangeRight` function.
  23259. *
  23260. * @private
  23261. * @param {boolean} [fromRight] Specify iterating from right to left.
  23262. * @returns {Function} Returns the new range function.
  23263. */
  23264. function createRange(fromRight) {
  23265. return function(start, end, step) {
  23266. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  23267. end = step = undefined;
  23268. }
  23269. // Ensure the sign of `-0` is preserved.
  23270. start = toFinite(start);
  23271. if (end === undefined) {
  23272. end = start;
  23273. start = 0;
  23274. } else {
  23275. end = toFinite(end);
  23276. }
  23277. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  23278. return baseRange(start, end, step, fromRight);
  23279. };
  23280. }
  23281. /**
  23282. * Creates a function that performs a relational operation on two values.
  23283. *
  23284. * @private
  23285. * @param {Function} operator The function to perform the operation.
  23286. * @returns {Function} Returns the new relational operation function.
  23287. */
  23288. function createRelationalOperation(operator) {
  23289. return function(value, other) {
  23290. if (!(typeof value == 'string' && typeof other == 'string')) {
  23291. value = toNumber(value);
  23292. other = toNumber(other);
  23293. }
  23294. return operator(value, other);
  23295. };
  23296. }
  23297. /**
  23298. * Creates a function that wraps `func` to continue currying.
  23299. *
  23300. * @private
  23301. * @param {Function} func The function to wrap.
  23302. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23303. * @param {Function} wrapFunc The function to create the `func` wrapper.
  23304. * @param {*} placeholder The placeholder value.
  23305. * @param {*} [thisArg] The `this` binding of `func`.
  23306. * @param {Array} [partials] The arguments to prepend to those provided to
  23307. * the new function.
  23308. * @param {Array} [holders] The `partials` placeholder indexes.
  23309. * @param {Array} [argPos] The argument positions of the new function.
  23310. * @param {number} [ary] The arity cap of `func`.
  23311. * @param {number} [arity] The arity of `func`.
  23312. * @returns {Function} Returns the new wrapped function.
  23313. */
  23314. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  23315. var isCurry = bitmask & WRAP_CURRY_FLAG,
  23316. newHolders = isCurry ? holders : undefined,
  23317. newHoldersRight = isCurry ? undefined : holders,
  23318. newPartials = isCurry ? partials : undefined,
  23319. newPartialsRight = isCurry ? undefined : partials;
  23320. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  23321. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  23322. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  23323. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  23324. }
  23325. var newData = [
  23326. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  23327. newHoldersRight, argPos, ary, arity
  23328. ];
  23329. var result = wrapFunc.apply(undefined, newData);
  23330. if (isLaziable(func)) {
  23331. setData(result, newData);
  23332. }
  23333. result.placeholder = placeholder;
  23334. return setWrapToString(result, func, bitmask);
  23335. }
  23336. /**
  23337. * Creates a function like `_.round`.
  23338. *
  23339. * @private
  23340. * @param {string} methodName The name of the `Math` method to use when rounding.
  23341. * @returns {Function} Returns the new round function.
  23342. */
  23343. function createRound(methodName) {
  23344. var func = Math[methodName];
  23345. return function(number, precision) {
  23346. number = toNumber(number);
  23347. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  23348. if (precision && nativeIsFinite(number)) {
  23349. // Shift with exponential notation to avoid floating-point issues.
  23350. // See [MDN](https://mdn.io/round#Examples) for more details.
  23351. var pair = (toString(number) + 'e').split('e'),
  23352. value = func(pair[0] + 'e' + (+pair[1] + precision));
  23353. pair = (toString(value) + 'e').split('e');
  23354. return +(pair[0] + 'e' + (+pair[1] - precision));
  23355. }
  23356. return func(number);
  23357. };
  23358. }
  23359. /**
  23360. * Creates a set object of `values`.
  23361. *
  23362. * @private
  23363. * @param {Array} values The values to add to the set.
  23364. * @returns {Object} Returns the new set.
  23365. */
  23366. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  23367. return new Set(values);
  23368. };
  23369. /**
  23370. * Creates a `_.toPairs` or `_.toPairsIn` function.
  23371. *
  23372. * @private
  23373. * @param {Function} keysFunc The function to get the keys of a given object.
  23374. * @returns {Function} Returns the new pairs function.
  23375. */
  23376. function createToPairs(keysFunc) {
  23377. return function(object) {
  23378. var tag = getTag(object);
  23379. if (tag == mapTag) {
  23380. return mapToArray(object);
  23381. }
  23382. if (tag == setTag) {
  23383. return setToPairs(object);
  23384. }
  23385. return baseToPairs(object, keysFunc(object));
  23386. };
  23387. }
  23388. /**
  23389. * Creates a function that either curries or invokes `func` with optional
  23390. * `this` binding and partially applied arguments.
  23391. *
  23392. * @private
  23393. * @param {Function|string} func The function or method name to wrap.
  23394. * @param {number} bitmask The bitmask flags.
  23395. * 1 - `_.bind`
  23396. * 2 - `_.bindKey`
  23397. * 4 - `_.curry` or `_.curryRight` of a bound function
  23398. * 8 - `_.curry`
  23399. * 16 - `_.curryRight`
  23400. * 32 - `_.partial`
  23401. * 64 - `_.partialRight`
  23402. * 128 - `_.rearg`
  23403. * 256 - `_.ary`
  23404. * 512 - `_.flip`
  23405. * @param {*} [thisArg] The `this` binding of `func`.
  23406. * @param {Array} [partials] The arguments to be partially applied.
  23407. * @param {Array} [holders] The `partials` placeholder indexes.
  23408. * @param {Array} [argPos] The argument positions of the new function.
  23409. * @param {number} [ary] The arity cap of `func`.
  23410. * @param {number} [arity] The arity of `func`.
  23411. * @returns {Function} Returns the new wrapped function.
  23412. */
  23413. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  23414. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  23415. if (!isBindKey && typeof func != 'function') {
  23416. throw new TypeError(FUNC_ERROR_TEXT);
  23417. }
  23418. var length = partials ? partials.length : 0;
  23419. if (!length) {
  23420. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  23421. partials = holders = undefined;
  23422. }
  23423. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  23424. arity = arity === undefined ? arity : toInteger(arity);
  23425. length -= holders ? holders.length : 0;
  23426. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  23427. var partialsRight = partials,
  23428. holdersRight = holders;
  23429. partials = holders = undefined;
  23430. }
  23431. var data = isBindKey ? undefined : getData(func);
  23432. var newData = [
  23433. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  23434. argPos, ary, arity
  23435. ];
  23436. if (data) {
  23437. mergeData(newData, data);
  23438. }
  23439. func = newData[0];
  23440. bitmask = newData[1];
  23441. thisArg = newData[2];
  23442. partials = newData[3];
  23443. holders = newData[4];
  23444. arity = newData[9] = newData[9] === undefined
  23445. ? (isBindKey ? 0 : func.length)
  23446. : nativeMax(newData[9] - length, 0);
  23447. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  23448. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  23449. }
  23450. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  23451. var result = createBind(func, bitmask, thisArg);
  23452. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  23453. result = createCurry(func, bitmask, arity);
  23454. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  23455. result = createPartial(func, bitmask, thisArg, partials);
  23456. } else {
  23457. result = createHybrid.apply(undefined, newData);
  23458. }
  23459. var setter = data ? baseSetData : setData;
  23460. return setWrapToString(setter(result, newData), func, bitmask);
  23461. }
  23462. /**
  23463. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  23464. * of source objects to the destination object for all destination properties
  23465. * that resolve to `undefined`.
  23466. *
  23467. * @private
  23468. * @param {*} objValue The destination value.
  23469. * @param {*} srcValue The source value.
  23470. * @param {string} key The key of the property to assign.
  23471. * @param {Object} object The parent object of `objValue`.
  23472. * @returns {*} Returns the value to assign.
  23473. */
  23474. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  23475. if (objValue === undefined ||
  23476. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  23477. return srcValue;
  23478. }
  23479. return objValue;
  23480. }
  23481. /**
  23482. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  23483. * objects into destination objects that are passed thru.
  23484. *
  23485. * @private
  23486. * @param {*} objValue The destination value.
  23487. * @param {*} srcValue The source value.
  23488. * @param {string} key The key of the property to merge.
  23489. * @param {Object} object The parent object of `objValue`.
  23490. * @param {Object} source The parent object of `srcValue`.
  23491. * @param {Object} [stack] Tracks traversed source values and their merged
  23492. * counterparts.
  23493. * @returns {*} Returns the value to assign.
  23494. */
  23495. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  23496. if (isObject(objValue) && isObject(srcValue)) {
  23497. // Recursively merge objects and arrays (susceptible to call stack limits).
  23498. stack.set(srcValue, objValue);
  23499. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  23500. stack['delete'](srcValue);
  23501. }
  23502. return objValue;
  23503. }
  23504. /**
  23505. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  23506. * objects.
  23507. *
  23508. * @private
  23509. * @param {*} value The value to inspect.
  23510. * @param {string} key The key of the property to inspect.
  23511. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  23512. */
  23513. function customOmitClone(value) {
  23514. return isPlainObject(value) ? undefined : value;
  23515. }
  23516. /**
  23517. * A specialized version of `baseIsEqualDeep` for arrays with support for
  23518. * partial deep comparisons.
  23519. *
  23520. * @private
  23521. * @param {Array} array The array to compare.
  23522. * @param {Array} other The other array to compare.
  23523. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23524. * @param {Function} customizer The function to customize comparisons.
  23525. * @param {Function} equalFunc The function to determine equivalents of values.
  23526. * @param {Object} stack Tracks traversed `array` and `other` objects.
  23527. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  23528. */
  23529. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  23530. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23531. arrLength = array.length,
  23532. othLength = other.length;
  23533. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  23534. return false;
  23535. }
  23536. // Assume cyclic values are equal.
  23537. var stacked = stack.get(array);
  23538. if (stacked && stack.get(other)) {
  23539. return stacked == other;
  23540. }
  23541. var index = -1,
  23542. result = true,
  23543. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  23544. stack.set(array, other);
  23545. stack.set(other, array);
  23546. // Ignore non-index properties.
  23547. while (++index < arrLength) {
  23548. var arrValue = array[index],
  23549. othValue = other[index];
  23550. if (customizer) {
  23551. var compared = isPartial
  23552. ? customizer(othValue, arrValue, index, other, array, stack)
  23553. : customizer(arrValue, othValue, index, array, other, stack);
  23554. }
  23555. if (compared !== undefined) {
  23556. if (compared) {
  23557. continue;
  23558. }
  23559. result = false;
  23560. break;
  23561. }
  23562. // Recursively compare arrays (susceptible to call stack limits).
  23563. if (seen) {
  23564. if (!arraySome(other, function(othValue, othIndex) {
  23565. if (!cacheHas(seen, othIndex) &&
  23566. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  23567. return seen.push(othIndex);
  23568. }
  23569. })) {
  23570. result = false;
  23571. break;
  23572. }
  23573. } else if (!(
  23574. arrValue === othValue ||
  23575. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  23576. )) {
  23577. result = false;
  23578. break;
  23579. }
  23580. }
  23581. stack['delete'](array);
  23582. stack['delete'](other);
  23583. return result;
  23584. }
  23585. /**
  23586. * A specialized version of `baseIsEqualDeep` for comparing objects of
  23587. * the same `toStringTag`.
  23588. *
  23589. * **Note:** This function only supports comparing values with tags of
  23590. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  23591. *
  23592. * @private
  23593. * @param {Object} object The object to compare.
  23594. * @param {Object} other The other object to compare.
  23595. * @param {string} tag The `toStringTag` of the objects to compare.
  23596. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23597. * @param {Function} customizer The function to customize comparisons.
  23598. * @param {Function} equalFunc The function to determine equivalents of values.
  23599. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23600. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23601. */
  23602. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  23603. switch (tag) {
  23604. case dataViewTag:
  23605. if ((object.byteLength != other.byteLength) ||
  23606. (object.byteOffset != other.byteOffset)) {
  23607. return false;
  23608. }
  23609. object = object.buffer;
  23610. other = other.buffer;
  23611. case arrayBufferTag:
  23612. if ((object.byteLength != other.byteLength) ||
  23613. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  23614. return false;
  23615. }
  23616. return true;
  23617. case boolTag:
  23618. case dateTag:
  23619. case numberTag:
  23620. // Coerce booleans to `1` or `0` and dates to milliseconds.
  23621. // Invalid dates are coerced to `NaN`.
  23622. return eq(+object, +other);
  23623. case errorTag:
  23624. return object.name == other.name && object.message == other.message;
  23625. case regexpTag:
  23626. case stringTag:
  23627. // Coerce regexes to strings and treat strings, primitives and objects,
  23628. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  23629. // for more details.
  23630. return object == (other + '');
  23631. case mapTag:
  23632. var convert = mapToArray;
  23633. case setTag:
  23634. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  23635. convert || (convert = setToArray);
  23636. if (object.size != other.size && !isPartial) {
  23637. return false;
  23638. }
  23639. // Assume cyclic values are equal.
  23640. var stacked = stack.get(object);
  23641. if (stacked) {
  23642. return stacked == other;
  23643. }
  23644. bitmask |= COMPARE_UNORDERED_FLAG;
  23645. // Recursively compare objects (susceptible to call stack limits).
  23646. stack.set(object, other);
  23647. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  23648. stack['delete'](object);
  23649. return result;
  23650. case symbolTag:
  23651. if (symbolValueOf) {
  23652. return symbolValueOf.call(object) == symbolValueOf.call(other);
  23653. }
  23654. }
  23655. return false;
  23656. }
  23657. /**
  23658. * A specialized version of `baseIsEqualDeep` for objects with support for
  23659. * partial deep comparisons.
  23660. *
  23661. * @private
  23662. * @param {Object} object The object to compare.
  23663. * @param {Object} other The other object to compare.
  23664. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23665. * @param {Function} customizer The function to customize comparisons.
  23666. * @param {Function} equalFunc The function to determine equivalents of values.
  23667. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23668. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23669. */
  23670. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  23671. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23672. objProps = getAllKeys(object),
  23673. objLength = objProps.length,
  23674. othProps = getAllKeys(other),
  23675. othLength = othProps.length;
  23676. if (objLength != othLength && !isPartial) {
  23677. return false;
  23678. }
  23679. var index = objLength;
  23680. while (index--) {
  23681. var key = objProps[index];
  23682. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  23683. return false;
  23684. }
  23685. }
  23686. // Assume cyclic values are equal.
  23687. var stacked = stack.get(object);
  23688. if (stacked && stack.get(other)) {
  23689. return stacked == other;
  23690. }
  23691. var result = true;
  23692. stack.set(object, other);
  23693. stack.set(other, object);
  23694. var skipCtor = isPartial;
  23695. while (++index < objLength) {
  23696. key = objProps[index];
  23697. var objValue = object[key],
  23698. othValue = other[key];
  23699. if (customizer) {
  23700. var compared = isPartial
  23701. ? customizer(othValue, objValue, key, other, object, stack)
  23702. : customizer(objValue, othValue, key, object, other, stack);
  23703. }
  23704. // Recursively compare objects (susceptible to call stack limits).
  23705. if (!(compared === undefined
  23706. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  23707. : compared
  23708. )) {
  23709. result = false;
  23710. break;
  23711. }
  23712. skipCtor || (skipCtor = key == 'constructor');
  23713. }
  23714. if (result && !skipCtor) {
  23715. var objCtor = object.constructor,
  23716. othCtor = other.constructor;
  23717. // Non `Object` object instances with different constructors are not equal.
  23718. if (objCtor != othCtor &&
  23719. ('constructor' in object && 'constructor' in other) &&
  23720. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  23721. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  23722. result = false;
  23723. }
  23724. }
  23725. stack['delete'](object);
  23726. stack['delete'](other);
  23727. return result;
  23728. }
  23729. /**
  23730. * A specialized version of `baseRest` which flattens the rest array.
  23731. *
  23732. * @private
  23733. * @param {Function} func The function to apply a rest parameter to.
  23734. * @returns {Function} Returns the new function.
  23735. */
  23736. function flatRest(func) {
  23737. return setToString(overRest(func, undefined, flatten), func + '');
  23738. }
  23739. /**
  23740. * Creates an array of own enumerable property names and symbols of `object`.
  23741. *
  23742. * @private
  23743. * @param {Object} object The object to query.
  23744. * @returns {Array} Returns the array of property names and symbols.
  23745. */
  23746. function getAllKeys(object) {
  23747. return baseGetAllKeys(object, keys, getSymbols);
  23748. }
  23749. /**
  23750. * Creates an array of own and inherited enumerable property names and
  23751. * symbols of `object`.
  23752. *
  23753. * @private
  23754. * @param {Object} object The object to query.
  23755. * @returns {Array} Returns the array of property names and symbols.
  23756. */
  23757. function getAllKeysIn(object) {
  23758. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  23759. }
  23760. /**
  23761. * Gets metadata for `func`.
  23762. *
  23763. * @private
  23764. * @param {Function} func The function to query.
  23765. * @returns {*} Returns the metadata for `func`.
  23766. */
  23767. var getData = !metaMap ? noop : function(func) {
  23768. return metaMap.get(func);
  23769. };
  23770. /**
  23771. * Gets the name of `func`.
  23772. *
  23773. * @private
  23774. * @param {Function} func The function to query.
  23775. * @returns {string} Returns the function name.
  23776. */
  23777. function getFuncName(func) {
  23778. var result = (func.name + ''),
  23779. array = realNames[result],
  23780. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  23781. while (length--) {
  23782. var data = array[length],
  23783. otherFunc = data.func;
  23784. if (otherFunc == null || otherFunc == func) {
  23785. return data.name;
  23786. }
  23787. }
  23788. return result;
  23789. }
  23790. /**
  23791. * Gets the argument placeholder value for `func`.
  23792. *
  23793. * @private
  23794. * @param {Function} func The function to inspect.
  23795. * @returns {*} Returns the placeholder value.
  23796. */
  23797. function getHolder(func) {
  23798. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  23799. return object.placeholder;
  23800. }
  23801. /**
  23802. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  23803. * this function returns the custom method, otherwise it returns `baseIteratee`.
  23804. * If arguments are provided, the chosen function is invoked with them and
  23805. * its result is returned.
  23806. *
  23807. * @private
  23808. * @param {*} [value] The value to convert to an iteratee.
  23809. * @param {number} [arity] The arity of the created iteratee.
  23810. * @returns {Function} Returns the chosen function or its result.
  23811. */
  23812. function getIteratee() {
  23813. var result = lodash.iteratee || iteratee;
  23814. result = result === iteratee ? baseIteratee : result;
  23815. return arguments.length ? result(arguments[0], arguments[1]) : result;
  23816. }
  23817. /**
  23818. * Gets the data for `map`.
  23819. *
  23820. * @private
  23821. * @param {Object} map The map to query.
  23822. * @param {string} key The reference key.
  23823. * @returns {*} Returns the map data.
  23824. */
  23825. function getMapData(map, key) {
  23826. var data = map.__data__;
  23827. return isKeyable(key)
  23828. ? data[typeof key == 'string' ? 'string' : 'hash']
  23829. : data.map;
  23830. }
  23831. /**
  23832. * Gets the property names, values, and compare flags of `object`.
  23833. *
  23834. * @private
  23835. * @param {Object} object The object to query.
  23836. * @returns {Array} Returns the match data of `object`.
  23837. */
  23838. function getMatchData(object) {
  23839. var result = keys(object),
  23840. length = result.length;
  23841. while (length--) {
  23842. var key = result[length],
  23843. value = object[key];
  23844. result[length] = [key, value, isStrictComparable(value)];
  23845. }
  23846. return result;
  23847. }
  23848. /**
  23849. * Gets the native function at `key` of `object`.
  23850. *
  23851. * @private
  23852. * @param {Object} object The object to query.
  23853. * @param {string} key The key of the method to get.
  23854. * @returns {*} Returns the function if it's native, else `undefined`.
  23855. */
  23856. function getNative(object, key) {
  23857. var value = getValue(object, key);
  23858. return baseIsNative(value) ? value : undefined;
  23859. }
  23860. /**
  23861. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  23862. *
  23863. * @private
  23864. * @param {*} value The value to query.
  23865. * @returns {string} Returns the raw `toStringTag`.
  23866. */
  23867. function getRawTag(value) {
  23868. var isOwn = hasOwnProperty.call(value, symToStringTag),
  23869. tag = value[symToStringTag];
  23870. try {
  23871. value[symToStringTag] = undefined;
  23872. var unmasked = true;
  23873. } catch (e) {}
  23874. var result = nativeObjectToString.call(value);
  23875. if (unmasked) {
  23876. if (isOwn) {
  23877. value[symToStringTag] = tag;
  23878. } else {
  23879. delete value[symToStringTag];
  23880. }
  23881. }
  23882. return result;
  23883. }
  23884. /**
  23885. * Creates an array of the own enumerable symbols of `object`.
  23886. *
  23887. * @private
  23888. * @param {Object} object The object to query.
  23889. * @returns {Array} Returns the array of symbols.
  23890. */
  23891. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  23892. if (object == null) {
  23893. return [];
  23894. }
  23895. object = Object(object);
  23896. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  23897. return propertyIsEnumerable.call(object, symbol);
  23898. });
  23899. };
  23900. /**
  23901. * Creates an array of the own and inherited enumerable symbols of `object`.
  23902. *
  23903. * @private
  23904. * @param {Object} object The object to query.
  23905. * @returns {Array} Returns the array of symbols.
  23906. */
  23907. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  23908. var result = [];
  23909. while (object) {
  23910. arrayPush(result, getSymbols(object));
  23911. object = getPrototype(object);
  23912. }
  23913. return result;
  23914. };
  23915. /**
  23916. * Gets the `toStringTag` of `value`.
  23917. *
  23918. * @private
  23919. * @param {*} value The value to query.
  23920. * @returns {string} Returns the `toStringTag`.
  23921. */
  23922. var getTag = baseGetTag;
  23923. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  23924. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  23925. (Map && getTag(new Map) != mapTag) ||
  23926. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  23927. (Set && getTag(new Set) != setTag) ||
  23928. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  23929. getTag = function(value) {
  23930. var result = baseGetTag(value),
  23931. Ctor = result == objectTag ? value.constructor : undefined,
  23932. ctorString = Ctor ? toSource(Ctor) : '';
  23933. if (ctorString) {
  23934. switch (ctorString) {
  23935. case dataViewCtorString: return dataViewTag;
  23936. case mapCtorString: return mapTag;
  23937. case promiseCtorString: return promiseTag;
  23938. case setCtorString: return setTag;
  23939. case weakMapCtorString: return weakMapTag;
  23940. }
  23941. }
  23942. return result;
  23943. };
  23944. }
  23945. /**
  23946. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  23947. *
  23948. * @private
  23949. * @param {number} start The start of the view.
  23950. * @param {number} end The end of the view.
  23951. * @param {Array} transforms The transformations to apply to the view.
  23952. * @returns {Object} Returns an object containing the `start` and `end`
  23953. * positions of the view.
  23954. */
  23955. function getView(start, end, transforms) {
  23956. var index = -1,
  23957. length = transforms.length;
  23958. while (++index < length) {
  23959. var data = transforms[index],
  23960. size = data.size;
  23961. switch (data.type) {
  23962. case 'drop': start += size; break;
  23963. case 'dropRight': end -= size; break;
  23964. case 'take': end = nativeMin(end, start + size); break;
  23965. case 'takeRight': start = nativeMax(start, end - size); break;
  23966. }
  23967. }
  23968. return { 'start': start, 'end': end };
  23969. }
  23970. /**
  23971. * Extracts wrapper details from the `source` body comment.
  23972. *
  23973. * @private
  23974. * @param {string} source The source to inspect.
  23975. * @returns {Array} Returns the wrapper details.
  23976. */
  23977. function getWrapDetails(source) {
  23978. var match = source.match(reWrapDetails);
  23979. return match ? match[1].split(reSplitDetails) : [];
  23980. }
  23981. /**
  23982. * Checks if `path` exists on `object`.
  23983. *
  23984. * @private
  23985. * @param {Object} object The object to query.
  23986. * @param {Array|string} path The path to check.
  23987. * @param {Function} hasFunc The function to check properties.
  23988. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  23989. */
  23990. function hasPath(object, path, hasFunc) {
  23991. path = castPath(path, object);
  23992. var index = -1,
  23993. length = path.length,
  23994. result = false;
  23995. while (++index < length) {
  23996. var key = toKey(path[index]);
  23997. if (!(result = object != null && hasFunc(object, key))) {
  23998. break;
  23999. }
  24000. object = object[key];
  24001. }
  24002. if (result || ++index != length) {
  24003. return result;
  24004. }
  24005. length = object == null ? 0 : object.length;
  24006. return !!length && isLength(length) && isIndex(key, length) &&
  24007. (isArray(object) || isArguments(object));
  24008. }
  24009. /**
  24010. * Initializes an array clone.
  24011. *
  24012. * @private
  24013. * @param {Array} array The array to clone.
  24014. * @returns {Array} Returns the initialized clone.
  24015. */
  24016. function initCloneArray(array) {
  24017. var length = array.length,
  24018. result = new array.constructor(length);
  24019. // Add properties assigned by `RegExp#exec`.
  24020. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  24021. result.index = array.index;
  24022. result.input = array.input;
  24023. }
  24024. return result;
  24025. }
  24026. /**
  24027. * Initializes an object clone.
  24028. *
  24029. * @private
  24030. * @param {Object} object The object to clone.
  24031. * @returns {Object} Returns the initialized clone.
  24032. */
  24033. function initCloneObject(object) {
  24034. return (typeof object.constructor == 'function' && !isPrototype(object))
  24035. ? baseCreate(getPrototype(object))
  24036. : {};
  24037. }
  24038. /**
  24039. * Initializes an object clone based on its `toStringTag`.
  24040. *
  24041. * **Note:** This function only supports cloning values with tags of
  24042. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  24043. *
  24044. * @private
  24045. * @param {Object} object The object to clone.
  24046. * @param {string} tag The `toStringTag` of the object to clone.
  24047. * @param {boolean} [isDeep] Specify a deep clone.
  24048. * @returns {Object} Returns the initialized clone.
  24049. */
  24050. function initCloneByTag(object, tag, isDeep) {
  24051. var Ctor = object.constructor;
  24052. switch (tag) {
  24053. case arrayBufferTag:
  24054. return cloneArrayBuffer(object);
  24055. case boolTag:
  24056. case dateTag:
  24057. return new Ctor(+object);
  24058. case dataViewTag:
  24059. return cloneDataView(object, isDeep);
  24060. case float32Tag: case float64Tag:
  24061. case int8Tag: case int16Tag: case int32Tag:
  24062. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  24063. return cloneTypedArray(object, isDeep);
  24064. case mapTag:
  24065. return new Ctor;
  24066. case numberTag:
  24067. case stringTag:
  24068. return new Ctor(object);
  24069. case regexpTag:
  24070. return cloneRegExp(object);
  24071. case setTag:
  24072. return new Ctor;
  24073. case symbolTag:
  24074. return cloneSymbol(object);
  24075. }
  24076. }
  24077. /**
  24078. * Inserts wrapper `details` in a comment at the top of the `source` body.
  24079. *
  24080. * @private
  24081. * @param {string} source The source to modify.
  24082. * @returns {Array} details The details to insert.
  24083. * @returns {string} Returns the modified source.
  24084. */
  24085. function insertWrapDetails(source, details) {
  24086. var length = details.length;
  24087. if (!length) {
  24088. return source;
  24089. }
  24090. var lastIndex = length - 1;
  24091. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  24092. details = details.join(length > 2 ? ', ' : ' ');
  24093. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  24094. }
  24095. /**
  24096. * Checks if `value` is a flattenable `arguments` object or array.
  24097. *
  24098. * @private
  24099. * @param {*} value The value to check.
  24100. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  24101. */
  24102. function isFlattenable(value) {
  24103. return isArray(value) || isArguments(value) ||
  24104. !!(spreadableSymbol && value && value[spreadableSymbol]);
  24105. }
  24106. /**
  24107. * Checks if `value` is a valid array-like index.
  24108. *
  24109. * @private
  24110. * @param {*} value The value to check.
  24111. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  24112. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  24113. */
  24114. function isIndex(value, length) {
  24115. var type = typeof value;
  24116. length = length == null ? MAX_SAFE_INTEGER : length;
  24117. return !!length &&
  24118. (type == 'number' ||
  24119. (type != 'symbol' && reIsUint.test(value))) &&
  24120. (value > -1 && value % 1 == 0 && value < length);
  24121. }
  24122. /**
  24123. * Checks if the given arguments are from an iteratee call.
  24124. *
  24125. * @private
  24126. * @param {*} value The potential iteratee value argument.
  24127. * @param {*} index The potential iteratee index or key argument.
  24128. * @param {*} object The potential iteratee object argument.
  24129. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  24130. * else `false`.
  24131. */
  24132. function isIterateeCall(value, index, object) {
  24133. if (!isObject(object)) {
  24134. return false;
  24135. }
  24136. var type = typeof index;
  24137. if (type == 'number'
  24138. ? (isArrayLike(object) && isIndex(index, object.length))
  24139. : (type == 'string' && index in object)
  24140. ) {
  24141. return eq(object[index], value);
  24142. }
  24143. return false;
  24144. }
  24145. /**
  24146. * Checks if `value` is a property name and not a property path.
  24147. *
  24148. * @private
  24149. * @param {*} value The value to check.
  24150. * @param {Object} [object] The object to query keys on.
  24151. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  24152. */
  24153. function isKey(value, object) {
  24154. if (isArray(value)) {
  24155. return false;
  24156. }
  24157. var type = typeof value;
  24158. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  24159. value == null || isSymbol(value)) {
  24160. return true;
  24161. }
  24162. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  24163. (object != null && value in Object(object));
  24164. }
  24165. /**
  24166. * Checks if `value` is suitable for use as unique object key.
  24167. *
  24168. * @private
  24169. * @param {*} value The value to check.
  24170. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  24171. */
  24172. function isKeyable(value) {
  24173. var type = typeof value;
  24174. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  24175. ? (value !== '__proto__')
  24176. : (value === null);
  24177. }
  24178. /**
  24179. * Checks if `func` has a lazy counterpart.
  24180. *
  24181. * @private
  24182. * @param {Function} func The function to check.
  24183. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  24184. * else `false`.
  24185. */
  24186. function isLaziable(func) {
  24187. var funcName = getFuncName(func),
  24188. other = lodash[funcName];
  24189. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  24190. return false;
  24191. }
  24192. if (func === other) {
  24193. return true;
  24194. }
  24195. var data = getData(other);
  24196. return !!data && func === data[0];
  24197. }
  24198. /**
  24199. * Checks if `func` has its source masked.
  24200. *
  24201. * @private
  24202. * @param {Function} func The function to check.
  24203. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  24204. */
  24205. function isMasked(func) {
  24206. return !!maskSrcKey && (maskSrcKey in func);
  24207. }
  24208. /**
  24209. * Checks if `func` is capable of being masked.
  24210. *
  24211. * @private
  24212. * @param {*} value The value to check.
  24213. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  24214. */
  24215. var isMaskable = coreJsData ? isFunction : stubFalse;
  24216. /**
  24217. * Checks if `value` is likely a prototype object.
  24218. *
  24219. * @private
  24220. * @param {*} value The value to check.
  24221. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  24222. */
  24223. function isPrototype(value) {
  24224. var Ctor = value && value.constructor,
  24225. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  24226. return value === proto;
  24227. }
  24228. /**
  24229. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  24230. *
  24231. * @private
  24232. * @param {*} value The value to check.
  24233. * @returns {boolean} Returns `true` if `value` if suitable for strict
  24234. * equality comparisons, else `false`.
  24235. */
  24236. function isStrictComparable(value) {
  24237. return value === value && !isObject(value);
  24238. }
  24239. /**
  24240. * A specialized version of `matchesProperty` for source values suitable
  24241. * for strict equality comparisons, i.e. `===`.
  24242. *
  24243. * @private
  24244. * @param {string} key The key of the property to get.
  24245. * @param {*} srcValue The value to match.
  24246. * @returns {Function} Returns the new spec function.
  24247. */
  24248. function matchesStrictComparable(key, srcValue) {
  24249. return function(object) {
  24250. if (object == null) {
  24251. return false;
  24252. }
  24253. return object[key] === srcValue &&
  24254. (srcValue !== undefined || (key in Object(object)));
  24255. };
  24256. }
  24257. /**
  24258. * A specialized version of `_.memoize` which clears the memoized function's
  24259. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  24260. *
  24261. * @private
  24262. * @param {Function} func The function to have its output memoized.
  24263. * @returns {Function} Returns the new memoized function.
  24264. */
  24265. function memoizeCapped(func) {
  24266. var result = memoize(func, function(key) {
  24267. if (cache.size === MAX_MEMOIZE_SIZE) {
  24268. cache.clear();
  24269. }
  24270. return key;
  24271. });
  24272. var cache = result.cache;
  24273. return result;
  24274. }
  24275. /**
  24276. * Merges the function metadata of `source` into `data`.
  24277. *
  24278. * Merging metadata reduces the number of wrappers used to invoke a function.
  24279. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  24280. * may be applied regardless of execution order. Methods like `_.ary` and
  24281. * `_.rearg` modify function arguments, making the order in which they are
  24282. * executed important, preventing the merging of metadata. However, we make
  24283. * an exception for a safe combined case where curried functions have `_.ary`
  24284. * and or `_.rearg` applied.
  24285. *
  24286. * @private
  24287. * @param {Array} data The destination metadata.
  24288. * @param {Array} source The source metadata.
  24289. * @returns {Array} Returns `data`.
  24290. */
  24291. function mergeData(data, source) {
  24292. var bitmask = data[1],
  24293. srcBitmask = source[1],
  24294. newBitmask = bitmask | srcBitmask,
  24295. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  24296. var isCombo =
  24297. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  24298. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  24299. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  24300. // Exit early if metadata can't be merged.
  24301. if (!(isCommon || isCombo)) {
  24302. return data;
  24303. }
  24304. // Use source `thisArg` if available.
  24305. if (srcBitmask & WRAP_BIND_FLAG) {
  24306. data[2] = source[2];
  24307. // Set when currying a bound function.
  24308. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  24309. }
  24310. // Compose partial arguments.
  24311. var value = source[3];
  24312. if (value) {
  24313. var partials = data[3];
  24314. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  24315. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  24316. }
  24317. // Compose partial right arguments.
  24318. value = source[5];
  24319. if (value) {
  24320. partials = data[5];
  24321. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  24322. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  24323. }
  24324. // Use source `argPos` if available.
  24325. value = source[7];
  24326. if (value) {
  24327. data[7] = value;
  24328. }
  24329. // Use source `ary` if it's smaller.
  24330. if (srcBitmask & WRAP_ARY_FLAG) {
  24331. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  24332. }
  24333. // Use source `arity` if one is not provided.
  24334. if (data[9] == null) {
  24335. data[9] = source[9];
  24336. }
  24337. // Use source `func` and merge bitmasks.
  24338. data[0] = source[0];
  24339. data[1] = newBitmask;
  24340. return data;
  24341. }
  24342. /**
  24343. * This function is like
  24344. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  24345. * except that it includes inherited enumerable properties.
  24346. *
  24347. * @private
  24348. * @param {Object} object The object to query.
  24349. * @returns {Array} Returns the array of property names.
  24350. */
  24351. function nativeKeysIn(object) {
  24352. var result = [];
  24353. if (object != null) {
  24354. for (var key in Object(object)) {
  24355. result.push(key);
  24356. }
  24357. }
  24358. return result;
  24359. }
  24360. /**
  24361. * Converts `value` to a string using `Object.prototype.toString`.
  24362. *
  24363. * @private
  24364. * @param {*} value The value to convert.
  24365. * @returns {string} Returns the converted string.
  24366. */
  24367. function objectToString(value) {
  24368. return nativeObjectToString.call(value);
  24369. }
  24370. /**
  24371. * A specialized version of `baseRest` which transforms the rest array.
  24372. *
  24373. * @private
  24374. * @param {Function} func The function to apply a rest parameter to.
  24375. * @param {number} [start=func.length-1] The start position of the rest parameter.
  24376. * @param {Function} transform The rest array transform.
  24377. * @returns {Function} Returns the new function.
  24378. */
  24379. function overRest(func, start, transform) {
  24380. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  24381. return function() {
  24382. var args = arguments,
  24383. index = -1,
  24384. length = nativeMax(args.length - start, 0),
  24385. array = Array(length);
  24386. while (++index < length) {
  24387. array[index] = args[start + index];
  24388. }
  24389. index = -1;
  24390. var otherArgs = Array(start + 1);
  24391. while (++index < start) {
  24392. otherArgs[index] = args[index];
  24393. }
  24394. otherArgs[start] = transform(array);
  24395. return apply(func, this, otherArgs);
  24396. };
  24397. }
  24398. /**
  24399. * Gets the parent value at `path` of `object`.
  24400. *
  24401. * @private
  24402. * @param {Object} object The object to query.
  24403. * @param {Array} path The path to get the parent value of.
  24404. * @returns {*} Returns the parent value.
  24405. */
  24406. function parent(object, path) {
  24407. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  24408. }
  24409. /**
  24410. * Reorder `array` according to the specified indexes where the element at
  24411. * the first index is assigned as the first element, the element at
  24412. * the second index is assigned as the second element, and so on.
  24413. *
  24414. * @private
  24415. * @param {Array} array The array to reorder.
  24416. * @param {Array} indexes The arranged array indexes.
  24417. * @returns {Array} Returns `array`.
  24418. */
  24419. function reorder(array, indexes) {
  24420. var arrLength = array.length,
  24421. length = nativeMin(indexes.length, arrLength),
  24422. oldArray = copyArray(array);
  24423. while (length--) {
  24424. var index = indexes[length];
  24425. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  24426. }
  24427. return array;
  24428. }
  24429. /**
  24430. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  24431. *
  24432. * @private
  24433. * @param {Object} object The object to query.
  24434. * @param {string} key The key of the property to get.
  24435. * @returns {*} Returns the property value.
  24436. */
  24437. function safeGet(object, key) {
  24438. if (key === 'constructor' && typeof object[key] === 'function') {
  24439. return;
  24440. }
  24441. if (key == '__proto__') {
  24442. return;
  24443. }
  24444. return object[key];
  24445. }
  24446. /**
  24447. * Sets metadata for `func`.
  24448. *
  24449. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  24450. * period of time, it will trip its breaker and transition to an identity
  24451. * function to avoid garbage collection pauses in V8. See
  24452. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  24453. * for more details.
  24454. *
  24455. * @private
  24456. * @param {Function} func The function to associate metadata with.
  24457. * @param {*} data The metadata.
  24458. * @returns {Function} Returns `func`.
  24459. */
  24460. var setData = shortOut(baseSetData);
  24461. /**
  24462. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  24463. *
  24464. * @private
  24465. * @param {Function} func The function to delay.
  24466. * @param {number} wait The number of milliseconds to delay invocation.
  24467. * @returns {number|Object} Returns the timer id or timeout object.
  24468. */
  24469. var setTimeout = ctxSetTimeout || function(func, wait) {
  24470. return root.setTimeout(func, wait);
  24471. };
  24472. /**
  24473. * Sets the `toString` method of `func` to return `string`.
  24474. *
  24475. * @private
  24476. * @param {Function} func The function to modify.
  24477. * @param {Function} string The `toString` result.
  24478. * @returns {Function} Returns `func`.
  24479. */
  24480. var setToString = shortOut(baseSetToString);
  24481. /**
  24482. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  24483. * with wrapper details in a comment at the top of the source body.
  24484. *
  24485. * @private
  24486. * @param {Function} wrapper The function to modify.
  24487. * @param {Function} reference The reference function.
  24488. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24489. * @returns {Function} Returns `wrapper`.
  24490. */
  24491. function setWrapToString(wrapper, reference, bitmask) {
  24492. var source = (reference + '');
  24493. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  24494. }
  24495. /**
  24496. * Creates a function that'll short out and invoke `identity` instead
  24497. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  24498. * milliseconds.
  24499. *
  24500. * @private
  24501. * @param {Function} func The function to restrict.
  24502. * @returns {Function} Returns the new shortable function.
  24503. */
  24504. function shortOut(func) {
  24505. var count = 0,
  24506. lastCalled = 0;
  24507. return function() {
  24508. var stamp = nativeNow(),
  24509. remaining = HOT_SPAN - (stamp - lastCalled);
  24510. lastCalled = stamp;
  24511. if (remaining > 0) {
  24512. if (++count >= HOT_COUNT) {
  24513. return arguments[0];
  24514. }
  24515. } else {
  24516. count = 0;
  24517. }
  24518. return func.apply(undefined, arguments);
  24519. };
  24520. }
  24521. /**
  24522. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  24523. *
  24524. * @private
  24525. * @param {Array} array The array to shuffle.
  24526. * @param {number} [size=array.length] The size of `array`.
  24527. * @returns {Array} Returns `array`.
  24528. */
  24529. function shuffleSelf(array, size) {
  24530. var index = -1,
  24531. length = array.length,
  24532. lastIndex = length - 1;
  24533. size = size === undefined ? length : size;
  24534. while (++index < size) {
  24535. var rand = baseRandom(index, lastIndex),
  24536. value = array[rand];
  24537. array[rand] = array[index];
  24538. array[index] = value;
  24539. }
  24540. array.length = size;
  24541. return array;
  24542. }
  24543. /**
  24544. * Converts `string` to a property path array.
  24545. *
  24546. * @private
  24547. * @param {string} string The string to convert.
  24548. * @returns {Array} Returns the property path array.
  24549. */
  24550. var stringToPath = memoizeCapped(function(string) {
  24551. var result = [];
  24552. if (string.charCodeAt(0) === 46 /* . */) {
  24553. result.push('');
  24554. }
  24555. string.replace(rePropName, function(match, number, quote, subString) {
  24556. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  24557. });
  24558. return result;
  24559. });
  24560. /**
  24561. * Converts `value` to a string key if it's not a string or symbol.
  24562. *
  24563. * @private
  24564. * @param {*} value The value to inspect.
  24565. * @returns {string|symbol} Returns the key.
  24566. */
  24567. function toKey(value) {
  24568. if (typeof value == 'string' || isSymbol(value)) {
  24569. return value;
  24570. }
  24571. var result = (value + '');
  24572. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  24573. }
  24574. /**
  24575. * Converts `func` to its source code.
  24576. *
  24577. * @private
  24578. * @param {Function} func The function to convert.
  24579. * @returns {string} Returns the source code.
  24580. */
  24581. function toSource(func) {
  24582. if (func != null) {
  24583. try {
  24584. return funcToString.call(func);
  24585. } catch (e) {}
  24586. try {
  24587. return (func + '');
  24588. } catch (e) {}
  24589. }
  24590. return '';
  24591. }
  24592. /**
  24593. * Updates wrapper `details` based on `bitmask` flags.
  24594. *
  24595. * @private
  24596. * @returns {Array} details The details to modify.
  24597. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24598. * @returns {Array} Returns `details`.
  24599. */
  24600. function updateWrapDetails(details, bitmask) {
  24601. arrayEach(wrapFlags, function(pair) {
  24602. var value = '_.' + pair[0];
  24603. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  24604. details.push(value);
  24605. }
  24606. });
  24607. return details.sort();
  24608. }
  24609. /**
  24610. * Creates a clone of `wrapper`.
  24611. *
  24612. * @private
  24613. * @param {Object} wrapper The wrapper to clone.
  24614. * @returns {Object} Returns the cloned wrapper.
  24615. */
  24616. function wrapperClone(wrapper) {
  24617. if (wrapper instanceof LazyWrapper) {
  24618. return wrapper.clone();
  24619. }
  24620. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  24621. result.__actions__ = copyArray(wrapper.__actions__);
  24622. result.__index__ = wrapper.__index__;
  24623. result.__values__ = wrapper.__values__;
  24624. return result;
  24625. }
  24626. /*------------------------------------------------------------------------*/
  24627. /**
  24628. * Creates an array of elements split into groups the length of `size`.
  24629. * If `array` can't be split evenly, the final chunk will be the remaining
  24630. * elements.
  24631. *
  24632. * @static
  24633. * @memberOf _
  24634. * @since 3.0.0
  24635. * @category Array
  24636. * @param {Array} array The array to process.
  24637. * @param {number} [size=1] The length of each chunk
  24638. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24639. * @returns {Array} Returns the new array of chunks.
  24640. * @example
  24641. *
  24642. * _.chunk(['a', 'b', 'c', 'd'], 2);
  24643. * // => [['a', 'b'], ['c', 'd']]
  24644. *
  24645. * _.chunk(['a', 'b', 'c', 'd'], 3);
  24646. * // => [['a', 'b', 'c'], ['d']]
  24647. */
  24648. function chunk(array, size, guard) {
  24649. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  24650. size = 1;
  24651. } else {
  24652. size = nativeMax(toInteger(size), 0);
  24653. }
  24654. var length = array == null ? 0 : array.length;
  24655. if (!length || size < 1) {
  24656. return [];
  24657. }
  24658. var index = 0,
  24659. resIndex = 0,
  24660. result = Array(nativeCeil(length / size));
  24661. while (index < length) {
  24662. result[resIndex++] = baseSlice(array, index, (index += size));
  24663. }
  24664. return result;
  24665. }
  24666. /**
  24667. * Creates an array with all falsey values removed. The values `false`, `null`,
  24668. * `0`, `""`, `undefined`, and `NaN` are falsey.
  24669. *
  24670. * @static
  24671. * @memberOf _
  24672. * @since 0.1.0
  24673. * @category Array
  24674. * @param {Array} array The array to compact.
  24675. * @returns {Array} Returns the new array of filtered values.
  24676. * @example
  24677. *
  24678. * _.compact([0, 1, false, 2, '', 3]);
  24679. * // => [1, 2, 3]
  24680. */
  24681. function compact(array) {
  24682. var index = -1,
  24683. length = array == null ? 0 : array.length,
  24684. resIndex = 0,
  24685. result = [];
  24686. while (++index < length) {
  24687. var value = array[index];
  24688. if (value) {
  24689. result[resIndex++] = value;
  24690. }
  24691. }
  24692. return result;
  24693. }
  24694. /**
  24695. * Creates a new array concatenating `array` with any additional arrays
  24696. * and/or values.
  24697. *
  24698. * @static
  24699. * @memberOf _
  24700. * @since 4.0.0
  24701. * @category Array
  24702. * @param {Array} array The array to concatenate.
  24703. * @param {...*} [values] The values to concatenate.
  24704. * @returns {Array} Returns the new concatenated array.
  24705. * @example
  24706. *
  24707. * var array = [1];
  24708. * var other = _.concat(array, 2, [3], [[4]]);
  24709. *
  24710. * console.log(other);
  24711. * // => [1, 2, 3, [4]]
  24712. *
  24713. * console.log(array);
  24714. * // => [1]
  24715. */
  24716. function concat() {
  24717. var length = arguments.length;
  24718. if (!length) {
  24719. return [];
  24720. }
  24721. var args = Array(length - 1),
  24722. array = arguments[0],
  24723. index = length;
  24724. while (index--) {
  24725. args[index - 1] = arguments[index];
  24726. }
  24727. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  24728. }
  24729. /**
  24730. * Creates an array of `array` values not included in the other given arrays
  24731. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24732. * for equality comparisons. The order and references of result values are
  24733. * determined by the first array.
  24734. *
  24735. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  24736. *
  24737. * @static
  24738. * @memberOf _
  24739. * @since 0.1.0
  24740. * @category Array
  24741. * @param {Array} array The array to inspect.
  24742. * @param {...Array} [values] The values to exclude.
  24743. * @returns {Array} Returns the new array of filtered values.
  24744. * @see _.without, _.xor
  24745. * @example
  24746. *
  24747. * _.difference([2, 1], [2, 3]);
  24748. * // => [1]
  24749. */
  24750. var difference = baseRest(function(array, values) {
  24751. return isArrayLikeObject(array)
  24752. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  24753. : [];
  24754. });
  24755. /**
  24756. * This method is like `_.difference` except that it accepts `iteratee` which
  24757. * is invoked for each element of `array` and `values` to generate the criterion
  24758. * by which they're compared. The order and references of result values are
  24759. * determined by the first array. The iteratee is invoked with one argument:
  24760. * (value).
  24761. *
  24762. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  24763. *
  24764. * @static
  24765. * @memberOf _
  24766. * @since 4.0.0
  24767. * @category Array
  24768. * @param {Array} array The array to inspect.
  24769. * @param {...Array} [values] The values to exclude.
  24770. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24771. * @returns {Array} Returns the new array of filtered values.
  24772. * @example
  24773. *
  24774. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  24775. * // => [1.2]
  24776. *
  24777. * // The `_.property` iteratee shorthand.
  24778. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  24779. * // => [{ 'x': 2 }]
  24780. */
  24781. var differenceBy = baseRest(function(array, values) {
  24782. var iteratee = last(values);
  24783. if (isArrayLikeObject(iteratee)) {
  24784. iteratee = undefined;
  24785. }
  24786. return isArrayLikeObject(array)
  24787. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  24788. : [];
  24789. });
  24790. /**
  24791. * This method is like `_.difference` except that it accepts `comparator`
  24792. * which is invoked to compare elements of `array` to `values`. The order and
  24793. * references of result values are determined by the first array. The comparator
  24794. * is invoked with two arguments: (arrVal, othVal).
  24795. *
  24796. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  24797. *
  24798. * @static
  24799. * @memberOf _
  24800. * @since 4.0.0
  24801. * @category Array
  24802. * @param {Array} array The array to inspect.
  24803. * @param {...Array} [values] The values to exclude.
  24804. * @param {Function} [comparator] The comparator invoked per element.
  24805. * @returns {Array} Returns the new array of filtered values.
  24806. * @example
  24807. *
  24808. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  24809. *
  24810. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  24811. * // => [{ 'x': 2, 'y': 1 }]
  24812. */
  24813. var differenceWith = baseRest(function(array, values) {
  24814. var comparator = last(values);
  24815. if (isArrayLikeObject(comparator)) {
  24816. comparator = undefined;
  24817. }
  24818. return isArrayLikeObject(array)
  24819. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  24820. : [];
  24821. });
  24822. /**
  24823. * Creates a slice of `array` with `n` elements dropped from the beginning.
  24824. *
  24825. * @static
  24826. * @memberOf _
  24827. * @since 0.5.0
  24828. * @category Array
  24829. * @param {Array} array The array to query.
  24830. * @param {number} [n=1] The number of elements to drop.
  24831. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24832. * @returns {Array} Returns the slice of `array`.
  24833. * @example
  24834. *
  24835. * _.drop([1, 2, 3]);
  24836. * // => [2, 3]
  24837. *
  24838. * _.drop([1, 2, 3], 2);
  24839. * // => [3]
  24840. *
  24841. * _.drop([1, 2, 3], 5);
  24842. * // => []
  24843. *
  24844. * _.drop([1, 2, 3], 0);
  24845. * // => [1, 2, 3]
  24846. */
  24847. function drop(array, n, guard) {
  24848. var length = array == null ? 0 : array.length;
  24849. if (!length) {
  24850. return [];
  24851. }
  24852. n = (guard || n === undefined) ? 1 : toInteger(n);
  24853. return baseSlice(array, n < 0 ? 0 : n, length);
  24854. }
  24855. /**
  24856. * Creates a slice of `array` with `n` elements dropped from the end.
  24857. *
  24858. * @static
  24859. * @memberOf _
  24860. * @since 3.0.0
  24861. * @category Array
  24862. * @param {Array} array The array to query.
  24863. * @param {number} [n=1] The number of elements to drop.
  24864. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24865. * @returns {Array} Returns the slice of `array`.
  24866. * @example
  24867. *
  24868. * _.dropRight([1, 2, 3]);
  24869. * // => [1, 2]
  24870. *
  24871. * _.dropRight([1, 2, 3], 2);
  24872. * // => [1]
  24873. *
  24874. * _.dropRight([1, 2, 3], 5);
  24875. * // => []
  24876. *
  24877. * _.dropRight([1, 2, 3], 0);
  24878. * // => [1, 2, 3]
  24879. */
  24880. function dropRight(array, n, guard) {
  24881. var length = array == null ? 0 : array.length;
  24882. if (!length) {
  24883. return [];
  24884. }
  24885. n = (guard || n === undefined) ? 1 : toInteger(n);
  24886. n = length - n;
  24887. return baseSlice(array, 0, n < 0 ? 0 : n);
  24888. }
  24889. /**
  24890. * Creates a slice of `array` excluding elements dropped from the end.
  24891. * Elements are dropped until `predicate` returns falsey. The predicate is
  24892. * invoked with three arguments: (value, index, array).
  24893. *
  24894. * @static
  24895. * @memberOf _
  24896. * @since 3.0.0
  24897. * @category Array
  24898. * @param {Array} array The array to query.
  24899. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24900. * @returns {Array} Returns the slice of `array`.
  24901. * @example
  24902. *
  24903. * var users = [
  24904. * { 'user': 'barney', 'active': true },
  24905. * { 'user': 'fred', 'active': false },
  24906. * { 'user': 'pebbles', 'active': false }
  24907. * ];
  24908. *
  24909. * _.dropRightWhile(users, function(o) { return !o.active; });
  24910. * // => objects for ['barney']
  24911. *
  24912. * // The `_.matches` iteratee shorthand.
  24913. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  24914. * // => objects for ['barney', 'fred']
  24915. *
  24916. * // The `_.matchesProperty` iteratee shorthand.
  24917. * _.dropRightWhile(users, ['active', false]);
  24918. * // => objects for ['barney']
  24919. *
  24920. * // The `_.property` iteratee shorthand.
  24921. * _.dropRightWhile(users, 'active');
  24922. * // => objects for ['barney', 'fred', 'pebbles']
  24923. */
  24924. function dropRightWhile(array, predicate) {
  24925. return (array && array.length)
  24926. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  24927. : [];
  24928. }
  24929. /**
  24930. * Creates a slice of `array` excluding elements dropped from the beginning.
  24931. * Elements are dropped until `predicate` returns falsey. The predicate is
  24932. * invoked with three arguments: (value, index, array).
  24933. *
  24934. * @static
  24935. * @memberOf _
  24936. * @since 3.0.0
  24937. * @category Array
  24938. * @param {Array} array The array to query.
  24939. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24940. * @returns {Array} Returns the slice of `array`.
  24941. * @example
  24942. *
  24943. * var users = [
  24944. * { 'user': 'barney', 'active': false },
  24945. * { 'user': 'fred', 'active': false },
  24946. * { 'user': 'pebbles', 'active': true }
  24947. * ];
  24948. *
  24949. * _.dropWhile(users, function(o) { return !o.active; });
  24950. * // => objects for ['pebbles']
  24951. *
  24952. * // The `_.matches` iteratee shorthand.
  24953. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  24954. * // => objects for ['fred', 'pebbles']
  24955. *
  24956. * // The `_.matchesProperty` iteratee shorthand.
  24957. * _.dropWhile(users, ['active', false]);
  24958. * // => objects for ['pebbles']
  24959. *
  24960. * // The `_.property` iteratee shorthand.
  24961. * _.dropWhile(users, 'active');
  24962. * // => objects for ['barney', 'fred', 'pebbles']
  24963. */
  24964. function dropWhile(array, predicate) {
  24965. return (array && array.length)
  24966. ? baseWhile(array, getIteratee(predicate, 3), true)
  24967. : [];
  24968. }
  24969. /**
  24970. * Fills elements of `array` with `value` from `start` up to, but not
  24971. * including, `end`.
  24972. *
  24973. * **Note:** This method mutates `array`.
  24974. *
  24975. * @static
  24976. * @memberOf _
  24977. * @since 3.2.0
  24978. * @category Array
  24979. * @param {Array} array The array to fill.
  24980. * @param {*} value The value to fill `array` with.
  24981. * @param {number} [start=0] The start position.
  24982. * @param {number} [end=array.length] The end position.
  24983. * @returns {Array} Returns `array`.
  24984. * @example
  24985. *
  24986. * var array = [1, 2, 3];
  24987. *
  24988. * _.fill(array, 'a');
  24989. * console.log(array);
  24990. * // => ['a', 'a', 'a']
  24991. *
  24992. * _.fill(Array(3), 2);
  24993. * // => [2, 2, 2]
  24994. *
  24995. * _.fill([4, 6, 8, 10], '*', 1, 3);
  24996. * // => [4, '*', '*', 10]
  24997. */
  24998. function fill(array, value, start, end) {
  24999. var length = array == null ? 0 : array.length;
  25000. if (!length) {
  25001. return [];
  25002. }
  25003. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  25004. start = 0;
  25005. end = length;
  25006. }
  25007. return baseFill(array, value, start, end);
  25008. }
  25009. /**
  25010. * This method is like `_.find` except that it returns the index of the first
  25011. * element `predicate` returns truthy for instead of the element itself.
  25012. *
  25013. * @static
  25014. * @memberOf _
  25015. * @since 1.1.0
  25016. * @category Array
  25017. * @param {Array} array The array to inspect.
  25018. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25019. * @param {number} [fromIndex=0] The index to search from.
  25020. * @returns {number} Returns the index of the found element, else `-1`.
  25021. * @example
  25022. *
  25023. * var users = [
  25024. * { 'user': 'barney', 'active': false },
  25025. * { 'user': 'fred', 'active': false },
  25026. * { 'user': 'pebbles', 'active': true }
  25027. * ];
  25028. *
  25029. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  25030. * // => 0
  25031. *
  25032. * // The `_.matches` iteratee shorthand.
  25033. * _.findIndex(users, { 'user': 'fred', 'active': false });
  25034. * // => 1
  25035. *
  25036. * // The `_.matchesProperty` iteratee shorthand.
  25037. * _.findIndex(users, ['active', false]);
  25038. * // => 0
  25039. *
  25040. * // The `_.property` iteratee shorthand.
  25041. * _.findIndex(users, 'active');
  25042. * // => 2
  25043. */
  25044. function findIndex(array, predicate, fromIndex) {
  25045. var length = array == null ? 0 : array.length;
  25046. if (!length) {
  25047. return -1;
  25048. }
  25049. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25050. if (index < 0) {
  25051. index = nativeMax(length + index, 0);
  25052. }
  25053. return baseFindIndex(array, getIteratee(predicate, 3), index);
  25054. }
  25055. /**
  25056. * This method is like `_.findIndex` except that it iterates over elements
  25057. * of `collection` from right to left.
  25058. *
  25059. * @static
  25060. * @memberOf _
  25061. * @since 2.0.0
  25062. * @category Array
  25063. * @param {Array} array The array to inspect.
  25064. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25065. * @param {number} [fromIndex=array.length-1] The index to search from.
  25066. * @returns {number} Returns the index of the found element, else `-1`.
  25067. * @example
  25068. *
  25069. * var users = [
  25070. * { 'user': 'barney', 'active': true },
  25071. * { 'user': 'fred', 'active': false },
  25072. * { 'user': 'pebbles', 'active': false }
  25073. * ];
  25074. *
  25075. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  25076. * // => 2
  25077. *
  25078. * // The `_.matches` iteratee shorthand.
  25079. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  25080. * // => 0
  25081. *
  25082. * // The `_.matchesProperty` iteratee shorthand.
  25083. * _.findLastIndex(users, ['active', false]);
  25084. * // => 2
  25085. *
  25086. * // The `_.property` iteratee shorthand.
  25087. * _.findLastIndex(users, 'active');
  25088. * // => 0
  25089. */
  25090. function findLastIndex(array, predicate, fromIndex) {
  25091. var length = array == null ? 0 : array.length;
  25092. if (!length) {
  25093. return -1;
  25094. }
  25095. var index = length - 1;
  25096. if (fromIndex !== undefined) {
  25097. index = toInteger(fromIndex);
  25098. index = fromIndex < 0
  25099. ? nativeMax(length + index, 0)
  25100. : nativeMin(index, length - 1);
  25101. }
  25102. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  25103. }
  25104. /**
  25105. * Flattens `array` a single level deep.
  25106. *
  25107. * @static
  25108. * @memberOf _
  25109. * @since 0.1.0
  25110. * @category Array
  25111. * @param {Array} array The array to flatten.
  25112. * @returns {Array} Returns the new flattened array.
  25113. * @example
  25114. *
  25115. * _.flatten([1, [2, [3, [4]], 5]]);
  25116. * // => [1, 2, [3, [4]], 5]
  25117. */
  25118. function flatten(array) {
  25119. var length = array == null ? 0 : array.length;
  25120. return length ? baseFlatten(array, 1) : [];
  25121. }
  25122. /**
  25123. * Recursively flattens `array`.
  25124. *
  25125. * @static
  25126. * @memberOf _
  25127. * @since 3.0.0
  25128. * @category Array
  25129. * @param {Array} array The array to flatten.
  25130. * @returns {Array} Returns the new flattened array.
  25131. * @example
  25132. *
  25133. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  25134. * // => [1, 2, 3, 4, 5]
  25135. */
  25136. function flattenDeep(array) {
  25137. var length = array == null ? 0 : array.length;
  25138. return length ? baseFlatten(array, INFINITY) : [];
  25139. }
  25140. /**
  25141. * Recursively flatten `array` up to `depth` times.
  25142. *
  25143. * @static
  25144. * @memberOf _
  25145. * @since 4.4.0
  25146. * @category Array
  25147. * @param {Array} array The array to flatten.
  25148. * @param {number} [depth=1] The maximum recursion depth.
  25149. * @returns {Array} Returns the new flattened array.
  25150. * @example
  25151. *
  25152. * var array = [1, [2, [3, [4]], 5]];
  25153. *
  25154. * _.flattenDepth(array, 1);
  25155. * // => [1, 2, [3, [4]], 5]
  25156. *
  25157. * _.flattenDepth(array, 2);
  25158. * // => [1, 2, 3, [4], 5]
  25159. */
  25160. function flattenDepth(array, depth) {
  25161. var length = array == null ? 0 : array.length;
  25162. if (!length) {
  25163. return [];
  25164. }
  25165. depth = depth === undefined ? 1 : toInteger(depth);
  25166. return baseFlatten(array, depth);
  25167. }
  25168. /**
  25169. * The inverse of `_.toPairs`; this method returns an object composed
  25170. * from key-value `pairs`.
  25171. *
  25172. * @static
  25173. * @memberOf _
  25174. * @since 4.0.0
  25175. * @category Array
  25176. * @param {Array} pairs The key-value pairs.
  25177. * @returns {Object} Returns the new object.
  25178. * @example
  25179. *
  25180. * _.fromPairs([['a', 1], ['b', 2]]);
  25181. * // => { 'a': 1, 'b': 2 }
  25182. */
  25183. function fromPairs(pairs) {
  25184. var index = -1,
  25185. length = pairs == null ? 0 : pairs.length,
  25186. result = {};
  25187. while (++index < length) {
  25188. var pair = pairs[index];
  25189. result[pair[0]] = pair[1];
  25190. }
  25191. return result;
  25192. }
  25193. /**
  25194. * Gets the first element of `array`.
  25195. *
  25196. * @static
  25197. * @memberOf _
  25198. * @since 0.1.0
  25199. * @alias first
  25200. * @category Array
  25201. * @param {Array} array The array to query.
  25202. * @returns {*} Returns the first element of `array`.
  25203. * @example
  25204. *
  25205. * _.head([1, 2, 3]);
  25206. * // => 1
  25207. *
  25208. * _.head([]);
  25209. * // => undefined
  25210. */
  25211. function head(array) {
  25212. return (array && array.length) ? array[0] : undefined;
  25213. }
  25214. /**
  25215. * Gets the index at which the first occurrence of `value` is found in `array`
  25216. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25217. * for equality comparisons. If `fromIndex` is negative, it's used as the
  25218. * offset from the end of `array`.
  25219. *
  25220. * @static
  25221. * @memberOf _
  25222. * @since 0.1.0
  25223. * @category Array
  25224. * @param {Array} array The array to inspect.
  25225. * @param {*} value The value to search for.
  25226. * @param {number} [fromIndex=0] The index to search from.
  25227. * @returns {number} Returns the index of the matched value, else `-1`.
  25228. * @example
  25229. *
  25230. * _.indexOf([1, 2, 1, 2], 2);
  25231. * // => 1
  25232. *
  25233. * // Search from the `fromIndex`.
  25234. * _.indexOf([1, 2, 1, 2], 2, 2);
  25235. * // => 3
  25236. */
  25237. function indexOf(array, value, fromIndex) {
  25238. var length = array == null ? 0 : array.length;
  25239. if (!length) {
  25240. return -1;
  25241. }
  25242. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25243. if (index < 0) {
  25244. index = nativeMax(length + index, 0);
  25245. }
  25246. return baseIndexOf(array, value, index);
  25247. }
  25248. /**
  25249. * Gets all but the last element of `array`.
  25250. *
  25251. * @static
  25252. * @memberOf _
  25253. * @since 0.1.0
  25254. * @category Array
  25255. * @param {Array} array The array to query.
  25256. * @returns {Array} Returns the slice of `array`.
  25257. * @example
  25258. *
  25259. * _.initial([1, 2, 3]);
  25260. * // => [1, 2]
  25261. */
  25262. function initial(array) {
  25263. var length = array == null ? 0 : array.length;
  25264. return length ? baseSlice(array, 0, -1) : [];
  25265. }
  25266. /**
  25267. * Creates an array of unique values that are included in all given arrays
  25268. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25269. * for equality comparisons. The order and references of result values are
  25270. * determined by the first array.
  25271. *
  25272. * @static
  25273. * @memberOf _
  25274. * @since 0.1.0
  25275. * @category Array
  25276. * @param {...Array} [arrays] The arrays to inspect.
  25277. * @returns {Array} Returns the new array of intersecting values.
  25278. * @example
  25279. *
  25280. * _.intersection([2, 1], [2, 3]);
  25281. * // => [2]
  25282. */
  25283. var intersection = baseRest(function(arrays) {
  25284. var mapped = arrayMap(arrays, castArrayLikeObject);
  25285. return (mapped.length && mapped[0] === arrays[0])
  25286. ? baseIntersection(mapped)
  25287. : [];
  25288. });
  25289. /**
  25290. * This method is like `_.intersection` except that it accepts `iteratee`
  25291. * which is invoked for each element of each `arrays` to generate the criterion
  25292. * by which they're compared. The order and references of result values are
  25293. * determined by the first array. The iteratee is invoked with one argument:
  25294. * (value).
  25295. *
  25296. * @static
  25297. * @memberOf _
  25298. * @since 4.0.0
  25299. * @category Array
  25300. * @param {...Array} [arrays] The arrays to inspect.
  25301. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25302. * @returns {Array} Returns the new array of intersecting values.
  25303. * @example
  25304. *
  25305. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  25306. * // => [2.1]
  25307. *
  25308. * // The `_.property` iteratee shorthand.
  25309. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25310. * // => [{ 'x': 1 }]
  25311. */
  25312. var intersectionBy = baseRest(function(arrays) {
  25313. var iteratee = last(arrays),
  25314. mapped = arrayMap(arrays, castArrayLikeObject);
  25315. if (iteratee === last(mapped)) {
  25316. iteratee = undefined;
  25317. } else {
  25318. mapped.pop();
  25319. }
  25320. return (mapped.length && mapped[0] === arrays[0])
  25321. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  25322. : [];
  25323. });
  25324. /**
  25325. * This method is like `_.intersection` except that it accepts `comparator`
  25326. * which is invoked to compare elements of `arrays`. The order and references
  25327. * of result values are determined by the first array. The comparator is
  25328. * invoked with two arguments: (arrVal, othVal).
  25329. *
  25330. * @static
  25331. * @memberOf _
  25332. * @since 4.0.0
  25333. * @category Array
  25334. * @param {...Array} [arrays] The arrays to inspect.
  25335. * @param {Function} [comparator] The comparator invoked per element.
  25336. * @returns {Array} Returns the new array of intersecting values.
  25337. * @example
  25338. *
  25339. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25340. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25341. *
  25342. * _.intersectionWith(objects, others, _.isEqual);
  25343. * // => [{ 'x': 1, 'y': 2 }]
  25344. */
  25345. var intersectionWith = baseRest(function(arrays) {
  25346. var comparator = last(arrays),
  25347. mapped = arrayMap(arrays, castArrayLikeObject);
  25348. comparator = typeof comparator == 'function' ? comparator : undefined;
  25349. if (comparator) {
  25350. mapped.pop();
  25351. }
  25352. return (mapped.length && mapped[0] === arrays[0])
  25353. ? baseIntersection(mapped, undefined, comparator)
  25354. : [];
  25355. });
  25356. /**
  25357. * Converts all elements in `array` into a string separated by `separator`.
  25358. *
  25359. * @static
  25360. * @memberOf _
  25361. * @since 4.0.0
  25362. * @category Array
  25363. * @param {Array} array The array to convert.
  25364. * @param {string} [separator=','] The element separator.
  25365. * @returns {string} Returns the joined string.
  25366. * @example
  25367. *
  25368. * _.join(['a', 'b', 'c'], '~');
  25369. * // => 'a~b~c'
  25370. */
  25371. function join(array, separator) {
  25372. return array == null ? '' : nativeJoin.call(array, separator);
  25373. }
  25374. /**
  25375. * Gets the last element of `array`.
  25376. *
  25377. * @static
  25378. * @memberOf _
  25379. * @since 0.1.0
  25380. * @category Array
  25381. * @param {Array} array The array to query.
  25382. * @returns {*} Returns the last element of `array`.
  25383. * @example
  25384. *
  25385. * _.last([1, 2, 3]);
  25386. * // => 3
  25387. */
  25388. function last(array) {
  25389. var length = array == null ? 0 : array.length;
  25390. return length ? array[length - 1] : undefined;
  25391. }
  25392. /**
  25393. * This method is like `_.indexOf` except that it iterates over elements of
  25394. * `array` from right to left.
  25395. *
  25396. * @static
  25397. * @memberOf _
  25398. * @since 0.1.0
  25399. * @category Array
  25400. * @param {Array} array The array to inspect.
  25401. * @param {*} value The value to search for.
  25402. * @param {number} [fromIndex=array.length-1] The index to search from.
  25403. * @returns {number} Returns the index of the matched value, else `-1`.
  25404. * @example
  25405. *
  25406. * _.lastIndexOf([1, 2, 1, 2], 2);
  25407. * // => 3
  25408. *
  25409. * // Search from the `fromIndex`.
  25410. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  25411. * // => 1
  25412. */
  25413. function lastIndexOf(array, value, fromIndex) {
  25414. var length = array == null ? 0 : array.length;
  25415. if (!length) {
  25416. return -1;
  25417. }
  25418. var index = length;
  25419. if (fromIndex !== undefined) {
  25420. index = toInteger(fromIndex);
  25421. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  25422. }
  25423. return value === value
  25424. ? strictLastIndexOf(array, value, index)
  25425. : baseFindIndex(array, baseIsNaN, index, true);
  25426. }
  25427. /**
  25428. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  25429. * element from the end is returned.
  25430. *
  25431. * @static
  25432. * @memberOf _
  25433. * @since 4.11.0
  25434. * @category Array
  25435. * @param {Array} array The array to query.
  25436. * @param {number} [n=0] The index of the element to return.
  25437. * @returns {*} Returns the nth element of `array`.
  25438. * @example
  25439. *
  25440. * var array = ['a', 'b', 'c', 'd'];
  25441. *
  25442. * _.nth(array, 1);
  25443. * // => 'b'
  25444. *
  25445. * _.nth(array, -2);
  25446. * // => 'c';
  25447. */
  25448. function nth(array, n) {
  25449. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  25450. }
  25451. /**
  25452. * Removes all given values from `array` using
  25453. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25454. * for equality comparisons.
  25455. *
  25456. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  25457. * to remove elements from an array by predicate.
  25458. *
  25459. * @static
  25460. * @memberOf _
  25461. * @since 2.0.0
  25462. * @category Array
  25463. * @param {Array} array The array to modify.
  25464. * @param {...*} [values] The values to remove.
  25465. * @returns {Array} Returns `array`.
  25466. * @example
  25467. *
  25468. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25469. *
  25470. * _.pull(array, 'a', 'c');
  25471. * console.log(array);
  25472. * // => ['b', 'b']
  25473. */
  25474. var pull = baseRest(pullAll);
  25475. /**
  25476. * This method is like `_.pull` except that it accepts an array of values to remove.
  25477. *
  25478. * **Note:** Unlike `_.difference`, this method mutates `array`.
  25479. *
  25480. * @static
  25481. * @memberOf _
  25482. * @since 4.0.0
  25483. * @category Array
  25484. * @param {Array} array The array to modify.
  25485. * @param {Array} values The values to remove.
  25486. * @returns {Array} Returns `array`.
  25487. * @example
  25488. *
  25489. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25490. *
  25491. * _.pullAll(array, ['a', 'c']);
  25492. * console.log(array);
  25493. * // => ['b', 'b']
  25494. */
  25495. function pullAll(array, values) {
  25496. return (array && array.length && values && values.length)
  25497. ? basePullAll(array, values)
  25498. : array;
  25499. }
  25500. /**
  25501. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  25502. * invoked for each element of `array` and `values` to generate the criterion
  25503. * by which they're compared. The iteratee is invoked with one argument: (value).
  25504. *
  25505. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  25506. *
  25507. * @static
  25508. * @memberOf _
  25509. * @since 4.0.0
  25510. * @category Array
  25511. * @param {Array} array The array to modify.
  25512. * @param {Array} values The values to remove.
  25513. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25514. * @returns {Array} Returns `array`.
  25515. * @example
  25516. *
  25517. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  25518. *
  25519. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  25520. * console.log(array);
  25521. * // => [{ 'x': 2 }]
  25522. */
  25523. function pullAllBy(array, values, iteratee) {
  25524. return (array && array.length && values && values.length)
  25525. ? basePullAll(array, values, getIteratee(iteratee, 2))
  25526. : array;
  25527. }
  25528. /**
  25529. * This method is like `_.pullAll` except that it accepts `comparator` which
  25530. * is invoked to compare elements of `array` to `values`. The comparator is
  25531. * invoked with two arguments: (arrVal, othVal).
  25532. *
  25533. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  25534. *
  25535. * @static
  25536. * @memberOf _
  25537. * @since 4.6.0
  25538. * @category Array
  25539. * @param {Array} array The array to modify.
  25540. * @param {Array} values The values to remove.
  25541. * @param {Function} [comparator] The comparator invoked per element.
  25542. * @returns {Array} Returns `array`.
  25543. * @example
  25544. *
  25545. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  25546. *
  25547. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  25548. * console.log(array);
  25549. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  25550. */
  25551. function pullAllWith(array, values, comparator) {
  25552. return (array && array.length && values && values.length)
  25553. ? basePullAll(array, values, undefined, comparator)
  25554. : array;
  25555. }
  25556. /**
  25557. * Removes elements from `array` corresponding to `indexes` and returns an
  25558. * array of removed elements.
  25559. *
  25560. * **Note:** Unlike `_.at`, this method mutates `array`.
  25561. *
  25562. * @static
  25563. * @memberOf _
  25564. * @since 3.0.0
  25565. * @category Array
  25566. * @param {Array} array The array to modify.
  25567. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  25568. * @returns {Array} Returns the new array of removed elements.
  25569. * @example
  25570. *
  25571. * var array = ['a', 'b', 'c', 'd'];
  25572. * var pulled = _.pullAt(array, [1, 3]);
  25573. *
  25574. * console.log(array);
  25575. * // => ['a', 'c']
  25576. *
  25577. * console.log(pulled);
  25578. * // => ['b', 'd']
  25579. */
  25580. var pullAt = flatRest(function(array, indexes) {
  25581. var length = array == null ? 0 : array.length,
  25582. result = baseAt(array, indexes);
  25583. basePullAt(array, arrayMap(indexes, function(index) {
  25584. return isIndex(index, length) ? +index : index;
  25585. }).sort(compareAscending));
  25586. return result;
  25587. });
  25588. /**
  25589. * Removes all elements from `array` that `predicate` returns truthy for
  25590. * and returns an array of the removed elements. The predicate is invoked
  25591. * with three arguments: (value, index, array).
  25592. *
  25593. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  25594. * to pull elements from an array by value.
  25595. *
  25596. * @static
  25597. * @memberOf _
  25598. * @since 2.0.0
  25599. * @category Array
  25600. * @param {Array} array The array to modify.
  25601. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25602. * @returns {Array} Returns the new array of removed elements.
  25603. * @example
  25604. *
  25605. * var array = [1, 2, 3, 4];
  25606. * var evens = _.remove(array, function(n) {
  25607. * return n % 2 == 0;
  25608. * });
  25609. *
  25610. * console.log(array);
  25611. * // => [1, 3]
  25612. *
  25613. * console.log(evens);
  25614. * // => [2, 4]
  25615. */
  25616. function remove(array, predicate) {
  25617. var result = [];
  25618. if (!(array && array.length)) {
  25619. return result;
  25620. }
  25621. var index = -1,
  25622. indexes = [],
  25623. length = array.length;
  25624. predicate = getIteratee(predicate, 3);
  25625. while (++index < length) {
  25626. var value = array[index];
  25627. if (predicate(value, index, array)) {
  25628. result.push(value);
  25629. indexes.push(index);
  25630. }
  25631. }
  25632. basePullAt(array, indexes);
  25633. return result;
  25634. }
  25635. /**
  25636. * Reverses `array` so that the first element becomes the last, the second
  25637. * element becomes the second to last, and so on.
  25638. *
  25639. * **Note:** This method mutates `array` and is based on
  25640. * [`Array#reverse`](https://mdn.io/Array/reverse).
  25641. *
  25642. * @static
  25643. * @memberOf _
  25644. * @since 4.0.0
  25645. * @category Array
  25646. * @param {Array} array The array to modify.
  25647. * @returns {Array} Returns `array`.
  25648. * @example
  25649. *
  25650. * var array = [1, 2, 3];
  25651. *
  25652. * _.reverse(array);
  25653. * // => [3, 2, 1]
  25654. *
  25655. * console.log(array);
  25656. * // => [3, 2, 1]
  25657. */
  25658. function reverse(array) {
  25659. return array == null ? array : nativeReverse.call(array);
  25660. }
  25661. /**
  25662. * Creates a slice of `array` from `start` up to, but not including, `end`.
  25663. *
  25664. * **Note:** This method is used instead of
  25665. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  25666. * returned.
  25667. *
  25668. * @static
  25669. * @memberOf _
  25670. * @since 3.0.0
  25671. * @category Array
  25672. * @param {Array} array The array to slice.
  25673. * @param {number} [start=0] The start position.
  25674. * @param {number} [end=array.length] The end position.
  25675. * @returns {Array} Returns the slice of `array`.
  25676. */
  25677. function slice(array, start, end) {
  25678. var length = array == null ? 0 : array.length;
  25679. if (!length) {
  25680. return [];
  25681. }
  25682. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  25683. start = 0;
  25684. end = length;
  25685. }
  25686. else {
  25687. start = start == null ? 0 : toInteger(start);
  25688. end = end === undefined ? length : toInteger(end);
  25689. }
  25690. return baseSlice(array, start, end);
  25691. }
  25692. /**
  25693. * Uses a binary search to determine the lowest index at which `value`
  25694. * should be inserted into `array` in order to maintain its sort order.
  25695. *
  25696. * @static
  25697. * @memberOf _
  25698. * @since 0.1.0
  25699. * @category Array
  25700. * @param {Array} array The sorted array to inspect.
  25701. * @param {*} value The value to evaluate.
  25702. * @returns {number} Returns the index at which `value` should be inserted
  25703. * into `array`.
  25704. * @example
  25705. *
  25706. * _.sortedIndex([30, 50], 40);
  25707. * // => 1
  25708. */
  25709. function sortedIndex(array, value) {
  25710. return baseSortedIndex(array, value);
  25711. }
  25712. /**
  25713. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  25714. * which is invoked for `value` and each element of `array` to compute their
  25715. * sort ranking. The iteratee is invoked with one argument: (value).
  25716. *
  25717. * @static
  25718. * @memberOf _
  25719. * @since 4.0.0
  25720. * @category Array
  25721. * @param {Array} array The sorted array to inspect.
  25722. * @param {*} value The value to evaluate.
  25723. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25724. * @returns {number} Returns the index at which `value` should be inserted
  25725. * into `array`.
  25726. * @example
  25727. *
  25728. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25729. *
  25730. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25731. * // => 0
  25732. *
  25733. * // The `_.property` iteratee shorthand.
  25734. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  25735. * // => 0
  25736. */
  25737. function sortedIndexBy(array, value, iteratee) {
  25738. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  25739. }
  25740. /**
  25741. * This method is like `_.indexOf` except that it performs a binary
  25742. * search on a sorted `array`.
  25743. *
  25744. * @static
  25745. * @memberOf _
  25746. * @since 4.0.0
  25747. * @category Array
  25748. * @param {Array} array The array to inspect.
  25749. * @param {*} value The value to search for.
  25750. * @returns {number} Returns the index of the matched value, else `-1`.
  25751. * @example
  25752. *
  25753. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  25754. * // => 1
  25755. */
  25756. function sortedIndexOf(array, value) {
  25757. var length = array == null ? 0 : array.length;
  25758. if (length) {
  25759. var index = baseSortedIndex(array, value);
  25760. if (index < length && eq(array[index], value)) {
  25761. return index;
  25762. }
  25763. }
  25764. return -1;
  25765. }
  25766. /**
  25767. * This method is like `_.sortedIndex` except that it returns the highest
  25768. * index at which `value` should be inserted into `array` in order to
  25769. * maintain its sort order.
  25770. *
  25771. * @static
  25772. * @memberOf _
  25773. * @since 3.0.0
  25774. * @category Array
  25775. * @param {Array} array The sorted array to inspect.
  25776. * @param {*} value The value to evaluate.
  25777. * @returns {number} Returns the index at which `value` should be inserted
  25778. * into `array`.
  25779. * @example
  25780. *
  25781. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  25782. * // => 4
  25783. */
  25784. function sortedLastIndex(array, value) {
  25785. return baseSortedIndex(array, value, true);
  25786. }
  25787. /**
  25788. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  25789. * which is invoked for `value` and each element of `array` to compute their
  25790. * sort ranking. The iteratee is invoked with one argument: (value).
  25791. *
  25792. * @static
  25793. * @memberOf _
  25794. * @since 4.0.0
  25795. * @category Array
  25796. * @param {Array} array The sorted array to inspect.
  25797. * @param {*} value The value to evaluate.
  25798. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25799. * @returns {number} Returns the index at which `value` should be inserted
  25800. * into `array`.
  25801. * @example
  25802. *
  25803. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25804. *
  25805. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25806. * // => 1
  25807. *
  25808. * // The `_.property` iteratee shorthand.
  25809. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  25810. * // => 1
  25811. */
  25812. function sortedLastIndexBy(array, value, iteratee) {
  25813. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  25814. }
  25815. /**
  25816. * This method is like `_.lastIndexOf` except that it performs a binary
  25817. * search on a sorted `array`.
  25818. *
  25819. * @static
  25820. * @memberOf _
  25821. * @since 4.0.0
  25822. * @category Array
  25823. * @param {Array} array The array to inspect.
  25824. * @param {*} value The value to search for.
  25825. * @returns {number} Returns the index of the matched value, else `-1`.
  25826. * @example
  25827. *
  25828. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  25829. * // => 3
  25830. */
  25831. function sortedLastIndexOf(array, value) {
  25832. var length = array == null ? 0 : array.length;
  25833. if (length) {
  25834. var index = baseSortedIndex(array, value, true) - 1;
  25835. if (eq(array[index], value)) {
  25836. return index;
  25837. }
  25838. }
  25839. return -1;
  25840. }
  25841. /**
  25842. * This method is like `_.uniq` except that it's designed and optimized
  25843. * for sorted arrays.
  25844. *
  25845. * @static
  25846. * @memberOf _
  25847. * @since 4.0.0
  25848. * @category Array
  25849. * @param {Array} array The array to inspect.
  25850. * @returns {Array} Returns the new duplicate free array.
  25851. * @example
  25852. *
  25853. * _.sortedUniq([1, 1, 2]);
  25854. * // => [1, 2]
  25855. */
  25856. function sortedUniq(array) {
  25857. return (array && array.length)
  25858. ? baseSortedUniq(array)
  25859. : [];
  25860. }
  25861. /**
  25862. * This method is like `_.uniqBy` except that it's designed and optimized
  25863. * for sorted arrays.
  25864. *
  25865. * @static
  25866. * @memberOf _
  25867. * @since 4.0.0
  25868. * @category Array
  25869. * @param {Array} array The array to inspect.
  25870. * @param {Function} [iteratee] The iteratee invoked per element.
  25871. * @returns {Array} Returns the new duplicate free array.
  25872. * @example
  25873. *
  25874. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  25875. * // => [1.1, 2.3]
  25876. */
  25877. function sortedUniqBy(array, iteratee) {
  25878. return (array && array.length)
  25879. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  25880. : [];
  25881. }
  25882. /**
  25883. * Gets all but the first element of `array`.
  25884. *
  25885. * @static
  25886. * @memberOf _
  25887. * @since 4.0.0
  25888. * @category Array
  25889. * @param {Array} array The array to query.
  25890. * @returns {Array} Returns the slice of `array`.
  25891. * @example
  25892. *
  25893. * _.tail([1, 2, 3]);
  25894. * // => [2, 3]
  25895. */
  25896. function tail(array) {
  25897. var length = array == null ? 0 : array.length;
  25898. return length ? baseSlice(array, 1, length) : [];
  25899. }
  25900. /**
  25901. * Creates a slice of `array` with `n` elements taken from the beginning.
  25902. *
  25903. * @static
  25904. * @memberOf _
  25905. * @since 0.1.0
  25906. * @category Array
  25907. * @param {Array} array The array to query.
  25908. * @param {number} [n=1] The number of elements to take.
  25909. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25910. * @returns {Array} Returns the slice of `array`.
  25911. * @example
  25912. *
  25913. * _.take([1, 2, 3]);
  25914. * // => [1]
  25915. *
  25916. * _.take([1, 2, 3], 2);
  25917. * // => [1, 2]
  25918. *
  25919. * _.take([1, 2, 3], 5);
  25920. * // => [1, 2, 3]
  25921. *
  25922. * _.take([1, 2, 3], 0);
  25923. * // => []
  25924. */
  25925. function take(array, n, guard) {
  25926. if (!(array && array.length)) {
  25927. return [];
  25928. }
  25929. n = (guard || n === undefined) ? 1 : toInteger(n);
  25930. return baseSlice(array, 0, n < 0 ? 0 : n);
  25931. }
  25932. /**
  25933. * Creates a slice of `array` with `n` elements taken from the end.
  25934. *
  25935. * @static
  25936. * @memberOf _
  25937. * @since 3.0.0
  25938. * @category Array
  25939. * @param {Array} array The array to query.
  25940. * @param {number} [n=1] The number of elements to take.
  25941. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25942. * @returns {Array} Returns the slice of `array`.
  25943. * @example
  25944. *
  25945. * _.takeRight([1, 2, 3]);
  25946. * // => [3]
  25947. *
  25948. * _.takeRight([1, 2, 3], 2);
  25949. * // => [2, 3]
  25950. *
  25951. * _.takeRight([1, 2, 3], 5);
  25952. * // => [1, 2, 3]
  25953. *
  25954. * _.takeRight([1, 2, 3], 0);
  25955. * // => []
  25956. */
  25957. function takeRight(array, n, guard) {
  25958. var length = array == null ? 0 : array.length;
  25959. if (!length) {
  25960. return [];
  25961. }
  25962. n = (guard || n === undefined) ? 1 : toInteger(n);
  25963. n = length - n;
  25964. return baseSlice(array, n < 0 ? 0 : n, length);
  25965. }
  25966. /**
  25967. * Creates a slice of `array` with elements taken from the end. Elements are
  25968. * taken until `predicate` returns falsey. The predicate is invoked with
  25969. * three arguments: (value, index, array).
  25970. *
  25971. * @static
  25972. * @memberOf _
  25973. * @since 3.0.0
  25974. * @category Array
  25975. * @param {Array} array The array to query.
  25976. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25977. * @returns {Array} Returns the slice of `array`.
  25978. * @example
  25979. *
  25980. * var users = [
  25981. * { 'user': 'barney', 'active': true },
  25982. * { 'user': 'fred', 'active': false },
  25983. * { 'user': 'pebbles', 'active': false }
  25984. * ];
  25985. *
  25986. * _.takeRightWhile(users, function(o) { return !o.active; });
  25987. * // => objects for ['fred', 'pebbles']
  25988. *
  25989. * // The `_.matches` iteratee shorthand.
  25990. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  25991. * // => objects for ['pebbles']
  25992. *
  25993. * // The `_.matchesProperty` iteratee shorthand.
  25994. * _.takeRightWhile(users, ['active', false]);
  25995. * // => objects for ['fred', 'pebbles']
  25996. *
  25997. * // The `_.property` iteratee shorthand.
  25998. * _.takeRightWhile(users, 'active');
  25999. * // => []
  26000. */
  26001. function takeRightWhile(array, predicate) {
  26002. return (array && array.length)
  26003. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  26004. : [];
  26005. }
  26006. /**
  26007. * Creates a slice of `array` with elements taken from the beginning. Elements
  26008. * are taken until `predicate` returns falsey. The predicate is invoked with
  26009. * three arguments: (value, index, array).
  26010. *
  26011. * @static
  26012. * @memberOf _
  26013. * @since 3.0.0
  26014. * @category Array
  26015. * @param {Array} array The array to query.
  26016. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26017. * @returns {Array} Returns the slice of `array`.
  26018. * @example
  26019. *
  26020. * var users = [
  26021. * { 'user': 'barney', 'active': false },
  26022. * { 'user': 'fred', 'active': false },
  26023. * { 'user': 'pebbles', 'active': true }
  26024. * ];
  26025. *
  26026. * _.takeWhile(users, function(o) { return !o.active; });
  26027. * // => objects for ['barney', 'fred']
  26028. *
  26029. * // The `_.matches` iteratee shorthand.
  26030. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  26031. * // => objects for ['barney']
  26032. *
  26033. * // The `_.matchesProperty` iteratee shorthand.
  26034. * _.takeWhile(users, ['active', false]);
  26035. * // => objects for ['barney', 'fred']
  26036. *
  26037. * // The `_.property` iteratee shorthand.
  26038. * _.takeWhile(users, 'active');
  26039. * // => []
  26040. */
  26041. function takeWhile(array, predicate) {
  26042. return (array && array.length)
  26043. ? baseWhile(array, getIteratee(predicate, 3))
  26044. : [];
  26045. }
  26046. /**
  26047. * Creates an array of unique values, in order, from all given arrays using
  26048. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26049. * for equality comparisons.
  26050. *
  26051. * @static
  26052. * @memberOf _
  26053. * @since 0.1.0
  26054. * @category Array
  26055. * @param {...Array} [arrays] The arrays to inspect.
  26056. * @returns {Array} Returns the new array of combined values.
  26057. * @example
  26058. *
  26059. * _.union([2], [1, 2]);
  26060. * // => [2, 1]
  26061. */
  26062. var union = baseRest(function(arrays) {
  26063. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  26064. });
  26065. /**
  26066. * This method is like `_.union` except that it accepts `iteratee` which is
  26067. * invoked for each element of each `arrays` to generate the criterion by
  26068. * which uniqueness is computed. Result values are chosen from the first
  26069. * array in which the value occurs. The iteratee is invoked with one argument:
  26070. * (value).
  26071. *
  26072. * @static
  26073. * @memberOf _
  26074. * @since 4.0.0
  26075. * @category Array
  26076. * @param {...Array} [arrays] The arrays to inspect.
  26077. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26078. * @returns {Array} Returns the new array of combined values.
  26079. * @example
  26080. *
  26081. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  26082. * // => [2.1, 1.2]
  26083. *
  26084. * // The `_.property` iteratee shorthand.
  26085. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26086. * // => [{ 'x': 1 }, { 'x': 2 }]
  26087. */
  26088. var unionBy = baseRest(function(arrays) {
  26089. var iteratee = last(arrays);
  26090. if (isArrayLikeObject(iteratee)) {
  26091. iteratee = undefined;
  26092. }
  26093. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  26094. });
  26095. /**
  26096. * This method is like `_.union` except that it accepts `comparator` which
  26097. * is invoked to compare elements of `arrays`. Result values are chosen from
  26098. * the first array in which the value occurs. The comparator is invoked
  26099. * with two arguments: (arrVal, othVal).
  26100. *
  26101. * @static
  26102. * @memberOf _
  26103. * @since 4.0.0
  26104. * @category Array
  26105. * @param {...Array} [arrays] The arrays to inspect.
  26106. * @param {Function} [comparator] The comparator invoked per element.
  26107. * @returns {Array} Returns the new array of combined values.
  26108. * @example
  26109. *
  26110. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26111. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26112. *
  26113. * _.unionWith(objects, others, _.isEqual);
  26114. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26115. */
  26116. var unionWith = baseRest(function(arrays) {
  26117. var comparator = last(arrays);
  26118. comparator = typeof comparator == 'function' ? comparator : undefined;
  26119. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  26120. });
  26121. /**
  26122. * Creates a duplicate-free version of an array, using
  26123. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26124. * for equality comparisons, in which only the first occurrence of each element
  26125. * is kept. The order of result values is determined by the order they occur
  26126. * in the array.
  26127. *
  26128. * @static
  26129. * @memberOf _
  26130. * @since 0.1.0
  26131. * @category Array
  26132. * @param {Array} array The array to inspect.
  26133. * @returns {Array} Returns the new duplicate free array.
  26134. * @example
  26135. *
  26136. * _.uniq([2, 1, 2]);
  26137. * // => [2, 1]
  26138. */
  26139. function uniq(array) {
  26140. return (array && array.length) ? baseUniq(array) : [];
  26141. }
  26142. /**
  26143. * This method is like `_.uniq` except that it accepts `iteratee` which is
  26144. * invoked for each element in `array` to generate the criterion by which
  26145. * uniqueness is computed. The order of result values is determined by the
  26146. * order they occur in the array. The iteratee is invoked with one argument:
  26147. * (value).
  26148. *
  26149. * @static
  26150. * @memberOf _
  26151. * @since 4.0.0
  26152. * @category Array
  26153. * @param {Array} array The array to inspect.
  26154. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26155. * @returns {Array} Returns the new duplicate free array.
  26156. * @example
  26157. *
  26158. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  26159. * // => [2.1, 1.2]
  26160. *
  26161. * // The `_.property` iteratee shorthand.
  26162. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  26163. * // => [{ 'x': 1 }, { 'x': 2 }]
  26164. */
  26165. function uniqBy(array, iteratee) {
  26166. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  26167. }
  26168. /**
  26169. * This method is like `_.uniq` except that it accepts `comparator` which
  26170. * is invoked to compare elements of `array`. The order of result values is
  26171. * determined by the order they occur in the array.The comparator is invoked
  26172. * with two arguments: (arrVal, othVal).
  26173. *
  26174. * @static
  26175. * @memberOf _
  26176. * @since 4.0.0
  26177. * @category Array
  26178. * @param {Array} array The array to inspect.
  26179. * @param {Function} [comparator] The comparator invoked per element.
  26180. * @returns {Array} Returns the new duplicate free array.
  26181. * @example
  26182. *
  26183. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26184. *
  26185. * _.uniqWith(objects, _.isEqual);
  26186. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  26187. */
  26188. function uniqWith(array, comparator) {
  26189. comparator = typeof comparator == 'function' ? comparator : undefined;
  26190. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  26191. }
  26192. /**
  26193. * This method is like `_.zip` except that it accepts an array of grouped
  26194. * elements and creates an array regrouping the elements to their pre-zip
  26195. * configuration.
  26196. *
  26197. * @static
  26198. * @memberOf _
  26199. * @since 1.2.0
  26200. * @category Array
  26201. * @param {Array} array The array of grouped elements to process.
  26202. * @returns {Array} Returns the new array of regrouped elements.
  26203. * @example
  26204. *
  26205. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  26206. * // => [['a', 1, true], ['b', 2, false]]
  26207. *
  26208. * _.unzip(zipped);
  26209. * // => [['a', 'b'], [1, 2], [true, false]]
  26210. */
  26211. function unzip(array) {
  26212. if (!(array && array.length)) {
  26213. return [];
  26214. }
  26215. var length = 0;
  26216. array = arrayFilter(array, function(group) {
  26217. if (isArrayLikeObject(group)) {
  26218. length = nativeMax(group.length, length);
  26219. return true;
  26220. }
  26221. });
  26222. return baseTimes(length, function(index) {
  26223. return arrayMap(array, baseProperty(index));
  26224. });
  26225. }
  26226. /**
  26227. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  26228. * how regrouped values should be combined. The iteratee is invoked with the
  26229. * elements of each group: (...group).
  26230. *
  26231. * @static
  26232. * @memberOf _
  26233. * @since 3.8.0
  26234. * @category Array
  26235. * @param {Array} array The array of grouped elements to process.
  26236. * @param {Function} [iteratee=_.identity] The function to combine
  26237. * regrouped values.
  26238. * @returns {Array} Returns the new array of regrouped elements.
  26239. * @example
  26240. *
  26241. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  26242. * // => [[1, 10, 100], [2, 20, 200]]
  26243. *
  26244. * _.unzipWith(zipped, _.add);
  26245. * // => [3, 30, 300]
  26246. */
  26247. function unzipWith(array, iteratee) {
  26248. if (!(array && array.length)) {
  26249. return [];
  26250. }
  26251. var result = unzip(array);
  26252. if (iteratee == null) {
  26253. return result;
  26254. }
  26255. return arrayMap(result, function(group) {
  26256. return apply(iteratee, undefined, group);
  26257. });
  26258. }
  26259. /**
  26260. * Creates an array excluding all given values using
  26261. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26262. * for equality comparisons.
  26263. *
  26264. * **Note:** Unlike `_.pull`, this method returns a new array.
  26265. *
  26266. * @static
  26267. * @memberOf _
  26268. * @since 0.1.0
  26269. * @category Array
  26270. * @param {Array} array The array to inspect.
  26271. * @param {...*} [values] The values to exclude.
  26272. * @returns {Array} Returns the new array of filtered values.
  26273. * @see _.difference, _.xor
  26274. * @example
  26275. *
  26276. * _.without([2, 1, 2, 3], 1, 2);
  26277. * // => [3]
  26278. */
  26279. var without = baseRest(function(array, values) {
  26280. return isArrayLikeObject(array)
  26281. ? baseDifference(array, values)
  26282. : [];
  26283. });
  26284. /**
  26285. * Creates an array of unique values that is the
  26286. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  26287. * of the given arrays. The order of result values is determined by the order
  26288. * they occur in the arrays.
  26289. *
  26290. * @static
  26291. * @memberOf _
  26292. * @since 2.4.0
  26293. * @category Array
  26294. * @param {...Array} [arrays] The arrays to inspect.
  26295. * @returns {Array} Returns the new array of filtered values.
  26296. * @see _.difference, _.without
  26297. * @example
  26298. *
  26299. * _.xor([2, 1], [2, 3]);
  26300. * // => [1, 3]
  26301. */
  26302. var xor = baseRest(function(arrays) {
  26303. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  26304. });
  26305. /**
  26306. * This method is like `_.xor` except that it accepts `iteratee` which is
  26307. * invoked for each element of each `arrays` to generate the criterion by
  26308. * which by which they're compared. The order of result values is determined
  26309. * by the order they occur in the arrays. The iteratee is invoked with one
  26310. * argument: (value).
  26311. *
  26312. * @static
  26313. * @memberOf _
  26314. * @since 4.0.0
  26315. * @category Array
  26316. * @param {...Array} [arrays] The arrays to inspect.
  26317. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26318. * @returns {Array} Returns the new array of filtered values.
  26319. * @example
  26320. *
  26321. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  26322. * // => [1.2, 3.4]
  26323. *
  26324. * // The `_.property` iteratee shorthand.
  26325. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26326. * // => [{ 'x': 2 }]
  26327. */
  26328. var xorBy = baseRest(function(arrays) {
  26329. var iteratee = last(arrays);
  26330. if (isArrayLikeObject(iteratee)) {
  26331. iteratee = undefined;
  26332. }
  26333. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  26334. });
  26335. /**
  26336. * This method is like `_.xor` except that it accepts `comparator` which is
  26337. * invoked to compare elements of `arrays`. The order of result values is
  26338. * determined by the order they occur in the arrays. The comparator is invoked
  26339. * with two arguments: (arrVal, othVal).
  26340. *
  26341. * @static
  26342. * @memberOf _
  26343. * @since 4.0.0
  26344. * @category Array
  26345. * @param {...Array} [arrays] The arrays to inspect.
  26346. * @param {Function} [comparator] The comparator invoked per element.
  26347. * @returns {Array} Returns the new array of filtered values.
  26348. * @example
  26349. *
  26350. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26351. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26352. *
  26353. * _.xorWith(objects, others, _.isEqual);
  26354. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26355. */
  26356. var xorWith = baseRest(function(arrays) {
  26357. var comparator = last(arrays);
  26358. comparator = typeof comparator == 'function' ? comparator : undefined;
  26359. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  26360. });
  26361. /**
  26362. * Creates an array of grouped elements, the first of which contains the
  26363. * first elements of the given arrays, the second of which contains the
  26364. * second elements of the given arrays, and so on.
  26365. *
  26366. * @static
  26367. * @memberOf _
  26368. * @since 0.1.0
  26369. * @category Array
  26370. * @param {...Array} [arrays] The arrays to process.
  26371. * @returns {Array} Returns the new array of grouped elements.
  26372. * @example
  26373. *
  26374. * _.zip(['a', 'b'], [1, 2], [true, false]);
  26375. * // => [['a', 1, true], ['b', 2, false]]
  26376. */
  26377. var zip = baseRest(unzip);
  26378. /**
  26379. * This method is like `_.fromPairs` except that it accepts two arrays,
  26380. * one of property identifiers and one of corresponding values.
  26381. *
  26382. * @static
  26383. * @memberOf _
  26384. * @since 0.4.0
  26385. * @category Array
  26386. * @param {Array} [props=[]] The property identifiers.
  26387. * @param {Array} [values=[]] The property values.
  26388. * @returns {Object} Returns the new object.
  26389. * @example
  26390. *
  26391. * _.zipObject(['a', 'b'], [1, 2]);
  26392. * // => { 'a': 1, 'b': 2 }
  26393. */
  26394. function zipObject(props, values) {
  26395. return baseZipObject(props || [], values || [], assignValue);
  26396. }
  26397. /**
  26398. * This method is like `_.zipObject` except that it supports property paths.
  26399. *
  26400. * @static
  26401. * @memberOf _
  26402. * @since 4.1.0
  26403. * @category Array
  26404. * @param {Array} [props=[]] The property identifiers.
  26405. * @param {Array} [values=[]] The property values.
  26406. * @returns {Object} Returns the new object.
  26407. * @example
  26408. *
  26409. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  26410. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  26411. */
  26412. function zipObjectDeep(props, values) {
  26413. return baseZipObject(props || [], values || [], baseSet);
  26414. }
  26415. /**
  26416. * This method is like `_.zip` except that it accepts `iteratee` to specify
  26417. * how grouped values should be combined. The iteratee is invoked with the
  26418. * elements of each group: (...group).
  26419. *
  26420. * @static
  26421. * @memberOf _
  26422. * @since 3.8.0
  26423. * @category Array
  26424. * @param {...Array} [arrays] The arrays to process.
  26425. * @param {Function} [iteratee=_.identity] The function to combine
  26426. * grouped values.
  26427. * @returns {Array} Returns the new array of grouped elements.
  26428. * @example
  26429. *
  26430. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  26431. * return a + b + c;
  26432. * });
  26433. * // => [111, 222]
  26434. */
  26435. var zipWith = baseRest(function(arrays) {
  26436. var length = arrays.length,
  26437. iteratee = length > 1 ? arrays[length - 1] : undefined;
  26438. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  26439. return unzipWith(arrays, iteratee);
  26440. });
  26441. /*------------------------------------------------------------------------*/
  26442. /**
  26443. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  26444. * chain sequences enabled. The result of such sequences must be unwrapped
  26445. * with `_#value`.
  26446. *
  26447. * @static
  26448. * @memberOf _
  26449. * @since 1.3.0
  26450. * @category Seq
  26451. * @param {*} value The value to wrap.
  26452. * @returns {Object} Returns the new `lodash` wrapper instance.
  26453. * @example
  26454. *
  26455. * var users = [
  26456. * { 'user': 'barney', 'age': 36 },
  26457. * { 'user': 'fred', 'age': 40 },
  26458. * { 'user': 'pebbles', 'age': 1 }
  26459. * ];
  26460. *
  26461. * var youngest = _
  26462. * .chain(users)
  26463. * .sortBy('age')
  26464. * .map(function(o) {
  26465. * return o.user + ' is ' + o.age;
  26466. * })
  26467. * .head()
  26468. * .value();
  26469. * // => 'pebbles is 1'
  26470. */
  26471. function chain(value) {
  26472. var result = lodash(value);
  26473. result.__chain__ = true;
  26474. return result;
  26475. }
  26476. /**
  26477. * This method invokes `interceptor` and returns `value`. The interceptor
  26478. * is invoked with one argument; (value). The purpose of this method is to
  26479. * "tap into" a method chain sequence in order to modify intermediate results.
  26480. *
  26481. * @static
  26482. * @memberOf _
  26483. * @since 0.1.0
  26484. * @category Seq
  26485. * @param {*} value The value to provide to `interceptor`.
  26486. * @param {Function} interceptor The function to invoke.
  26487. * @returns {*} Returns `value`.
  26488. * @example
  26489. *
  26490. * _([1, 2, 3])
  26491. * .tap(function(array) {
  26492. * // Mutate input array.
  26493. * array.pop();
  26494. * })
  26495. * .reverse()
  26496. * .value();
  26497. * // => [2, 1]
  26498. */
  26499. function tap(value, interceptor) {
  26500. interceptor(value);
  26501. return value;
  26502. }
  26503. /**
  26504. * This method is like `_.tap` except that it returns the result of `interceptor`.
  26505. * The purpose of this method is to "pass thru" values replacing intermediate
  26506. * results in a method chain sequence.
  26507. *
  26508. * @static
  26509. * @memberOf _
  26510. * @since 3.0.0
  26511. * @category Seq
  26512. * @param {*} value The value to provide to `interceptor`.
  26513. * @param {Function} interceptor The function to invoke.
  26514. * @returns {*} Returns the result of `interceptor`.
  26515. * @example
  26516. *
  26517. * _(' abc ')
  26518. * .chain()
  26519. * .trim()
  26520. * .thru(function(value) {
  26521. * return [value];
  26522. * })
  26523. * .value();
  26524. * // => ['abc']
  26525. */
  26526. function thru(value, interceptor) {
  26527. return interceptor(value);
  26528. }
  26529. /**
  26530. * This method is the wrapper version of `_.at`.
  26531. *
  26532. * @name at
  26533. * @memberOf _
  26534. * @since 1.0.0
  26535. * @category Seq
  26536. * @param {...(string|string[])} [paths] The property paths to pick.
  26537. * @returns {Object} Returns the new `lodash` wrapper instance.
  26538. * @example
  26539. *
  26540. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  26541. *
  26542. * _(object).at(['a[0].b.c', 'a[1]']).value();
  26543. * // => [3, 4]
  26544. */
  26545. var wrapperAt = flatRest(function(paths) {
  26546. var length = paths.length,
  26547. start = length ? paths[0] : 0,
  26548. value = this.__wrapped__,
  26549. interceptor = function(object) { return baseAt(object, paths); };
  26550. if (length > 1 || this.__actions__.length ||
  26551. !(value instanceof LazyWrapper) || !isIndex(start)) {
  26552. return this.thru(interceptor);
  26553. }
  26554. value = value.slice(start, +start + (length ? 1 : 0));
  26555. value.__actions__.push({
  26556. 'func': thru,
  26557. 'args': [interceptor],
  26558. 'thisArg': undefined
  26559. });
  26560. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  26561. if (length && !array.length) {
  26562. array.push(undefined);
  26563. }
  26564. return array;
  26565. });
  26566. });
  26567. /**
  26568. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  26569. *
  26570. * @name chain
  26571. * @memberOf _
  26572. * @since 0.1.0
  26573. * @category Seq
  26574. * @returns {Object} Returns the new `lodash` wrapper instance.
  26575. * @example
  26576. *
  26577. * var users = [
  26578. * { 'user': 'barney', 'age': 36 },
  26579. * { 'user': 'fred', 'age': 40 }
  26580. * ];
  26581. *
  26582. * // A sequence without explicit chaining.
  26583. * _(users).head();
  26584. * // => { 'user': 'barney', 'age': 36 }
  26585. *
  26586. * // A sequence with explicit chaining.
  26587. * _(users)
  26588. * .chain()
  26589. * .head()
  26590. * .pick('user')
  26591. * .value();
  26592. * // => { 'user': 'barney' }
  26593. */
  26594. function wrapperChain() {
  26595. return chain(this);
  26596. }
  26597. /**
  26598. * Executes the chain sequence and returns the wrapped result.
  26599. *
  26600. * @name commit
  26601. * @memberOf _
  26602. * @since 3.2.0
  26603. * @category Seq
  26604. * @returns {Object} Returns the new `lodash` wrapper instance.
  26605. * @example
  26606. *
  26607. * var array = [1, 2];
  26608. * var wrapped = _(array).push(3);
  26609. *
  26610. * console.log(array);
  26611. * // => [1, 2]
  26612. *
  26613. * wrapped = wrapped.commit();
  26614. * console.log(array);
  26615. * // => [1, 2, 3]
  26616. *
  26617. * wrapped.last();
  26618. * // => 3
  26619. *
  26620. * console.log(array);
  26621. * // => [1, 2, 3]
  26622. */
  26623. function wrapperCommit() {
  26624. return new LodashWrapper(this.value(), this.__chain__);
  26625. }
  26626. /**
  26627. * Gets the next value on a wrapped object following the
  26628. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  26629. *
  26630. * @name next
  26631. * @memberOf _
  26632. * @since 4.0.0
  26633. * @category Seq
  26634. * @returns {Object} Returns the next iterator value.
  26635. * @example
  26636. *
  26637. * var wrapped = _([1, 2]);
  26638. *
  26639. * wrapped.next();
  26640. * // => { 'done': false, 'value': 1 }
  26641. *
  26642. * wrapped.next();
  26643. * // => { 'done': false, 'value': 2 }
  26644. *
  26645. * wrapped.next();
  26646. * // => { 'done': true, 'value': undefined }
  26647. */
  26648. function wrapperNext() {
  26649. if (this.__values__ === undefined) {
  26650. this.__values__ = toArray(this.value());
  26651. }
  26652. var done = this.__index__ >= this.__values__.length,
  26653. value = done ? undefined : this.__values__[this.__index__++];
  26654. return { 'done': done, 'value': value };
  26655. }
  26656. /**
  26657. * Enables the wrapper to be iterable.
  26658. *
  26659. * @name Symbol.iterator
  26660. * @memberOf _
  26661. * @since 4.0.0
  26662. * @category Seq
  26663. * @returns {Object} Returns the wrapper object.
  26664. * @example
  26665. *
  26666. * var wrapped = _([1, 2]);
  26667. *
  26668. * wrapped[Symbol.iterator]() === wrapped;
  26669. * // => true
  26670. *
  26671. * Array.from(wrapped);
  26672. * // => [1, 2]
  26673. */
  26674. function wrapperToIterator() {
  26675. return this;
  26676. }
  26677. /**
  26678. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  26679. *
  26680. * @name plant
  26681. * @memberOf _
  26682. * @since 3.2.0
  26683. * @category Seq
  26684. * @param {*} value The value to plant.
  26685. * @returns {Object} Returns the new `lodash` wrapper instance.
  26686. * @example
  26687. *
  26688. * function square(n) {
  26689. * return n * n;
  26690. * }
  26691. *
  26692. * var wrapped = _([1, 2]).map(square);
  26693. * var other = wrapped.plant([3, 4]);
  26694. *
  26695. * other.value();
  26696. * // => [9, 16]
  26697. *
  26698. * wrapped.value();
  26699. * // => [1, 4]
  26700. */
  26701. function wrapperPlant(value) {
  26702. var result,
  26703. parent = this;
  26704. while (parent instanceof baseLodash) {
  26705. var clone = wrapperClone(parent);
  26706. clone.__index__ = 0;
  26707. clone.__values__ = undefined;
  26708. if (result) {
  26709. previous.__wrapped__ = clone;
  26710. } else {
  26711. result = clone;
  26712. }
  26713. var previous = clone;
  26714. parent = parent.__wrapped__;
  26715. }
  26716. previous.__wrapped__ = value;
  26717. return result;
  26718. }
  26719. /**
  26720. * This method is the wrapper version of `_.reverse`.
  26721. *
  26722. * **Note:** This method mutates the wrapped array.
  26723. *
  26724. * @name reverse
  26725. * @memberOf _
  26726. * @since 0.1.0
  26727. * @category Seq
  26728. * @returns {Object} Returns the new `lodash` wrapper instance.
  26729. * @example
  26730. *
  26731. * var array = [1, 2, 3];
  26732. *
  26733. * _(array).reverse().value()
  26734. * // => [3, 2, 1]
  26735. *
  26736. * console.log(array);
  26737. * // => [3, 2, 1]
  26738. */
  26739. function wrapperReverse() {
  26740. var value = this.__wrapped__;
  26741. if (value instanceof LazyWrapper) {
  26742. var wrapped = value;
  26743. if (this.__actions__.length) {
  26744. wrapped = new LazyWrapper(this);
  26745. }
  26746. wrapped = wrapped.reverse();
  26747. wrapped.__actions__.push({
  26748. 'func': thru,
  26749. 'args': [reverse],
  26750. 'thisArg': undefined
  26751. });
  26752. return new LodashWrapper(wrapped, this.__chain__);
  26753. }
  26754. return this.thru(reverse);
  26755. }
  26756. /**
  26757. * Executes the chain sequence to resolve the unwrapped value.
  26758. *
  26759. * @name value
  26760. * @memberOf _
  26761. * @since 0.1.0
  26762. * @alias toJSON, valueOf
  26763. * @category Seq
  26764. * @returns {*} Returns the resolved unwrapped value.
  26765. * @example
  26766. *
  26767. * _([1, 2, 3]).value();
  26768. * // => [1, 2, 3]
  26769. */
  26770. function wrapperValue() {
  26771. return baseWrapperValue(this.__wrapped__, this.__actions__);
  26772. }
  26773. /*------------------------------------------------------------------------*/
  26774. /**
  26775. * Creates an object composed of keys generated from the results of running
  26776. * each element of `collection` thru `iteratee`. The corresponding value of
  26777. * each key is the number of times the key was returned by `iteratee`. The
  26778. * iteratee is invoked with one argument: (value).
  26779. *
  26780. * @static
  26781. * @memberOf _
  26782. * @since 0.5.0
  26783. * @category Collection
  26784. * @param {Array|Object} collection The collection to iterate over.
  26785. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26786. * @returns {Object} Returns the composed aggregate object.
  26787. * @example
  26788. *
  26789. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  26790. * // => { '4': 1, '6': 2 }
  26791. *
  26792. * // The `_.property` iteratee shorthand.
  26793. * _.countBy(['one', 'two', 'three'], 'length');
  26794. * // => { '3': 2, '5': 1 }
  26795. */
  26796. var countBy = createAggregator(function(result, value, key) {
  26797. if (hasOwnProperty.call(result, key)) {
  26798. ++result[key];
  26799. } else {
  26800. baseAssignValue(result, key, 1);
  26801. }
  26802. });
  26803. /**
  26804. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  26805. * Iteration is stopped once `predicate` returns falsey. The predicate is
  26806. * invoked with three arguments: (value, index|key, collection).
  26807. *
  26808. * **Note:** This method returns `true` for
  26809. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  26810. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  26811. * elements of empty collections.
  26812. *
  26813. * @static
  26814. * @memberOf _
  26815. * @since 0.1.0
  26816. * @category Collection
  26817. * @param {Array|Object} collection The collection to iterate over.
  26818. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26819. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26820. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  26821. * else `false`.
  26822. * @example
  26823. *
  26824. * _.every([true, 1, null, 'yes'], Boolean);
  26825. * // => false
  26826. *
  26827. * var users = [
  26828. * { 'user': 'barney', 'age': 36, 'active': false },
  26829. * { 'user': 'fred', 'age': 40, 'active': false }
  26830. * ];
  26831. *
  26832. * // The `_.matches` iteratee shorthand.
  26833. * _.every(users, { 'user': 'barney', 'active': false });
  26834. * // => false
  26835. *
  26836. * // The `_.matchesProperty` iteratee shorthand.
  26837. * _.every(users, ['active', false]);
  26838. * // => true
  26839. *
  26840. * // The `_.property` iteratee shorthand.
  26841. * _.every(users, 'active');
  26842. * // => false
  26843. */
  26844. function every(collection, predicate, guard) {
  26845. var func = isArray(collection) ? arrayEvery : baseEvery;
  26846. if (guard && isIterateeCall(collection, predicate, guard)) {
  26847. predicate = undefined;
  26848. }
  26849. return func(collection, getIteratee(predicate, 3));
  26850. }
  26851. /**
  26852. * Iterates over elements of `collection`, returning an array of all elements
  26853. * `predicate` returns truthy for. The predicate is invoked with three
  26854. * arguments: (value, index|key, collection).
  26855. *
  26856. * **Note:** Unlike `_.remove`, this method returns a new array.
  26857. *
  26858. * @static
  26859. * @memberOf _
  26860. * @since 0.1.0
  26861. * @category Collection
  26862. * @param {Array|Object} collection The collection to iterate over.
  26863. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26864. * @returns {Array} Returns the new filtered array.
  26865. * @see _.reject
  26866. * @example
  26867. *
  26868. * var users = [
  26869. * { 'user': 'barney', 'age': 36, 'active': true },
  26870. * { 'user': 'fred', 'age': 40, 'active': false }
  26871. * ];
  26872. *
  26873. * _.filter(users, function(o) { return !o.active; });
  26874. * // => objects for ['fred']
  26875. *
  26876. * // The `_.matches` iteratee shorthand.
  26877. * _.filter(users, { 'age': 36, 'active': true });
  26878. * // => objects for ['barney']
  26879. *
  26880. * // The `_.matchesProperty` iteratee shorthand.
  26881. * _.filter(users, ['active', false]);
  26882. * // => objects for ['fred']
  26883. *
  26884. * // The `_.property` iteratee shorthand.
  26885. * _.filter(users, 'active');
  26886. * // => objects for ['barney']
  26887. */
  26888. function filter(collection, predicate) {
  26889. var func = isArray(collection) ? arrayFilter : baseFilter;
  26890. return func(collection, getIteratee(predicate, 3));
  26891. }
  26892. /**
  26893. * Iterates over elements of `collection`, returning the first element
  26894. * `predicate` returns truthy for. The predicate is invoked with three
  26895. * arguments: (value, index|key, collection).
  26896. *
  26897. * @static
  26898. * @memberOf _
  26899. * @since 0.1.0
  26900. * @category Collection
  26901. * @param {Array|Object} collection The collection to inspect.
  26902. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26903. * @param {number} [fromIndex=0] The index to search from.
  26904. * @returns {*} Returns the matched element, else `undefined`.
  26905. * @example
  26906. *
  26907. * var users = [
  26908. * { 'user': 'barney', 'age': 36, 'active': true },
  26909. * { 'user': 'fred', 'age': 40, 'active': false },
  26910. * { 'user': 'pebbles', 'age': 1, 'active': true }
  26911. * ];
  26912. *
  26913. * _.find(users, function(o) { return o.age < 40; });
  26914. * // => object for 'barney'
  26915. *
  26916. * // The `_.matches` iteratee shorthand.
  26917. * _.find(users, { 'age': 1, 'active': true });
  26918. * // => object for 'pebbles'
  26919. *
  26920. * // The `_.matchesProperty` iteratee shorthand.
  26921. * _.find(users, ['active', false]);
  26922. * // => object for 'fred'
  26923. *
  26924. * // The `_.property` iteratee shorthand.
  26925. * _.find(users, 'active');
  26926. * // => object for 'barney'
  26927. */
  26928. var find = createFind(findIndex);
  26929. /**
  26930. * This method is like `_.find` except that it iterates over elements of
  26931. * `collection` from right to left.
  26932. *
  26933. * @static
  26934. * @memberOf _
  26935. * @since 2.0.0
  26936. * @category Collection
  26937. * @param {Array|Object} collection The collection to inspect.
  26938. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26939. * @param {number} [fromIndex=collection.length-1] The index to search from.
  26940. * @returns {*} Returns the matched element, else `undefined`.
  26941. * @example
  26942. *
  26943. * _.findLast([1, 2, 3, 4], function(n) {
  26944. * return n % 2 == 1;
  26945. * });
  26946. * // => 3
  26947. */
  26948. var findLast = createFind(findLastIndex);
  26949. /**
  26950. * Creates a flattened array of values by running each element in `collection`
  26951. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  26952. * with three arguments: (value, index|key, collection).
  26953. *
  26954. * @static
  26955. * @memberOf _
  26956. * @since 4.0.0
  26957. * @category Collection
  26958. * @param {Array|Object} collection The collection to iterate over.
  26959. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26960. * @returns {Array} Returns the new flattened array.
  26961. * @example
  26962. *
  26963. * function duplicate(n) {
  26964. * return [n, n];
  26965. * }
  26966. *
  26967. * _.flatMap([1, 2], duplicate);
  26968. * // => [1, 1, 2, 2]
  26969. */
  26970. function flatMap(collection, iteratee) {
  26971. return baseFlatten(map(collection, iteratee), 1);
  26972. }
  26973. /**
  26974. * This method is like `_.flatMap` except that it recursively flattens the
  26975. * mapped results.
  26976. *
  26977. * @static
  26978. * @memberOf _
  26979. * @since 4.7.0
  26980. * @category Collection
  26981. * @param {Array|Object} collection The collection to iterate over.
  26982. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26983. * @returns {Array} Returns the new flattened array.
  26984. * @example
  26985. *
  26986. * function duplicate(n) {
  26987. * return [[[n, n]]];
  26988. * }
  26989. *
  26990. * _.flatMapDeep([1, 2], duplicate);
  26991. * // => [1, 1, 2, 2]
  26992. */
  26993. function flatMapDeep(collection, iteratee) {
  26994. return baseFlatten(map(collection, iteratee), INFINITY);
  26995. }
  26996. /**
  26997. * This method is like `_.flatMap` except that it recursively flattens the
  26998. * mapped results up to `depth` times.
  26999. *
  27000. * @static
  27001. * @memberOf _
  27002. * @since 4.7.0
  27003. * @category Collection
  27004. * @param {Array|Object} collection The collection to iterate over.
  27005. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27006. * @param {number} [depth=1] The maximum recursion depth.
  27007. * @returns {Array} Returns the new flattened array.
  27008. * @example
  27009. *
  27010. * function duplicate(n) {
  27011. * return [[[n, n]]];
  27012. * }
  27013. *
  27014. * _.flatMapDepth([1, 2], duplicate, 2);
  27015. * // => [[1, 1], [2, 2]]
  27016. */
  27017. function flatMapDepth(collection, iteratee, depth) {
  27018. depth = depth === undefined ? 1 : toInteger(depth);
  27019. return baseFlatten(map(collection, iteratee), depth);
  27020. }
  27021. /**
  27022. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  27023. * The iteratee is invoked with three arguments: (value, index|key, collection).
  27024. * Iteratee functions may exit iteration early by explicitly returning `false`.
  27025. *
  27026. * **Note:** As with other "Collections" methods, objects with a "length"
  27027. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  27028. * or `_.forOwn` for object iteration.
  27029. *
  27030. * @static
  27031. * @memberOf _
  27032. * @since 0.1.0
  27033. * @alias each
  27034. * @category Collection
  27035. * @param {Array|Object} collection The collection to iterate over.
  27036. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27037. * @returns {Array|Object} Returns `collection`.
  27038. * @see _.forEachRight
  27039. * @example
  27040. *
  27041. * _.forEach([1, 2], function(value) {
  27042. * console.log(value);
  27043. * });
  27044. * // => Logs `1` then `2`.
  27045. *
  27046. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  27047. * console.log(key);
  27048. * });
  27049. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  27050. */
  27051. function forEach(collection, iteratee) {
  27052. var func = isArray(collection) ? arrayEach : baseEach;
  27053. return func(collection, getIteratee(iteratee, 3));
  27054. }
  27055. /**
  27056. * This method is like `_.forEach` except that it iterates over elements of
  27057. * `collection` from right to left.
  27058. *
  27059. * @static
  27060. * @memberOf _
  27061. * @since 2.0.0
  27062. * @alias eachRight
  27063. * @category Collection
  27064. * @param {Array|Object} collection The collection to iterate over.
  27065. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27066. * @returns {Array|Object} Returns `collection`.
  27067. * @see _.forEach
  27068. * @example
  27069. *
  27070. * _.forEachRight([1, 2], function(value) {
  27071. * console.log(value);
  27072. * });
  27073. * // => Logs `2` then `1`.
  27074. */
  27075. function forEachRight(collection, iteratee) {
  27076. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  27077. return func(collection, getIteratee(iteratee, 3));
  27078. }
  27079. /**
  27080. * Creates an object composed of keys generated from the results of running
  27081. * each element of `collection` thru `iteratee`. The order of grouped values
  27082. * is determined by the order they occur in `collection`. The corresponding
  27083. * value of each key is an array of elements responsible for generating the
  27084. * key. The iteratee is invoked with one argument: (value).
  27085. *
  27086. * @static
  27087. * @memberOf _
  27088. * @since 0.1.0
  27089. * @category Collection
  27090. * @param {Array|Object} collection The collection to iterate over.
  27091. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27092. * @returns {Object} Returns the composed aggregate object.
  27093. * @example
  27094. *
  27095. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  27096. * // => { '4': [4.2], '6': [6.1, 6.3] }
  27097. *
  27098. * // The `_.property` iteratee shorthand.
  27099. * _.groupBy(['one', 'two', 'three'], 'length');
  27100. * // => { '3': ['one', 'two'], '5': ['three'] }
  27101. */
  27102. var groupBy = createAggregator(function(result, value, key) {
  27103. if (hasOwnProperty.call(result, key)) {
  27104. result[key].push(value);
  27105. } else {
  27106. baseAssignValue(result, key, [value]);
  27107. }
  27108. });
  27109. /**
  27110. * Checks if `value` is in `collection`. If `collection` is a string, it's
  27111. * checked for a substring of `value`, otherwise
  27112. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  27113. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  27114. * the offset from the end of `collection`.
  27115. *
  27116. * @static
  27117. * @memberOf _
  27118. * @since 0.1.0
  27119. * @category Collection
  27120. * @param {Array|Object|string} collection The collection to inspect.
  27121. * @param {*} value The value to search for.
  27122. * @param {number} [fromIndex=0] The index to search from.
  27123. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27124. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  27125. * @example
  27126. *
  27127. * _.includes([1, 2, 3], 1);
  27128. * // => true
  27129. *
  27130. * _.includes([1, 2, 3], 1, 2);
  27131. * // => false
  27132. *
  27133. * _.includes({ 'a': 1, 'b': 2 }, 1);
  27134. * // => true
  27135. *
  27136. * _.includes('abcd', 'bc');
  27137. * // => true
  27138. */
  27139. function includes(collection, value, fromIndex, guard) {
  27140. collection = isArrayLike(collection) ? collection : values(collection);
  27141. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  27142. var length = collection.length;
  27143. if (fromIndex < 0) {
  27144. fromIndex = nativeMax(length + fromIndex, 0);
  27145. }
  27146. return isString(collection)
  27147. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  27148. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  27149. }
  27150. /**
  27151. * Invokes the method at `path` of each element in `collection`, returning
  27152. * an array of the results of each invoked method. Any additional arguments
  27153. * are provided to each invoked method. If `path` is a function, it's invoked
  27154. * for, and `this` bound to, each element in `collection`.
  27155. *
  27156. * @static
  27157. * @memberOf _
  27158. * @since 4.0.0
  27159. * @category Collection
  27160. * @param {Array|Object} collection The collection to iterate over.
  27161. * @param {Array|Function|string} path The path of the method to invoke or
  27162. * the function invoked per iteration.
  27163. * @param {...*} [args] The arguments to invoke each method with.
  27164. * @returns {Array} Returns the array of results.
  27165. * @example
  27166. *
  27167. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  27168. * // => [[1, 5, 7], [1, 2, 3]]
  27169. *
  27170. * _.invokeMap([123, 456], String.prototype.split, '');
  27171. * // => [['1', '2', '3'], ['4', '5', '6']]
  27172. */
  27173. var invokeMap = baseRest(function(collection, path, args) {
  27174. var index = -1,
  27175. isFunc = typeof path == 'function',
  27176. result = isArrayLike(collection) ? Array(collection.length) : [];
  27177. baseEach(collection, function(value) {
  27178. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  27179. });
  27180. return result;
  27181. });
  27182. /**
  27183. * Creates an object composed of keys generated from the results of running
  27184. * each element of `collection` thru `iteratee`. The corresponding value of
  27185. * each key is the last element responsible for generating the key. The
  27186. * iteratee is invoked with one argument: (value).
  27187. *
  27188. * @static
  27189. * @memberOf _
  27190. * @since 4.0.0
  27191. * @category Collection
  27192. * @param {Array|Object} collection The collection to iterate over.
  27193. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27194. * @returns {Object} Returns the composed aggregate object.
  27195. * @example
  27196. *
  27197. * var array = [
  27198. * { 'dir': 'left', 'code': 97 },
  27199. * { 'dir': 'right', 'code': 100 }
  27200. * ];
  27201. *
  27202. * _.keyBy(array, function(o) {
  27203. * return String.fromCharCode(o.code);
  27204. * });
  27205. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  27206. *
  27207. * _.keyBy(array, 'dir');
  27208. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  27209. */
  27210. var keyBy = createAggregator(function(result, value, key) {
  27211. baseAssignValue(result, key, value);
  27212. });
  27213. /**
  27214. * Creates an array of values by running each element in `collection` thru
  27215. * `iteratee`. The iteratee is invoked with three arguments:
  27216. * (value, index|key, collection).
  27217. *
  27218. * Many lodash methods are guarded to work as iteratees for methods like
  27219. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  27220. *
  27221. * The guarded methods are:
  27222. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  27223. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  27224. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  27225. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  27226. *
  27227. * @static
  27228. * @memberOf _
  27229. * @since 0.1.0
  27230. * @category Collection
  27231. * @param {Array|Object} collection The collection to iterate over.
  27232. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27233. * @returns {Array} Returns the new mapped array.
  27234. * @example
  27235. *
  27236. * function square(n) {
  27237. * return n * n;
  27238. * }
  27239. *
  27240. * _.map([4, 8], square);
  27241. * // => [16, 64]
  27242. *
  27243. * _.map({ 'a': 4, 'b': 8 }, square);
  27244. * // => [16, 64] (iteration order is not guaranteed)
  27245. *
  27246. * var users = [
  27247. * { 'user': 'barney' },
  27248. * { 'user': 'fred' }
  27249. * ];
  27250. *
  27251. * // The `_.property` iteratee shorthand.
  27252. * _.map(users, 'user');
  27253. * // => ['barney', 'fred']
  27254. */
  27255. function map(collection, iteratee) {
  27256. var func = isArray(collection) ? arrayMap : baseMap;
  27257. return func(collection, getIteratee(iteratee, 3));
  27258. }
  27259. /**
  27260. * This method is like `_.sortBy` except that it allows specifying the sort
  27261. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  27262. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  27263. * descending or "asc" for ascending sort order of corresponding values.
  27264. *
  27265. * @static
  27266. * @memberOf _
  27267. * @since 4.0.0
  27268. * @category Collection
  27269. * @param {Array|Object} collection The collection to iterate over.
  27270. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  27271. * The iteratees to sort by.
  27272. * @param {string[]} [orders] The sort orders of `iteratees`.
  27273. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27274. * @returns {Array} Returns the new sorted array.
  27275. * @example
  27276. *
  27277. * var users = [
  27278. * { 'user': 'fred', 'age': 48 },
  27279. * { 'user': 'barney', 'age': 34 },
  27280. * { 'user': 'fred', 'age': 40 },
  27281. * { 'user': 'barney', 'age': 36 }
  27282. * ];
  27283. *
  27284. * // Sort by `user` in ascending order and by `age` in descending order.
  27285. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  27286. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27287. */
  27288. function orderBy(collection, iteratees, orders, guard) {
  27289. if (collection == null) {
  27290. return [];
  27291. }
  27292. if (!isArray(iteratees)) {
  27293. iteratees = iteratees == null ? [] : [iteratees];
  27294. }
  27295. orders = guard ? undefined : orders;
  27296. if (!isArray(orders)) {
  27297. orders = orders == null ? [] : [orders];
  27298. }
  27299. return baseOrderBy(collection, iteratees, orders);
  27300. }
  27301. /**
  27302. * Creates an array of elements split into two groups, the first of which
  27303. * contains elements `predicate` returns truthy for, the second of which
  27304. * contains elements `predicate` returns falsey for. The predicate is
  27305. * invoked with one argument: (value).
  27306. *
  27307. * @static
  27308. * @memberOf _
  27309. * @since 3.0.0
  27310. * @category Collection
  27311. * @param {Array|Object} collection The collection to iterate over.
  27312. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27313. * @returns {Array} Returns the array of grouped elements.
  27314. * @example
  27315. *
  27316. * var users = [
  27317. * { 'user': 'barney', 'age': 36, 'active': false },
  27318. * { 'user': 'fred', 'age': 40, 'active': true },
  27319. * { 'user': 'pebbles', 'age': 1, 'active': false }
  27320. * ];
  27321. *
  27322. * _.partition(users, function(o) { return o.active; });
  27323. * // => objects for [['fred'], ['barney', 'pebbles']]
  27324. *
  27325. * // The `_.matches` iteratee shorthand.
  27326. * _.partition(users, { 'age': 1, 'active': false });
  27327. * // => objects for [['pebbles'], ['barney', 'fred']]
  27328. *
  27329. * // The `_.matchesProperty` iteratee shorthand.
  27330. * _.partition(users, ['active', false]);
  27331. * // => objects for [['barney', 'pebbles'], ['fred']]
  27332. *
  27333. * // The `_.property` iteratee shorthand.
  27334. * _.partition(users, 'active');
  27335. * // => objects for [['fred'], ['barney', 'pebbles']]
  27336. */
  27337. var partition = createAggregator(function(result, value, key) {
  27338. result[key ? 0 : 1].push(value);
  27339. }, function() { return [[], []]; });
  27340. /**
  27341. * Reduces `collection` to a value which is the accumulated result of running
  27342. * each element in `collection` thru `iteratee`, where each successive
  27343. * invocation is supplied the return value of the previous. If `accumulator`
  27344. * is not given, the first element of `collection` is used as the initial
  27345. * value. The iteratee is invoked with four arguments:
  27346. * (accumulator, value, index|key, collection).
  27347. *
  27348. * Many lodash methods are guarded to work as iteratees for methods like
  27349. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  27350. *
  27351. * The guarded methods are:
  27352. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  27353. * and `sortBy`
  27354. *
  27355. * @static
  27356. * @memberOf _
  27357. * @since 0.1.0
  27358. * @category Collection
  27359. * @param {Array|Object} collection The collection to iterate over.
  27360. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27361. * @param {*} [accumulator] The initial value.
  27362. * @returns {*} Returns the accumulated value.
  27363. * @see _.reduceRight
  27364. * @example
  27365. *
  27366. * _.reduce([1, 2], function(sum, n) {
  27367. * return sum + n;
  27368. * }, 0);
  27369. * // => 3
  27370. *
  27371. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  27372. * (result[value] || (result[value] = [])).push(key);
  27373. * return result;
  27374. * }, {});
  27375. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  27376. */
  27377. function reduce(collection, iteratee, accumulator) {
  27378. var func = isArray(collection) ? arrayReduce : baseReduce,
  27379. initAccum = arguments.length < 3;
  27380. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  27381. }
  27382. /**
  27383. * This method is like `_.reduce` except that it iterates over elements of
  27384. * `collection` from right to left.
  27385. *
  27386. * @static
  27387. * @memberOf _
  27388. * @since 0.1.0
  27389. * @category Collection
  27390. * @param {Array|Object} collection The collection to iterate over.
  27391. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27392. * @param {*} [accumulator] The initial value.
  27393. * @returns {*} Returns the accumulated value.
  27394. * @see _.reduce
  27395. * @example
  27396. *
  27397. * var array = [[0, 1], [2, 3], [4, 5]];
  27398. *
  27399. * _.reduceRight(array, function(flattened, other) {
  27400. * return flattened.concat(other);
  27401. * }, []);
  27402. * // => [4, 5, 2, 3, 0, 1]
  27403. */
  27404. function reduceRight(collection, iteratee, accumulator) {
  27405. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  27406. initAccum = arguments.length < 3;
  27407. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  27408. }
  27409. /**
  27410. * The opposite of `_.filter`; this method returns the elements of `collection`
  27411. * that `predicate` does **not** return truthy for.
  27412. *
  27413. * @static
  27414. * @memberOf _
  27415. * @since 0.1.0
  27416. * @category Collection
  27417. * @param {Array|Object} collection The collection to iterate over.
  27418. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27419. * @returns {Array} Returns the new filtered array.
  27420. * @see _.filter
  27421. * @example
  27422. *
  27423. * var users = [
  27424. * { 'user': 'barney', 'age': 36, 'active': false },
  27425. * { 'user': 'fred', 'age': 40, 'active': true }
  27426. * ];
  27427. *
  27428. * _.reject(users, function(o) { return !o.active; });
  27429. * // => objects for ['fred']
  27430. *
  27431. * // The `_.matches` iteratee shorthand.
  27432. * _.reject(users, { 'age': 40, 'active': true });
  27433. * // => objects for ['barney']
  27434. *
  27435. * // The `_.matchesProperty` iteratee shorthand.
  27436. * _.reject(users, ['active', false]);
  27437. * // => objects for ['fred']
  27438. *
  27439. * // The `_.property` iteratee shorthand.
  27440. * _.reject(users, 'active');
  27441. * // => objects for ['barney']
  27442. */
  27443. function reject(collection, predicate) {
  27444. var func = isArray(collection) ? arrayFilter : baseFilter;
  27445. return func(collection, negate(getIteratee(predicate, 3)));
  27446. }
  27447. /**
  27448. * Gets a random element from `collection`.
  27449. *
  27450. * @static
  27451. * @memberOf _
  27452. * @since 2.0.0
  27453. * @category Collection
  27454. * @param {Array|Object} collection The collection to sample.
  27455. * @returns {*} Returns the random element.
  27456. * @example
  27457. *
  27458. * _.sample([1, 2, 3, 4]);
  27459. * // => 2
  27460. */
  27461. function sample(collection) {
  27462. var func = isArray(collection) ? arraySample : baseSample;
  27463. return func(collection);
  27464. }
  27465. /**
  27466. * Gets `n` random elements at unique keys from `collection` up to the
  27467. * size of `collection`.
  27468. *
  27469. * @static
  27470. * @memberOf _
  27471. * @since 4.0.0
  27472. * @category Collection
  27473. * @param {Array|Object} collection The collection to sample.
  27474. * @param {number} [n=1] The number of elements to sample.
  27475. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27476. * @returns {Array} Returns the random elements.
  27477. * @example
  27478. *
  27479. * _.sampleSize([1, 2, 3], 2);
  27480. * // => [3, 1]
  27481. *
  27482. * _.sampleSize([1, 2, 3], 4);
  27483. * // => [2, 3, 1]
  27484. */
  27485. function sampleSize(collection, n, guard) {
  27486. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  27487. n = 1;
  27488. } else {
  27489. n = toInteger(n);
  27490. }
  27491. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  27492. return func(collection, n);
  27493. }
  27494. /**
  27495. * Creates an array of shuffled values, using a version of the
  27496. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  27497. *
  27498. * @static
  27499. * @memberOf _
  27500. * @since 0.1.0
  27501. * @category Collection
  27502. * @param {Array|Object} collection The collection to shuffle.
  27503. * @returns {Array} Returns the new shuffled array.
  27504. * @example
  27505. *
  27506. * _.shuffle([1, 2, 3, 4]);
  27507. * // => [4, 1, 3, 2]
  27508. */
  27509. function shuffle(collection) {
  27510. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  27511. return func(collection);
  27512. }
  27513. /**
  27514. * Gets the size of `collection` by returning its length for array-like
  27515. * values or the number of own enumerable string keyed properties for objects.
  27516. *
  27517. * @static
  27518. * @memberOf _
  27519. * @since 0.1.0
  27520. * @category Collection
  27521. * @param {Array|Object|string} collection The collection to inspect.
  27522. * @returns {number} Returns the collection size.
  27523. * @example
  27524. *
  27525. * _.size([1, 2, 3]);
  27526. * // => 3
  27527. *
  27528. * _.size({ 'a': 1, 'b': 2 });
  27529. * // => 2
  27530. *
  27531. * _.size('pebbles');
  27532. * // => 7
  27533. */
  27534. function size(collection) {
  27535. if (collection == null) {
  27536. return 0;
  27537. }
  27538. if (isArrayLike(collection)) {
  27539. return isString(collection) ? stringSize(collection) : collection.length;
  27540. }
  27541. var tag = getTag(collection);
  27542. if (tag == mapTag || tag == setTag) {
  27543. return collection.size;
  27544. }
  27545. return baseKeys(collection).length;
  27546. }
  27547. /**
  27548. * Checks if `predicate` returns truthy for **any** element of `collection`.
  27549. * Iteration is stopped once `predicate` returns truthy. The predicate is
  27550. * invoked with three arguments: (value, index|key, collection).
  27551. *
  27552. * @static
  27553. * @memberOf _
  27554. * @since 0.1.0
  27555. * @category Collection
  27556. * @param {Array|Object} collection The collection to iterate over.
  27557. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27558. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27559. * @returns {boolean} Returns `true` if any element passes the predicate check,
  27560. * else `false`.
  27561. * @example
  27562. *
  27563. * _.some([null, 0, 'yes', false], Boolean);
  27564. * // => true
  27565. *
  27566. * var users = [
  27567. * { 'user': 'barney', 'active': true },
  27568. * { 'user': 'fred', 'active': false }
  27569. * ];
  27570. *
  27571. * // The `_.matches` iteratee shorthand.
  27572. * _.some(users, { 'user': 'barney', 'active': false });
  27573. * // => false
  27574. *
  27575. * // The `_.matchesProperty` iteratee shorthand.
  27576. * _.some(users, ['active', false]);
  27577. * // => true
  27578. *
  27579. * // The `_.property` iteratee shorthand.
  27580. * _.some(users, 'active');
  27581. * // => true
  27582. */
  27583. function some(collection, predicate, guard) {
  27584. var func = isArray(collection) ? arraySome : baseSome;
  27585. if (guard && isIterateeCall(collection, predicate, guard)) {
  27586. predicate = undefined;
  27587. }
  27588. return func(collection, getIteratee(predicate, 3));
  27589. }
  27590. /**
  27591. * Creates an array of elements, sorted in ascending order by the results of
  27592. * running each element in a collection thru each iteratee. This method
  27593. * performs a stable sort, that is, it preserves the original sort order of
  27594. * equal elements. The iteratees are invoked with one argument: (value).
  27595. *
  27596. * @static
  27597. * @memberOf _
  27598. * @since 0.1.0
  27599. * @category Collection
  27600. * @param {Array|Object} collection The collection to iterate over.
  27601. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  27602. * The iteratees to sort by.
  27603. * @returns {Array} Returns the new sorted array.
  27604. * @example
  27605. *
  27606. * var users = [
  27607. * { 'user': 'fred', 'age': 48 },
  27608. * { 'user': 'barney', 'age': 36 },
  27609. * { 'user': 'fred', 'age': 40 },
  27610. * { 'user': 'barney', 'age': 34 }
  27611. * ];
  27612. *
  27613. * _.sortBy(users, [function(o) { return o.user; }]);
  27614. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27615. *
  27616. * _.sortBy(users, ['user', 'age']);
  27617. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  27618. */
  27619. var sortBy = baseRest(function(collection, iteratees) {
  27620. if (collection == null) {
  27621. return [];
  27622. }
  27623. var length = iteratees.length;
  27624. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  27625. iteratees = [];
  27626. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  27627. iteratees = [iteratees[0]];
  27628. }
  27629. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  27630. });
  27631. /*------------------------------------------------------------------------*/
  27632. /**
  27633. * Gets the timestamp of the number of milliseconds that have elapsed since
  27634. * the Unix epoch (1 January 1970 00:00:00 UTC).
  27635. *
  27636. * @static
  27637. * @memberOf _
  27638. * @since 2.4.0
  27639. * @category Date
  27640. * @returns {number} Returns the timestamp.
  27641. * @example
  27642. *
  27643. * _.defer(function(stamp) {
  27644. * console.log(_.now() - stamp);
  27645. * }, _.now());
  27646. * // => Logs the number of milliseconds it took for the deferred invocation.
  27647. */
  27648. var now = ctxNow || function() {
  27649. return root.Date.now();
  27650. };
  27651. /*------------------------------------------------------------------------*/
  27652. /**
  27653. * The opposite of `_.before`; this method creates a function that invokes
  27654. * `func` once it's called `n` or more times.
  27655. *
  27656. * @static
  27657. * @memberOf _
  27658. * @since 0.1.0
  27659. * @category Function
  27660. * @param {number} n The number of calls before `func` is invoked.
  27661. * @param {Function} func The function to restrict.
  27662. * @returns {Function} Returns the new restricted function.
  27663. * @example
  27664. *
  27665. * var saves = ['profile', 'settings'];
  27666. *
  27667. * var done = _.after(saves.length, function() {
  27668. * console.log('done saving!');
  27669. * });
  27670. *
  27671. * _.forEach(saves, function(type) {
  27672. * asyncSave({ 'type': type, 'complete': done });
  27673. * });
  27674. * // => Logs 'done saving!' after the two async saves have completed.
  27675. */
  27676. function after(n, func) {
  27677. if (typeof func != 'function') {
  27678. throw new TypeError(FUNC_ERROR_TEXT);
  27679. }
  27680. n = toInteger(n);
  27681. return function() {
  27682. if (--n < 1) {
  27683. return func.apply(this, arguments);
  27684. }
  27685. };
  27686. }
  27687. /**
  27688. * Creates a function that invokes `func`, with up to `n` arguments,
  27689. * ignoring any additional arguments.
  27690. *
  27691. * @static
  27692. * @memberOf _
  27693. * @since 3.0.0
  27694. * @category Function
  27695. * @param {Function} func The function to cap arguments for.
  27696. * @param {number} [n=func.length] The arity cap.
  27697. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27698. * @returns {Function} Returns the new capped function.
  27699. * @example
  27700. *
  27701. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  27702. * // => [6, 8, 10]
  27703. */
  27704. function ary(func, n, guard) {
  27705. n = guard ? undefined : n;
  27706. n = (func && n == null) ? func.length : n;
  27707. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  27708. }
  27709. /**
  27710. * Creates a function that invokes `func`, with the `this` binding and arguments
  27711. * of the created function, while it's called less than `n` times. Subsequent
  27712. * calls to the created function return the result of the last `func` invocation.
  27713. *
  27714. * @static
  27715. * @memberOf _
  27716. * @since 3.0.0
  27717. * @category Function
  27718. * @param {number} n The number of calls at which `func` is no longer invoked.
  27719. * @param {Function} func The function to restrict.
  27720. * @returns {Function} Returns the new restricted function.
  27721. * @example
  27722. *
  27723. * jQuery(element).on('click', _.before(5, addContactToList));
  27724. * // => Allows adding up to 4 contacts to the list.
  27725. */
  27726. function before(n, func) {
  27727. var result;
  27728. if (typeof func != 'function') {
  27729. throw new TypeError(FUNC_ERROR_TEXT);
  27730. }
  27731. n = toInteger(n);
  27732. return function() {
  27733. if (--n > 0) {
  27734. result = func.apply(this, arguments);
  27735. }
  27736. if (n <= 1) {
  27737. func = undefined;
  27738. }
  27739. return result;
  27740. };
  27741. }
  27742. /**
  27743. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  27744. * and `partials` prepended to the arguments it receives.
  27745. *
  27746. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  27747. * may be used as a placeholder for partially applied arguments.
  27748. *
  27749. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  27750. * property of bound functions.
  27751. *
  27752. * @static
  27753. * @memberOf _
  27754. * @since 0.1.0
  27755. * @category Function
  27756. * @param {Function} func The function to bind.
  27757. * @param {*} thisArg The `this` binding of `func`.
  27758. * @param {...*} [partials] The arguments to be partially applied.
  27759. * @returns {Function} Returns the new bound function.
  27760. * @example
  27761. *
  27762. * function greet(greeting, punctuation) {
  27763. * return greeting + ' ' + this.user + punctuation;
  27764. * }
  27765. *
  27766. * var object = { 'user': 'fred' };
  27767. *
  27768. * var bound = _.bind(greet, object, 'hi');
  27769. * bound('!');
  27770. * // => 'hi fred!'
  27771. *
  27772. * // Bound with placeholders.
  27773. * var bound = _.bind(greet, object, _, '!');
  27774. * bound('hi');
  27775. * // => 'hi fred!'
  27776. */
  27777. var bind = baseRest(function(func, thisArg, partials) {
  27778. var bitmask = WRAP_BIND_FLAG;
  27779. if (partials.length) {
  27780. var holders = replaceHolders(partials, getHolder(bind));
  27781. bitmask |= WRAP_PARTIAL_FLAG;
  27782. }
  27783. return createWrap(func, bitmask, thisArg, partials, holders);
  27784. });
  27785. /**
  27786. * Creates a function that invokes the method at `object[key]` with `partials`
  27787. * prepended to the arguments it receives.
  27788. *
  27789. * This method differs from `_.bind` by allowing bound functions to reference
  27790. * methods that may be redefined or don't yet exist. See
  27791. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  27792. * for more details.
  27793. *
  27794. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  27795. * builds, may be used as a placeholder for partially applied arguments.
  27796. *
  27797. * @static
  27798. * @memberOf _
  27799. * @since 0.10.0
  27800. * @category Function
  27801. * @param {Object} object The object to invoke the method on.
  27802. * @param {string} key The key of the method.
  27803. * @param {...*} [partials] The arguments to be partially applied.
  27804. * @returns {Function} Returns the new bound function.
  27805. * @example
  27806. *
  27807. * var object = {
  27808. * 'user': 'fred',
  27809. * 'greet': function(greeting, punctuation) {
  27810. * return greeting + ' ' + this.user + punctuation;
  27811. * }
  27812. * };
  27813. *
  27814. * var bound = _.bindKey(object, 'greet', 'hi');
  27815. * bound('!');
  27816. * // => 'hi fred!'
  27817. *
  27818. * object.greet = function(greeting, punctuation) {
  27819. * return greeting + 'ya ' + this.user + punctuation;
  27820. * };
  27821. *
  27822. * bound('!');
  27823. * // => 'hiya fred!'
  27824. *
  27825. * // Bound with placeholders.
  27826. * var bound = _.bindKey(object, 'greet', _, '!');
  27827. * bound('hi');
  27828. * // => 'hiya fred!'
  27829. */
  27830. var bindKey = baseRest(function(object, key, partials) {
  27831. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  27832. if (partials.length) {
  27833. var holders = replaceHolders(partials, getHolder(bindKey));
  27834. bitmask |= WRAP_PARTIAL_FLAG;
  27835. }
  27836. return createWrap(key, bitmask, object, partials, holders);
  27837. });
  27838. /**
  27839. * Creates a function that accepts arguments of `func` and either invokes
  27840. * `func` returning its result, if at least `arity` number of arguments have
  27841. * been provided, or returns a function that accepts the remaining `func`
  27842. * arguments, and so on. The arity of `func` may be specified if `func.length`
  27843. * is not sufficient.
  27844. *
  27845. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  27846. * may be used as a placeholder for provided arguments.
  27847. *
  27848. * **Note:** This method doesn't set the "length" property of curried functions.
  27849. *
  27850. * @static
  27851. * @memberOf _
  27852. * @since 2.0.0
  27853. * @category Function
  27854. * @param {Function} func The function to curry.
  27855. * @param {number} [arity=func.length] The arity of `func`.
  27856. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27857. * @returns {Function} Returns the new curried function.
  27858. * @example
  27859. *
  27860. * var abc = function(a, b, c) {
  27861. * return [a, b, c];
  27862. * };
  27863. *
  27864. * var curried = _.curry(abc);
  27865. *
  27866. * curried(1)(2)(3);
  27867. * // => [1, 2, 3]
  27868. *
  27869. * curried(1, 2)(3);
  27870. * // => [1, 2, 3]
  27871. *
  27872. * curried(1, 2, 3);
  27873. * // => [1, 2, 3]
  27874. *
  27875. * // Curried with placeholders.
  27876. * curried(1)(_, 3)(2);
  27877. * // => [1, 2, 3]
  27878. */
  27879. function curry(func, arity, guard) {
  27880. arity = guard ? undefined : arity;
  27881. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27882. result.placeholder = curry.placeholder;
  27883. return result;
  27884. }
  27885. /**
  27886. * This method is like `_.curry` except that arguments are applied to `func`
  27887. * in the manner of `_.partialRight` instead of `_.partial`.
  27888. *
  27889. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  27890. * builds, may be used as a placeholder for provided arguments.
  27891. *
  27892. * **Note:** This method doesn't set the "length" property of curried functions.
  27893. *
  27894. * @static
  27895. * @memberOf _
  27896. * @since 3.0.0
  27897. * @category Function
  27898. * @param {Function} func The function to curry.
  27899. * @param {number} [arity=func.length] The arity of `func`.
  27900. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27901. * @returns {Function} Returns the new curried function.
  27902. * @example
  27903. *
  27904. * var abc = function(a, b, c) {
  27905. * return [a, b, c];
  27906. * };
  27907. *
  27908. * var curried = _.curryRight(abc);
  27909. *
  27910. * curried(3)(2)(1);
  27911. * // => [1, 2, 3]
  27912. *
  27913. * curried(2, 3)(1);
  27914. * // => [1, 2, 3]
  27915. *
  27916. * curried(1, 2, 3);
  27917. * // => [1, 2, 3]
  27918. *
  27919. * // Curried with placeholders.
  27920. * curried(3)(1, _)(2);
  27921. * // => [1, 2, 3]
  27922. */
  27923. function curryRight(func, arity, guard) {
  27924. arity = guard ? undefined : arity;
  27925. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27926. result.placeholder = curryRight.placeholder;
  27927. return result;
  27928. }
  27929. /**
  27930. * Creates a debounced function that delays invoking `func` until after `wait`
  27931. * milliseconds have elapsed since the last time the debounced function was
  27932. * invoked. The debounced function comes with a `cancel` method to cancel
  27933. * delayed `func` invocations and a `flush` method to immediately invoke them.
  27934. * Provide `options` to indicate whether `func` should be invoked on the
  27935. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  27936. * with the last arguments provided to the debounced function. Subsequent
  27937. * calls to the debounced function return the result of the last `func`
  27938. * invocation.
  27939. *
  27940. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  27941. * invoked on the trailing edge of the timeout only if the debounced function
  27942. * is invoked more than once during the `wait` timeout.
  27943. *
  27944. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  27945. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  27946. *
  27947. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  27948. * for details over the differences between `_.debounce` and `_.throttle`.
  27949. *
  27950. * @static
  27951. * @memberOf _
  27952. * @since 0.1.0
  27953. * @category Function
  27954. * @param {Function} func The function to debounce.
  27955. * @param {number} [wait=0] The number of milliseconds to delay.
  27956. * @param {Object} [options={}] The options object.
  27957. * @param {boolean} [options.leading=false]
  27958. * Specify invoking on the leading edge of the timeout.
  27959. * @param {number} [options.maxWait]
  27960. * The maximum time `func` is allowed to be delayed before it's invoked.
  27961. * @param {boolean} [options.trailing=true]
  27962. * Specify invoking on the trailing edge of the timeout.
  27963. * @returns {Function} Returns the new debounced function.
  27964. * @example
  27965. *
  27966. * // Avoid costly calculations while the window size is in flux.
  27967. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  27968. *
  27969. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  27970. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  27971. * 'leading': true,
  27972. * 'trailing': false
  27973. * }));
  27974. *
  27975. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  27976. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  27977. * var source = new EventSource('/stream');
  27978. * jQuery(source).on('message', debounced);
  27979. *
  27980. * // Cancel the trailing debounced invocation.
  27981. * jQuery(window).on('popstate', debounced.cancel);
  27982. */
  27983. function debounce(func, wait, options) {
  27984. var lastArgs,
  27985. lastThis,
  27986. maxWait,
  27987. result,
  27988. timerId,
  27989. lastCallTime,
  27990. lastInvokeTime = 0,
  27991. leading = false,
  27992. maxing = false,
  27993. trailing = true;
  27994. if (typeof func != 'function') {
  27995. throw new TypeError(FUNC_ERROR_TEXT);
  27996. }
  27997. wait = toNumber(wait) || 0;
  27998. if (isObject(options)) {
  27999. leading = !!options.leading;
  28000. maxing = 'maxWait' in options;
  28001. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  28002. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28003. }
  28004. function invokeFunc(time) {
  28005. var args = lastArgs,
  28006. thisArg = lastThis;
  28007. lastArgs = lastThis = undefined;
  28008. lastInvokeTime = time;
  28009. result = func.apply(thisArg, args);
  28010. return result;
  28011. }
  28012. function leadingEdge(time) {
  28013. // Reset any `maxWait` timer.
  28014. lastInvokeTime = time;
  28015. // Start the timer for the trailing edge.
  28016. timerId = setTimeout(timerExpired, wait);
  28017. // Invoke the leading edge.
  28018. return leading ? invokeFunc(time) : result;
  28019. }
  28020. function remainingWait(time) {
  28021. var timeSinceLastCall = time - lastCallTime,
  28022. timeSinceLastInvoke = time - lastInvokeTime,
  28023. timeWaiting = wait - timeSinceLastCall;
  28024. return maxing
  28025. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  28026. : timeWaiting;
  28027. }
  28028. function shouldInvoke(time) {
  28029. var timeSinceLastCall = time - lastCallTime,
  28030. timeSinceLastInvoke = time - lastInvokeTime;
  28031. // Either this is the first call, activity has stopped and we're at the
  28032. // trailing edge, the system time has gone backwards and we're treating
  28033. // it as the trailing edge, or we've hit the `maxWait` limit.
  28034. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  28035. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  28036. }
  28037. function timerExpired() {
  28038. var time = now();
  28039. if (shouldInvoke(time)) {
  28040. return trailingEdge(time);
  28041. }
  28042. // Restart the timer.
  28043. timerId = setTimeout(timerExpired, remainingWait(time));
  28044. }
  28045. function trailingEdge(time) {
  28046. timerId = undefined;
  28047. // Only invoke if we have `lastArgs` which means `func` has been
  28048. // debounced at least once.
  28049. if (trailing && lastArgs) {
  28050. return invokeFunc(time);
  28051. }
  28052. lastArgs = lastThis = undefined;
  28053. return result;
  28054. }
  28055. function cancel() {
  28056. if (timerId !== undefined) {
  28057. clearTimeout(timerId);
  28058. }
  28059. lastInvokeTime = 0;
  28060. lastArgs = lastCallTime = lastThis = timerId = undefined;
  28061. }
  28062. function flush() {
  28063. return timerId === undefined ? result : trailingEdge(now());
  28064. }
  28065. function debounced() {
  28066. var time = now(),
  28067. isInvoking = shouldInvoke(time);
  28068. lastArgs = arguments;
  28069. lastThis = this;
  28070. lastCallTime = time;
  28071. if (isInvoking) {
  28072. if (timerId === undefined) {
  28073. return leadingEdge(lastCallTime);
  28074. }
  28075. if (maxing) {
  28076. // Handle invocations in a tight loop.
  28077. clearTimeout(timerId);
  28078. timerId = setTimeout(timerExpired, wait);
  28079. return invokeFunc(lastCallTime);
  28080. }
  28081. }
  28082. if (timerId === undefined) {
  28083. timerId = setTimeout(timerExpired, wait);
  28084. }
  28085. return result;
  28086. }
  28087. debounced.cancel = cancel;
  28088. debounced.flush = flush;
  28089. return debounced;
  28090. }
  28091. /**
  28092. * Defers invoking the `func` until the current call stack has cleared. Any
  28093. * additional arguments are provided to `func` when it's invoked.
  28094. *
  28095. * @static
  28096. * @memberOf _
  28097. * @since 0.1.0
  28098. * @category Function
  28099. * @param {Function} func The function to defer.
  28100. * @param {...*} [args] The arguments to invoke `func` with.
  28101. * @returns {number} Returns the timer id.
  28102. * @example
  28103. *
  28104. * _.defer(function(text) {
  28105. * console.log(text);
  28106. * }, 'deferred');
  28107. * // => Logs 'deferred' after one millisecond.
  28108. */
  28109. var defer = baseRest(function(func, args) {
  28110. return baseDelay(func, 1, args);
  28111. });
  28112. /**
  28113. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  28114. * provided to `func` when it's invoked.
  28115. *
  28116. * @static
  28117. * @memberOf _
  28118. * @since 0.1.0
  28119. * @category Function
  28120. * @param {Function} func The function to delay.
  28121. * @param {number} wait The number of milliseconds to delay invocation.
  28122. * @param {...*} [args] The arguments to invoke `func` with.
  28123. * @returns {number} Returns the timer id.
  28124. * @example
  28125. *
  28126. * _.delay(function(text) {
  28127. * console.log(text);
  28128. * }, 1000, 'later');
  28129. * // => Logs 'later' after one second.
  28130. */
  28131. var delay = baseRest(function(func, wait, args) {
  28132. return baseDelay(func, toNumber(wait) || 0, args);
  28133. });
  28134. /**
  28135. * Creates a function that invokes `func` with arguments reversed.
  28136. *
  28137. * @static
  28138. * @memberOf _
  28139. * @since 4.0.0
  28140. * @category Function
  28141. * @param {Function} func The function to flip arguments for.
  28142. * @returns {Function} Returns the new flipped function.
  28143. * @example
  28144. *
  28145. * var flipped = _.flip(function() {
  28146. * return _.toArray(arguments);
  28147. * });
  28148. *
  28149. * flipped('a', 'b', 'c', 'd');
  28150. * // => ['d', 'c', 'b', 'a']
  28151. */
  28152. function flip(func) {
  28153. return createWrap(func, WRAP_FLIP_FLAG);
  28154. }
  28155. /**
  28156. * Creates a function that memoizes the result of `func`. If `resolver` is
  28157. * provided, it determines the cache key for storing the result based on the
  28158. * arguments provided to the memoized function. By default, the first argument
  28159. * provided to the memoized function is used as the map cache key. The `func`
  28160. * is invoked with the `this` binding of the memoized function.
  28161. *
  28162. * **Note:** The cache is exposed as the `cache` property on the memoized
  28163. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  28164. * constructor with one whose instances implement the
  28165. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  28166. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  28167. *
  28168. * @static
  28169. * @memberOf _
  28170. * @since 0.1.0
  28171. * @category Function
  28172. * @param {Function} func The function to have its output memoized.
  28173. * @param {Function} [resolver] The function to resolve the cache key.
  28174. * @returns {Function} Returns the new memoized function.
  28175. * @example
  28176. *
  28177. * var object = { 'a': 1, 'b': 2 };
  28178. * var other = { 'c': 3, 'd': 4 };
  28179. *
  28180. * var values = _.memoize(_.values);
  28181. * values(object);
  28182. * // => [1, 2]
  28183. *
  28184. * values(other);
  28185. * // => [3, 4]
  28186. *
  28187. * object.a = 2;
  28188. * values(object);
  28189. * // => [1, 2]
  28190. *
  28191. * // Modify the result cache.
  28192. * values.cache.set(object, ['a', 'b']);
  28193. * values(object);
  28194. * // => ['a', 'b']
  28195. *
  28196. * // Replace `_.memoize.Cache`.
  28197. * _.memoize.Cache = WeakMap;
  28198. */
  28199. function memoize(func, resolver) {
  28200. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  28201. throw new TypeError(FUNC_ERROR_TEXT);
  28202. }
  28203. var memoized = function() {
  28204. var args = arguments,
  28205. key = resolver ? resolver.apply(this, args) : args[0],
  28206. cache = memoized.cache;
  28207. if (cache.has(key)) {
  28208. return cache.get(key);
  28209. }
  28210. var result = func.apply(this, args);
  28211. memoized.cache = cache.set(key, result) || cache;
  28212. return result;
  28213. };
  28214. memoized.cache = new (memoize.Cache || MapCache);
  28215. return memoized;
  28216. }
  28217. // Expose `MapCache`.
  28218. memoize.Cache = MapCache;
  28219. /**
  28220. * Creates a function that negates the result of the predicate `func`. The
  28221. * `func` predicate is invoked with the `this` binding and arguments of the
  28222. * created function.
  28223. *
  28224. * @static
  28225. * @memberOf _
  28226. * @since 3.0.0
  28227. * @category Function
  28228. * @param {Function} predicate The predicate to negate.
  28229. * @returns {Function} Returns the new negated function.
  28230. * @example
  28231. *
  28232. * function isEven(n) {
  28233. * return n % 2 == 0;
  28234. * }
  28235. *
  28236. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  28237. * // => [1, 3, 5]
  28238. */
  28239. function negate(predicate) {
  28240. if (typeof predicate != 'function') {
  28241. throw new TypeError(FUNC_ERROR_TEXT);
  28242. }
  28243. return function() {
  28244. var args = arguments;
  28245. switch (args.length) {
  28246. case 0: return !predicate.call(this);
  28247. case 1: return !predicate.call(this, args[0]);
  28248. case 2: return !predicate.call(this, args[0], args[1]);
  28249. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  28250. }
  28251. return !predicate.apply(this, args);
  28252. };
  28253. }
  28254. /**
  28255. * Creates a function that is restricted to invoking `func` once. Repeat calls
  28256. * to the function return the value of the first invocation. The `func` is
  28257. * invoked with the `this` binding and arguments of the created function.
  28258. *
  28259. * @static
  28260. * @memberOf _
  28261. * @since 0.1.0
  28262. * @category Function
  28263. * @param {Function} func The function to restrict.
  28264. * @returns {Function} Returns the new restricted function.
  28265. * @example
  28266. *
  28267. * var initialize = _.once(createApplication);
  28268. * initialize();
  28269. * initialize();
  28270. * // => `createApplication` is invoked once
  28271. */
  28272. function once(func) {
  28273. return before(2, func);
  28274. }
  28275. /**
  28276. * Creates a function that invokes `func` with its arguments transformed.
  28277. *
  28278. * @static
  28279. * @since 4.0.0
  28280. * @memberOf _
  28281. * @category Function
  28282. * @param {Function} func The function to wrap.
  28283. * @param {...(Function|Function[])} [transforms=[_.identity]]
  28284. * The argument transforms.
  28285. * @returns {Function} Returns the new function.
  28286. * @example
  28287. *
  28288. * function doubled(n) {
  28289. * return n * 2;
  28290. * }
  28291. *
  28292. * function square(n) {
  28293. * return n * n;
  28294. * }
  28295. *
  28296. * var func = _.overArgs(function(x, y) {
  28297. * return [x, y];
  28298. * }, [square, doubled]);
  28299. *
  28300. * func(9, 3);
  28301. * // => [81, 6]
  28302. *
  28303. * func(10, 5);
  28304. * // => [100, 10]
  28305. */
  28306. var overArgs = castRest(function(func, transforms) {
  28307. transforms = (transforms.length == 1 && isArray(transforms[0]))
  28308. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  28309. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  28310. var funcsLength = transforms.length;
  28311. return baseRest(function(args) {
  28312. var index = -1,
  28313. length = nativeMin(args.length, funcsLength);
  28314. while (++index < length) {
  28315. args[index] = transforms[index].call(this, args[index]);
  28316. }
  28317. return apply(func, this, args);
  28318. });
  28319. });
  28320. /**
  28321. * Creates a function that invokes `func` with `partials` prepended to the
  28322. * arguments it receives. This method is like `_.bind` except it does **not**
  28323. * alter the `this` binding.
  28324. *
  28325. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  28326. * builds, may be used as a placeholder for partially applied arguments.
  28327. *
  28328. * **Note:** This method doesn't set the "length" property of partially
  28329. * applied functions.
  28330. *
  28331. * @static
  28332. * @memberOf _
  28333. * @since 0.2.0
  28334. * @category Function
  28335. * @param {Function} func The function to partially apply arguments to.
  28336. * @param {...*} [partials] The arguments to be partially applied.
  28337. * @returns {Function} Returns the new partially applied function.
  28338. * @example
  28339. *
  28340. * function greet(greeting, name) {
  28341. * return greeting + ' ' + name;
  28342. * }
  28343. *
  28344. * var sayHelloTo = _.partial(greet, 'hello');
  28345. * sayHelloTo('fred');
  28346. * // => 'hello fred'
  28347. *
  28348. * // Partially applied with placeholders.
  28349. * var greetFred = _.partial(greet, _, 'fred');
  28350. * greetFred('hi');
  28351. * // => 'hi fred'
  28352. */
  28353. var partial = baseRest(function(func, partials) {
  28354. var holders = replaceHolders(partials, getHolder(partial));
  28355. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  28356. });
  28357. /**
  28358. * This method is like `_.partial` except that partially applied arguments
  28359. * are appended to the arguments it receives.
  28360. *
  28361. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  28362. * builds, may be used as a placeholder for partially applied arguments.
  28363. *
  28364. * **Note:** This method doesn't set the "length" property of partially
  28365. * applied functions.
  28366. *
  28367. * @static
  28368. * @memberOf _
  28369. * @since 1.0.0
  28370. * @category Function
  28371. * @param {Function} func The function to partially apply arguments to.
  28372. * @param {...*} [partials] The arguments to be partially applied.
  28373. * @returns {Function} Returns the new partially applied function.
  28374. * @example
  28375. *
  28376. * function greet(greeting, name) {
  28377. * return greeting + ' ' + name;
  28378. * }
  28379. *
  28380. * var greetFred = _.partialRight(greet, 'fred');
  28381. * greetFred('hi');
  28382. * // => 'hi fred'
  28383. *
  28384. * // Partially applied with placeholders.
  28385. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  28386. * sayHelloTo('fred');
  28387. * // => 'hello fred'
  28388. */
  28389. var partialRight = baseRest(function(func, partials) {
  28390. var holders = replaceHolders(partials, getHolder(partialRight));
  28391. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  28392. });
  28393. /**
  28394. * Creates a function that invokes `func` with arguments arranged according
  28395. * to the specified `indexes` where the argument value at the first index is
  28396. * provided as the first argument, the argument value at the second index is
  28397. * provided as the second argument, and so on.
  28398. *
  28399. * @static
  28400. * @memberOf _
  28401. * @since 3.0.0
  28402. * @category Function
  28403. * @param {Function} func The function to rearrange arguments for.
  28404. * @param {...(number|number[])} indexes The arranged argument indexes.
  28405. * @returns {Function} Returns the new function.
  28406. * @example
  28407. *
  28408. * var rearged = _.rearg(function(a, b, c) {
  28409. * return [a, b, c];
  28410. * }, [2, 0, 1]);
  28411. *
  28412. * rearged('b', 'c', 'a')
  28413. * // => ['a', 'b', 'c']
  28414. */
  28415. var rearg = flatRest(function(func, indexes) {
  28416. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  28417. });
  28418. /**
  28419. * Creates a function that invokes `func` with the `this` binding of the
  28420. * created function and arguments from `start` and beyond provided as
  28421. * an array.
  28422. *
  28423. * **Note:** This method is based on the
  28424. * [rest parameter](https://mdn.io/rest_parameters).
  28425. *
  28426. * @static
  28427. * @memberOf _
  28428. * @since 4.0.0
  28429. * @category Function
  28430. * @param {Function} func The function to apply a rest parameter to.
  28431. * @param {number} [start=func.length-1] The start position of the rest parameter.
  28432. * @returns {Function} Returns the new function.
  28433. * @example
  28434. *
  28435. * var say = _.rest(function(what, names) {
  28436. * return what + ' ' + _.initial(names).join(', ') +
  28437. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  28438. * });
  28439. *
  28440. * say('hello', 'fred', 'barney', 'pebbles');
  28441. * // => 'hello fred, barney, & pebbles'
  28442. */
  28443. function rest(func, start) {
  28444. if (typeof func != 'function') {
  28445. throw new TypeError(FUNC_ERROR_TEXT);
  28446. }
  28447. start = start === undefined ? start : toInteger(start);
  28448. return baseRest(func, start);
  28449. }
  28450. /**
  28451. * Creates a function that invokes `func` with the `this` binding of the
  28452. * create function and an array of arguments much like
  28453. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  28454. *
  28455. * **Note:** This method is based on the
  28456. * [spread operator](https://mdn.io/spread_operator).
  28457. *
  28458. * @static
  28459. * @memberOf _
  28460. * @since 3.2.0
  28461. * @category Function
  28462. * @param {Function} func The function to spread arguments over.
  28463. * @param {number} [start=0] The start position of the spread.
  28464. * @returns {Function} Returns the new function.
  28465. * @example
  28466. *
  28467. * var say = _.spread(function(who, what) {
  28468. * return who + ' says ' + what;
  28469. * });
  28470. *
  28471. * say(['fred', 'hello']);
  28472. * // => 'fred says hello'
  28473. *
  28474. * var numbers = Promise.all([
  28475. * Promise.resolve(40),
  28476. * Promise.resolve(36)
  28477. * ]);
  28478. *
  28479. * numbers.then(_.spread(function(x, y) {
  28480. * return x + y;
  28481. * }));
  28482. * // => a Promise of 76
  28483. */
  28484. function spread(func, start) {
  28485. if (typeof func != 'function') {
  28486. throw new TypeError(FUNC_ERROR_TEXT);
  28487. }
  28488. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  28489. return baseRest(function(args) {
  28490. var array = args[start],
  28491. otherArgs = castSlice(args, 0, start);
  28492. if (array) {
  28493. arrayPush(otherArgs, array);
  28494. }
  28495. return apply(func, this, otherArgs);
  28496. });
  28497. }
  28498. /**
  28499. * Creates a throttled function that only invokes `func` at most once per
  28500. * every `wait` milliseconds. The throttled function comes with a `cancel`
  28501. * method to cancel delayed `func` invocations and a `flush` method to
  28502. * immediately invoke them. Provide `options` to indicate whether `func`
  28503. * should be invoked on the leading and/or trailing edge of the `wait`
  28504. * timeout. The `func` is invoked with the last arguments provided to the
  28505. * throttled function. Subsequent calls to the throttled function return the
  28506. * result of the last `func` invocation.
  28507. *
  28508. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  28509. * invoked on the trailing edge of the timeout only if the throttled function
  28510. * is invoked more than once during the `wait` timeout.
  28511. *
  28512. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  28513. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  28514. *
  28515. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  28516. * for details over the differences between `_.throttle` and `_.debounce`.
  28517. *
  28518. * @static
  28519. * @memberOf _
  28520. * @since 0.1.0
  28521. * @category Function
  28522. * @param {Function} func The function to throttle.
  28523. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  28524. * @param {Object} [options={}] The options object.
  28525. * @param {boolean} [options.leading=true]
  28526. * Specify invoking on the leading edge of the timeout.
  28527. * @param {boolean} [options.trailing=true]
  28528. * Specify invoking on the trailing edge of the timeout.
  28529. * @returns {Function} Returns the new throttled function.
  28530. * @example
  28531. *
  28532. * // Avoid excessively updating the position while scrolling.
  28533. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  28534. *
  28535. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  28536. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  28537. * jQuery(element).on('click', throttled);
  28538. *
  28539. * // Cancel the trailing throttled invocation.
  28540. * jQuery(window).on('popstate', throttled.cancel);
  28541. */
  28542. function throttle(func, wait, options) {
  28543. var leading = true,
  28544. trailing = true;
  28545. if (typeof func != 'function') {
  28546. throw new TypeError(FUNC_ERROR_TEXT);
  28547. }
  28548. if (isObject(options)) {
  28549. leading = 'leading' in options ? !!options.leading : leading;
  28550. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28551. }
  28552. return debounce(func, wait, {
  28553. 'leading': leading,
  28554. 'maxWait': wait,
  28555. 'trailing': trailing
  28556. });
  28557. }
  28558. /**
  28559. * Creates a function that accepts up to one argument, ignoring any
  28560. * additional arguments.
  28561. *
  28562. * @static
  28563. * @memberOf _
  28564. * @since 4.0.0
  28565. * @category Function
  28566. * @param {Function} func The function to cap arguments for.
  28567. * @returns {Function} Returns the new capped function.
  28568. * @example
  28569. *
  28570. * _.map(['6', '8', '10'], _.unary(parseInt));
  28571. * // => [6, 8, 10]
  28572. */
  28573. function unary(func) {
  28574. return ary(func, 1);
  28575. }
  28576. /**
  28577. * Creates a function that provides `value` to `wrapper` as its first
  28578. * argument. Any additional arguments provided to the function are appended
  28579. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  28580. * binding of the created function.
  28581. *
  28582. * @static
  28583. * @memberOf _
  28584. * @since 0.1.0
  28585. * @category Function
  28586. * @param {*} value The value to wrap.
  28587. * @param {Function} [wrapper=identity] The wrapper function.
  28588. * @returns {Function} Returns the new function.
  28589. * @example
  28590. *
  28591. * var p = _.wrap(_.escape, function(func, text) {
  28592. * return '<p>' + func(text) + '</p>';
  28593. * });
  28594. *
  28595. * p('fred, barney, & pebbles');
  28596. * // => '<p>fred, barney, &amp; pebbles</p>'
  28597. */
  28598. function wrap(value, wrapper) {
  28599. return partial(castFunction(wrapper), value);
  28600. }
  28601. /*------------------------------------------------------------------------*/
  28602. /**
  28603. * Casts `value` as an array if it's not one.
  28604. *
  28605. * @static
  28606. * @memberOf _
  28607. * @since 4.4.0
  28608. * @category Lang
  28609. * @param {*} value The value to inspect.
  28610. * @returns {Array} Returns the cast array.
  28611. * @example
  28612. *
  28613. * _.castArray(1);
  28614. * // => [1]
  28615. *
  28616. * _.castArray({ 'a': 1 });
  28617. * // => [{ 'a': 1 }]
  28618. *
  28619. * _.castArray('abc');
  28620. * // => ['abc']
  28621. *
  28622. * _.castArray(null);
  28623. * // => [null]
  28624. *
  28625. * _.castArray(undefined);
  28626. * // => [undefined]
  28627. *
  28628. * _.castArray();
  28629. * // => []
  28630. *
  28631. * var array = [1, 2, 3];
  28632. * console.log(_.castArray(array) === array);
  28633. * // => true
  28634. */
  28635. function castArray() {
  28636. if (!arguments.length) {
  28637. return [];
  28638. }
  28639. var value = arguments[0];
  28640. return isArray(value) ? value : [value];
  28641. }
  28642. /**
  28643. * Creates a shallow clone of `value`.
  28644. *
  28645. * **Note:** This method is loosely based on the
  28646. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  28647. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  28648. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  28649. * arrays. The own enumerable properties of `arguments` objects are cloned
  28650. * as plain objects. An empty object is returned for uncloneable values such
  28651. * as error objects, functions, DOM nodes, and WeakMaps.
  28652. *
  28653. * @static
  28654. * @memberOf _
  28655. * @since 0.1.0
  28656. * @category Lang
  28657. * @param {*} value The value to clone.
  28658. * @returns {*} Returns the cloned value.
  28659. * @see _.cloneDeep
  28660. * @example
  28661. *
  28662. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28663. *
  28664. * var shallow = _.clone(objects);
  28665. * console.log(shallow[0] === objects[0]);
  28666. * // => true
  28667. */
  28668. function clone(value) {
  28669. return baseClone(value, CLONE_SYMBOLS_FLAG);
  28670. }
  28671. /**
  28672. * This method is like `_.clone` except that it accepts `customizer` which
  28673. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  28674. * cloning is handled by the method instead. The `customizer` is invoked with
  28675. * up to four arguments; (value [, index|key, object, stack]).
  28676. *
  28677. * @static
  28678. * @memberOf _
  28679. * @since 4.0.0
  28680. * @category Lang
  28681. * @param {*} value The value to clone.
  28682. * @param {Function} [customizer] The function to customize cloning.
  28683. * @returns {*} Returns the cloned value.
  28684. * @see _.cloneDeepWith
  28685. * @example
  28686. *
  28687. * function customizer(value) {
  28688. * if (_.isElement(value)) {
  28689. * return value.cloneNode(false);
  28690. * }
  28691. * }
  28692. *
  28693. * var el = _.cloneWith(document.body, customizer);
  28694. *
  28695. * console.log(el === document.body);
  28696. * // => false
  28697. * console.log(el.nodeName);
  28698. * // => 'BODY'
  28699. * console.log(el.childNodes.length);
  28700. * // => 0
  28701. */
  28702. function cloneWith(value, customizer) {
  28703. customizer = typeof customizer == 'function' ? customizer : undefined;
  28704. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  28705. }
  28706. /**
  28707. * This method is like `_.clone` except that it recursively clones `value`.
  28708. *
  28709. * @static
  28710. * @memberOf _
  28711. * @since 1.0.0
  28712. * @category Lang
  28713. * @param {*} value The value to recursively clone.
  28714. * @returns {*} Returns the deep cloned value.
  28715. * @see _.clone
  28716. * @example
  28717. *
  28718. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28719. *
  28720. * var deep = _.cloneDeep(objects);
  28721. * console.log(deep[0] === objects[0]);
  28722. * // => false
  28723. */
  28724. function cloneDeep(value) {
  28725. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  28726. }
  28727. /**
  28728. * This method is like `_.cloneWith` except that it recursively clones `value`.
  28729. *
  28730. * @static
  28731. * @memberOf _
  28732. * @since 4.0.0
  28733. * @category Lang
  28734. * @param {*} value The value to recursively clone.
  28735. * @param {Function} [customizer] The function to customize cloning.
  28736. * @returns {*} Returns the deep cloned value.
  28737. * @see _.cloneWith
  28738. * @example
  28739. *
  28740. * function customizer(value) {
  28741. * if (_.isElement(value)) {
  28742. * return value.cloneNode(true);
  28743. * }
  28744. * }
  28745. *
  28746. * var el = _.cloneDeepWith(document.body, customizer);
  28747. *
  28748. * console.log(el === document.body);
  28749. * // => false
  28750. * console.log(el.nodeName);
  28751. * // => 'BODY'
  28752. * console.log(el.childNodes.length);
  28753. * // => 20
  28754. */
  28755. function cloneDeepWith(value, customizer) {
  28756. customizer = typeof customizer == 'function' ? customizer : undefined;
  28757. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  28758. }
  28759. /**
  28760. * Checks if `object` conforms to `source` by invoking the predicate
  28761. * properties of `source` with the corresponding property values of `object`.
  28762. *
  28763. * **Note:** This method is equivalent to `_.conforms` when `source` is
  28764. * partially applied.
  28765. *
  28766. * @static
  28767. * @memberOf _
  28768. * @since 4.14.0
  28769. * @category Lang
  28770. * @param {Object} object The object to inspect.
  28771. * @param {Object} source The object of property predicates to conform to.
  28772. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  28773. * @example
  28774. *
  28775. * var object = { 'a': 1, 'b': 2 };
  28776. *
  28777. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  28778. * // => true
  28779. *
  28780. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  28781. * // => false
  28782. */
  28783. function conformsTo(object, source) {
  28784. return source == null || baseConformsTo(object, source, keys(source));
  28785. }
  28786. /**
  28787. * Performs a
  28788. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  28789. * comparison between two values to determine if they are equivalent.
  28790. *
  28791. * @static
  28792. * @memberOf _
  28793. * @since 4.0.0
  28794. * @category Lang
  28795. * @param {*} value The value to compare.
  28796. * @param {*} other The other value to compare.
  28797. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28798. * @example
  28799. *
  28800. * var object = { 'a': 1 };
  28801. * var other = { 'a': 1 };
  28802. *
  28803. * _.eq(object, object);
  28804. * // => true
  28805. *
  28806. * _.eq(object, other);
  28807. * // => false
  28808. *
  28809. * _.eq('a', 'a');
  28810. * // => true
  28811. *
  28812. * _.eq('a', Object('a'));
  28813. * // => false
  28814. *
  28815. * _.eq(NaN, NaN);
  28816. * // => true
  28817. */
  28818. function eq(value, other) {
  28819. return value === other || (value !== value && other !== other);
  28820. }
  28821. /**
  28822. * Checks if `value` is greater than `other`.
  28823. *
  28824. * @static
  28825. * @memberOf _
  28826. * @since 3.9.0
  28827. * @category Lang
  28828. * @param {*} value The value to compare.
  28829. * @param {*} other The other value to compare.
  28830. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  28831. * else `false`.
  28832. * @see _.lt
  28833. * @example
  28834. *
  28835. * _.gt(3, 1);
  28836. * // => true
  28837. *
  28838. * _.gt(3, 3);
  28839. * // => false
  28840. *
  28841. * _.gt(1, 3);
  28842. * // => false
  28843. */
  28844. var gt = createRelationalOperation(baseGt);
  28845. /**
  28846. * Checks if `value` is greater than or equal to `other`.
  28847. *
  28848. * @static
  28849. * @memberOf _
  28850. * @since 3.9.0
  28851. * @category Lang
  28852. * @param {*} value The value to compare.
  28853. * @param {*} other The other value to compare.
  28854. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  28855. * `other`, else `false`.
  28856. * @see _.lte
  28857. * @example
  28858. *
  28859. * _.gte(3, 1);
  28860. * // => true
  28861. *
  28862. * _.gte(3, 3);
  28863. * // => true
  28864. *
  28865. * _.gte(1, 3);
  28866. * // => false
  28867. */
  28868. var gte = createRelationalOperation(function(value, other) {
  28869. return value >= other;
  28870. });
  28871. /**
  28872. * Checks if `value` is likely an `arguments` object.
  28873. *
  28874. * @static
  28875. * @memberOf _
  28876. * @since 0.1.0
  28877. * @category Lang
  28878. * @param {*} value The value to check.
  28879. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  28880. * else `false`.
  28881. * @example
  28882. *
  28883. * _.isArguments(function() { return arguments; }());
  28884. * // => true
  28885. *
  28886. * _.isArguments([1, 2, 3]);
  28887. * // => false
  28888. */
  28889. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  28890. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  28891. !propertyIsEnumerable.call(value, 'callee');
  28892. };
  28893. /**
  28894. * Checks if `value` is classified as an `Array` object.
  28895. *
  28896. * @static
  28897. * @memberOf _
  28898. * @since 0.1.0
  28899. * @category Lang
  28900. * @param {*} value The value to check.
  28901. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  28902. * @example
  28903. *
  28904. * _.isArray([1, 2, 3]);
  28905. * // => true
  28906. *
  28907. * _.isArray(document.body.children);
  28908. * // => false
  28909. *
  28910. * _.isArray('abc');
  28911. * // => false
  28912. *
  28913. * _.isArray(_.noop);
  28914. * // => false
  28915. */
  28916. var isArray = Array.isArray;
  28917. /**
  28918. * Checks if `value` is classified as an `ArrayBuffer` object.
  28919. *
  28920. * @static
  28921. * @memberOf _
  28922. * @since 4.3.0
  28923. * @category Lang
  28924. * @param {*} value The value to check.
  28925. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  28926. * @example
  28927. *
  28928. * _.isArrayBuffer(new ArrayBuffer(2));
  28929. * // => true
  28930. *
  28931. * _.isArrayBuffer(new Array(2));
  28932. * // => false
  28933. */
  28934. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  28935. /**
  28936. * Checks if `value` is array-like. A value is considered array-like if it's
  28937. * not a function and has a `value.length` that's an integer greater than or
  28938. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  28939. *
  28940. * @static
  28941. * @memberOf _
  28942. * @since 4.0.0
  28943. * @category Lang
  28944. * @param {*} value The value to check.
  28945. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  28946. * @example
  28947. *
  28948. * _.isArrayLike([1, 2, 3]);
  28949. * // => true
  28950. *
  28951. * _.isArrayLike(document.body.children);
  28952. * // => true
  28953. *
  28954. * _.isArrayLike('abc');
  28955. * // => true
  28956. *
  28957. * _.isArrayLike(_.noop);
  28958. * // => false
  28959. */
  28960. function isArrayLike(value) {
  28961. return value != null && isLength(value.length) && !isFunction(value);
  28962. }
  28963. /**
  28964. * This method is like `_.isArrayLike` except that it also checks if `value`
  28965. * is an object.
  28966. *
  28967. * @static
  28968. * @memberOf _
  28969. * @since 4.0.0
  28970. * @category Lang
  28971. * @param {*} value The value to check.
  28972. * @returns {boolean} Returns `true` if `value` is an array-like object,
  28973. * else `false`.
  28974. * @example
  28975. *
  28976. * _.isArrayLikeObject([1, 2, 3]);
  28977. * // => true
  28978. *
  28979. * _.isArrayLikeObject(document.body.children);
  28980. * // => true
  28981. *
  28982. * _.isArrayLikeObject('abc');
  28983. * // => false
  28984. *
  28985. * _.isArrayLikeObject(_.noop);
  28986. * // => false
  28987. */
  28988. function isArrayLikeObject(value) {
  28989. return isObjectLike(value) && isArrayLike(value);
  28990. }
  28991. /**
  28992. * Checks if `value` is classified as a boolean primitive or object.
  28993. *
  28994. * @static
  28995. * @memberOf _
  28996. * @since 0.1.0
  28997. * @category Lang
  28998. * @param {*} value The value to check.
  28999. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  29000. * @example
  29001. *
  29002. * _.isBoolean(false);
  29003. * // => true
  29004. *
  29005. * _.isBoolean(null);
  29006. * // => false
  29007. */
  29008. function isBoolean(value) {
  29009. return value === true || value === false ||
  29010. (isObjectLike(value) && baseGetTag(value) == boolTag);
  29011. }
  29012. /**
  29013. * Checks if `value` is a buffer.
  29014. *
  29015. * @static
  29016. * @memberOf _
  29017. * @since 4.3.0
  29018. * @category Lang
  29019. * @param {*} value The value to check.
  29020. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  29021. * @example
  29022. *
  29023. * _.isBuffer(new Buffer(2));
  29024. * // => true
  29025. *
  29026. * _.isBuffer(new Uint8Array(2));
  29027. * // => false
  29028. */
  29029. var isBuffer = nativeIsBuffer || stubFalse;
  29030. /**
  29031. * Checks if `value` is classified as a `Date` object.
  29032. *
  29033. * @static
  29034. * @memberOf _
  29035. * @since 0.1.0
  29036. * @category Lang
  29037. * @param {*} value The value to check.
  29038. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  29039. * @example
  29040. *
  29041. * _.isDate(new Date);
  29042. * // => true
  29043. *
  29044. * _.isDate('Mon April 23 2012');
  29045. * // => false
  29046. */
  29047. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  29048. /**
  29049. * Checks if `value` is likely a DOM element.
  29050. *
  29051. * @static
  29052. * @memberOf _
  29053. * @since 0.1.0
  29054. * @category Lang
  29055. * @param {*} value The value to check.
  29056. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  29057. * @example
  29058. *
  29059. * _.isElement(document.body);
  29060. * // => true
  29061. *
  29062. * _.isElement('<body>');
  29063. * // => false
  29064. */
  29065. function isElement(value) {
  29066. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  29067. }
  29068. /**
  29069. * Checks if `value` is an empty object, collection, map, or set.
  29070. *
  29071. * Objects are considered empty if they have no own enumerable string keyed
  29072. * properties.
  29073. *
  29074. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  29075. * jQuery-like collections are considered empty if they have a `length` of `0`.
  29076. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  29077. *
  29078. * @static
  29079. * @memberOf _
  29080. * @since 0.1.0
  29081. * @category Lang
  29082. * @param {*} value The value to check.
  29083. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  29084. * @example
  29085. *
  29086. * _.isEmpty(null);
  29087. * // => true
  29088. *
  29089. * _.isEmpty(true);
  29090. * // => true
  29091. *
  29092. * _.isEmpty(1);
  29093. * // => true
  29094. *
  29095. * _.isEmpty([1, 2, 3]);
  29096. * // => false
  29097. *
  29098. * _.isEmpty({ 'a': 1 });
  29099. * // => false
  29100. */
  29101. function isEmpty(value) {
  29102. if (value == null) {
  29103. return true;
  29104. }
  29105. if (isArrayLike(value) &&
  29106. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  29107. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  29108. return !value.length;
  29109. }
  29110. var tag = getTag(value);
  29111. if (tag == mapTag || tag == setTag) {
  29112. return !value.size;
  29113. }
  29114. if (isPrototype(value)) {
  29115. return !baseKeys(value).length;
  29116. }
  29117. for (var key in value) {
  29118. if (hasOwnProperty.call(value, key)) {
  29119. return false;
  29120. }
  29121. }
  29122. return true;
  29123. }
  29124. /**
  29125. * Performs a deep comparison between two values to determine if they are
  29126. * equivalent.
  29127. *
  29128. * **Note:** This method supports comparing arrays, array buffers, booleans,
  29129. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  29130. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  29131. * by their own, not inherited, enumerable properties. Functions and DOM
  29132. * nodes are compared by strict equality, i.e. `===`.
  29133. *
  29134. * @static
  29135. * @memberOf _
  29136. * @since 0.1.0
  29137. * @category Lang
  29138. * @param {*} value The value to compare.
  29139. * @param {*} other The other value to compare.
  29140. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29141. * @example
  29142. *
  29143. * var object = { 'a': 1 };
  29144. * var other = { 'a': 1 };
  29145. *
  29146. * _.isEqual(object, other);
  29147. * // => true
  29148. *
  29149. * object === other;
  29150. * // => false
  29151. */
  29152. function isEqual(value, other) {
  29153. return baseIsEqual(value, other);
  29154. }
  29155. /**
  29156. * This method is like `_.isEqual` except that it accepts `customizer` which
  29157. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29158. * are handled by the method instead. The `customizer` is invoked with up to
  29159. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  29160. *
  29161. * @static
  29162. * @memberOf _
  29163. * @since 4.0.0
  29164. * @category Lang
  29165. * @param {*} value The value to compare.
  29166. * @param {*} other The other value to compare.
  29167. * @param {Function} [customizer] The function to customize comparisons.
  29168. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29169. * @example
  29170. *
  29171. * function isGreeting(value) {
  29172. * return /^h(?:i|ello)$/.test(value);
  29173. * }
  29174. *
  29175. * function customizer(objValue, othValue) {
  29176. * if (isGreeting(objValue) && isGreeting(othValue)) {
  29177. * return true;
  29178. * }
  29179. * }
  29180. *
  29181. * var array = ['hello', 'goodbye'];
  29182. * var other = ['hi', 'goodbye'];
  29183. *
  29184. * _.isEqualWith(array, other, customizer);
  29185. * // => true
  29186. */
  29187. function isEqualWith(value, other, customizer) {
  29188. customizer = typeof customizer == 'function' ? customizer : undefined;
  29189. var result = customizer ? customizer(value, other) : undefined;
  29190. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  29191. }
  29192. /**
  29193. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  29194. * `SyntaxError`, `TypeError`, or `URIError` object.
  29195. *
  29196. * @static
  29197. * @memberOf _
  29198. * @since 3.0.0
  29199. * @category Lang
  29200. * @param {*} value The value to check.
  29201. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  29202. * @example
  29203. *
  29204. * _.isError(new Error);
  29205. * // => true
  29206. *
  29207. * _.isError(Error);
  29208. * // => false
  29209. */
  29210. function isError(value) {
  29211. if (!isObjectLike(value)) {
  29212. return false;
  29213. }
  29214. var tag = baseGetTag(value);
  29215. return tag == errorTag || tag == domExcTag ||
  29216. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  29217. }
  29218. /**
  29219. * Checks if `value` is a finite primitive number.
  29220. *
  29221. * **Note:** This method is based on
  29222. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  29223. *
  29224. * @static
  29225. * @memberOf _
  29226. * @since 0.1.0
  29227. * @category Lang
  29228. * @param {*} value The value to check.
  29229. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  29230. * @example
  29231. *
  29232. * _.isFinite(3);
  29233. * // => true
  29234. *
  29235. * _.isFinite(Number.MIN_VALUE);
  29236. * // => true
  29237. *
  29238. * _.isFinite(Infinity);
  29239. * // => false
  29240. *
  29241. * _.isFinite('3');
  29242. * // => false
  29243. */
  29244. function isFinite(value) {
  29245. return typeof value == 'number' && nativeIsFinite(value);
  29246. }
  29247. /**
  29248. * Checks if `value` is classified as a `Function` object.
  29249. *
  29250. * @static
  29251. * @memberOf _
  29252. * @since 0.1.0
  29253. * @category Lang
  29254. * @param {*} value The value to check.
  29255. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  29256. * @example
  29257. *
  29258. * _.isFunction(_);
  29259. * // => true
  29260. *
  29261. * _.isFunction(/abc/);
  29262. * // => false
  29263. */
  29264. function isFunction(value) {
  29265. if (!isObject(value)) {
  29266. return false;
  29267. }
  29268. // The use of `Object#toString` avoids issues with the `typeof` operator
  29269. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  29270. var tag = baseGetTag(value);
  29271. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  29272. }
  29273. /**
  29274. * Checks if `value` is an integer.
  29275. *
  29276. * **Note:** This method is based on
  29277. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  29278. *
  29279. * @static
  29280. * @memberOf _
  29281. * @since 4.0.0
  29282. * @category Lang
  29283. * @param {*} value The value to check.
  29284. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  29285. * @example
  29286. *
  29287. * _.isInteger(3);
  29288. * // => true
  29289. *
  29290. * _.isInteger(Number.MIN_VALUE);
  29291. * // => false
  29292. *
  29293. * _.isInteger(Infinity);
  29294. * // => false
  29295. *
  29296. * _.isInteger('3');
  29297. * // => false
  29298. */
  29299. function isInteger(value) {
  29300. return typeof value == 'number' && value == toInteger(value);
  29301. }
  29302. /**
  29303. * Checks if `value` is a valid array-like length.
  29304. *
  29305. * **Note:** This method is loosely based on
  29306. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29307. *
  29308. * @static
  29309. * @memberOf _
  29310. * @since 4.0.0
  29311. * @category Lang
  29312. * @param {*} value The value to check.
  29313. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  29314. * @example
  29315. *
  29316. * _.isLength(3);
  29317. * // => true
  29318. *
  29319. * _.isLength(Number.MIN_VALUE);
  29320. * // => false
  29321. *
  29322. * _.isLength(Infinity);
  29323. * // => false
  29324. *
  29325. * _.isLength('3');
  29326. * // => false
  29327. */
  29328. function isLength(value) {
  29329. return typeof value == 'number' &&
  29330. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  29331. }
  29332. /**
  29333. * Checks if `value` is the
  29334. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  29335. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  29336. *
  29337. * @static
  29338. * @memberOf _
  29339. * @since 0.1.0
  29340. * @category Lang
  29341. * @param {*} value The value to check.
  29342. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  29343. * @example
  29344. *
  29345. * _.isObject({});
  29346. * // => true
  29347. *
  29348. * _.isObject([1, 2, 3]);
  29349. * // => true
  29350. *
  29351. * _.isObject(_.noop);
  29352. * // => true
  29353. *
  29354. * _.isObject(null);
  29355. * // => false
  29356. */
  29357. function isObject(value) {
  29358. var type = typeof value;
  29359. return value != null && (type == 'object' || type == 'function');
  29360. }
  29361. /**
  29362. * Checks if `value` is object-like. A value is object-like if it's not `null`
  29363. * and has a `typeof` result of "object".
  29364. *
  29365. * @static
  29366. * @memberOf _
  29367. * @since 4.0.0
  29368. * @category Lang
  29369. * @param {*} value The value to check.
  29370. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  29371. * @example
  29372. *
  29373. * _.isObjectLike({});
  29374. * // => true
  29375. *
  29376. * _.isObjectLike([1, 2, 3]);
  29377. * // => true
  29378. *
  29379. * _.isObjectLike(_.noop);
  29380. * // => false
  29381. *
  29382. * _.isObjectLike(null);
  29383. * // => false
  29384. */
  29385. function isObjectLike(value) {
  29386. return value != null && typeof value == 'object';
  29387. }
  29388. /**
  29389. * Checks if `value` is classified as a `Map` object.
  29390. *
  29391. * @static
  29392. * @memberOf _
  29393. * @since 4.3.0
  29394. * @category Lang
  29395. * @param {*} value The value to check.
  29396. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  29397. * @example
  29398. *
  29399. * _.isMap(new Map);
  29400. * // => true
  29401. *
  29402. * _.isMap(new WeakMap);
  29403. * // => false
  29404. */
  29405. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  29406. /**
  29407. * Performs a partial deep comparison between `object` and `source` to
  29408. * determine if `object` contains equivalent property values.
  29409. *
  29410. * **Note:** This method is equivalent to `_.matches` when `source` is
  29411. * partially applied.
  29412. *
  29413. * Partial comparisons will match empty array and empty object `source`
  29414. * values against any array or object value, respectively. See `_.isEqual`
  29415. * for a list of supported value comparisons.
  29416. *
  29417. * @static
  29418. * @memberOf _
  29419. * @since 3.0.0
  29420. * @category Lang
  29421. * @param {Object} object The object to inspect.
  29422. * @param {Object} source The object of property values to match.
  29423. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29424. * @example
  29425. *
  29426. * var object = { 'a': 1, 'b': 2 };
  29427. *
  29428. * _.isMatch(object, { 'b': 2 });
  29429. * // => true
  29430. *
  29431. * _.isMatch(object, { 'b': 1 });
  29432. * // => false
  29433. */
  29434. function isMatch(object, source) {
  29435. return object === source || baseIsMatch(object, source, getMatchData(source));
  29436. }
  29437. /**
  29438. * This method is like `_.isMatch` except that it accepts `customizer` which
  29439. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29440. * are handled by the method instead. The `customizer` is invoked with five
  29441. * arguments: (objValue, srcValue, index|key, object, source).
  29442. *
  29443. * @static
  29444. * @memberOf _
  29445. * @since 4.0.0
  29446. * @category Lang
  29447. * @param {Object} object The object to inspect.
  29448. * @param {Object} source The object of property values to match.
  29449. * @param {Function} [customizer] The function to customize comparisons.
  29450. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29451. * @example
  29452. *
  29453. * function isGreeting(value) {
  29454. * return /^h(?:i|ello)$/.test(value);
  29455. * }
  29456. *
  29457. * function customizer(objValue, srcValue) {
  29458. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  29459. * return true;
  29460. * }
  29461. * }
  29462. *
  29463. * var object = { 'greeting': 'hello' };
  29464. * var source = { 'greeting': 'hi' };
  29465. *
  29466. * _.isMatchWith(object, source, customizer);
  29467. * // => true
  29468. */
  29469. function isMatchWith(object, source, customizer) {
  29470. customizer = typeof customizer == 'function' ? customizer : undefined;
  29471. return baseIsMatch(object, source, getMatchData(source), customizer);
  29472. }
  29473. /**
  29474. * Checks if `value` is `NaN`.
  29475. *
  29476. * **Note:** This method is based on
  29477. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  29478. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  29479. * `undefined` and other non-number values.
  29480. *
  29481. * @static
  29482. * @memberOf _
  29483. * @since 0.1.0
  29484. * @category Lang
  29485. * @param {*} value The value to check.
  29486. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  29487. * @example
  29488. *
  29489. * _.isNaN(NaN);
  29490. * // => true
  29491. *
  29492. * _.isNaN(new Number(NaN));
  29493. * // => true
  29494. *
  29495. * isNaN(undefined);
  29496. * // => true
  29497. *
  29498. * _.isNaN(undefined);
  29499. * // => false
  29500. */
  29501. function isNaN(value) {
  29502. // An `NaN` primitive is the only value that is not equal to itself.
  29503. // Perform the `toStringTag` check first to avoid errors with some
  29504. // ActiveX objects in IE.
  29505. return isNumber(value) && value != +value;
  29506. }
  29507. /**
  29508. * Checks if `value` is a pristine native function.
  29509. *
  29510. * **Note:** This method can't reliably detect native functions in the presence
  29511. * of the core-js package because core-js circumvents this kind of detection.
  29512. * Despite multiple requests, the core-js maintainer has made it clear: any
  29513. * attempt to fix the detection will be obstructed. As a result, we're left
  29514. * with little choice but to throw an error. Unfortunately, this also affects
  29515. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  29516. * which rely on core-js.
  29517. *
  29518. * @static
  29519. * @memberOf _
  29520. * @since 3.0.0
  29521. * @category Lang
  29522. * @param {*} value The value to check.
  29523. * @returns {boolean} Returns `true` if `value` is a native function,
  29524. * else `false`.
  29525. * @example
  29526. *
  29527. * _.isNative(Array.prototype.push);
  29528. * // => true
  29529. *
  29530. * _.isNative(_);
  29531. * // => false
  29532. */
  29533. function isNative(value) {
  29534. if (isMaskable(value)) {
  29535. throw new Error(CORE_ERROR_TEXT);
  29536. }
  29537. return baseIsNative(value);
  29538. }
  29539. /**
  29540. * Checks if `value` is `null`.
  29541. *
  29542. * @static
  29543. * @memberOf _
  29544. * @since 0.1.0
  29545. * @category Lang
  29546. * @param {*} value The value to check.
  29547. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  29548. * @example
  29549. *
  29550. * _.isNull(null);
  29551. * // => true
  29552. *
  29553. * _.isNull(void 0);
  29554. * // => false
  29555. */
  29556. function isNull(value) {
  29557. return value === null;
  29558. }
  29559. /**
  29560. * Checks if `value` is `null` or `undefined`.
  29561. *
  29562. * @static
  29563. * @memberOf _
  29564. * @since 4.0.0
  29565. * @category Lang
  29566. * @param {*} value The value to check.
  29567. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  29568. * @example
  29569. *
  29570. * _.isNil(null);
  29571. * // => true
  29572. *
  29573. * _.isNil(void 0);
  29574. * // => true
  29575. *
  29576. * _.isNil(NaN);
  29577. * // => false
  29578. */
  29579. function isNil(value) {
  29580. return value == null;
  29581. }
  29582. /**
  29583. * Checks if `value` is classified as a `Number` primitive or object.
  29584. *
  29585. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  29586. * classified as numbers, use the `_.isFinite` method.
  29587. *
  29588. * @static
  29589. * @memberOf _
  29590. * @since 0.1.0
  29591. * @category Lang
  29592. * @param {*} value The value to check.
  29593. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  29594. * @example
  29595. *
  29596. * _.isNumber(3);
  29597. * // => true
  29598. *
  29599. * _.isNumber(Number.MIN_VALUE);
  29600. * // => true
  29601. *
  29602. * _.isNumber(Infinity);
  29603. * // => true
  29604. *
  29605. * _.isNumber('3');
  29606. * // => false
  29607. */
  29608. function isNumber(value) {
  29609. return typeof value == 'number' ||
  29610. (isObjectLike(value) && baseGetTag(value) == numberTag);
  29611. }
  29612. /**
  29613. * Checks if `value` is a plain object, that is, an object created by the
  29614. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  29615. *
  29616. * @static
  29617. * @memberOf _
  29618. * @since 0.8.0
  29619. * @category Lang
  29620. * @param {*} value The value to check.
  29621. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  29622. * @example
  29623. *
  29624. * function Foo() {
  29625. * this.a = 1;
  29626. * }
  29627. *
  29628. * _.isPlainObject(new Foo);
  29629. * // => false
  29630. *
  29631. * _.isPlainObject([1, 2, 3]);
  29632. * // => false
  29633. *
  29634. * _.isPlainObject({ 'x': 0, 'y': 0 });
  29635. * // => true
  29636. *
  29637. * _.isPlainObject(Object.create(null));
  29638. * // => true
  29639. */
  29640. function isPlainObject(value) {
  29641. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  29642. return false;
  29643. }
  29644. var proto = getPrototype(value);
  29645. if (proto === null) {
  29646. return true;
  29647. }
  29648. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  29649. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  29650. funcToString.call(Ctor) == objectCtorString;
  29651. }
  29652. /**
  29653. * Checks if `value` is classified as a `RegExp` object.
  29654. *
  29655. * @static
  29656. * @memberOf _
  29657. * @since 0.1.0
  29658. * @category Lang
  29659. * @param {*} value The value to check.
  29660. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  29661. * @example
  29662. *
  29663. * _.isRegExp(/abc/);
  29664. * // => true
  29665. *
  29666. * _.isRegExp('/abc/');
  29667. * // => false
  29668. */
  29669. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  29670. /**
  29671. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  29672. * double precision number which isn't the result of a rounded unsafe integer.
  29673. *
  29674. * **Note:** This method is based on
  29675. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  29676. *
  29677. * @static
  29678. * @memberOf _
  29679. * @since 4.0.0
  29680. * @category Lang
  29681. * @param {*} value The value to check.
  29682. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  29683. * @example
  29684. *
  29685. * _.isSafeInteger(3);
  29686. * // => true
  29687. *
  29688. * _.isSafeInteger(Number.MIN_VALUE);
  29689. * // => false
  29690. *
  29691. * _.isSafeInteger(Infinity);
  29692. * // => false
  29693. *
  29694. * _.isSafeInteger('3');
  29695. * // => false
  29696. */
  29697. function isSafeInteger(value) {
  29698. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  29699. }
  29700. /**
  29701. * Checks if `value` is classified as a `Set` object.
  29702. *
  29703. * @static
  29704. * @memberOf _
  29705. * @since 4.3.0
  29706. * @category Lang
  29707. * @param {*} value The value to check.
  29708. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  29709. * @example
  29710. *
  29711. * _.isSet(new Set);
  29712. * // => true
  29713. *
  29714. * _.isSet(new WeakSet);
  29715. * // => false
  29716. */
  29717. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  29718. /**
  29719. * Checks if `value` is classified as a `String` primitive or object.
  29720. *
  29721. * @static
  29722. * @since 0.1.0
  29723. * @memberOf _
  29724. * @category Lang
  29725. * @param {*} value The value to check.
  29726. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  29727. * @example
  29728. *
  29729. * _.isString('abc');
  29730. * // => true
  29731. *
  29732. * _.isString(1);
  29733. * // => false
  29734. */
  29735. function isString(value) {
  29736. return typeof value == 'string' ||
  29737. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  29738. }
  29739. /**
  29740. * Checks if `value` is classified as a `Symbol` primitive or object.
  29741. *
  29742. * @static
  29743. * @memberOf _
  29744. * @since 4.0.0
  29745. * @category Lang
  29746. * @param {*} value The value to check.
  29747. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  29748. * @example
  29749. *
  29750. * _.isSymbol(Symbol.iterator);
  29751. * // => true
  29752. *
  29753. * _.isSymbol('abc');
  29754. * // => false
  29755. */
  29756. function isSymbol(value) {
  29757. return typeof value == 'symbol' ||
  29758. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  29759. }
  29760. /**
  29761. * Checks if `value` is classified as a typed array.
  29762. *
  29763. * @static
  29764. * @memberOf _
  29765. * @since 3.0.0
  29766. * @category Lang
  29767. * @param {*} value The value to check.
  29768. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  29769. * @example
  29770. *
  29771. * _.isTypedArray(new Uint8Array);
  29772. * // => true
  29773. *
  29774. * _.isTypedArray([]);
  29775. * // => false
  29776. */
  29777. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  29778. /**
  29779. * Checks if `value` is `undefined`.
  29780. *
  29781. * @static
  29782. * @since 0.1.0
  29783. * @memberOf _
  29784. * @category Lang
  29785. * @param {*} value The value to check.
  29786. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  29787. * @example
  29788. *
  29789. * _.isUndefined(void 0);
  29790. * // => true
  29791. *
  29792. * _.isUndefined(null);
  29793. * // => false
  29794. */
  29795. function isUndefined(value) {
  29796. return value === undefined;
  29797. }
  29798. /**
  29799. * Checks if `value` is classified as a `WeakMap` object.
  29800. *
  29801. * @static
  29802. * @memberOf _
  29803. * @since 4.3.0
  29804. * @category Lang
  29805. * @param {*} value The value to check.
  29806. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  29807. * @example
  29808. *
  29809. * _.isWeakMap(new WeakMap);
  29810. * // => true
  29811. *
  29812. * _.isWeakMap(new Map);
  29813. * // => false
  29814. */
  29815. function isWeakMap(value) {
  29816. return isObjectLike(value) && getTag(value) == weakMapTag;
  29817. }
  29818. /**
  29819. * Checks if `value` is classified as a `WeakSet` object.
  29820. *
  29821. * @static
  29822. * @memberOf _
  29823. * @since 4.3.0
  29824. * @category Lang
  29825. * @param {*} value The value to check.
  29826. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  29827. * @example
  29828. *
  29829. * _.isWeakSet(new WeakSet);
  29830. * // => true
  29831. *
  29832. * _.isWeakSet(new Set);
  29833. * // => false
  29834. */
  29835. function isWeakSet(value) {
  29836. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  29837. }
  29838. /**
  29839. * Checks if `value` is less than `other`.
  29840. *
  29841. * @static
  29842. * @memberOf _
  29843. * @since 3.9.0
  29844. * @category Lang
  29845. * @param {*} value The value to compare.
  29846. * @param {*} other The other value to compare.
  29847. * @returns {boolean} Returns `true` if `value` is less than `other`,
  29848. * else `false`.
  29849. * @see _.gt
  29850. * @example
  29851. *
  29852. * _.lt(1, 3);
  29853. * // => true
  29854. *
  29855. * _.lt(3, 3);
  29856. * // => false
  29857. *
  29858. * _.lt(3, 1);
  29859. * // => false
  29860. */
  29861. var lt = createRelationalOperation(baseLt);
  29862. /**
  29863. * Checks if `value` is less than or equal to `other`.
  29864. *
  29865. * @static
  29866. * @memberOf _
  29867. * @since 3.9.0
  29868. * @category Lang
  29869. * @param {*} value The value to compare.
  29870. * @param {*} other The other value to compare.
  29871. * @returns {boolean} Returns `true` if `value` is less than or equal to
  29872. * `other`, else `false`.
  29873. * @see _.gte
  29874. * @example
  29875. *
  29876. * _.lte(1, 3);
  29877. * // => true
  29878. *
  29879. * _.lte(3, 3);
  29880. * // => true
  29881. *
  29882. * _.lte(3, 1);
  29883. * // => false
  29884. */
  29885. var lte = createRelationalOperation(function(value, other) {
  29886. return value <= other;
  29887. });
  29888. /**
  29889. * Converts `value` to an array.
  29890. *
  29891. * @static
  29892. * @since 0.1.0
  29893. * @memberOf _
  29894. * @category Lang
  29895. * @param {*} value The value to convert.
  29896. * @returns {Array} Returns the converted array.
  29897. * @example
  29898. *
  29899. * _.toArray({ 'a': 1, 'b': 2 });
  29900. * // => [1, 2]
  29901. *
  29902. * _.toArray('abc');
  29903. * // => ['a', 'b', 'c']
  29904. *
  29905. * _.toArray(1);
  29906. * // => []
  29907. *
  29908. * _.toArray(null);
  29909. * // => []
  29910. */
  29911. function toArray(value) {
  29912. if (!value) {
  29913. return [];
  29914. }
  29915. if (isArrayLike(value)) {
  29916. return isString(value) ? stringToArray(value) : copyArray(value);
  29917. }
  29918. if (symIterator && value[symIterator]) {
  29919. return iteratorToArray(value[symIterator]());
  29920. }
  29921. var tag = getTag(value),
  29922. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  29923. return func(value);
  29924. }
  29925. /**
  29926. * Converts `value` to a finite number.
  29927. *
  29928. * @static
  29929. * @memberOf _
  29930. * @since 4.12.0
  29931. * @category Lang
  29932. * @param {*} value The value to convert.
  29933. * @returns {number} Returns the converted number.
  29934. * @example
  29935. *
  29936. * _.toFinite(3.2);
  29937. * // => 3.2
  29938. *
  29939. * _.toFinite(Number.MIN_VALUE);
  29940. * // => 5e-324
  29941. *
  29942. * _.toFinite(Infinity);
  29943. * // => 1.7976931348623157e+308
  29944. *
  29945. * _.toFinite('3.2');
  29946. * // => 3.2
  29947. */
  29948. function toFinite(value) {
  29949. if (!value) {
  29950. return value === 0 ? value : 0;
  29951. }
  29952. value = toNumber(value);
  29953. if (value === INFINITY || value === -INFINITY) {
  29954. var sign = (value < 0 ? -1 : 1);
  29955. return sign * MAX_INTEGER;
  29956. }
  29957. return value === value ? value : 0;
  29958. }
  29959. /**
  29960. * Converts `value` to an integer.
  29961. *
  29962. * **Note:** This method is loosely based on
  29963. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  29964. *
  29965. * @static
  29966. * @memberOf _
  29967. * @since 4.0.0
  29968. * @category Lang
  29969. * @param {*} value The value to convert.
  29970. * @returns {number} Returns the converted integer.
  29971. * @example
  29972. *
  29973. * _.toInteger(3.2);
  29974. * // => 3
  29975. *
  29976. * _.toInteger(Number.MIN_VALUE);
  29977. * // => 0
  29978. *
  29979. * _.toInteger(Infinity);
  29980. * // => 1.7976931348623157e+308
  29981. *
  29982. * _.toInteger('3.2');
  29983. * // => 3
  29984. */
  29985. function toInteger(value) {
  29986. var result = toFinite(value),
  29987. remainder = result % 1;
  29988. return result === result ? (remainder ? result - remainder : result) : 0;
  29989. }
  29990. /**
  29991. * Converts `value` to an integer suitable for use as the length of an
  29992. * array-like object.
  29993. *
  29994. * **Note:** This method is based on
  29995. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29996. *
  29997. * @static
  29998. * @memberOf _
  29999. * @since 4.0.0
  30000. * @category Lang
  30001. * @param {*} value The value to convert.
  30002. * @returns {number} Returns the converted integer.
  30003. * @example
  30004. *
  30005. * _.toLength(3.2);
  30006. * // => 3
  30007. *
  30008. * _.toLength(Number.MIN_VALUE);
  30009. * // => 0
  30010. *
  30011. * _.toLength(Infinity);
  30012. * // => 4294967295
  30013. *
  30014. * _.toLength('3.2');
  30015. * // => 3
  30016. */
  30017. function toLength(value) {
  30018. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  30019. }
  30020. /**
  30021. * Converts `value` to a number.
  30022. *
  30023. * @static
  30024. * @memberOf _
  30025. * @since 4.0.0
  30026. * @category Lang
  30027. * @param {*} value The value to process.
  30028. * @returns {number} Returns the number.
  30029. * @example
  30030. *
  30031. * _.toNumber(3.2);
  30032. * // => 3.2
  30033. *
  30034. * _.toNumber(Number.MIN_VALUE);
  30035. * // => 5e-324
  30036. *
  30037. * _.toNumber(Infinity);
  30038. * // => Infinity
  30039. *
  30040. * _.toNumber('3.2');
  30041. * // => 3.2
  30042. */
  30043. function toNumber(value) {
  30044. if (typeof value == 'number') {
  30045. return value;
  30046. }
  30047. if (isSymbol(value)) {
  30048. return NAN;
  30049. }
  30050. if (isObject(value)) {
  30051. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  30052. value = isObject(other) ? (other + '') : other;
  30053. }
  30054. if (typeof value != 'string') {
  30055. return value === 0 ? value : +value;
  30056. }
  30057. value = value.replace(reTrim, '');
  30058. var isBinary = reIsBinary.test(value);
  30059. return (isBinary || reIsOctal.test(value))
  30060. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  30061. : (reIsBadHex.test(value) ? NAN : +value);
  30062. }
  30063. /**
  30064. * Converts `value` to a plain object flattening inherited enumerable string
  30065. * keyed properties of `value` to own properties of the plain object.
  30066. *
  30067. * @static
  30068. * @memberOf _
  30069. * @since 3.0.0
  30070. * @category Lang
  30071. * @param {*} value The value to convert.
  30072. * @returns {Object} Returns the converted plain object.
  30073. * @example
  30074. *
  30075. * function Foo() {
  30076. * this.b = 2;
  30077. * }
  30078. *
  30079. * Foo.prototype.c = 3;
  30080. *
  30081. * _.assign({ 'a': 1 }, new Foo);
  30082. * // => { 'a': 1, 'b': 2 }
  30083. *
  30084. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  30085. * // => { 'a': 1, 'b': 2, 'c': 3 }
  30086. */
  30087. function toPlainObject(value) {
  30088. return copyObject(value, keysIn(value));
  30089. }
  30090. /**
  30091. * Converts `value` to a safe integer. A safe integer can be compared and
  30092. * represented correctly.
  30093. *
  30094. * @static
  30095. * @memberOf _
  30096. * @since 4.0.0
  30097. * @category Lang
  30098. * @param {*} value The value to convert.
  30099. * @returns {number} Returns the converted integer.
  30100. * @example
  30101. *
  30102. * _.toSafeInteger(3.2);
  30103. * // => 3
  30104. *
  30105. * _.toSafeInteger(Number.MIN_VALUE);
  30106. * // => 0
  30107. *
  30108. * _.toSafeInteger(Infinity);
  30109. * // => 9007199254740991
  30110. *
  30111. * _.toSafeInteger('3.2');
  30112. * // => 3
  30113. */
  30114. function toSafeInteger(value) {
  30115. return value
  30116. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  30117. : (value === 0 ? value : 0);
  30118. }
  30119. /**
  30120. * Converts `value` to a string. An empty string is returned for `null`
  30121. * and `undefined` values. The sign of `-0` is preserved.
  30122. *
  30123. * @static
  30124. * @memberOf _
  30125. * @since 4.0.0
  30126. * @category Lang
  30127. * @param {*} value The value to convert.
  30128. * @returns {string} Returns the converted string.
  30129. * @example
  30130. *
  30131. * _.toString(null);
  30132. * // => ''
  30133. *
  30134. * _.toString(-0);
  30135. * // => '-0'
  30136. *
  30137. * _.toString([1, 2, 3]);
  30138. * // => '1,2,3'
  30139. */
  30140. function toString(value) {
  30141. return value == null ? '' : baseToString(value);
  30142. }
  30143. /*------------------------------------------------------------------------*/
  30144. /**
  30145. * Assigns own enumerable string keyed properties of source objects to the
  30146. * destination object. Source objects are applied from left to right.
  30147. * Subsequent sources overwrite property assignments of previous sources.
  30148. *
  30149. * **Note:** This method mutates `object` and is loosely based on
  30150. * [`Object.assign`](https://mdn.io/Object/assign).
  30151. *
  30152. * @static
  30153. * @memberOf _
  30154. * @since 0.10.0
  30155. * @category Object
  30156. * @param {Object} object The destination object.
  30157. * @param {...Object} [sources] The source objects.
  30158. * @returns {Object} Returns `object`.
  30159. * @see _.assignIn
  30160. * @example
  30161. *
  30162. * function Foo() {
  30163. * this.a = 1;
  30164. * }
  30165. *
  30166. * function Bar() {
  30167. * this.c = 3;
  30168. * }
  30169. *
  30170. * Foo.prototype.b = 2;
  30171. * Bar.prototype.d = 4;
  30172. *
  30173. * _.assign({ 'a': 0 }, new Foo, new Bar);
  30174. * // => { 'a': 1, 'c': 3 }
  30175. */
  30176. var assign = createAssigner(function(object, source) {
  30177. if (isPrototype(source) || isArrayLike(source)) {
  30178. copyObject(source, keys(source), object);
  30179. return;
  30180. }
  30181. for (var key in source) {
  30182. if (hasOwnProperty.call(source, key)) {
  30183. assignValue(object, key, source[key]);
  30184. }
  30185. }
  30186. });
  30187. /**
  30188. * This method is like `_.assign` except that it iterates over own and
  30189. * inherited source properties.
  30190. *
  30191. * **Note:** This method mutates `object`.
  30192. *
  30193. * @static
  30194. * @memberOf _
  30195. * @since 4.0.0
  30196. * @alias extend
  30197. * @category Object
  30198. * @param {Object} object The destination object.
  30199. * @param {...Object} [sources] The source objects.
  30200. * @returns {Object} Returns `object`.
  30201. * @see _.assign
  30202. * @example
  30203. *
  30204. * function Foo() {
  30205. * this.a = 1;
  30206. * }
  30207. *
  30208. * function Bar() {
  30209. * this.c = 3;
  30210. * }
  30211. *
  30212. * Foo.prototype.b = 2;
  30213. * Bar.prototype.d = 4;
  30214. *
  30215. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  30216. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  30217. */
  30218. var assignIn = createAssigner(function(object, source) {
  30219. copyObject(source, keysIn(source), object);
  30220. });
  30221. /**
  30222. * This method is like `_.assignIn` except that it accepts `customizer`
  30223. * which is invoked to produce the assigned values. If `customizer` returns
  30224. * `undefined`, assignment is handled by the method instead. The `customizer`
  30225. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30226. *
  30227. * **Note:** This method mutates `object`.
  30228. *
  30229. * @static
  30230. * @memberOf _
  30231. * @since 4.0.0
  30232. * @alias extendWith
  30233. * @category Object
  30234. * @param {Object} object The destination object.
  30235. * @param {...Object} sources The source objects.
  30236. * @param {Function} [customizer] The function to customize assigned values.
  30237. * @returns {Object} Returns `object`.
  30238. * @see _.assignWith
  30239. * @example
  30240. *
  30241. * function customizer(objValue, srcValue) {
  30242. * return _.isUndefined(objValue) ? srcValue : objValue;
  30243. * }
  30244. *
  30245. * var defaults = _.partialRight(_.assignInWith, customizer);
  30246. *
  30247. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30248. * // => { 'a': 1, 'b': 2 }
  30249. */
  30250. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  30251. copyObject(source, keysIn(source), object, customizer);
  30252. });
  30253. /**
  30254. * This method is like `_.assign` except that it accepts `customizer`
  30255. * which is invoked to produce the assigned values. If `customizer` returns
  30256. * `undefined`, assignment is handled by the method instead. The `customizer`
  30257. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30258. *
  30259. * **Note:** This method mutates `object`.
  30260. *
  30261. * @static
  30262. * @memberOf _
  30263. * @since 4.0.0
  30264. * @category Object
  30265. * @param {Object} object The destination object.
  30266. * @param {...Object} sources The source objects.
  30267. * @param {Function} [customizer] The function to customize assigned values.
  30268. * @returns {Object} Returns `object`.
  30269. * @see _.assignInWith
  30270. * @example
  30271. *
  30272. * function customizer(objValue, srcValue) {
  30273. * return _.isUndefined(objValue) ? srcValue : objValue;
  30274. * }
  30275. *
  30276. * var defaults = _.partialRight(_.assignWith, customizer);
  30277. *
  30278. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30279. * // => { 'a': 1, 'b': 2 }
  30280. */
  30281. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  30282. copyObject(source, keys(source), object, customizer);
  30283. });
  30284. /**
  30285. * Creates an array of values corresponding to `paths` of `object`.
  30286. *
  30287. * @static
  30288. * @memberOf _
  30289. * @since 1.0.0
  30290. * @category Object
  30291. * @param {Object} object The object to iterate over.
  30292. * @param {...(string|string[])} [paths] The property paths to pick.
  30293. * @returns {Array} Returns the picked values.
  30294. * @example
  30295. *
  30296. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  30297. *
  30298. * _.at(object, ['a[0].b.c', 'a[1]']);
  30299. * // => [3, 4]
  30300. */
  30301. var at = flatRest(baseAt);
  30302. /**
  30303. * Creates an object that inherits from the `prototype` object. If a
  30304. * `properties` object is given, its own enumerable string keyed properties
  30305. * are assigned to the created object.
  30306. *
  30307. * @static
  30308. * @memberOf _
  30309. * @since 2.3.0
  30310. * @category Object
  30311. * @param {Object} prototype The object to inherit from.
  30312. * @param {Object} [properties] The properties to assign to the object.
  30313. * @returns {Object} Returns the new object.
  30314. * @example
  30315. *
  30316. * function Shape() {
  30317. * this.x = 0;
  30318. * this.y = 0;
  30319. * }
  30320. *
  30321. * function Circle() {
  30322. * Shape.call(this);
  30323. * }
  30324. *
  30325. * Circle.prototype = _.create(Shape.prototype, {
  30326. * 'constructor': Circle
  30327. * });
  30328. *
  30329. * var circle = new Circle;
  30330. * circle instanceof Circle;
  30331. * // => true
  30332. *
  30333. * circle instanceof Shape;
  30334. * // => true
  30335. */
  30336. function create(prototype, properties) {
  30337. var result = baseCreate(prototype);
  30338. return properties == null ? result : baseAssign(result, properties);
  30339. }
  30340. /**
  30341. * Assigns own and inherited enumerable string keyed properties of source
  30342. * objects to the destination object for all destination properties that
  30343. * resolve to `undefined`. Source objects are applied from left to right.
  30344. * Once a property is set, additional values of the same property are ignored.
  30345. *
  30346. * **Note:** This method mutates `object`.
  30347. *
  30348. * @static
  30349. * @since 0.1.0
  30350. * @memberOf _
  30351. * @category Object
  30352. * @param {Object} object The destination object.
  30353. * @param {...Object} [sources] The source objects.
  30354. * @returns {Object} Returns `object`.
  30355. * @see _.defaultsDeep
  30356. * @example
  30357. *
  30358. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30359. * // => { 'a': 1, 'b': 2 }
  30360. */
  30361. var defaults = baseRest(function(object, sources) {
  30362. object = Object(object);
  30363. var index = -1;
  30364. var length = sources.length;
  30365. var guard = length > 2 ? sources[2] : undefined;
  30366. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  30367. length = 1;
  30368. }
  30369. while (++index < length) {
  30370. var source = sources[index];
  30371. var props = keysIn(source);
  30372. var propsIndex = -1;
  30373. var propsLength = props.length;
  30374. while (++propsIndex < propsLength) {
  30375. var key = props[propsIndex];
  30376. var value = object[key];
  30377. if (value === undefined ||
  30378. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  30379. object[key] = source[key];
  30380. }
  30381. }
  30382. }
  30383. return object;
  30384. });
  30385. /**
  30386. * This method is like `_.defaults` except that it recursively assigns
  30387. * default properties.
  30388. *
  30389. * **Note:** This method mutates `object`.
  30390. *
  30391. * @static
  30392. * @memberOf _
  30393. * @since 3.10.0
  30394. * @category Object
  30395. * @param {Object} object The destination object.
  30396. * @param {...Object} [sources] The source objects.
  30397. * @returns {Object} Returns `object`.
  30398. * @see _.defaults
  30399. * @example
  30400. *
  30401. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  30402. * // => { 'a': { 'b': 2, 'c': 3 } }
  30403. */
  30404. var defaultsDeep = baseRest(function(args) {
  30405. args.push(undefined, customDefaultsMerge);
  30406. return apply(mergeWith, undefined, args);
  30407. });
  30408. /**
  30409. * This method is like `_.find` except that it returns the key of the first
  30410. * element `predicate` returns truthy for instead of the element itself.
  30411. *
  30412. * @static
  30413. * @memberOf _
  30414. * @since 1.1.0
  30415. * @category Object
  30416. * @param {Object} object The object to inspect.
  30417. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30418. * @returns {string|undefined} Returns the key of the matched element,
  30419. * else `undefined`.
  30420. * @example
  30421. *
  30422. * var users = {
  30423. * 'barney': { 'age': 36, 'active': true },
  30424. * 'fred': { 'age': 40, 'active': false },
  30425. * 'pebbles': { 'age': 1, 'active': true }
  30426. * };
  30427. *
  30428. * _.findKey(users, function(o) { return o.age < 40; });
  30429. * // => 'barney' (iteration order is not guaranteed)
  30430. *
  30431. * // The `_.matches` iteratee shorthand.
  30432. * _.findKey(users, { 'age': 1, 'active': true });
  30433. * // => 'pebbles'
  30434. *
  30435. * // The `_.matchesProperty` iteratee shorthand.
  30436. * _.findKey(users, ['active', false]);
  30437. * // => 'fred'
  30438. *
  30439. * // The `_.property` iteratee shorthand.
  30440. * _.findKey(users, 'active');
  30441. * // => 'barney'
  30442. */
  30443. function findKey(object, predicate) {
  30444. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  30445. }
  30446. /**
  30447. * This method is like `_.findKey` except that it iterates over elements of
  30448. * a collection in the opposite order.
  30449. *
  30450. * @static
  30451. * @memberOf _
  30452. * @since 2.0.0
  30453. * @category Object
  30454. * @param {Object} object The object to inspect.
  30455. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30456. * @returns {string|undefined} Returns the key of the matched element,
  30457. * else `undefined`.
  30458. * @example
  30459. *
  30460. * var users = {
  30461. * 'barney': { 'age': 36, 'active': true },
  30462. * 'fred': { 'age': 40, 'active': false },
  30463. * 'pebbles': { 'age': 1, 'active': true }
  30464. * };
  30465. *
  30466. * _.findLastKey(users, function(o) { return o.age < 40; });
  30467. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  30468. *
  30469. * // The `_.matches` iteratee shorthand.
  30470. * _.findLastKey(users, { 'age': 36, 'active': true });
  30471. * // => 'barney'
  30472. *
  30473. * // The `_.matchesProperty` iteratee shorthand.
  30474. * _.findLastKey(users, ['active', false]);
  30475. * // => 'fred'
  30476. *
  30477. * // The `_.property` iteratee shorthand.
  30478. * _.findLastKey(users, 'active');
  30479. * // => 'pebbles'
  30480. */
  30481. function findLastKey(object, predicate) {
  30482. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  30483. }
  30484. /**
  30485. * Iterates over own and inherited enumerable string keyed properties of an
  30486. * object and invokes `iteratee` for each property. The iteratee is invoked
  30487. * with three arguments: (value, key, object). Iteratee functions may exit
  30488. * iteration early by explicitly returning `false`.
  30489. *
  30490. * @static
  30491. * @memberOf _
  30492. * @since 0.3.0
  30493. * @category Object
  30494. * @param {Object} object The object to iterate over.
  30495. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30496. * @returns {Object} Returns `object`.
  30497. * @see _.forInRight
  30498. * @example
  30499. *
  30500. * function Foo() {
  30501. * this.a = 1;
  30502. * this.b = 2;
  30503. * }
  30504. *
  30505. * Foo.prototype.c = 3;
  30506. *
  30507. * _.forIn(new Foo, function(value, key) {
  30508. * console.log(key);
  30509. * });
  30510. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  30511. */
  30512. function forIn(object, iteratee) {
  30513. return object == null
  30514. ? object
  30515. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  30516. }
  30517. /**
  30518. * This method is like `_.forIn` except that it iterates over properties of
  30519. * `object` in the opposite order.
  30520. *
  30521. * @static
  30522. * @memberOf _
  30523. * @since 2.0.0
  30524. * @category Object
  30525. * @param {Object} object The object to iterate over.
  30526. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30527. * @returns {Object} Returns `object`.
  30528. * @see _.forIn
  30529. * @example
  30530. *
  30531. * function Foo() {
  30532. * this.a = 1;
  30533. * this.b = 2;
  30534. * }
  30535. *
  30536. * Foo.prototype.c = 3;
  30537. *
  30538. * _.forInRight(new Foo, function(value, key) {
  30539. * console.log(key);
  30540. * });
  30541. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  30542. */
  30543. function forInRight(object, iteratee) {
  30544. return object == null
  30545. ? object
  30546. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  30547. }
  30548. /**
  30549. * Iterates over own enumerable string keyed properties of an object and
  30550. * invokes `iteratee` for each property. The iteratee is invoked with three
  30551. * arguments: (value, key, object). Iteratee functions may exit iteration
  30552. * early by explicitly returning `false`.
  30553. *
  30554. * @static
  30555. * @memberOf _
  30556. * @since 0.3.0
  30557. * @category Object
  30558. * @param {Object} object The object to iterate over.
  30559. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30560. * @returns {Object} Returns `object`.
  30561. * @see _.forOwnRight
  30562. * @example
  30563. *
  30564. * function Foo() {
  30565. * this.a = 1;
  30566. * this.b = 2;
  30567. * }
  30568. *
  30569. * Foo.prototype.c = 3;
  30570. *
  30571. * _.forOwn(new Foo, function(value, key) {
  30572. * console.log(key);
  30573. * });
  30574. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  30575. */
  30576. function forOwn(object, iteratee) {
  30577. return object && baseForOwn(object, getIteratee(iteratee, 3));
  30578. }
  30579. /**
  30580. * This method is like `_.forOwn` except that it iterates over properties of
  30581. * `object` in the opposite order.
  30582. *
  30583. * @static
  30584. * @memberOf _
  30585. * @since 2.0.0
  30586. * @category Object
  30587. * @param {Object} object The object to iterate over.
  30588. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30589. * @returns {Object} Returns `object`.
  30590. * @see _.forOwn
  30591. * @example
  30592. *
  30593. * function Foo() {
  30594. * this.a = 1;
  30595. * this.b = 2;
  30596. * }
  30597. *
  30598. * Foo.prototype.c = 3;
  30599. *
  30600. * _.forOwnRight(new Foo, function(value, key) {
  30601. * console.log(key);
  30602. * });
  30603. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  30604. */
  30605. function forOwnRight(object, iteratee) {
  30606. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  30607. }
  30608. /**
  30609. * Creates an array of function property names from own enumerable properties
  30610. * of `object`.
  30611. *
  30612. * @static
  30613. * @since 0.1.0
  30614. * @memberOf _
  30615. * @category Object
  30616. * @param {Object} object The object to inspect.
  30617. * @returns {Array} Returns the function names.
  30618. * @see _.functionsIn
  30619. * @example
  30620. *
  30621. * function Foo() {
  30622. * this.a = _.constant('a');
  30623. * this.b = _.constant('b');
  30624. * }
  30625. *
  30626. * Foo.prototype.c = _.constant('c');
  30627. *
  30628. * _.functions(new Foo);
  30629. * // => ['a', 'b']
  30630. */
  30631. function functions(object) {
  30632. return object == null ? [] : baseFunctions(object, keys(object));
  30633. }
  30634. /**
  30635. * Creates an array of function property names from own and inherited
  30636. * enumerable properties of `object`.
  30637. *
  30638. * @static
  30639. * @memberOf _
  30640. * @since 4.0.0
  30641. * @category Object
  30642. * @param {Object} object The object to inspect.
  30643. * @returns {Array} Returns the function names.
  30644. * @see _.functions
  30645. * @example
  30646. *
  30647. * function Foo() {
  30648. * this.a = _.constant('a');
  30649. * this.b = _.constant('b');
  30650. * }
  30651. *
  30652. * Foo.prototype.c = _.constant('c');
  30653. *
  30654. * _.functionsIn(new Foo);
  30655. * // => ['a', 'b', 'c']
  30656. */
  30657. function functionsIn(object) {
  30658. return object == null ? [] : baseFunctions(object, keysIn(object));
  30659. }
  30660. /**
  30661. * Gets the value at `path` of `object`. If the resolved value is
  30662. * `undefined`, the `defaultValue` is returned in its place.
  30663. *
  30664. * @static
  30665. * @memberOf _
  30666. * @since 3.7.0
  30667. * @category Object
  30668. * @param {Object} object The object to query.
  30669. * @param {Array|string} path The path of the property to get.
  30670. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30671. * @returns {*} Returns the resolved value.
  30672. * @example
  30673. *
  30674. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30675. *
  30676. * _.get(object, 'a[0].b.c');
  30677. * // => 3
  30678. *
  30679. * _.get(object, ['a', '0', 'b', 'c']);
  30680. * // => 3
  30681. *
  30682. * _.get(object, 'a.b.c', 'default');
  30683. * // => 'default'
  30684. */
  30685. function get(object, path, defaultValue) {
  30686. var result = object == null ? undefined : baseGet(object, path);
  30687. return result === undefined ? defaultValue : result;
  30688. }
  30689. /**
  30690. * Checks if `path` is a direct property of `object`.
  30691. *
  30692. * @static
  30693. * @since 0.1.0
  30694. * @memberOf _
  30695. * @category Object
  30696. * @param {Object} object The object to query.
  30697. * @param {Array|string} path The path to check.
  30698. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30699. * @example
  30700. *
  30701. * var object = { 'a': { 'b': 2 } };
  30702. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  30703. *
  30704. * _.has(object, 'a');
  30705. * // => true
  30706. *
  30707. * _.has(object, 'a.b');
  30708. * // => true
  30709. *
  30710. * _.has(object, ['a', 'b']);
  30711. * // => true
  30712. *
  30713. * _.has(other, 'a');
  30714. * // => false
  30715. */
  30716. function has(object, path) {
  30717. return object != null && hasPath(object, path, baseHas);
  30718. }
  30719. /**
  30720. * Checks if `path` is a direct or inherited property of `object`.
  30721. *
  30722. * @static
  30723. * @memberOf _
  30724. * @since 4.0.0
  30725. * @category Object
  30726. * @param {Object} object The object to query.
  30727. * @param {Array|string} path The path to check.
  30728. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30729. * @example
  30730. *
  30731. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  30732. *
  30733. * _.hasIn(object, 'a');
  30734. * // => true
  30735. *
  30736. * _.hasIn(object, 'a.b');
  30737. * // => true
  30738. *
  30739. * _.hasIn(object, ['a', 'b']);
  30740. * // => true
  30741. *
  30742. * _.hasIn(object, 'b');
  30743. * // => false
  30744. */
  30745. function hasIn(object, path) {
  30746. return object != null && hasPath(object, path, baseHasIn);
  30747. }
  30748. /**
  30749. * Creates an object composed of the inverted keys and values of `object`.
  30750. * If `object` contains duplicate values, subsequent values overwrite
  30751. * property assignments of previous values.
  30752. *
  30753. * @static
  30754. * @memberOf _
  30755. * @since 0.7.0
  30756. * @category Object
  30757. * @param {Object} object The object to invert.
  30758. * @returns {Object} Returns the new inverted object.
  30759. * @example
  30760. *
  30761. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30762. *
  30763. * _.invert(object);
  30764. * // => { '1': 'c', '2': 'b' }
  30765. */
  30766. var invert = createInverter(function(result, value, key) {
  30767. if (value != null &&
  30768. typeof value.toString != 'function') {
  30769. value = nativeObjectToString.call(value);
  30770. }
  30771. result[value] = key;
  30772. }, constant(identity));
  30773. /**
  30774. * This method is like `_.invert` except that the inverted object is generated
  30775. * from the results of running each element of `object` thru `iteratee`. The
  30776. * corresponding inverted value of each inverted key is an array of keys
  30777. * responsible for generating the inverted value. The iteratee is invoked
  30778. * with one argument: (value).
  30779. *
  30780. * @static
  30781. * @memberOf _
  30782. * @since 4.1.0
  30783. * @category Object
  30784. * @param {Object} object The object to invert.
  30785. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  30786. * @returns {Object} Returns the new inverted object.
  30787. * @example
  30788. *
  30789. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30790. *
  30791. * _.invertBy(object);
  30792. * // => { '1': ['a', 'c'], '2': ['b'] }
  30793. *
  30794. * _.invertBy(object, function(value) {
  30795. * return 'group' + value;
  30796. * });
  30797. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  30798. */
  30799. var invertBy = createInverter(function(result, value, key) {
  30800. if (value != null &&
  30801. typeof value.toString != 'function') {
  30802. value = nativeObjectToString.call(value);
  30803. }
  30804. if (hasOwnProperty.call(result, value)) {
  30805. result[value].push(key);
  30806. } else {
  30807. result[value] = [key];
  30808. }
  30809. }, getIteratee);
  30810. /**
  30811. * Invokes the method at `path` of `object`.
  30812. *
  30813. * @static
  30814. * @memberOf _
  30815. * @since 4.0.0
  30816. * @category Object
  30817. * @param {Object} object The object to query.
  30818. * @param {Array|string} path The path of the method to invoke.
  30819. * @param {...*} [args] The arguments to invoke the method with.
  30820. * @returns {*} Returns the result of the invoked method.
  30821. * @example
  30822. *
  30823. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  30824. *
  30825. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  30826. * // => [2, 3]
  30827. */
  30828. var invoke = baseRest(baseInvoke);
  30829. /**
  30830. * Creates an array of the own enumerable property names of `object`.
  30831. *
  30832. * **Note:** Non-object values are coerced to objects. See the
  30833. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  30834. * for more details.
  30835. *
  30836. * @static
  30837. * @since 0.1.0
  30838. * @memberOf _
  30839. * @category Object
  30840. * @param {Object} object The object to query.
  30841. * @returns {Array} Returns the array of property names.
  30842. * @example
  30843. *
  30844. * function Foo() {
  30845. * this.a = 1;
  30846. * this.b = 2;
  30847. * }
  30848. *
  30849. * Foo.prototype.c = 3;
  30850. *
  30851. * _.keys(new Foo);
  30852. * // => ['a', 'b'] (iteration order is not guaranteed)
  30853. *
  30854. * _.keys('hi');
  30855. * // => ['0', '1']
  30856. */
  30857. function keys(object) {
  30858. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  30859. }
  30860. /**
  30861. * Creates an array of the own and inherited enumerable property names of `object`.
  30862. *
  30863. * **Note:** Non-object values are coerced to objects.
  30864. *
  30865. * @static
  30866. * @memberOf _
  30867. * @since 3.0.0
  30868. * @category Object
  30869. * @param {Object} object The object to query.
  30870. * @returns {Array} Returns the array of property names.
  30871. * @example
  30872. *
  30873. * function Foo() {
  30874. * this.a = 1;
  30875. * this.b = 2;
  30876. * }
  30877. *
  30878. * Foo.prototype.c = 3;
  30879. *
  30880. * _.keysIn(new Foo);
  30881. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  30882. */
  30883. function keysIn(object) {
  30884. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  30885. }
  30886. /**
  30887. * The opposite of `_.mapValues`; this method creates an object with the
  30888. * same values as `object` and keys generated by running each own enumerable
  30889. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  30890. * with three arguments: (value, key, object).
  30891. *
  30892. * @static
  30893. * @memberOf _
  30894. * @since 3.8.0
  30895. * @category Object
  30896. * @param {Object} object The object to iterate over.
  30897. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30898. * @returns {Object} Returns the new mapped object.
  30899. * @see _.mapValues
  30900. * @example
  30901. *
  30902. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  30903. * return key + value;
  30904. * });
  30905. * // => { 'a1': 1, 'b2': 2 }
  30906. */
  30907. function mapKeys(object, iteratee) {
  30908. var result = {};
  30909. iteratee = getIteratee(iteratee, 3);
  30910. baseForOwn(object, function(value, key, object) {
  30911. baseAssignValue(result, iteratee(value, key, object), value);
  30912. });
  30913. return result;
  30914. }
  30915. /**
  30916. * Creates an object with the same keys as `object` and values generated
  30917. * by running each own enumerable string keyed property of `object` thru
  30918. * `iteratee`. The iteratee is invoked with three arguments:
  30919. * (value, key, object).
  30920. *
  30921. * @static
  30922. * @memberOf _
  30923. * @since 2.4.0
  30924. * @category Object
  30925. * @param {Object} object The object to iterate over.
  30926. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30927. * @returns {Object} Returns the new mapped object.
  30928. * @see _.mapKeys
  30929. * @example
  30930. *
  30931. * var users = {
  30932. * 'fred': { 'user': 'fred', 'age': 40 },
  30933. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  30934. * };
  30935. *
  30936. * _.mapValues(users, function(o) { return o.age; });
  30937. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30938. *
  30939. * // The `_.property` iteratee shorthand.
  30940. * _.mapValues(users, 'age');
  30941. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30942. */
  30943. function mapValues(object, iteratee) {
  30944. var result = {};
  30945. iteratee = getIteratee(iteratee, 3);
  30946. baseForOwn(object, function(value, key, object) {
  30947. baseAssignValue(result, key, iteratee(value, key, object));
  30948. });
  30949. return result;
  30950. }
  30951. /**
  30952. * This method is like `_.assign` except that it recursively merges own and
  30953. * inherited enumerable string keyed properties of source objects into the
  30954. * destination object. Source properties that resolve to `undefined` are
  30955. * skipped if a destination value exists. Array and plain object properties
  30956. * are merged recursively. Other objects and value types are overridden by
  30957. * assignment. Source objects are applied from left to right. Subsequent
  30958. * sources overwrite property assignments of previous sources.
  30959. *
  30960. * **Note:** This method mutates `object`.
  30961. *
  30962. * @static
  30963. * @memberOf _
  30964. * @since 0.5.0
  30965. * @category Object
  30966. * @param {Object} object The destination object.
  30967. * @param {...Object} [sources] The source objects.
  30968. * @returns {Object} Returns `object`.
  30969. * @example
  30970. *
  30971. * var object = {
  30972. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  30973. * };
  30974. *
  30975. * var other = {
  30976. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  30977. * };
  30978. *
  30979. * _.merge(object, other);
  30980. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  30981. */
  30982. var merge = createAssigner(function(object, source, srcIndex) {
  30983. baseMerge(object, source, srcIndex);
  30984. });
  30985. /**
  30986. * This method is like `_.merge` except that it accepts `customizer` which
  30987. * is invoked to produce the merged values of the destination and source
  30988. * properties. If `customizer` returns `undefined`, merging is handled by the
  30989. * method instead. The `customizer` is invoked with six arguments:
  30990. * (objValue, srcValue, key, object, source, stack).
  30991. *
  30992. * **Note:** This method mutates `object`.
  30993. *
  30994. * @static
  30995. * @memberOf _
  30996. * @since 4.0.0
  30997. * @category Object
  30998. * @param {Object} object The destination object.
  30999. * @param {...Object} sources The source objects.
  31000. * @param {Function} customizer The function to customize assigned values.
  31001. * @returns {Object} Returns `object`.
  31002. * @example
  31003. *
  31004. * function customizer(objValue, srcValue) {
  31005. * if (_.isArray(objValue)) {
  31006. * return objValue.concat(srcValue);
  31007. * }
  31008. * }
  31009. *
  31010. * var object = { 'a': [1], 'b': [2] };
  31011. * var other = { 'a': [3], 'b': [4] };
  31012. *
  31013. * _.mergeWith(object, other, customizer);
  31014. * // => { 'a': [1, 3], 'b': [2, 4] }
  31015. */
  31016. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  31017. baseMerge(object, source, srcIndex, customizer);
  31018. });
  31019. /**
  31020. * The opposite of `_.pick`; this method creates an object composed of the
  31021. * own and inherited enumerable property paths of `object` that are not omitted.
  31022. *
  31023. * **Note:** This method is considerably slower than `_.pick`.
  31024. *
  31025. * @static
  31026. * @since 0.1.0
  31027. * @memberOf _
  31028. * @category Object
  31029. * @param {Object} object The source object.
  31030. * @param {...(string|string[])} [paths] The property paths to omit.
  31031. * @returns {Object} Returns the new object.
  31032. * @example
  31033. *
  31034. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31035. *
  31036. * _.omit(object, ['a', 'c']);
  31037. * // => { 'b': '2' }
  31038. */
  31039. var omit = flatRest(function(object, paths) {
  31040. var result = {};
  31041. if (object == null) {
  31042. return result;
  31043. }
  31044. var isDeep = false;
  31045. paths = arrayMap(paths, function(path) {
  31046. path = castPath(path, object);
  31047. isDeep || (isDeep = path.length > 1);
  31048. return path;
  31049. });
  31050. copyObject(object, getAllKeysIn(object), result);
  31051. if (isDeep) {
  31052. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  31053. }
  31054. var length = paths.length;
  31055. while (length--) {
  31056. baseUnset(result, paths[length]);
  31057. }
  31058. return result;
  31059. });
  31060. /**
  31061. * The opposite of `_.pickBy`; this method creates an object composed of
  31062. * the own and inherited enumerable string keyed properties of `object` that
  31063. * `predicate` doesn't return truthy for. The predicate is invoked with two
  31064. * arguments: (value, key).
  31065. *
  31066. * @static
  31067. * @memberOf _
  31068. * @since 4.0.0
  31069. * @category Object
  31070. * @param {Object} object The source object.
  31071. * @param {Function} [predicate=_.identity] The function invoked per property.
  31072. * @returns {Object} Returns the new object.
  31073. * @example
  31074. *
  31075. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31076. *
  31077. * _.omitBy(object, _.isNumber);
  31078. * // => { 'b': '2' }
  31079. */
  31080. function omitBy(object, predicate) {
  31081. return pickBy(object, negate(getIteratee(predicate)));
  31082. }
  31083. /**
  31084. * Creates an object composed of the picked `object` properties.
  31085. *
  31086. * @static
  31087. * @since 0.1.0
  31088. * @memberOf _
  31089. * @category Object
  31090. * @param {Object} object The source object.
  31091. * @param {...(string|string[])} [paths] The property paths to pick.
  31092. * @returns {Object} Returns the new object.
  31093. * @example
  31094. *
  31095. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31096. *
  31097. * _.pick(object, ['a', 'c']);
  31098. * // => { 'a': 1, 'c': 3 }
  31099. */
  31100. var pick = flatRest(function(object, paths) {
  31101. return object == null ? {} : basePick(object, paths);
  31102. });
  31103. /**
  31104. * Creates an object composed of the `object` properties `predicate` returns
  31105. * truthy for. The predicate is invoked with two arguments: (value, key).
  31106. *
  31107. * @static
  31108. * @memberOf _
  31109. * @since 4.0.0
  31110. * @category Object
  31111. * @param {Object} object The source object.
  31112. * @param {Function} [predicate=_.identity] The function invoked per property.
  31113. * @returns {Object} Returns the new object.
  31114. * @example
  31115. *
  31116. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31117. *
  31118. * _.pickBy(object, _.isNumber);
  31119. * // => { 'a': 1, 'c': 3 }
  31120. */
  31121. function pickBy(object, predicate) {
  31122. if (object == null) {
  31123. return {};
  31124. }
  31125. var props = arrayMap(getAllKeysIn(object), function(prop) {
  31126. return [prop];
  31127. });
  31128. predicate = getIteratee(predicate);
  31129. return basePickBy(object, props, function(value, path) {
  31130. return predicate(value, path[0]);
  31131. });
  31132. }
  31133. /**
  31134. * This method is like `_.get` except that if the resolved value is a
  31135. * function it's invoked with the `this` binding of its parent object and
  31136. * its result is returned.
  31137. *
  31138. * @static
  31139. * @since 0.1.0
  31140. * @memberOf _
  31141. * @category Object
  31142. * @param {Object} object The object to query.
  31143. * @param {Array|string} path The path of the property to resolve.
  31144. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  31145. * @returns {*} Returns the resolved value.
  31146. * @example
  31147. *
  31148. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  31149. *
  31150. * _.result(object, 'a[0].b.c1');
  31151. * // => 3
  31152. *
  31153. * _.result(object, 'a[0].b.c2');
  31154. * // => 4
  31155. *
  31156. * _.result(object, 'a[0].b.c3', 'default');
  31157. * // => 'default'
  31158. *
  31159. * _.result(object, 'a[0].b.c3', _.constant('default'));
  31160. * // => 'default'
  31161. */
  31162. function result(object, path, defaultValue) {
  31163. path = castPath(path, object);
  31164. var index = -1,
  31165. length = path.length;
  31166. // Ensure the loop is entered when path is empty.
  31167. if (!length) {
  31168. length = 1;
  31169. object = undefined;
  31170. }
  31171. while (++index < length) {
  31172. var value = object == null ? undefined : object[toKey(path[index])];
  31173. if (value === undefined) {
  31174. index = length;
  31175. value = defaultValue;
  31176. }
  31177. object = isFunction(value) ? value.call(object) : value;
  31178. }
  31179. return object;
  31180. }
  31181. /**
  31182. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  31183. * it's created. Arrays are created for missing index properties while objects
  31184. * are created for all other missing properties. Use `_.setWith` to customize
  31185. * `path` creation.
  31186. *
  31187. * **Note:** This method mutates `object`.
  31188. *
  31189. * @static
  31190. * @memberOf _
  31191. * @since 3.7.0
  31192. * @category Object
  31193. * @param {Object} object The object to modify.
  31194. * @param {Array|string} path The path of the property to set.
  31195. * @param {*} value The value to set.
  31196. * @returns {Object} Returns `object`.
  31197. * @example
  31198. *
  31199. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31200. *
  31201. * _.set(object, 'a[0].b.c', 4);
  31202. * console.log(object.a[0].b.c);
  31203. * // => 4
  31204. *
  31205. * _.set(object, ['x', '0', 'y', 'z'], 5);
  31206. * console.log(object.x[0].y.z);
  31207. * // => 5
  31208. */
  31209. function set(object, path, value) {
  31210. return object == null ? object : baseSet(object, path, value);
  31211. }
  31212. /**
  31213. * This method is like `_.set` except that it accepts `customizer` which is
  31214. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31215. * path creation is handled by the method instead. The `customizer` is invoked
  31216. * with three arguments: (nsValue, key, nsObject).
  31217. *
  31218. * **Note:** This method mutates `object`.
  31219. *
  31220. * @static
  31221. * @memberOf _
  31222. * @since 4.0.0
  31223. * @category Object
  31224. * @param {Object} object The object to modify.
  31225. * @param {Array|string} path The path of the property to set.
  31226. * @param {*} value The value to set.
  31227. * @param {Function} [customizer] The function to customize assigned values.
  31228. * @returns {Object} Returns `object`.
  31229. * @example
  31230. *
  31231. * var object = {};
  31232. *
  31233. * _.setWith(object, '[0][1]', 'a', Object);
  31234. * // => { '0': { '1': 'a' } }
  31235. */
  31236. function setWith(object, path, value, customizer) {
  31237. customizer = typeof customizer == 'function' ? customizer : undefined;
  31238. return object == null ? object : baseSet(object, path, value, customizer);
  31239. }
  31240. /**
  31241. * Creates an array of own enumerable string keyed-value pairs for `object`
  31242. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  31243. * entries are returned.
  31244. *
  31245. * @static
  31246. * @memberOf _
  31247. * @since 4.0.0
  31248. * @alias entries
  31249. * @category Object
  31250. * @param {Object} object The object to query.
  31251. * @returns {Array} Returns the key-value pairs.
  31252. * @example
  31253. *
  31254. * function Foo() {
  31255. * this.a = 1;
  31256. * this.b = 2;
  31257. * }
  31258. *
  31259. * Foo.prototype.c = 3;
  31260. *
  31261. * _.toPairs(new Foo);
  31262. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  31263. */
  31264. var toPairs = createToPairs(keys);
  31265. /**
  31266. * Creates an array of own and inherited enumerable string keyed-value pairs
  31267. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  31268. * or set, its entries are returned.
  31269. *
  31270. * @static
  31271. * @memberOf _
  31272. * @since 4.0.0
  31273. * @alias entriesIn
  31274. * @category Object
  31275. * @param {Object} object The object to query.
  31276. * @returns {Array} Returns the key-value pairs.
  31277. * @example
  31278. *
  31279. * function Foo() {
  31280. * this.a = 1;
  31281. * this.b = 2;
  31282. * }
  31283. *
  31284. * Foo.prototype.c = 3;
  31285. *
  31286. * _.toPairsIn(new Foo);
  31287. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  31288. */
  31289. var toPairsIn = createToPairs(keysIn);
  31290. /**
  31291. * An alternative to `_.reduce`; this method transforms `object` to a new
  31292. * `accumulator` object which is the result of running each of its own
  31293. * enumerable string keyed properties thru `iteratee`, with each invocation
  31294. * potentially mutating the `accumulator` object. If `accumulator` is not
  31295. * provided, a new object with the same `[[Prototype]]` will be used. The
  31296. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  31297. * Iteratee functions may exit iteration early by explicitly returning `false`.
  31298. *
  31299. * @static
  31300. * @memberOf _
  31301. * @since 1.3.0
  31302. * @category Object
  31303. * @param {Object} object The object to iterate over.
  31304. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31305. * @param {*} [accumulator] The custom accumulator value.
  31306. * @returns {*} Returns the accumulated value.
  31307. * @example
  31308. *
  31309. * _.transform([2, 3, 4], function(result, n) {
  31310. * result.push(n *= n);
  31311. * return n % 2 == 0;
  31312. * }, []);
  31313. * // => [4, 9]
  31314. *
  31315. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  31316. * (result[value] || (result[value] = [])).push(key);
  31317. * }, {});
  31318. * // => { '1': ['a', 'c'], '2': ['b'] }
  31319. */
  31320. function transform(object, iteratee, accumulator) {
  31321. var isArr = isArray(object),
  31322. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  31323. iteratee = getIteratee(iteratee, 4);
  31324. if (accumulator == null) {
  31325. var Ctor = object && object.constructor;
  31326. if (isArrLike) {
  31327. accumulator = isArr ? new Ctor : [];
  31328. }
  31329. else if (isObject(object)) {
  31330. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  31331. }
  31332. else {
  31333. accumulator = {};
  31334. }
  31335. }
  31336. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  31337. return iteratee(accumulator, value, index, object);
  31338. });
  31339. return accumulator;
  31340. }
  31341. /**
  31342. * Removes the property at `path` of `object`.
  31343. *
  31344. * **Note:** This method mutates `object`.
  31345. *
  31346. * @static
  31347. * @memberOf _
  31348. * @since 4.0.0
  31349. * @category Object
  31350. * @param {Object} object The object to modify.
  31351. * @param {Array|string} path The path of the property to unset.
  31352. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  31353. * @example
  31354. *
  31355. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  31356. * _.unset(object, 'a[0].b.c');
  31357. * // => true
  31358. *
  31359. * console.log(object);
  31360. * // => { 'a': [{ 'b': {} }] };
  31361. *
  31362. * _.unset(object, ['a', '0', 'b', 'c']);
  31363. * // => true
  31364. *
  31365. * console.log(object);
  31366. * // => { 'a': [{ 'b': {} }] };
  31367. */
  31368. function unset(object, path) {
  31369. return object == null ? true : baseUnset(object, path);
  31370. }
  31371. /**
  31372. * This method is like `_.set` except that accepts `updater` to produce the
  31373. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  31374. * is invoked with one argument: (value).
  31375. *
  31376. * **Note:** This method mutates `object`.
  31377. *
  31378. * @static
  31379. * @memberOf _
  31380. * @since 4.6.0
  31381. * @category Object
  31382. * @param {Object} object The object to modify.
  31383. * @param {Array|string} path The path of the property to set.
  31384. * @param {Function} updater The function to produce the updated value.
  31385. * @returns {Object} Returns `object`.
  31386. * @example
  31387. *
  31388. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31389. *
  31390. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  31391. * console.log(object.a[0].b.c);
  31392. * // => 9
  31393. *
  31394. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  31395. * console.log(object.x[0].y.z);
  31396. * // => 0
  31397. */
  31398. function update(object, path, updater) {
  31399. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  31400. }
  31401. /**
  31402. * This method is like `_.update` except that it accepts `customizer` which is
  31403. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31404. * path creation is handled by the method instead. The `customizer` is invoked
  31405. * with three arguments: (nsValue, key, nsObject).
  31406. *
  31407. * **Note:** This method mutates `object`.
  31408. *
  31409. * @static
  31410. * @memberOf _
  31411. * @since 4.6.0
  31412. * @category Object
  31413. * @param {Object} object The object to modify.
  31414. * @param {Array|string} path The path of the property to set.
  31415. * @param {Function} updater The function to produce the updated value.
  31416. * @param {Function} [customizer] The function to customize assigned values.
  31417. * @returns {Object} Returns `object`.
  31418. * @example
  31419. *
  31420. * var object = {};
  31421. *
  31422. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  31423. * // => { '0': { '1': 'a' } }
  31424. */
  31425. function updateWith(object, path, updater, customizer) {
  31426. customizer = typeof customizer == 'function' ? customizer : undefined;
  31427. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  31428. }
  31429. /**
  31430. * Creates an array of the own enumerable string keyed property values of `object`.
  31431. *
  31432. * **Note:** Non-object values are coerced to objects.
  31433. *
  31434. * @static
  31435. * @since 0.1.0
  31436. * @memberOf _
  31437. * @category Object
  31438. * @param {Object} object The object to query.
  31439. * @returns {Array} Returns the array of property values.
  31440. * @example
  31441. *
  31442. * function Foo() {
  31443. * this.a = 1;
  31444. * this.b = 2;
  31445. * }
  31446. *
  31447. * Foo.prototype.c = 3;
  31448. *
  31449. * _.values(new Foo);
  31450. * // => [1, 2] (iteration order is not guaranteed)
  31451. *
  31452. * _.values('hi');
  31453. * // => ['h', 'i']
  31454. */
  31455. function values(object) {
  31456. return object == null ? [] : baseValues(object, keys(object));
  31457. }
  31458. /**
  31459. * Creates an array of the own and inherited enumerable string keyed property
  31460. * values of `object`.
  31461. *
  31462. * **Note:** Non-object values are coerced to objects.
  31463. *
  31464. * @static
  31465. * @memberOf _
  31466. * @since 3.0.0
  31467. * @category Object
  31468. * @param {Object} object The object to query.
  31469. * @returns {Array} Returns the array of property values.
  31470. * @example
  31471. *
  31472. * function Foo() {
  31473. * this.a = 1;
  31474. * this.b = 2;
  31475. * }
  31476. *
  31477. * Foo.prototype.c = 3;
  31478. *
  31479. * _.valuesIn(new Foo);
  31480. * // => [1, 2, 3] (iteration order is not guaranteed)
  31481. */
  31482. function valuesIn(object) {
  31483. return object == null ? [] : baseValues(object, keysIn(object));
  31484. }
  31485. /*------------------------------------------------------------------------*/
  31486. /**
  31487. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  31488. *
  31489. * @static
  31490. * @memberOf _
  31491. * @since 4.0.0
  31492. * @category Number
  31493. * @param {number} number The number to clamp.
  31494. * @param {number} [lower] The lower bound.
  31495. * @param {number} upper The upper bound.
  31496. * @returns {number} Returns the clamped number.
  31497. * @example
  31498. *
  31499. * _.clamp(-10, -5, 5);
  31500. * // => -5
  31501. *
  31502. * _.clamp(10, -5, 5);
  31503. * // => 5
  31504. */
  31505. function clamp(number, lower, upper) {
  31506. if (upper === undefined) {
  31507. upper = lower;
  31508. lower = undefined;
  31509. }
  31510. if (upper !== undefined) {
  31511. upper = toNumber(upper);
  31512. upper = upper === upper ? upper : 0;
  31513. }
  31514. if (lower !== undefined) {
  31515. lower = toNumber(lower);
  31516. lower = lower === lower ? lower : 0;
  31517. }
  31518. return baseClamp(toNumber(number), lower, upper);
  31519. }
  31520. /**
  31521. * Checks if `n` is between `start` and up to, but not including, `end`. If
  31522. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  31523. * If `start` is greater than `end` the params are swapped to support
  31524. * negative ranges.
  31525. *
  31526. * @static
  31527. * @memberOf _
  31528. * @since 3.3.0
  31529. * @category Number
  31530. * @param {number} number The number to check.
  31531. * @param {number} [start=0] The start of the range.
  31532. * @param {number} end The end of the range.
  31533. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  31534. * @see _.range, _.rangeRight
  31535. * @example
  31536. *
  31537. * _.inRange(3, 2, 4);
  31538. * // => true
  31539. *
  31540. * _.inRange(4, 8);
  31541. * // => true
  31542. *
  31543. * _.inRange(4, 2);
  31544. * // => false
  31545. *
  31546. * _.inRange(2, 2);
  31547. * // => false
  31548. *
  31549. * _.inRange(1.2, 2);
  31550. * // => true
  31551. *
  31552. * _.inRange(5.2, 4);
  31553. * // => false
  31554. *
  31555. * _.inRange(-3, -2, -6);
  31556. * // => true
  31557. */
  31558. function inRange(number, start, end) {
  31559. start = toFinite(start);
  31560. if (end === undefined) {
  31561. end = start;
  31562. start = 0;
  31563. } else {
  31564. end = toFinite(end);
  31565. }
  31566. number = toNumber(number);
  31567. return baseInRange(number, start, end);
  31568. }
  31569. /**
  31570. * Produces a random number between the inclusive `lower` and `upper` bounds.
  31571. * If only one argument is provided a number between `0` and the given number
  31572. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  31573. * floats, a floating-point number is returned instead of an integer.
  31574. *
  31575. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  31576. * floating-point values which can produce unexpected results.
  31577. *
  31578. * @static
  31579. * @memberOf _
  31580. * @since 0.7.0
  31581. * @category Number
  31582. * @param {number} [lower=0] The lower bound.
  31583. * @param {number} [upper=1] The upper bound.
  31584. * @param {boolean} [floating] Specify returning a floating-point number.
  31585. * @returns {number} Returns the random number.
  31586. * @example
  31587. *
  31588. * _.random(0, 5);
  31589. * // => an integer between 0 and 5
  31590. *
  31591. * _.random(5);
  31592. * // => also an integer between 0 and 5
  31593. *
  31594. * _.random(5, true);
  31595. * // => a floating-point number between 0 and 5
  31596. *
  31597. * _.random(1.2, 5.2);
  31598. * // => a floating-point number between 1.2 and 5.2
  31599. */
  31600. function random(lower, upper, floating) {
  31601. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  31602. upper = floating = undefined;
  31603. }
  31604. if (floating === undefined) {
  31605. if (typeof upper == 'boolean') {
  31606. floating = upper;
  31607. upper = undefined;
  31608. }
  31609. else if (typeof lower == 'boolean') {
  31610. floating = lower;
  31611. lower = undefined;
  31612. }
  31613. }
  31614. if (lower === undefined && upper === undefined) {
  31615. lower = 0;
  31616. upper = 1;
  31617. }
  31618. else {
  31619. lower = toFinite(lower);
  31620. if (upper === undefined) {
  31621. upper = lower;
  31622. lower = 0;
  31623. } else {
  31624. upper = toFinite(upper);
  31625. }
  31626. }
  31627. if (lower > upper) {
  31628. var temp = lower;
  31629. lower = upper;
  31630. upper = temp;
  31631. }
  31632. if (floating || lower % 1 || upper % 1) {
  31633. var rand = nativeRandom();
  31634. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  31635. }
  31636. return baseRandom(lower, upper);
  31637. }
  31638. /*------------------------------------------------------------------------*/
  31639. /**
  31640. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  31641. *
  31642. * @static
  31643. * @memberOf _
  31644. * @since 3.0.0
  31645. * @category String
  31646. * @param {string} [string=''] The string to convert.
  31647. * @returns {string} Returns the camel cased string.
  31648. * @example
  31649. *
  31650. * _.camelCase('Foo Bar');
  31651. * // => 'fooBar'
  31652. *
  31653. * _.camelCase('--foo-bar--');
  31654. * // => 'fooBar'
  31655. *
  31656. * _.camelCase('__FOO_BAR__');
  31657. * // => 'fooBar'
  31658. */
  31659. var camelCase = createCompounder(function(result, word, index) {
  31660. word = word.toLowerCase();
  31661. return result + (index ? capitalize(word) : word);
  31662. });
  31663. /**
  31664. * Converts the first character of `string` to upper case and the remaining
  31665. * to lower case.
  31666. *
  31667. * @static
  31668. * @memberOf _
  31669. * @since 3.0.0
  31670. * @category String
  31671. * @param {string} [string=''] The string to capitalize.
  31672. * @returns {string} Returns the capitalized string.
  31673. * @example
  31674. *
  31675. * _.capitalize('FRED');
  31676. * // => 'Fred'
  31677. */
  31678. function capitalize(string) {
  31679. return upperFirst(toString(string).toLowerCase());
  31680. }
  31681. /**
  31682. * Deburrs `string` by converting
  31683. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  31684. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  31685. * letters to basic Latin letters and removing
  31686. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  31687. *
  31688. * @static
  31689. * @memberOf _
  31690. * @since 3.0.0
  31691. * @category String
  31692. * @param {string} [string=''] The string to deburr.
  31693. * @returns {string} Returns the deburred string.
  31694. * @example
  31695. *
  31696. * _.deburr('déjà vu');
  31697. * // => 'deja vu'
  31698. */
  31699. function deburr(string) {
  31700. string = toString(string);
  31701. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  31702. }
  31703. /**
  31704. * Checks if `string` ends with the given target string.
  31705. *
  31706. * @static
  31707. * @memberOf _
  31708. * @since 3.0.0
  31709. * @category String
  31710. * @param {string} [string=''] The string to inspect.
  31711. * @param {string} [target] The string to search for.
  31712. * @param {number} [position=string.length] The position to search up to.
  31713. * @returns {boolean} Returns `true` if `string` ends with `target`,
  31714. * else `false`.
  31715. * @example
  31716. *
  31717. * _.endsWith('abc', 'c');
  31718. * // => true
  31719. *
  31720. * _.endsWith('abc', 'b');
  31721. * // => false
  31722. *
  31723. * _.endsWith('abc', 'b', 2);
  31724. * // => true
  31725. */
  31726. function endsWith(string, target, position) {
  31727. string = toString(string);
  31728. target = baseToString(target);
  31729. var length = string.length;
  31730. position = position === undefined
  31731. ? length
  31732. : baseClamp(toInteger(position), 0, length);
  31733. var end = position;
  31734. position -= target.length;
  31735. return position >= 0 && string.slice(position, end) == target;
  31736. }
  31737. /**
  31738. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  31739. * corresponding HTML entities.
  31740. *
  31741. * **Note:** No other characters are escaped. To escape additional
  31742. * characters use a third-party library like [_he_](https://mths.be/he).
  31743. *
  31744. * Though the ">" character is escaped for symmetry, characters like
  31745. * ">" and "/" don't need escaping in HTML and have no special meaning
  31746. * unless they're part of a tag or unquoted attribute value. See
  31747. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  31748. * (under "semi-related fun fact") for more details.
  31749. *
  31750. * When working with HTML you should always
  31751. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  31752. * XSS vectors.
  31753. *
  31754. * @static
  31755. * @since 0.1.0
  31756. * @memberOf _
  31757. * @category String
  31758. * @param {string} [string=''] The string to escape.
  31759. * @returns {string} Returns the escaped string.
  31760. * @example
  31761. *
  31762. * _.escape('fred, barney, & pebbles');
  31763. * // => 'fred, barney, &amp; pebbles'
  31764. */
  31765. function escape(string) {
  31766. string = toString(string);
  31767. return (string && reHasUnescapedHtml.test(string))
  31768. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  31769. : string;
  31770. }
  31771. /**
  31772. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  31773. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  31774. *
  31775. * @static
  31776. * @memberOf _
  31777. * @since 3.0.0
  31778. * @category String
  31779. * @param {string} [string=''] The string to escape.
  31780. * @returns {string} Returns the escaped string.
  31781. * @example
  31782. *
  31783. * _.escapeRegExp('[lodash](https://lodash.com/)');
  31784. * // => '\[lodash\]\(https://lodash\.com/\)'
  31785. */
  31786. function escapeRegExp(string) {
  31787. string = toString(string);
  31788. return (string && reHasRegExpChar.test(string))
  31789. ? string.replace(reRegExpChar, '\\$&')
  31790. : string;
  31791. }
  31792. /**
  31793. * Converts `string` to
  31794. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  31795. *
  31796. * @static
  31797. * @memberOf _
  31798. * @since 3.0.0
  31799. * @category String
  31800. * @param {string} [string=''] The string to convert.
  31801. * @returns {string} Returns the kebab cased string.
  31802. * @example
  31803. *
  31804. * _.kebabCase('Foo Bar');
  31805. * // => 'foo-bar'
  31806. *
  31807. * _.kebabCase('fooBar');
  31808. * // => 'foo-bar'
  31809. *
  31810. * _.kebabCase('__FOO_BAR__');
  31811. * // => 'foo-bar'
  31812. */
  31813. var kebabCase = createCompounder(function(result, word, index) {
  31814. return result + (index ? '-' : '') + word.toLowerCase();
  31815. });
  31816. /**
  31817. * Converts `string`, as space separated words, to lower case.
  31818. *
  31819. * @static
  31820. * @memberOf _
  31821. * @since 4.0.0
  31822. * @category String
  31823. * @param {string} [string=''] The string to convert.
  31824. * @returns {string} Returns the lower cased string.
  31825. * @example
  31826. *
  31827. * _.lowerCase('--Foo-Bar--');
  31828. * // => 'foo bar'
  31829. *
  31830. * _.lowerCase('fooBar');
  31831. * // => 'foo bar'
  31832. *
  31833. * _.lowerCase('__FOO_BAR__');
  31834. * // => 'foo bar'
  31835. */
  31836. var lowerCase = createCompounder(function(result, word, index) {
  31837. return result + (index ? ' ' : '') + word.toLowerCase();
  31838. });
  31839. /**
  31840. * Converts the first character of `string` to lower case.
  31841. *
  31842. * @static
  31843. * @memberOf _
  31844. * @since 4.0.0
  31845. * @category String
  31846. * @param {string} [string=''] The string to convert.
  31847. * @returns {string} Returns the converted string.
  31848. * @example
  31849. *
  31850. * _.lowerFirst('Fred');
  31851. * // => 'fred'
  31852. *
  31853. * _.lowerFirst('FRED');
  31854. * // => 'fRED'
  31855. */
  31856. var lowerFirst = createCaseFirst('toLowerCase');
  31857. /**
  31858. * Pads `string` on the left and right sides if it's shorter than `length`.
  31859. * Padding characters are truncated if they can't be evenly divided by `length`.
  31860. *
  31861. * @static
  31862. * @memberOf _
  31863. * @since 3.0.0
  31864. * @category String
  31865. * @param {string} [string=''] The string to pad.
  31866. * @param {number} [length=0] The padding length.
  31867. * @param {string} [chars=' '] The string used as padding.
  31868. * @returns {string} Returns the padded string.
  31869. * @example
  31870. *
  31871. * _.pad('abc', 8);
  31872. * // => ' abc '
  31873. *
  31874. * _.pad('abc', 8, '_-');
  31875. * // => '_-abc_-_'
  31876. *
  31877. * _.pad('abc', 3);
  31878. * // => 'abc'
  31879. */
  31880. function pad(string, length, chars) {
  31881. string = toString(string);
  31882. length = toInteger(length);
  31883. var strLength = length ? stringSize(string) : 0;
  31884. if (!length || strLength >= length) {
  31885. return string;
  31886. }
  31887. var mid = (length - strLength) / 2;
  31888. return (
  31889. createPadding(nativeFloor(mid), chars) +
  31890. string +
  31891. createPadding(nativeCeil(mid), chars)
  31892. );
  31893. }
  31894. /**
  31895. * Pads `string` on the right side if it's shorter than `length`. Padding
  31896. * characters are truncated if they exceed `length`.
  31897. *
  31898. * @static
  31899. * @memberOf _
  31900. * @since 4.0.0
  31901. * @category String
  31902. * @param {string} [string=''] The string to pad.
  31903. * @param {number} [length=0] The padding length.
  31904. * @param {string} [chars=' '] The string used as padding.
  31905. * @returns {string} Returns the padded string.
  31906. * @example
  31907. *
  31908. * _.padEnd('abc', 6);
  31909. * // => 'abc '
  31910. *
  31911. * _.padEnd('abc', 6, '_-');
  31912. * // => 'abc_-_'
  31913. *
  31914. * _.padEnd('abc', 3);
  31915. * // => 'abc'
  31916. */
  31917. function padEnd(string, length, chars) {
  31918. string = toString(string);
  31919. length = toInteger(length);
  31920. var strLength = length ? stringSize(string) : 0;
  31921. return (length && strLength < length)
  31922. ? (string + createPadding(length - strLength, chars))
  31923. : string;
  31924. }
  31925. /**
  31926. * Pads `string` on the left side if it's shorter than `length`. Padding
  31927. * characters are truncated if they exceed `length`.
  31928. *
  31929. * @static
  31930. * @memberOf _
  31931. * @since 4.0.0
  31932. * @category String
  31933. * @param {string} [string=''] The string to pad.
  31934. * @param {number} [length=0] The padding length.
  31935. * @param {string} [chars=' '] The string used as padding.
  31936. * @returns {string} Returns the padded string.
  31937. * @example
  31938. *
  31939. * _.padStart('abc', 6);
  31940. * // => ' abc'
  31941. *
  31942. * _.padStart('abc', 6, '_-');
  31943. * // => '_-_abc'
  31944. *
  31945. * _.padStart('abc', 3);
  31946. * // => 'abc'
  31947. */
  31948. function padStart(string, length, chars) {
  31949. string = toString(string);
  31950. length = toInteger(length);
  31951. var strLength = length ? stringSize(string) : 0;
  31952. return (length && strLength < length)
  31953. ? (createPadding(length - strLength, chars) + string)
  31954. : string;
  31955. }
  31956. /**
  31957. * Converts `string` to an integer of the specified radix. If `radix` is
  31958. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  31959. * hexadecimal, in which case a `radix` of `16` is used.
  31960. *
  31961. * **Note:** This method aligns with the
  31962. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  31963. *
  31964. * @static
  31965. * @memberOf _
  31966. * @since 1.1.0
  31967. * @category String
  31968. * @param {string} string The string to convert.
  31969. * @param {number} [radix=10] The radix to interpret `value` by.
  31970. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31971. * @returns {number} Returns the converted integer.
  31972. * @example
  31973. *
  31974. * _.parseInt('08');
  31975. * // => 8
  31976. *
  31977. * _.map(['6', '08', '10'], _.parseInt);
  31978. * // => [6, 8, 10]
  31979. */
  31980. function parseInt(string, radix, guard) {
  31981. if (guard || radix == null) {
  31982. radix = 0;
  31983. } else if (radix) {
  31984. radix = +radix;
  31985. }
  31986. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  31987. }
  31988. /**
  31989. * Repeats the given string `n` times.
  31990. *
  31991. * @static
  31992. * @memberOf _
  31993. * @since 3.0.0
  31994. * @category String
  31995. * @param {string} [string=''] The string to repeat.
  31996. * @param {number} [n=1] The number of times to repeat the string.
  31997. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31998. * @returns {string} Returns the repeated string.
  31999. * @example
  32000. *
  32001. * _.repeat('*', 3);
  32002. * // => '***'
  32003. *
  32004. * _.repeat('abc', 2);
  32005. * // => 'abcabc'
  32006. *
  32007. * _.repeat('abc', 0);
  32008. * // => ''
  32009. */
  32010. function repeat(string, n, guard) {
  32011. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  32012. n = 1;
  32013. } else {
  32014. n = toInteger(n);
  32015. }
  32016. return baseRepeat(toString(string), n);
  32017. }
  32018. /**
  32019. * Replaces matches for `pattern` in `string` with `replacement`.
  32020. *
  32021. * **Note:** This method is based on
  32022. * [`String#replace`](https://mdn.io/String/replace).
  32023. *
  32024. * @static
  32025. * @memberOf _
  32026. * @since 4.0.0
  32027. * @category String
  32028. * @param {string} [string=''] The string to modify.
  32029. * @param {RegExp|string} pattern The pattern to replace.
  32030. * @param {Function|string} replacement The match replacement.
  32031. * @returns {string} Returns the modified string.
  32032. * @example
  32033. *
  32034. * _.replace('Hi Fred', 'Fred', 'Barney');
  32035. * // => 'Hi Barney'
  32036. */
  32037. function replace() {
  32038. var args = arguments,
  32039. string = toString(args[0]);
  32040. return args.length < 3 ? string : string.replace(args[1], args[2]);
  32041. }
  32042. /**
  32043. * Converts `string` to
  32044. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  32045. *
  32046. * @static
  32047. * @memberOf _
  32048. * @since 3.0.0
  32049. * @category String
  32050. * @param {string} [string=''] The string to convert.
  32051. * @returns {string} Returns the snake cased string.
  32052. * @example
  32053. *
  32054. * _.snakeCase('Foo Bar');
  32055. * // => 'foo_bar'
  32056. *
  32057. * _.snakeCase('fooBar');
  32058. * // => 'foo_bar'
  32059. *
  32060. * _.snakeCase('--FOO-BAR--');
  32061. * // => 'foo_bar'
  32062. */
  32063. var snakeCase = createCompounder(function(result, word, index) {
  32064. return result + (index ? '_' : '') + word.toLowerCase();
  32065. });
  32066. /**
  32067. * Splits `string` by `separator`.
  32068. *
  32069. * **Note:** This method is based on
  32070. * [`String#split`](https://mdn.io/String/split).
  32071. *
  32072. * @static
  32073. * @memberOf _
  32074. * @since 4.0.0
  32075. * @category String
  32076. * @param {string} [string=''] The string to split.
  32077. * @param {RegExp|string} separator The separator pattern to split by.
  32078. * @param {number} [limit] The length to truncate results to.
  32079. * @returns {Array} Returns the string segments.
  32080. * @example
  32081. *
  32082. * _.split('a-b-c', '-', 2);
  32083. * // => ['a', 'b']
  32084. */
  32085. function split(string, separator, limit) {
  32086. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  32087. separator = limit = undefined;
  32088. }
  32089. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  32090. if (!limit) {
  32091. return [];
  32092. }
  32093. string = toString(string);
  32094. if (string && (
  32095. typeof separator == 'string' ||
  32096. (separator != null && !isRegExp(separator))
  32097. )) {
  32098. separator = baseToString(separator);
  32099. if (!separator && hasUnicode(string)) {
  32100. return castSlice(stringToArray(string), 0, limit);
  32101. }
  32102. }
  32103. return string.split(separator, limit);
  32104. }
  32105. /**
  32106. * Converts `string` to
  32107. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  32108. *
  32109. * @static
  32110. * @memberOf _
  32111. * @since 3.1.0
  32112. * @category String
  32113. * @param {string} [string=''] The string to convert.
  32114. * @returns {string} Returns the start cased string.
  32115. * @example
  32116. *
  32117. * _.startCase('--foo-bar--');
  32118. * // => 'Foo Bar'
  32119. *
  32120. * _.startCase('fooBar');
  32121. * // => 'Foo Bar'
  32122. *
  32123. * _.startCase('__FOO_BAR__');
  32124. * // => 'FOO BAR'
  32125. */
  32126. var startCase = createCompounder(function(result, word, index) {
  32127. return result + (index ? ' ' : '') + upperFirst(word);
  32128. });
  32129. /**
  32130. * Checks if `string` starts with the given target string.
  32131. *
  32132. * @static
  32133. * @memberOf _
  32134. * @since 3.0.0
  32135. * @category String
  32136. * @param {string} [string=''] The string to inspect.
  32137. * @param {string} [target] The string to search for.
  32138. * @param {number} [position=0] The position to search from.
  32139. * @returns {boolean} Returns `true` if `string` starts with `target`,
  32140. * else `false`.
  32141. * @example
  32142. *
  32143. * _.startsWith('abc', 'a');
  32144. * // => true
  32145. *
  32146. * _.startsWith('abc', 'b');
  32147. * // => false
  32148. *
  32149. * _.startsWith('abc', 'b', 1);
  32150. * // => true
  32151. */
  32152. function startsWith(string, target, position) {
  32153. string = toString(string);
  32154. position = position == null
  32155. ? 0
  32156. : baseClamp(toInteger(position), 0, string.length);
  32157. target = baseToString(target);
  32158. return string.slice(position, position + target.length) == target;
  32159. }
  32160. /**
  32161. * Creates a compiled template function that can interpolate data properties
  32162. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  32163. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  32164. * properties may be accessed as free variables in the template. If a setting
  32165. * object is given, it takes precedence over `_.templateSettings` values.
  32166. *
  32167. * **Note:** In the development build `_.template` utilizes
  32168. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  32169. * for easier debugging.
  32170. *
  32171. * For more information on precompiling templates see
  32172. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  32173. *
  32174. * For more information on Chrome extension sandboxes see
  32175. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  32176. *
  32177. * @static
  32178. * @since 0.1.0
  32179. * @memberOf _
  32180. * @category String
  32181. * @param {string} [string=''] The template string.
  32182. * @param {Object} [options={}] The options object.
  32183. * @param {RegExp} [options.escape=_.templateSettings.escape]
  32184. * The HTML "escape" delimiter.
  32185. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  32186. * The "evaluate" delimiter.
  32187. * @param {Object} [options.imports=_.templateSettings.imports]
  32188. * An object to import into the template as free variables.
  32189. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  32190. * The "interpolate" delimiter.
  32191. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  32192. * The sourceURL of the compiled template.
  32193. * @param {string} [options.variable='obj']
  32194. * The data object variable name.
  32195. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32196. * @returns {Function} Returns the compiled template function.
  32197. * @example
  32198. *
  32199. * // Use the "interpolate" delimiter to create a compiled template.
  32200. * var compiled = _.template('hello <%= user %>!');
  32201. * compiled({ 'user': 'fred' });
  32202. * // => 'hello fred!'
  32203. *
  32204. * // Use the HTML "escape" delimiter to escape data property values.
  32205. * var compiled = _.template('<b><%- value %></b>');
  32206. * compiled({ 'value': '<script>' });
  32207. * // => '<b>&lt;script&gt;</b>'
  32208. *
  32209. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  32210. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  32211. * compiled({ 'users': ['fred', 'barney'] });
  32212. * // => '<li>fred</li><li>barney</li>'
  32213. *
  32214. * // Use the internal `print` function in "evaluate" delimiters.
  32215. * var compiled = _.template('<% print("hello " + user); %>!');
  32216. * compiled({ 'user': 'barney' });
  32217. * // => 'hello barney!'
  32218. *
  32219. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  32220. * // Disable support by replacing the "interpolate" delimiter.
  32221. * var compiled = _.template('hello ${ user }!');
  32222. * compiled({ 'user': 'pebbles' });
  32223. * // => 'hello pebbles!'
  32224. *
  32225. * // Use backslashes to treat delimiters as plain text.
  32226. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  32227. * compiled({ 'value': 'ignored' });
  32228. * // => '<%- value %>'
  32229. *
  32230. * // Use the `imports` option to import `jQuery` as `jq`.
  32231. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  32232. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  32233. * compiled({ 'users': ['fred', 'barney'] });
  32234. * // => '<li>fred</li><li>barney</li>'
  32235. *
  32236. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  32237. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  32238. * compiled(data);
  32239. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  32240. *
  32241. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  32242. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  32243. * compiled.source;
  32244. * // => function(data) {
  32245. * // var __t, __p = '';
  32246. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  32247. * // return __p;
  32248. * // }
  32249. *
  32250. * // Use custom template delimiters.
  32251. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  32252. * var compiled = _.template('hello {{ user }}!');
  32253. * compiled({ 'user': 'mustache' });
  32254. * // => 'hello mustache!'
  32255. *
  32256. * // Use the `source` property to inline compiled templates for meaningful
  32257. * // line numbers in error messages and stack traces.
  32258. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  32259. * var JST = {\
  32260. * "main": ' + _.template(mainText).source + '\
  32261. * };\
  32262. * ');
  32263. */
  32264. function template(string, options, guard) {
  32265. // Based on John Resig's `tmpl` implementation
  32266. // (http://ejohn.org/blog/javascript-micro-templating/)
  32267. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  32268. var settings = lodash.templateSettings;
  32269. if (guard && isIterateeCall(string, options, guard)) {
  32270. options = undefined;
  32271. }
  32272. string = toString(string);
  32273. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  32274. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  32275. importsKeys = keys(imports),
  32276. importsValues = baseValues(imports, importsKeys);
  32277. var isEscaping,
  32278. isEvaluating,
  32279. index = 0,
  32280. interpolate = options.interpolate || reNoMatch,
  32281. source = "__p += '";
  32282. // Compile the regexp to match each delimiter.
  32283. var reDelimiters = RegExp(
  32284. (options.escape || reNoMatch).source + '|' +
  32285. interpolate.source + '|' +
  32286. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  32287. (options.evaluate || reNoMatch).source + '|$'
  32288. , 'g');
  32289. // Use a sourceURL for easier debugging.
  32290. // The sourceURL gets injected into the source that's eval-ed, so be careful
  32291. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  32292. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  32293. var sourceURL = '//# sourceURL=' +
  32294. (hasOwnProperty.call(options, 'sourceURL')
  32295. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  32296. : ('lodash.templateSources[' + (++templateCounter) + ']')
  32297. ) + '\n';
  32298. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  32299. interpolateValue || (interpolateValue = esTemplateValue);
  32300. // Escape characters that can't be included in string literals.
  32301. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  32302. // Replace delimiters with snippets.
  32303. if (escapeValue) {
  32304. isEscaping = true;
  32305. source += "' +\n__e(" + escapeValue + ") +\n'";
  32306. }
  32307. if (evaluateValue) {
  32308. isEvaluating = true;
  32309. source += "';\n" + evaluateValue + ";\n__p += '";
  32310. }
  32311. if (interpolateValue) {
  32312. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  32313. }
  32314. index = offset + match.length;
  32315. // The JS engine embedded in Adobe products needs `match` returned in
  32316. // order to produce the correct `offset` value.
  32317. return match;
  32318. });
  32319. source += "';\n";
  32320. // If `variable` is not specified wrap a with-statement around the generated
  32321. // code to add the data object to the top of the scope chain.
  32322. // Like with sourceURL, we take care to not check the option's prototype,
  32323. // as this configuration is a code injection vector.
  32324. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  32325. if (!variable) {
  32326. source = 'with (obj) {\n' + source + '\n}\n';
  32327. }
  32328. // Cleanup code by stripping empty strings.
  32329. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  32330. .replace(reEmptyStringMiddle, '$1')
  32331. .replace(reEmptyStringTrailing, '$1;');
  32332. // Frame code as the function body.
  32333. source = 'function(' + (variable || 'obj') + ') {\n' +
  32334. (variable
  32335. ? ''
  32336. : 'obj || (obj = {});\n'
  32337. ) +
  32338. "var __t, __p = ''" +
  32339. (isEscaping
  32340. ? ', __e = _.escape'
  32341. : ''
  32342. ) +
  32343. (isEvaluating
  32344. ? ', __j = Array.prototype.join;\n' +
  32345. "function print() { __p += __j.call(arguments, '') }\n"
  32346. : ';\n'
  32347. ) +
  32348. source +
  32349. 'return __p\n}';
  32350. var result = attempt(function() {
  32351. return Function(importsKeys, sourceURL + 'return ' + source)
  32352. .apply(undefined, importsValues);
  32353. });
  32354. // Provide the compiled function's source by its `toString` method or
  32355. // the `source` property as a convenience for inlining compiled templates.
  32356. result.source = source;
  32357. if (isError(result)) {
  32358. throw result;
  32359. }
  32360. return result;
  32361. }
  32362. /**
  32363. * Converts `string`, as a whole, to lower case just like
  32364. * [String#toLowerCase](https://mdn.io/toLowerCase).
  32365. *
  32366. * @static
  32367. * @memberOf _
  32368. * @since 4.0.0
  32369. * @category String
  32370. * @param {string} [string=''] The string to convert.
  32371. * @returns {string} Returns the lower cased string.
  32372. * @example
  32373. *
  32374. * _.toLower('--Foo-Bar--');
  32375. * // => '--foo-bar--'
  32376. *
  32377. * _.toLower('fooBar');
  32378. * // => 'foobar'
  32379. *
  32380. * _.toLower('__FOO_BAR__');
  32381. * // => '__foo_bar__'
  32382. */
  32383. function toLower(value) {
  32384. return toString(value).toLowerCase();
  32385. }
  32386. /**
  32387. * Converts `string`, as a whole, to upper case just like
  32388. * [String#toUpperCase](https://mdn.io/toUpperCase).
  32389. *
  32390. * @static
  32391. * @memberOf _
  32392. * @since 4.0.0
  32393. * @category String
  32394. * @param {string} [string=''] The string to convert.
  32395. * @returns {string} Returns the upper cased string.
  32396. * @example
  32397. *
  32398. * _.toUpper('--foo-bar--');
  32399. * // => '--FOO-BAR--'
  32400. *
  32401. * _.toUpper('fooBar');
  32402. * // => 'FOOBAR'
  32403. *
  32404. * _.toUpper('__foo_bar__');
  32405. * // => '__FOO_BAR__'
  32406. */
  32407. function toUpper(value) {
  32408. return toString(value).toUpperCase();
  32409. }
  32410. /**
  32411. * Removes leading and trailing whitespace or specified characters from `string`.
  32412. *
  32413. * @static
  32414. * @memberOf _
  32415. * @since 3.0.0
  32416. * @category String
  32417. * @param {string} [string=''] The string to trim.
  32418. * @param {string} [chars=whitespace] The characters to trim.
  32419. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32420. * @returns {string} Returns the trimmed string.
  32421. * @example
  32422. *
  32423. * _.trim(' abc ');
  32424. * // => 'abc'
  32425. *
  32426. * _.trim('-_-abc-_-', '_-');
  32427. * // => 'abc'
  32428. *
  32429. * _.map([' foo ', ' bar '], _.trim);
  32430. * // => ['foo', 'bar']
  32431. */
  32432. function trim(string, chars, guard) {
  32433. string = toString(string);
  32434. if (string && (guard || chars === undefined)) {
  32435. return string.replace(reTrim, '');
  32436. }
  32437. if (!string || !(chars = baseToString(chars))) {
  32438. return string;
  32439. }
  32440. var strSymbols = stringToArray(string),
  32441. chrSymbols = stringToArray(chars),
  32442. start = charsStartIndex(strSymbols, chrSymbols),
  32443. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  32444. return castSlice(strSymbols, start, end).join('');
  32445. }
  32446. /**
  32447. * Removes trailing whitespace or specified characters from `string`.
  32448. *
  32449. * @static
  32450. * @memberOf _
  32451. * @since 4.0.0
  32452. * @category String
  32453. * @param {string} [string=''] The string to trim.
  32454. * @param {string} [chars=whitespace] The characters to trim.
  32455. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32456. * @returns {string} Returns the trimmed string.
  32457. * @example
  32458. *
  32459. * _.trimEnd(' abc ');
  32460. * // => ' abc'
  32461. *
  32462. * _.trimEnd('-_-abc-_-', '_-');
  32463. * // => '-_-abc'
  32464. */
  32465. function trimEnd(string, chars, guard) {
  32466. string = toString(string);
  32467. if (string && (guard || chars === undefined)) {
  32468. return string.replace(reTrimEnd, '');
  32469. }
  32470. if (!string || !(chars = baseToString(chars))) {
  32471. return string;
  32472. }
  32473. var strSymbols = stringToArray(string),
  32474. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  32475. return castSlice(strSymbols, 0, end).join('');
  32476. }
  32477. /**
  32478. * Removes leading whitespace or specified characters from `string`.
  32479. *
  32480. * @static
  32481. * @memberOf _
  32482. * @since 4.0.0
  32483. * @category String
  32484. * @param {string} [string=''] The string to trim.
  32485. * @param {string} [chars=whitespace] The characters to trim.
  32486. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32487. * @returns {string} Returns the trimmed string.
  32488. * @example
  32489. *
  32490. * _.trimStart(' abc ');
  32491. * // => 'abc '
  32492. *
  32493. * _.trimStart('-_-abc-_-', '_-');
  32494. * // => 'abc-_-'
  32495. */
  32496. function trimStart(string, chars, guard) {
  32497. string = toString(string);
  32498. if (string && (guard || chars === undefined)) {
  32499. return string.replace(reTrimStart, '');
  32500. }
  32501. if (!string || !(chars = baseToString(chars))) {
  32502. return string;
  32503. }
  32504. var strSymbols = stringToArray(string),
  32505. start = charsStartIndex(strSymbols, stringToArray(chars));
  32506. return castSlice(strSymbols, start).join('');
  32507. }
  32508. /**
  32509. * Truncates `string` if it's longer than the given maximum string length.
  32510. * The last characters of the truncated string are replaced with the omission
  32511. * string which defaults to "...".
  32512. *
  32513. * @static
  32514. * @memberOf _
  32515. * @since 4.0.0
  32516. * @category String
  32517. * @param {string} [string=''] The string to truncate.
  32518. * @param {Object} [options={}] The options object.
  32519. * @param {number} [options.length=30] The maximum string length.
  32520. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  32521. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  32522. * @returns {string} Returns the truncated string.
  32523. * @example
  32524. *
  32525. * _.truncate('hi-diddly-ho there, neighborino');
  32526. * // => 'hi-diddly-ho there, neighbo...'
  32527. *
  32528. * _.truncate('hi-diddly-ho there, neighborino', {
  32529. * 'length': 24,
  32530. * 'separator': ' '
  32531. * });
  32532. * // => 'hi-diddly-ho there,...'
  32533. *
  32534. * _.truncate('hi-diddly-ho there, neighborino', {
  32535. * 'length': 24,
  32536. * 'separator': /,? +/
  32537. * });
  32538. * // => 'hi-diddly-ho there...'
  32539. *
  32540. * _.truncate('hi-diddly-ho there, neighborino', {
  32541. * 'omission': ' [...]'
  32542. * });
  32543. * // => 'hi-diddly-ho there, neig [...]'
  32544. */
  32545. function truncate(string, options) {
  32546. var length = DEFAULT_TRUNC_LENGTH,
  32547. omission = DEFAULT_TRUNC_OMISSION;
  32548. if (isObject(options)) {
  32549. var separator = 'separator' in options ? options.separator : separator;
  32550. length = 'length' in options ? toInteger(options.length) : length;
  32551. omission = 'omission' in options ? baseToString(options.omission) : omission;
  32552. }
  32553. string = toString(string);
  32554. var strLength = string.length;
  32555. if (hasUnicode(string)) {
  32556. var strSymbols = stringToArray(string);
  32557. strLength = strSymbols.length;
  32558. }
  32559. if (length >= strLength) {
  32560. return string;
  32561. }
  32562. var end = length - stringSize(omission);
  32563. if (end < 1) {
  32564. return omission;
  32565. }
  32566. var result = strSymbols
  32567. ? castSlice(strSymbols, 0, end).join('')
  32568. : string.slice(0, end);
  32569. if (separator === undefined) {
  32570. return result + omission;
  32571. }
  32572. if (strSymbols) {
  32573. end += (result.length - end);
  32574. }
  32575. if (isRegExp(separator)) {
  32576. if (string.slice(end).search(separator)) {
  32577. var match,
  32578. substring = result;
  32579. if (!separator.global) {
  32580. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  32581. }
  32582. separator.lastIndex = 0;
  32583. while ((match = separator.exec(substring))) {
  32584. var newEnd = match.index;
  32585. }
  32586. result = result.slice(0, newEnd === undefined ? end : newEnd);
  32587. }
  32588. } else if (string.indexOf(baseToString(separator), end) != end) {
  32589. var index = result.lastIndexOf(separator);
  32590. if (index > -1) {
  32591. result = result.slice(0, index);
  32592. }
  32593. }
  32594. return result + omission;
  32595. }
  32596. /**
  32597. * The inverse of `_.escape`; this method converts the HTML entities
  32598. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  32599. * their corresponding characters.
  32600. *
  32601. * **Note:** No other HTML entities are unescaped. To unescape additional
  32602. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  32603. *
  32604. * @static
  32605. * @memberOf _
  32606. * @since 0.6.0
  32607. * @category String
  32608. * @param {string} [string=''] The string to unescape.
  32609. * @returns {string} Returns the unescaped string.
  32610. * @example
  32611. *
  32612. * _.unescape('fred, barney, &amp; pebbles');
  32613. * // => 'fred, barney, & pebbles'
  32614. */
  32615. function unescape(string) {
  32616. string = toString(string);
  32617. return (string && reHasEscapedHtml.test(string))
  32618. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  32619. : string;
  32620. }
  32621. /**
  32622. * Converts `string`, as space separated words, to upper case.
  32623. *
  32624. * @static
  32625. * @memberOf _
  32626. * @since 4.0.0
  32627. * @category String
  32628. * @param {string} [string=''] The string to convert.
  32629. * @returns {string} Returns the upper cased string.
  32630. * @example
  32631. *
  32632. * _.upperCase('--foo-bar');
  32633. * // => 'FOO BAR'
  32634. *
  32635. * _.upperCase('fooBar');
  32636. * // => 'FOO BAR'
  32637. *
  32638. * _.upperCase('__foo_bar__');
  32639. * // => 'FOO BAR'
  32640. */
  32641. var upperCase = createCompounder(function(result, word, index) {
  32642. return result + (index ? ' ' : '') + word.toUpperCase();
  32643. });
  32644. /**
  32645. * Converts the first character of `string` to upper case.
  32646. *
  32647. * @static
  32648. * @memberOf _
  32649. * @since 4.0.0
  32650. * @category String
  32651. * @param {string} [string=''] The string to convert.
  32652. * @returns {string} Returns the converted string.
  32653. * @example
  32654. *
  32655. * _.upperFirst('fred');
  32656. * // => 'Fred'
  32657. *
  32658. * _.upperFirst('FRED');
  32659. * // => 'FRED'
  32660. */
  32661. var upperFirst = createCaseFirst('toUpperCase');
  32662. /**
  32663. * Splits `string` into an array of its words.
  32664. *
  32665. * @static
  32666. * @memberOf _
  32667. * @since 3.0.0
  32668. * @category String
  32669. * @param {string} [string=''] The string to inspect.
  32670. * @param {RegExp|string} [pattern] The pattern to match words.
  32671. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32672. * @returns {Array} Returns the words of `string`.
  32673. * @example
  32674. *
  32675. * _.words('fred, barney, & pebbles');
  32676. * // => ['fred', 'barney', 'pebbles']
  32677. *
  32678. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  32679. * // => ['fred', 'barney', '&', 'pebbles']
  32680. */
  32681. function words(string, pattern, guard) {
  32682. string = toString(string);
  32683. pattern = guard ? undefined : pattern;
  32684. if (pattern === undefined) {
  32685. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  32686. }
  32687. return string.match(pattern) || [];
  32688. }
  32689. /*------------------------------------------------------------------------*/
  32690. /**
  32691. * Attempts to invoke `func`, returning either the result or the caught error
  32692. * object. Any additional arguments are provided to `func` when it's invoked.
  32693. *
  32694. * @static
  32695. * @memberOf _
  32696. * @since 3.0.0
  32697. * @category Util
  32698. * @param {Function} func The function to attempt.
  32699. * @param {...*} [args] The arguments to invoke `func` with.
  32700. * @returns {*} Returns the `func` result or error object.
  32701. * @example
  32702. *
  32703. * // Avoid throwing errors for invalid selectors.
  32704. * var elements = _.attempt(function(selector) {
  32705. * return document.querySelectorAll(selector);
  32706. * }, '>_>');
  32707. *
  32708. * if (_.isError(elements)) {
  32709. * elements = [];
  32710. * }
  32711. */
  32712. var attempt = baseRest(function(func, args) {
  32713. try {
  32714. return apply(func, undefined, args);
  32715. } catch (e) {
  32716. return isError(e) ? e : new Error(e);
  32717. }
  32718. });
  32719. /**
  32720. * Binds methods of an object to the object itself, overwriting the existing
  32721. * method.
  32722. *
  32723. * **Note:** This method doesn't set the "length" property of bound functions.
  32724. *
  32725. * @static
  32726. * @since 0.1.0
  32727. * @memberOf _
  32728. * @category Util
  32729. * @param {Object} object The object to bind and assign the bound methods to.
  32730. * @param {...(string|string[])} methodNames The object method names to bind.
  32731. * @returns {Object} Returns `object`.
  32732. * @example
  32733. *
  32734. * var view = {
  32735. * 'label': 'docs',
  32736. * 'click': function() {
  32737. * console.log('clicked ' + this.label);
  32738. * }
  32739. * };
  32740. *
  32741. * _.bindAll(view, ['click']);
  32742. * jQuery(element).on('click', view.click);
  32743. * // => Logs 'clicked docs' when clicked.
  32744. */
  32745. var bindAll = flatRest(function(object, methodNames) {
  32746. arrayEach(methodNames, function(key) {
  32747. key = toKey(key);
  32748. baseAssignValue(object, key, bind(object[key], object));
  32749. });
  32750. return object;
  32751. });
  32752. /**
  32753. * Creates a function that iterates over `pairs` and invokes the corresponding
  32754. * function of the first predicate to return truthy. The predicate-function
  32755. * pairs are invoked with the `this` binding and arguments of the created
  32756. * function.
  32757. *
  32758. * @static
  32759. * @memberOf _
  32760. * @since 4.0.0
  32761. * @category Util
  32762. * @param {Array} pairs The predicate-function pairs.
  32763. * @returns {Function} Returns the new composite function.
  32764. * @example
  32765. *
  32766. * var func = _.cond([
  32767. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  32768. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  32769. * [_.stubTrue, _.constant('no match')]
  32770. * ]);
  32771. *
  32772. * func({ 'a': 1, 'b': 2 });
  32773. * // => 'matches A'
  32774. *
  32775. * func({ 'a': 0, 'b': 1 });
  32776. * // => 'matches B'
  32777. *
  32778. * func({ 'a': '1', 'b': '2' });
  32779. * // => 'no match'
  32780. */
  32781. function cond(pairs) {
  32782. var length = pairs == null ? 0 : pairs.length,
  32783. toIteratee = getIteratee();
  32784. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  32785. if (typeof pair[1] != 'function') {
  32786. throw new TypeError(FUNC_ERROR_TEXT);
  32787. }
  32788. return [toIteratee(pair[0]), pair[1]];
  32789. });
  32790. return baseRest(function(args) {
  32791. var index = -1;
  32792. while (++index < length) {
  32793. var pair = pairs[index];
  32794. if (apply(pair[0], this, args)) {
  32795. return apply(pair[1], this, args);
  32796. }
  32797. }
  32798. });
  32799. }
  32800. /**
  32801. * Creates a function that invokes the predicate properties of `source` with
  32802. * the corresponding property values of a given object, returning `true` if
  32803. * all predicates return truthy, else `false`.
  32804. *
  32805. * **Note:** The created function is equivalent to `_.conformsTo` with
  32806. * `source` partially applied.
  32807. *
  32808. * @static
  32809. * @memberOf _
  32810. * @since 4.0.0
  32811. * @category Util
  32812. * @param {Object} source The object of property predicates to conform to.
  32813. * @returns {Function} Returns the new spec function.
  32814. * @example
  32815. *
  32816. * var objects = [
  32817. * { 'a': 2, 'b': 1 },
  32818. * { 'a': 1, 'b': 2 }
  32819. * ];
  32820. *
  32821. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  32822. * // => [{ 'a': 1, 'b': 2 }]
  32823. */
  32824. function conforms(source) {
  32825. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  32826. }
  32827. /**
  32828. * Creates a function that returns `value`.
  32829. *
  32830. * @static
  32831. * @memberOf _
  32832. * @since 2.4.0
  32833. * @category Util
  32834. * @param {*} value The value to return from the new function.
  32835. * @returns {Function} Returns the new constant function.
  32836. * @example
  32837. *
  32838. * var objects = _.times(2, _.constant({ 'a': 1 }));
  32839. *
  32840. * console.log(objects);
  32841. * // => [{ 'a': 1 }, { 'a': 1 }]
  32842. *
  32843. * console.log(objects[0] === objects[1]);
  32844. * // => true
  32845. */
  32846. function constant(value) {
  32847. return function() {
  32848. return value;
  32849. };
  32850. }
  32851. /**
  32852. * Checks `value` to determine whether a default value should be returned in
  32853. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  32854. * or `undefined`.
  32855. *
  32856. * @static
  32857. * @memberOf _
  32858. * @since 4.14.0
  32859. * @category Util
  32860. * @param {*} value The value to check.
  32861. * @param {*} defaultValue The default value.
  32862. * @returns {*} Returns the resolved value.
  32863. * @example
  32864. *
  32865. * _.defaultTo(1, 10);
  32866. * // => 1
  32867. *
  32868. * _.defaultTo(undefined, 10);
  32869. * // => 10
  32870. */
  32871. function defaultTo(value, defaultValue) {
  32872. return (value == null || value !== value) ? defaultValue : value;
  32873. }
  32874. /**
  32875. * Creates a function that returns the result of invoking the given functions
  32876. * with the `this` binding of the created function, where each successive
  32877. * invocation is supplied the return value of the previous.
  32878. *
  32879. * @static
  32880. * @memberOf _
  32881. * @since 3.0.0
  32882. * @category Util
  32883. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32884. * @returns {Function} Returns the new composite function.
  32885. * @see _.flowRight
  32886. * @example
  32887. *
  32888. * function square(n) {
  32889. * return n * n;
  32890. * }
  32891. *
  32892. * var addSquare = _.flow([_.add, square]);
  32893. * addSquare(1, 2);
  32894. * // => 9
  32895. */
  32896. var flow = createFlow();
  32897. /**
  32898. * This method is like `_.flow` except that it creates a function that
  32899. * invokes the given functions from right to left.
  32900. *
  32901. * @static
  32902. * @since 3.0.0
  32903. * @memberOf _
  32904. * @category Util
  32905. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32906. * @returns {Function} Returns the new composite function.
  32907. * @see _.flow
  32908. * @example
  32909. *
  32910. * function square(n) {
  32911. * return n * n;
  32912. * }
  32913. *
  32914. * var addSquare = _.flowRight([square, _.add]);
  32915. * addSquare(1, 2);
  32916. * // => 9
  32917. */
  32918. var flowRight = createFlow(true);
  32919. /**
  32920. * This method returns the first argument it receives.
  32921. *
  32922. * @static
  32923. * @since 0.1.0
  32924. * @memberOf _
  32925. * @category Util
  32926. * @param {*} value Any value.
  32927. * @returns {*} Returns `value`.
  32928. * @example
  32929. *
  32930. * var object = { 'a': 1 };
  32931. *
  32932. * console.log(_.identity(object) === object);
  32933. * // => true
  32934. */
  32935. function identity(value) {
  32936. return value;
  32937. }
  32938. /**
  32939. * Creates a function that invokes `func` with the arguments of the created
  32940. * function. If `func` is a property name, the created function returns the
  32941. * property value for a given element. If `func` is an array or object, the
  32942. * created function returns `true` for elements that contain the equivalent
  32943. * source properties, otherwise it returns `false`.
  32944. *
  32945. * @static
  32946. * @since 4.0.0
  32947. * @memberOf _
  32948. * @category Util
  32949. * @param {*} [func=_.identity] The value to convert to a callback.
  32950. * @returns {Function} Returns the callback.
  32951. * @example
  32952. *
  32953. * var users = [
  32954. * { 'user': 'barney', 'age': 36, 'active': true },
  32955. * { 'user': 'fred', 'age': 40, 'active': false }
  32956. * ];
  32957. *
  32958. * // The `_.matches` iteratee shorthand.
  32959. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  32960. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  32961. *
  32962. * // The `_.matchesProperty` iteratee shorthand.
  32963. * _.filter(users, _.iteratee(['user', 'fred']));
  32964. * // => [{ 'user': 'fred', 'age': 40 }]
  32965. *
  32966. * // The `_.property` iteratee shorthand.
  32967. * _.map(users, _.iteratee('user'));
  32968. * // => ['barney', 'fred']
  32969. *
  32970. * // Create custom iteratee shorthands.
  32971. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  32972. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  32973. * return func.test(string);
  32974. * };
  32975. * });
  32976. *
  32977. * _.filter(['abc', 'def'], /ef/);
  32978. * // => ['def']
  32979. */
  32980. function iteratee(func) {
  32981. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  32982. }
  32983. /**
  32984. * Creates a function that performs a partial deep comparison between a given
  32985. * object and `source`, returning `true` if the given object has equivalent
  32986. * property values, else `false`.
  32987. *
  32988. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  32989. * partially applied.
  32990. *
  32991. * Partial comparisons will match empty array and empty object `source`
  32992. * values against any array or object value, respectively. See `_.isEqual`
  32993. * for a list of supported value comparisons.
  32994. *
  32995. * @static
  32996. * @memberOf _
  32997. * @since 3.0.0
  32998. * @category Util
  32999. * @param {Object} source The object of property values to match.
  33000. * @returns {Function} Returns the new spec function.
  33001. * @example
  33002. *
  33003. * var objects = [
  33004. * { 'a': 1, 'b': 2, 'c': 3 },
  33005. * { 'a': 4, 'b': 5, 'c': 6 }
  33006. * ];
  33007. *
  33008. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  33009. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  33010. */
  33011. function matches(source) {
  33012. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  33013. }
  33014. /**
  33015. * Creates a function that performs a partial deep comparison between the
  33016. * value at `path` of a given object to `srcValue`, returning `true` if the
  33017. * object value is equivalent, else `false`.
  33018. *
  33019. * **Note:** Partial comparisons will match empty array and empty object
  33020. * `srcValue` values against any array or object value, respectively. See
  33021. * `_.isEqual` for a list of supported value comparisons.
  33022. *
  33023. * @static
  33024. * @memberOf _
  33025. * @since 3.2.0
  33026. * @category Util
  33027. * @param {Array|string} path The path of the property to get.
  33028. * @param {*} srcValue The value to match.
  33029. * @returns {Function} Returns the new spec function.
  33030. * @example
  33031. *
  33032. * var objects = [
  33033. * { 'a': 1, 'b': 2, 'c': 3 },
  33034. * { 'a': 4, 'b': 5, 'c': 6 }
  33035. * ];
  33036. *
  33037. * _.find(objects, _.matchesProperty('a', 4));
  33038. * // => { 'a': 4, 'b': 5, 'c': 6 }
  33039. */
  33040. function matchesProperty(path, srcValue) {
  33041. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  33042. }
  33043. /**
  33044. * Creates a function that invokes the method at `path` of a given object.
  33045. * Any additional arguments are provided to the invoked method.
  33046. *
  33047. * @static
  33048. * @memberOf _
  33049. * @since 3.7.0
  33050. * @category Util
  33051. * @param {Array|string} path The path of the method to invoke.
  33052. * @param {...*} [args] The arguments to invoke the method with.
  33053. * @returns {Function} Returns the new invoker function.
  33054. * @example
  33055. *
  33056. * var objects = [
  33057. * { 'a': { 'b': _.constant(2) } },
  33058. * { 'a': { 'b': _.constant(1) } }
  33059. * ];
  33060. *
  33061. * _.map(objects, _.method('a.b'));
  33062. * // => [2, 1]
  33063. *
  33064. * _.map(objects, _.method(['a', 'b']));
  33065. * // => [2, 1]
  33066. */
  33067. var method = baseRest(function(path, args) {
  33068. return function(object) {
  33069. return baseInvoke(object, path, args);
  33070. };
  33071. });
  33072. /**
  33073. * The opposite of `_.method`; this method creates a function that invokes
  33074. * the method at a given path of `object`. Any additional arguments are
  33075. * provided to the invoked method.
  33076. *
  33077. * @static
  33078. * @memberOf _
  33079. * @since 3.7.0
  33080. * @category Util
  33081. * @param {Object} object The object to query.
  33082. * @param {...*} [args] The arguments to invoke the method with.
  33083. * @returns {Function} Returns the new invoker function.
  33084. * @example
  33085. *
  33086. * var array = _.times(3, _.constant),
  33087. * object = { 'a': array, 'b': array, 'c': array };
  33088. *
  33089. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  33090. * // => [2, 0]
  33091. *
  33092. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  33093. * // => [2, 0]
  33094. */
  33095. var methodOf = baseRest(function(object, args) {
  33096. return function(path) {
  33097. return baseInvoke(object, path, args);
  33098. };
  33099. });
  33100. /**
  33101. * Adds all own enumerable string keyed function properties of a source
  33102. * object to the destination object. If `object` is a function, then methods
  33103. * are added to its prototype as well.
  33104. *
  33105. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  33106. * avoid conflicts caused by modifying the original.
  33107. *
  33108. * @static
  33109. * @since 0.1.0
  33110. * @memberOf _
  33111. * @category Util
  33112. * @param {Function|Object} [object=lodash] The destination object.
  33113. * @param {Object} source The object of functions to add.
  33114. * @param {Object} [options={}] The options object.
  33115. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  33116. * @returns {Function|Object} Returns `object`.
  33117. * @example
  33118. *
  33119. * function vowels(string) {
  33120. * return _.filter(string, function(v) {
  33121. * return /[aeiou]/i.test(v);
  33122. * });
  33123. * }
  33124. *
  33125. * _.mixin({ 'vowels': vowels });
  33126. * _.vowels('fred');
  33127. * // => ['e']
  33128. *
  33129. * _('fred').vowels().value();
  33130. * // => ['e']
  33131. *
  33132. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  33133. * _('fred').vowels();
  33134. * // => ['e']
  33135. */
  33136. function mixin(object, source, options) {
  33137. var props = keys(source),
  33138. methodNames = baseFunctions(source, props);
  33139. if (options == null &&
  33140. !(isObject(source) && (methodNames.length || !props.length))) {
  33141. options = source;
  33142. source = object;
  33143. object = this;
  33144. methodNames = baseFunctions(source, keys(source));
  33145. }
  33146. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  33147. isFunc = isFunction(object);
  33148. arrayEach(methodNames, function(methodName) {
  33149. var func = source[methodName];
  33150. object[methodName] = func;
  33151. if (isFunc) {
  33152. object.prototype[methodName] = function() {
  33153. var chainAll = this.__chain__;
  33154. if (chain || chainAll) {
  33155. var result = object(this.__wrapped__),
  33156. actions = result.__actions__ = copyArray(this.__actions__);
  33157. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  33158. result.__chain__ = chainAll;
  33159. return result;
  33160. }
  33161. return func.apply(object, arrayPush([this.value()], arguments));
  33162. };
  33163. }
  33164. });
  33165. return object;
  33166. }
  33167. /**
  33168. * Reverts the `_` variable to its previous value and returns a reference to
  33169. * the `lodash` function.
  33170. *
  33171. * @static
  33172. * @since 0.1.0
  33173. * @memberOf _
  33174. * @category Util
  33175. * @returns {Function} Returns the `lodash` function.
  33176. * @example
  33177. *
  33178. * var lodash = _.noConflict();
  33179. */
  33180. function noConflict() {
  33181. if (root._ === this) {
  33182. root._ = oldDash;
  33183. }
  33184. return this;
  33185. }
  33186. /**
  33187. * This method returns `undefined`.
  33188. *
  33189. * @static
  33190. * @memberOf _
  33191. * @since 2.3.0
  33192. * @category Util
  33193. * @example
  33194. *
  33195. * _.times(2, _.noop);
  33196. * // => [undefined, undefined]
  33197. */
  33198. function noop() {
  33199. // No operation performed.
  33200. }
  33201. /**
  33202. * Creates a function that gets the argument at index `n`. If `n` is negative,
  33203. * the nth argument from the end is returned.
  33204. *
  33205. * @static
  33206. * @memberOf _
  33207. * @since 4.0.0
  33208. * @category Util
  33209. * @param {number} [n=0] The index of the argument to return.
  33210. * @returns {Function} Returns the new pass-thru function.
  33211. * @example
  33212. *
  33213. * var func = _.nthArg(1);
  33214. * func('a', 'b', 'c', 'd');
  33215. * // => 'b'
  33216. *
  33217. * var func = _.nthArg(-2);
  33218. * func('a', 'b', 'c', 'd');
  33219. * // => 'c'
  33220. */
  33221. function nthArg(n) {
  33222. n = toInteger(n);
  33223. return baseRest(function(args) {
  33224. return baseNth(args, n);
  33225. });
  33226. }
  33227. /**
  33228. * Creates a function that invokes `iteratees` with the arguments it receives
  33229. * and returns their results.
  33230. *
  33231. * @static
  33232. * @memberOf _
  33233. * @since 4.0.0
  33234. * @category Util
  33235. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  33236. * The iteratees to invoke.
  33237. * @returns {Function} Returns the new function.
  33238. * @example
  33239. *
  33240. * var func = _.over([Math.max, Math.min]);
  33241. *
  33242. * func(1, 2, 3, 4);
  33243. * // => [4, 1]
  33244. */
  33245. var over = createOver(arrayMap);
  33246. /**
  33247. * Creates a function that checks if **all** of the `predicates` return
  33248. * truthy when invoked with the arguments it receives.
  33249. *
  33250. * @static
  33251. * @memberOf _
  33252. * @since 4.0.0
  33253. * @category Util
  33254. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33255. * The predicates to check.
  33256. * @returns {Function} Returns the new function.
  33257. * @example
  33258. *
  33259. * var func = _.overEvery([Boolean, isFinite]);
  33260. *
  33261. * func('1');
  33262. * // => true
  33263. *
  33264. * func(null);
  33265. * // => false
  33266. *
  33267. * func(NaN);
  33268. * // => false
  33269. */
  33270. var overEvery = createOver(arrayEvery);
  33271. /**
  33272. * Creates a function that checks if **any** of the `predicates` return
  33273. * truthy when invoked with the arguments it receives.
  33274. *
  33275. * @static
  33276. * @memberOf _
  33277. * @since 4.0.0
  33278. * @category Util
  33279. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33280. * The predicates to check.
  33281. * @returns {Function} Returns the new function.
  33282. * @example
  33283. *
  33284. * var func = _.overSome([Boolean, isFinite]);
  33285. *
  33286. * func('1');
  33287. * // => true
  33288. *
  33289. * func(null);
  33290. * // => true
  33291. *
  33292. * func(NaN);
  33293. * // => false
  33294. */
  33295. var overSome = createOver(arraySome);
  33296. /**
  33297. * Creates a function that returns the value at `path` of a given object.
  33298. *
  33299. * @static
  33300. * @memberOf _
  33301. * @since 2.4.0
  33302. * @category Util
  33303. * @param {Array|string} path The path of the property to get.
  33304. * @returns {Function} Returns the new accessor function.
  33305. * @example
  33306. *
  33307. * var objects = [
  33308. * { 'a': { 'b': 2 } },
  33309. * { 'a': { 'b': 1 } }
  33310. * ];
  33311. *
  33312. * _.map(objects, _.property('a.b'));
  33313. * // => [2, 1]
  33314. *
  33315. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  33316. * // => [1, 2]
  33317. */
  33318. function property(path) {
  33319. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  33320. }
  33321. /**
  33322. * The opposite of `_.property`; this method creates a function that returns
  33323. * the value at a given path of `object`.
  33324. *
  33325. * @static
  33326. * @memberOf _
  33327. * @since 3.0.0
  33328. * @category Util
  33329. * @param {Object} object The object to query.
  33330. * @returns {Function} Returns the new accessor function.
  33331. * @example
  33332. *
  33333. * var array = [0, 1, 2],
  33334. * object = { 'a': array, 'b': array, 'c': array };
  33335. *
  33336. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  33337. * // => [2, 0]
  33338. *
  33339. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  33340. * // => [2, 0]
  33341. */
  33342. function propertyOf(object) {
  33343. return function(path) {
  33344. return object == null ? undefined : baseGet(object, path);
  33345. };
  33346. }
  33347. /**
  33348. * Creates an array of numbers (positive and/or negative) progressing from
  33349. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  33350. * `start` is specified without an `end` or `step`. If `end` is not specified,
  33351. * it's set to `start` with `start` then set to `0`.
  33352. *
  33353. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  33354. * floating-point values which can produce unexpected results.
  33355. *
  33356. * @static
  33357. * @since 0.1.0
  33358. * @memberOf _
  33359. * @category Util
  33360. * @param {number} [start=0] The start of the range.
  33361. * @param {number} end The end of the range.
  33362. * @param {number} [step=1] The value to increment or decrement by.
  33363. * @returns {Array} Returns the range of numbers.
  33364. * @see _.inRange, _.rangeRight
  33365. * @example
  33366. *
  33367. * _.range(4);
  33368. * // => [0, 1, 2, 3]
  33369. *
  33370. * _.range(-4);
  33371. * // => [0, -1, -2, -3]
  33372. *
  33373. * _.range(1, 5);
  33374. * // => [1, 2, 3, 4]
  33375. *
  33376. * _.range(0, 20, 5);
  33377. * // => [0, 5, 10, 15]
  33378. *
  33379. * _.range(0, -4, -1);
  33380. * // => [0, -1, -2, -3]
  33381. *
  33382. * _.range(1, 4, 0);
  33383. * // => [1, 1, 1]
  33384. *
  33385. * _.range(0);
  33386. * // => []
  33387. */
  33388. var range = createRange();
  33389. /**
  33390. * This method is like `_.range` except that it populates values in
  33391. * descending order.
  33392. *
  33393. * @static
  33394. * @memberOf _
  33395. * @since 4.0.0
  33396. * @category Util
  33397. * @param {number} [start=0] The start of the range.
  33398. * @param {number} end The end of the range.
  33399. * @param {number} [step=1] The value to increment or decrement by.
  33400. * @returns {Array} Returns the range of numbers.
  33401. * @see _.inRange, _.range
  33402. * @example
  33403. *
  33404. * _.rangeRight(4);
  33405. * // => [3, 2, 1, 0]
  33406. *
  33407. * _.rangeRight(-4);
  33408. * // => [-3, -2, -1, 0]
  33409. *
  33410. * _.rangeRight(1, 5);
  33411. * // => [4, 3, 2, 1]
  33412. *
  33413. * _.rangeRight(0, 20, 5);
  33414. * // => [15, 10, 5, 0]
  33415. *
  33416. * _.rangeRight(0, -4, -1);
  33417. * // => [-3, -2, -1, 0]
  33418. *
  33419. * _.rangeRight(1, 4, 0);
  33420. * // => [1, 1, 1]
  33421. *
  33422. * _.rangeRight(0);
  33423. * // => []
  33424. */
  33425. var rangeRight = createRange(true);
  33426. /**
  33427. * This method returns a new empty array.
  33428. *
  33429. * @static
  33430. * @memberOf _
  33431. * @since 4.13.0
  33432. * @category Util
  33433. * @returns {Array} Returns the new empty array.
  33434. * @example
  33435. *
  33436. * var arrays = _.times(2, _.stubArray);
  33437. *
  33438. * console.log(arrays);
  33439. * // => [[], []]
  33440. *
  33441. * console.log(arrays[0] === arrays[1]);
  33442. * // => false
  33443. */
  33444. function stubArray() {
  33445. return [];
  33446. }
  33447. /**
  33448. * This method returns `false`.
  33449. *
  33450. * @static
  33451. * @memberOf _
  33452. * @since 4.13.0
  33453. * @category Util
  33454. * @returns {boolean} Returns `false`.
  33455. * @example
  33456. *
  33457. * _.times(2, _.stubFalse);
  33458. * // => [false, false]
  33459. */
  33460. function stubFalse() {
  33461. return false;
  33462. }
  33463. /**
  33464. * This method returns a new empty object.
  33465. *
  33466. * @static
  33467. * @memberOf _
  33468. * @since 4.13.0
  33469. * @category Util
  33470. * @returns {Object} Returns the new empty object.
  33471. * @example
  33472. *
  33473. * var objects = _.times(2, _.stubObject);
  33474. *
  33475. * console.log(objects);
  33476. * // => [{}, {}]
  33477. *
  33478. * console.log(objects[0] === objects[1]);
  33479. * // => false
  33480. */
  33481. function stubObject() {
  33482. return {};
  33483. }
  33484. /**
  33485. * This method returns an empty string.
  33486. *
  33487. * @static
  33488. * @memberOf _
  33489. * @since 4.13.0
  33490. * @category Util
  33491. * @returns {string} Returns the empty string.
  33492. * @example
  33493. *
  33494. * _.times(2, _.stubString);
  33495. * // => ['', '']
  33496. */
  33497. function stubString() {
  33498. return '';
  33499. }
  33500. /**
  33501. * This method returns `true`.
  33502. *
  33503. * @static
  33504. * @memberOf _
  33505. * @since 4.13.0
  33506. * @category Util
  33507. * @returns {boolean} Returns `true`.
  33508. * @example
  33509. *
  33510. * _.times(2, _.stubTrue);
  33511. * // => [true, true]
  33512. */
  33513. function stubTrue() {
  33514. return true;
  33515. }
  33516. /**
  33517. * Invokes the iteratee `n` times, returning an array of the results of
  33518. * each invocation. The iteratee is invoked with one argument; (index).
  33519. *
  33520. * @static
  33521. * @since 0.1.0
  33522. * @memberOf _
  33523. * @category Util
  33524. * @param {number} n The number of times to invoke `iteratee`.
  33525. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  33526. * @returns {Array} Returns the array of results.
  33527. * @example
  33528. *
  33529. * _.times(3, String);
  33530. * // => ['0', '1', '2']
  33531. *
  33532. * _.times(4, _.constant(0));
  33533. * // => [0, 0, 0, 0]
  33534. */
  33535. function times(n, iteratee) {
  33536. n = toInteger(n);
  33537. if (n < 1 || n > MAX_SAFE_INTEGER) {
  33538. return [];
  33539. }
  33540. var index = MAX_ARRAY_LENGTH,
  33541. length = nativeMin(n, MAX_ARRAY_LENGTH);
  33542. iteratee = getIteratee(iteratee);
  33543. n -= MAX_ARRAY_LENGTH;
  33544. var result = baseTimes(length, iteratee);
  33545. while (++index < n) {
  33546. iteratee(index);
  33547. }
  33548. return result;
  33549. }
  33550. /**
  33551. * Converts `value` to a property path array.
  33552. *
  33553. * @static
  33554. * @memberOf _
  33555. * @since 4.0.0
  33556. * @category Util
  33557. * @param {*} value The value to convert.
  33558. * @returns {Array} Returns the new property path array.
  33559. * @example
  33560. *
  33561. * _.toPath('a.b.c');
  33562. * // => ['a', 'b', 'c']
  33563. *
  33564. * _.toPath('a[0].b.c');
  33565. * // => ['a', '0', 'b', 'c']
  33566. */
  33567. function toPath(value) {
  33568. if (isArray(value)) {
  33569. return arrayMap(value, toKey);
  33570. }
  33571. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  33572. }
  33573. /**
  33574. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  33575. *
  33576. * @static
  33577. * @since 0.1.0
  33578. * @memberOf _
  33579. * @category Util
  33580. * @param {string} [prefix=''] The value to prefix the ID with.
  33581. * @returns {string} Returns the unique ID.
  33582. * @example
  33583. *
  33584. * _.uniqueId('contact_');
  33585. * // => 'contact_104'
  33586. *
  33587. * _.uniqueId();
  33588. * // => '105'
  33589. */
  33590. function uniqueId(prefix) {
  33591. var id = ++idCounter;
  33592. return toString(prefix) + id;
  33593. }
  33594. /*------------------------------------------------------------------------*/
  33595. /**
  33596. * Adds two numbers.
  33597. *
  33598. * @static
  33599. * @memberOf _
  33600. * @since 3.4.0
  33601. * @category Math
  33602. * @param {number} augend The first number in an addition.
  33603. * @param {number} addend The second number in an addition.
  33604. * @returns {number} Returns the total.
  33605. * @example
  33606. *
  33607. * _.add(6, 4);
  33608. * // => 10
  33609. */
  33610. var add = createMathOperation(function(augend, addend) {
  33611. return augend + addend;
  33612. }, 0);
  33613. /**
  33614. * Computes `number` rounded up to `precision`.
  33615. *
  33616. * @static
  33617. * @memberOf _
  33618. * @since 3.10.0
  33619. * @category Math
  33620. * @param {number} number The number to round up.
  33621. * @param {number} [precision=0] The precision to round up to.
  33622. * @returns {number} Returns the rounded up number.
  33623. * @example
  33624. *
  33625. * _.ceil(4.006);
  33626. * // => 5
  33627. *
  33628. * _.ceil(6.004, 2);
  33629. * // => 6.01
  33630. *
  33631. * _.ceil(6040, -2);
  33632. * // => 6100
  33633. */
  33634. var ceil = createRound('ceil');
  33635. /**
  33636. * Divide two numbers.
  33637. *
  33638. * @static
  33639. * @memberOf _
  33640. * @since 4.7.0
  33641. * @category Math
  33642. * @param {number} dividend The first number in a division.
  33643. * @param {number} divisor The second number in a division.
  33644. * @returns {number} Returns the quotient.
  33645. * @example
  33646. *
  33647. * _.divide(6, 4);
  33648. * // => 1.5
  33649. */
  33650. var divide = createMathOperation(function(dividend, divisor) {
  33651. return dividend / divisor;
  33652. }, 1);
  33653. /**
  33654. * Computes `number` rounded down to `precision`.
  33655. *
  33656. * @static
  33657. * @memberOf _
  33658. * @since 3.10.0
  33659. * @category Math
  33660. * @param {number} number The number to round down.
  33661. * @param {number} [precision=0] The precision to round down to.
  33662. * @returns {number} Returns the rounded down number.
  33663. * @example
  33664. *
  33665. * _.floor(4.006);
  33666. * // => 4
  33667. *
  33668. * _.floor(0.046, 2);
  33669. * // => 0.04
  33670. *
  33671. * _.floor(4060, -2);
  33672. * // => 4000
  33673. */
  33674. var floor = createRound('floor');
  33675. /**
  33676. * Computes the maximum value of `array`. If `array` is empty or falsey,
  33677. * `undefined` is returned.
  33678. *
  33679. * @static
  33680. * @since 0.1.0
  33681. * @memberOf _
  33682. * @category Math
  33683. * @param {Array} array The array to iterate over.
  33684. * @returns {*} Returns the maximum value.
  33685. * @example
  33686. *
  33687. * _.max([4, 2, 8, 6]);
  33688. * // => 8
  33689. *
  33690. * _.max([]);
  33691. * // => undefined
  33692. */
  33693. function max(array) {
  33694. return (array && array.length)
  33695. ? baseExtremum(array, identity, baseGt)
  33696. : undefined;
  33697. }
  33698. /**
  33699. * This method is like `_.max` except that it accepts `iteratee` which is
  33700. * invoked for each element in `array` to generate the criterion by which
  33701. * the value is ranked. The iteratee is invoked with one argument: (value).
  33702. *
  33703. * @static
  33704. * @memberOf _
  33705. * @since 4.0.0
  33706. * @category Math
  33707. * @param {Array} array The array to iterate over.
  33708. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33709. * @returns {*} Returns the maximum value.
  33710. * @example
  33711. *
  33712. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33713. *
  33714. * _.maxBy(objects, function(o) { return o.n; });
  33715. * // => { 'n': 2 }
  33716. *
  33717. * // The `_.property` iteratee shorthand.
  33718. * _.maxBy(objects, 'n');
  33719. * // => { 'n': 2 }
  33720. */
  33721. function maxBy(array, iteratee) {
  33722. return (array && array.length)
  33723. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  33724. : undefined;
  33725. }
  33726. /**
  33727. * Computes the mean of the values in `array`.
  33728. *
  33729. * @static
  33730. * @memberOf _
  33731. * @since 4.0.0
  33732. * @category Math
  33733. * @param {Array} array The array to iterate over.
  33734. * @returns {number} Returns the mean.
  33735. * @example
  33736. *
  33737. * _.mean([4, 2, 8, 6]);
  33738. * // => 5
  33739. */
  33740. function mean(array) {
  33741. return baseMean(array, identity);
  33742. }
  33743. /**
  33744. * This method is like `_.mean` except that it accepts `iteratee` which is
  33745. * invoked for each element in `array` to generate the value to be averaged.
  33746. * The iteratee is invoked with one argument: (value).
  33747. *
  33748. * @static
  33749. * @memberOf _
  33750. * @since 4.7.0
  33751. * @category Math
  33752. * @param {Array} array The array to iterate over.
  33753. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33754. * @returns {number} Returns the mean.
  33755. * @example
  33756. *
  33757. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33758. *
  33759. * _.meanBy(objects, function(o) { return o.n; });
  33760. * // => 5
  33761. *
  33762. * // The `_.property` iteratee shorthand.
  33763. * _.meanBy(objects, 'n');
  33764. * // => 5
  33765. */
  33766. function meanBy(array, iteratee) {
  33767. return baseMean(array, getIteratee(iteratee, 2));
  33768. }
  33769. /**
  33770. * Computes the minimum value of `array`. If `array` is empty or falsey,
  33771. * `undefined` is returned.
  33772. *
  33773. * @static
  33774. * @since 0.1.0
  33775. * @memberOf _
  33776. * @category Math
  33777. * @param {Array} array The array to iterate over.
  33778. * @returns {*} Returns the minimum value.
  33779. * @example
  33780. *
  33781. * _.min([4, 2, 8, 6]);
  33782. * // => 2
  33783. *
  33784. * _.min([]);
  33785. * // => undefined
  33786. */
  33787. function min(array) {
  33788. return (array && array.length)
  33789. ? baseExtremum(array, identity, baseLt)
  33790. : undefined;
  33791. }
  33792. /**
  33793. * This method is like `_.min` except that it accepts `iteratee` which is
  33794. * invoked for each element in `array` to generate the criterion by which
  33795. * the value is ranked. The iteratee is invoked with one argument: (value).
  33796. *
  33797. * @static
  33798. * @memberOf _
  33799. * @since 4.0.0
  33800. * @category Math
  33801. * @param {Array} array The array to iterate over.
  33802. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33803. * @returns {*} Returns the minimum value.
  33804. * @example
  33805. *
  33806. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33807. *
  33808. * _.minBy(objects, function(o) { return o.n; });
  33809. * // => { 'n': 1 }
  33810. *
  33811. * // The `_.property` iteratee shorthand.
  33812. * _.minBy(objects, 'n');
  33813. * // => { 'n': 1 }
  33814. */
  33815. function minBy(array, iteratee) {
  33816. return (array && array.length)
  33817. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  33818. : undefined;
  33819. }
  33820. /**
  33821. * Multiply two numbers.
  33822. *
  33823. * @static
  33824. * @memberOf _
  33825. * @since 4.7.0
  33826. * @category Math
  33827. * @param {number} multiplier The first number in a multiplication.
  33828. * @param {number} multiplicand The second number in a multiplication.
  33829. * @returns {number} Returns the product.
  33830. * @example
  33831. *
  33832. * _.multiply(6, 4);
  33833. * // => 24
  33834. */
  33835. var multiply = createMathOperation(function(multiplier, multiplicand) {
  33836. return multiplier * multiplicand;
  33837. }, 1);
  33838. /**
  33839. * Computes `number` rounded to `precision`.
  33840. *
  33841. * @static
  33842. * @memberOf _
  33843. * @since 3.10.0
  33844. * @category Math
  33845. * @param {number} number The number to round.
  33846. * @param {number} [precision=0] The precision to round to.
  33847. * @returns {number} Returns the rounded number.
  33848. * @example
  33849. *
  33850. * _.round(4.006);
  33851. * // => 4
  33852. *
  33853. * _.round(4.006, 2);
  33854. * // => 4.01
  33855. *
  33856. * _.round(4060, -2);
  33857. * // => 4100
  33858. */
  33859. var round = createRound('round');
  33860. /**
  33861. * Subtract two numbers.
  33862. *
  33863. * @static
  33864. * @memberOf _
  33865. * @since 4.0.0
  33866. * @category Math
  33867. * @param {number} minuend The first number in a subtraction.
  33868. * @param {number} subtrahend The second number in a subtraction.
  33869. * @returns {number} Returns the difference.
  33870. * @example
  33871. *
  33872. * _.subtract(6, 4);
  33873. * // => 2
  33874. */
  33875. var subtract = createMathOperation(function(minuend, subtrahend) {
  33876. return minuend - subtrahend;
  33877. }, 0);
  33878. /**
  33879. * Computes the sum of the values in `array`.
  33880. *
  33881. * @static
  33882. * @memberOf _
  33883. * @since 3.4.0
  33884. * @category Math
  33885. * @param {Array} array The array to iterate over.
  33886. * @returns {number} Returns the sum.
  33887. * @example
  33888. *
  33889. * _.sum([4, 2, 8, 6]);
  33890. * // => 20
  33891. */
  33892. function sum(array) {
  33893. return (array && array.length)
  33894. ? baseSum(array, identity)
  33895. : 0;
  33896. }
  33897. /**
  33898. * This method is like `_.sum` except that it accepts `iteratee` which is
  33899. * invoked for each element in `array` to generate the value to be summed.
  33900. * The iteratee is invoked with one argument: (value).
  33901. *
  33902. * @static
  33903. * @memberOf _
  33904. * @since 4.0.0
  33905. * @category Math
  33906. * @param {Array} array The array to iterate over.
  33907. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33908. * @returns {number} Returns the sum.
  33909. * @example
  33910. *
  33911. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33912. *
  33913. * _.sumBy(objects, function(o) { return o.n; });
  33914. * // => 20
  33915. *
  33916. * // The `_.property` iteratee shorthand.
  33917. * _.sumBy(objects, 'n');
  33918. * // => 20
  33919. */
  33920. function sumBy(array, iteratee) {
  33921. return (array && array.length)
  33922. ? baseSum(array, getIteratee(iteratee, 2))
  33923. : 0;
  33924. }
  33925. /*------------------------------------------------------------------------*/
  33926. // Add methods that return wrapped values in chain sequences.
  33927. lodash.after = after;
  33928. lodash.ary = ary;
  33929. lodash.assign = assign;
  33930. lodash.assignIn = assignIn;
  33931. lodash.assignInWith = assignInWith;
  33932. lodash.assignWith = assignWith;
  33933. lodash.at = at;
  33934. lodash.before = before;
  33935. lodash.bind = bind;
  33936. lodash.bindAll = bindAll;
  33937. lodash.bindKey = bindKey;
  33938. lodash.castArray = castArray;
  33939. lodash.chain = chain;
  33940. lodash.chunk = chunk;
  33941. lodash.compact = compact;
  33942. lodash.concat = concat;
  33943. lodash.cond = cond;
  33944. lodash.conforms = conforms;
  33945. lodash.constant = constant;
  33946. lodash.countBy = countBy;
  33947. lodash.create = create;
  33948. lodash.curry = curry;
  33949. lodash.curryRight = curryRight;
  33950. lodash.debounce = debounce;
  33951. lodash.defaults = defaults;
  33952. lodash.defaultsDeep = defaultsDeep;
  33953. lodash.defer = defer;
  33954. lodash.delay = delay;
  33955. lodash.difference = difference;
  33956. lodash.differenceBy = differenceBy;
  33957. lodash.differenceWith = differenceWith;
  33958. lodash.drop = drop;
  33959. lodash.dropRight = dropRight;
  33960. lodash.dropRightWhile = dropRightWhile;
  33961. lodash.dropWhile = dropWhile;
  33962. lodash.fill = fill;
  33963. lodash.filter = filter;
  33964. lodash.flatMap = flatMap;
  33965. lodash.flatMapDeep = flatMapDeep;
  33966. lodash.flatMapDepth = flatMapDepth;
  33967. lodash.flatten = flatten;
  33968. lodash.flattenDeep = flattenDeep;
  33969. lodash.flattenDepth = flattenDepth;
  33970. lodash.flip = flip;
  33971. lodash.flow = flow;
  33972. lodash.flowRight = flowRight;
  33973. lodash.fromPairs = fromPairs;
  33974. lodash.functions = functions;
  33975. lodash.functionsIn = functionsIn;
  33976. lodash.groupBy = groupBy;
  33977. lodash.initial = initial;
  33978. lodash.intersection = intersection;
  33979. lodash.intersectionBy = intersectionBy;
  33980. lodash.intersectionWith = intersectionWith;
  33981. lodash.invert = invert;
  33982. lodash.invertBy = invertBy;
  33983. lodash.invokeMap = invokeMap;
  33984. lodash.iteratee = iteratee;
  33985. lodash.keyBy = keyBy;
  33986. lodash.keys = keys;
  33987. lodash.keysIn = keysIn;
  33988. lodash.map = map;
  33989. lodash.mapKeys = mapKeys;
  33990. lodash.mapValues = mapValues;
  33991. lodash.matches = matches;
  33992. lodash.matchesProperty = matchesProperty;
  33993. lodash.memoize = memoize;
  33994. lodash.merge = merge;
  33995. lodash.mergeWith = mergeWith;
  33996. lodash.method = method;
  33997. lodash.methodOf = methodOf;
  33998. lodash.mixin = mixin;
  33999. lodash.negate = negate;
  34000. lodash.nthArg = nthArg;
  34001. lodash.omit = omit;
  34002. lodash.omitBy = omitBy;
  34003. lodash.once = once;
  34004. lodash.orderBy = orderBy;
  34005. lodash.over = over;
  34006. lodash.overArgs = overArgs;
  34007. lodash.overEvery = overEvery;
  34008. lodash.overSome = overSome;
  34009. lodash.partial = partial;
  34010. lodash.partialRight = partialRight;
  34011. lodash.partition = partition;
  34012. lodash.pick = pick;
  34013. lodash.pickBy = pickBy;
  34014. lodash.property = property;
  34015. lodash.propertyOf = propertyOf;
  34016. lodash.pull = pull;
  34017. lodash.pullAll = pullAll;
  34018. lodash.pullAllBy = pullAllBy;
  34019. lodash.pullAllWith = pullAllWith;
  34020. lodash.pullAt = pullAt;
  34021. lodash.range = range;
  34022. lodash.rangeRight = rangeRight;
  34023. lodash.rearg = rearg;
  34024. lodash.reject = reject;
  34025. lodash.remove = remove;
  34026. lodash.rest = rest;
  34027. lodash.reverse = reverse;
  34028. lodash.sampleSize = sampleSize;
  34029. lodash.set = set;
  34030. lodash.setWith = setWith;
  34031. lodash.shuffle = shuffle;
  34032. lodash.slice = slice;
  34033. lodash.sortBy = sortBy;
  34034. lodash.sortedUniq = sortedUniq;
  34035. lodash.sortedUniqBy = sortedUniqBy;
  34036. lodash.split = split;
  34037. lodash.spread = spread;
  34038. lodash.tail = tail;
  34039. lodash.take = take;
  34040. lodash.takeRight = takeRight;
  34041. lodash.takeRightWhile = takeRightWhile;
  34042. lodash.takeWhile = takeWhile;
  34043. lodash.tap = tap;
  34044. lodash.throttle = throttle;
  34045. lodash.thru = thru;
  34046. lodash.toArray = toArray;
  34047. lodash.toPairs = toPairs;
  34048. lodash.toPairsIn = toPairsIn;
  34049. lodash.toPath = toPath;
  34050. lodash.toPlainObject = toPlainObject;
  34051. lodash.transform = transform;
  34052. lodash.unary = unary;
  34053. lodash.union = union;
  34054. lodash.unionBy = unionBy;
  34055. lodash.unionWith = unionWith;
  34056. lodash.uniq = uniq;
  34057. lodash.uniqBy = uniqBy;
  34058. lodash.uniqWith = uniqWith;
  34059. lodash.unset = unset;
  34060. lodash.unzip = unzip;
  34061. lodash.unzipWith = unzipWith;
  34062. lodash.update = update;
  34063. lodash.updateWith = updateWith;
  34064. lodash.values = values;
  34065. lodash.valuesIn = valuesIn;
  34066. lodash.without = without;
  34067. lodash.words = words;
  34068. lodash.wrap = wrap;
  34069. lodash.xor = xor;
  34070. lodash.xorBy = xorBy;
  34071. lodash.xorWith = xorWith;
  34072. lodash.zip = zip;
  34073. lodash.zipObject = zipObject;
  34074. lodash.zipObjectDeep = zipObjectDeep;
  34075. lodash.zipWith = zipWith;
  34076. // Add aliases.
  34077. lodash.entries = toPairs;
  34078. lodash.entriesIn = toPairsIn;
  34079. lodash.extend = assignIn;
  34080. lodash.extendWith = assignInWith;
  34081. // Add methods to `lodash.prototype`.
  34082. mixin(lodash, lodash);
  34083. /*------------------------------------------------------------------------*/
  34084. // Add methods that return unwrapped values in chain sequences.
  34085. lodash.add = add;
  34086. lodash.attempt = attempt;
  34087. lodash.camelCase = camelCase;
  34088. lodash.capitalize = capitalize;
  34089. lodash.ceil = ceil;
  34090. lodash.clamp = clamp;
  34091. lodash.clone = clone;
  34092. lodash.cloneDeep = cloneDeep;
  34093. lodash.cloneDeepWith = cloneDeepWith;
  34094. lodash.cloneWith = cloneWith;
  34095. lodash.conformsTo = conformsTo;
  34096. lodash.deburr = deburr;
  34097. lodash.defaultTo = defaultTo;
  34098. lodash.divide = divide;
  34099. lodash.endsWith = endsWith;
  34100. lodash.eq = eq;
  34101. lodash.escape = escape;
  34102. lodash.escapeRegExp = escapeRegExp;
  34103. lodash.every = every;
  34104. lodash.find = find;
  34105. lodash.findIndex = findIndex;
  34106. lodash.findKey = findKey;
  34107. lodash.findLast = findLast;
  34108. lodash.findLastIndex = findLastIndex;
  34109. lodash.findLastKey = findLastKey;
  34110. lodash.floor = floor;
  34111. lodash.forEach = forEach;
  34112. lodash.forEachRight = forEachRight;
  34113. lodash.forIn = forIn;
  34114. lodash.forInRight = forInRight;
  34115. lodash.forOwn = forOwn;
  34116. lodash.forOwnRight = forOwnRight;
  34117. lodash.get = get;
  34118. lodash.gt = gt;
  34119. lodash.gte = gte;
  34120. lodash.has = has;
  34121. lodash.hasIn = hasIn;
  34122. lodash.head = head;
  34123. lodash.identity = identity;
  34124. lodash.includes = includes;
  34125. lodash.indexOf = indexOf;
  34126. lodash.inRange = inRange;
  34127. lodash.invoke = invoke;
  34128. lodash.isArguments = isArguments;
  34129. lodash.isArray = isArray;
  34130. lodash.isArrayBuffer = isArrayBuffer;
  34131. lodash.isArrayLike = isArrayLike;
  34132. lodash.isArrayLikeObject = isArrayLikeObject;
  34133. lodash.isBoolean = isBoolean;
  34134. lodash.isBuffer = isBuffer;
  34135. lodash.isDate = isDate;
  34136. lodash.isElement = isElement;
  34137. lodash.isEmpty = isEmpty;
  34138. lodash.isEqual = isEqual;
  34139. lodash.isEqualWith = isEqualWith;
  34140. lodash.isError = isError;
  34141. lodash.isFinite = isFinite;
  34142. lodash.isFunction = isFunction;
  34143. lodash.isInteger = isInteger;
  34144. lodash.isLength = isLength;
  34145. lodash.isMap = isMap;
  34146. lodash.isMatch = isMatch;
  34147. lodash.isMatchWith = isMatchWith;
  34148. lodash.isNaN = isNaN;
  34149. lodash.isNative = isNative;
  34150. lodash.isNil = isNil;
  34151. lodash.isNull = isNull;
  34152. lodash.isNumber = isNumber;
  34153. lodash.isObject = isObject;
  34154. lodash.isObjectLike = isObjectLike;
  34155. lodash.isPlainObject = isPlainObject;
  34156. lodash.isRegExp = isRegExp;
  34157. lodash.isSafeInteger = isSafeInteger;
  34158. lodash.isSet = isSet;
  34159. lodash.isString = isString;
  34160. lodash.isSymbol = isSymbol;
  34161. lodash.isTypedArray = isTypedArray;
  34162. lodash.isUndefined = isUndefined;
  34163. lodash.isWeakMap = isWeakMap;
  34164. lodash.isWeakSet = isWeakSet;
  34165. lodash.join = join;
  34166. lodash.kebabCase = kebabCase;
  34167. lodash.last = last;
  34168. lodash.lastIndexOf = lastIndexOf;
  34169. lodash.lowerCase = lowerCase;
  34170. lodash.lowerFirst = lowerFirst;
  34171. lodash.lt = lt;
  34172. lodash.lte = lte;
  34173. lodash.max = max;
  34174. lodash.maxBy = maxBy;
  34175. lodash.mean = mean;
  34176. lodash.meanBy = meanBy;
  34177. lodash.min = min;
  34178. lodash.minBy = minBy;
  34179. lodash.stubArray = stubArray;
  34180. lodash.stubFalse = stubFalse;
  34181. lodash.stubObject = stubObject;
  34182. lodash.stubString = stubString;
  34183. lodash.stubTrue = stubTrue;
  34184. lodash.multiply = multiply;
  34185. lodash.nth = nth;
  34186. lodash.noConflict = noConflict;
  34187. lodash.noop = noop;
  34188. lodash.now = now;
  34189. lodash.pad = pad;
  34190. lodash.padEnd = padEnd;
  34191. lodash.padStart = padStart;
  34192. lodash.parseInt = parseInt;
  34193. lodash.random = random;
  34194. lodash.reduce = reduce;
  34195. lodash.reduceRight = reduceRight;
  34196. lodash.repeat = repeat;
  34197. lodash.replace = replace;
  34198. lodash.result = result;
  34199. lodash.round = round;
  34200. lodash.runInContext = runInContext;
  34201. lodash.sample = sample;
  34202. lodash.size = size;
  34203. lodash.snakeCase = snakeCase;
  34204. lodash.some = some;
  34205. lodash.sortedIndex = sortedIndex;
  34206. lodash.sortedIndexBy = sortedIndexBy;
  34207. lodash.sortedIndexOf = sortedIndexOf;
  34208. lodash.sortedLastIndex = sortedLastIndex;
  34209. lodash.sortedLastIndexBy = sortedLastIndexBy;
  34210. lodash.sortedLastIndexOf = sortedLastIndexOf;
  34211. lodash.startCase = startCase;
  34212. lodash.startsWith = startsWith;
  34213. lodash.subtract = subtract;
  34214. lodash.sum = sum;
  34215. lodash.sumBy = sumBy;
  34216. lodash.template = template;
  34217. lodash.times = times;
  34218. lodash.toFinite = toFinite;
  34219. lodash.toInteger = toInteger;
  34220. lodash.toLength = toLength;
  34221. lodash.toLower = toLower;
  34222. lodash.toNumber = toNumber;
  34223. lodash.toSafeInteger = toSafeInteger;
  34224. lodash.toString = toString;
  34225. lodash.toUpper = toUpper;
  34226. lodash.trim = trim;
  34227. lodash.trimEnd = trimEnd;
  34228. lodash.trimStart = trimStart;
  34229. lodash.truncate = truncate;
  34230. lodash.unescape = unescape;
  34231. lodash.uniqueId = uniqueId;
  34232. lodash.upperCase = upperCase;
  34233. lodash.upperFirst = upperFirst;
  34234. // Add aliases.
  34235. lodash.each = forEach;
  34236. lodash.eachRight = forEachRight;
  34237. lodash.first = head;
  34238. mixin(lodash, (function() {
  34239. var source = {};
  34240. baseForOwn(lodash, function(func, methodName) {
  34241. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  34242. source[methodName] = func;
  34243. }
  34244. });
  34245. return source;
  34246. }()), { 'chain': false });
  34247. /*------------------------------------------------------------------------*/
  34248. /**
  34249. * The semantic version number.
  34250. *
  34251. * @static
  34252. * @memberOf _
  34253. * @type {string}
  34254. */
  34255. lodash.VERSION = VERSION;
  34256. // Assign default placeholders.
  34257. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  34258. lodash[methodName].placeholder = lodash;
  34259. });
  34260. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  34261. arrayEach(['drop', 'take'], function(methodName, index) {
  34262. LazyWrapper.prototype[methodName] = function(n) {
  34263. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  34264. var result = (this.__filtered__ && !index)
  34265. ? new LazyWrapper(this)
  34266. : this.clone();
  34267. if (result.__filtered__) {
  34268. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  34269. } else {
  34270. result.__views__.push({
  34271. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  34272. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  34273. });
  34274. }
  34275. return result;
  34276. };
  34277. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  34278. return this.reverse()[methodName](n).reverse();
  34279. };
  34280. });
  34281. // Add `LazyWrapper` methods that accept an `iteratee` value.
  34282. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  34283. var type = index + 1,
  34284. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  34285. LazyWrapper.prototype[methodName] = function(iteratee) {
  34286. var result = this.clone();
  34287. result.__iteratees__.push({
  34288. 'iteratee': getIteratee(iteratee, 3),
  34289. 'type': type
  34290. });
  34291. result.__filtered__ = result.__filtered__ || isFilter;
  34292. return result;
  34293. };
  34294. });
  34295. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  34296. arrayEach(['head', 'last'], function(methodName, index) {
  34297. var takeName = 'take' + (index ? 'Right' : '');
  34298. LazyWrapper.prototype[methodName] = function() {
  34299. return this[takeName](1).value()[0];
  34300. };
  34301. });
  34302. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  34303. arrayEach(['initial', 'tail'], function(methodName, index) {
  34304. var dropName = 'drop' + (index ? '' : 'Right');
  34305. LazyWrapper.prototype[methodName] = function() {
  34306. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  34307. };
  34308. });
  34309. LazyWrapper.prototype.compact = function() {
  34310. return this.filter(identity);
  34311. };
  34312. LazyWrapper.prototype.find = function(predicate) {
  34313. return this.filter(predicate).head();
  34314. };
  34315. LazyWrapper.prototype.findLast = function(predicate) {
  34316. return this.reverse().find(predicate);
  34317. };
  34318. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  34319. if (typeof path == 'function') {
  34320. return new LazyWrapper(this);
  34321. }
  34322. return this.map(function(value) {
  34323. return baseInvoke(value, path, args);
  34324. });
  34325. });
  34326. LazyWrapper.prototype.reject = function(predicate) {
  34327. return this.filter(negate(getIteratee(predicate)));
  34328. };
  34329. LazyWrapper.prototype.slice = function(start, end) {
  34330. start = toInteger(start);
  34331. var result = this;
  34332. if (result.__filtered__ && (start > 0 || end < 0)) {
  34333. return new LazyWrapper(result);
  34334. }
  34335. if (start < 0) {
  34336. result = result.takeRight(-start);
  34337. } else if (start) {
  34338. result = result.drop(start);
  34339. }
  34340. if (end !== undefined) {
  34341. end = toInteger(end);
  34342. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  34343. }
  34344. return result;
  34345. };
  34346. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  34347. return this.reverse().takeWhile(predicate).reverse();
  34348. };
  34349. LazyWrapper.prototype.toArray = function() {
  34350. return this.take(MAX_ARRAY_LENGTH);
  34351. };
  34352. // Add `LazyWrapper` methods to `lodash.prototype`.
  34353. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34354. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  34355. isTaker = /^(?:head|last)$/.test(methodName),
  34356. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  34357. retUnwrapped = isTaker || /^find/.test(methodName);
  34358. if (!lodashFunc) {
  34359. return;
  34360. }
  34361. lodash.prototype[methodName] = function() {
  34362. var value = this.__wrapped__,
  34363. args = isTaker ? [1] : arguments,
  34364. isLazy = value instanceof LazyWrapper,
  34365. iteratee = args[0],
  34366. useLazy = isLazy || isArray(value);
  34367. var interceptor = function(value) {
  34368. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  34369. return (isTaker && chainAll) ? result[0] : result;
  34370. };
  34371. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  34372. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  34373. isLazy = useLazy = false;
  34374. }
  34375. var chainAll = this.__chain__,
  34376. isHybrid = !!this.__actions__.length,
  34377. isUnwrapped = retUnwrapped && !chainAll,
  34378. onlyLazy = isLazy && !isHybrid;
  34379. if (!retUnwrapped && useLazy) {
  34380. value = onlyLazy ? value : new LazyWrapper(this);
  34381. var result = func.apply(value, args);
  34382. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  34383. return new LodashWrapper(result, chainAll);
  34384. }
  34385. if (isUnwrapped && onlyLazy) {
  34386. return func.apply(this, args);
  34387. }
  34388. result = this.thru(interceptor);
  34389. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  34390. };
  34391. });
  34392. // Add `Array` methods to `lodash.prototype`.
  34393. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  34394. var func = arrayProto[methodName],
  34395. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  34396. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  34397. lodash.prototype[methodName] = function() {
  34398. var args = arguments;
  34399. if (retUnwrapped && !this.__chain__) {
  34400. var value = this.value();
  34401. return func.apply(isArray(value) ? value : [], args);
  34402. }
  34403. return this[chainName](function(value) {
  34404. return func.apply(isArray(value) ? value : [], args);
  34405. });
  34406. };
  34407. });
  34408. // Map minified method names to their real names.
  34409. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34410. var lodashFunc = lodash[methodName];
  34411. if (lodashFunc) {
  34412. var key = lodashFunc.name + '';
  34413. if (!hasOwnProperty.call(realNames, key)) {
  34414. realNames[key] = [];
  34415. }
  34416. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  34417. }
  34418. });
  34419. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  34420. 'name': 'wrapper',
  34421. 'func': undefined
  34422. }];
  34423. // Add methods to `LazyWrapper`.
  34424. LazyWrapper.prototype.clone = lazyClone;
  34425. LazyWrapper.prototype.reverse = lazyReverse;
  34426. LazyWrapper.prototype.value = lazyValue;
  34427. // Add chain sequence methods to the `lodash` wrapper.
  34428. lodash.prototype.at = wrapperAt;
  34429. lodash.prototype.chain = wrapperChain;
  34430. lodash.prototype.commit = wrapperCommit;
  34431. lodash.prototype.next = wrapperNext;
  34432. lodash.prototype.plant = wrapperPlant;
  34433. lodash.prototype.reverse = wrapperReverse;
  34434. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  34435. // Add lazy aliases.
  34436. lodash.prototype.first = lodash.prototype.head;
  34437. if (symIterator) {
  34438. lodash.prototype[symIterator] = wrapperToIterator;
  34439. }
  34440. return lodash;
  34441. });
  34442. /*--------------------------------------------------------------------------*/
  34443. // Export lodash.
  34444. var _ = runInContext();
  34445. // Some AMD build optimizers, like r.js, check for condition patterns like:
  34446. if (true) {
  34447. // Expose Lodash on the global object to prevent errors when Lodash is
  34448. // loaded by a script tag in the presence of an AMD loader.
  34449. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  34450. // Use `_.noConflict` to remove Lodash from the global object.
  34451. root._ = _;
  34452. // Define as an anonymous module so, through path mapping, it can be
  34453. // referenced as the "underscore" module.
  34454. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  34455. return _;
  34456. }).call(exports, __webpack_require__, exports, module),
  34457. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  34458. }
  34459. // Check for `exports` after `define` in case a build optimizer adds it.
  34460. else {}
  34461. }.call(this));
  34462. /* 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)))
  34463. /***/ }),
  34464. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  34465. /*!***************************************************!*\
  34466. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  34467. \***************************************************/
  34468. /*! exports provided: default */
  34469. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  34470. "use strict";
  34471. __webpack_require__.r(__webpack_exports__);
  34472. /* WEBPACK VAR INJECTION */(function(global) {/**!
  34473. * @fileOverview Kickass library to create and place poppers near their reference elements.
  34474. * @version 1.16.1
  34475. * @license
  34476. * Copyright (c) 2016 Federico Zivolo and contributors
  34477. *
  34478. * Permission is hereby granted, free of charge, to any person obtaining a copy
  34479. * of this software and associated documentation files (the "Software"), to deal
  34480. * in the Software without restriction, including without limitation the rights
  34481. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  34482. * copies of the Software, and to permit persons to whom the Software is
  34483. * furnished to do so, subject to the following conditions:
  34484. *
  34485. * The above copyright notice and this permission notice shall be included in all
  34486. * copies or substantial portions of the Software.
  34487. *
  34488. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  34489. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  34490. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  34491. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  34492. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  34493. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  34494. * SOFTWARE.
  34495. */
  34496. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  34497. var timeoutDuration = function () {
  34498. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  34499. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  34500. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  34501. return 1;
  34502. }
  34503. }
  34504. return 0;
  34505. }();
  34506. function microtaskDebounce(fn) {
  34507. var called = false;
  34508. return function () {
  34509. if (called) {
  34510. return;
  34511. }
  34512. called = true;
  34513. window.Promise.resolve().then(function () {
  34514. called = false;
  34515. fn();
  34516. });
  34517. };
  34518. }
  34519. function taskDebounce(fn) {
  34520. var scheduled = false;
  34521. return function () {
  34522. if (!scheduled) {
  34523. scheduled = true;
  34524. setTimeout(function () {
  34525. scheduled = false;
  34526. fn();
  34527. }, timeoutDuration);
  34528. }
  34529. };
  34530. }
  34531. var supportsMicroTasks = isBrowser && window.Promise;
  34532. /**
  34533. * Create a debounced version of a method, that's asynchronously deferred
  34534. * but called in the minimum time possible.
  34535. *
  34536. * @method
  34537. * @memberof Popper.Utils
  34538. * @argument {Function} fn
  34539. * @returns {Function}
  34540. */
  34541. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  34542. /**
  34543. * Check if the given variable is a function
  34544. * @method
  34545. * @memberof Popper.Utils
  34546. * @argument {Any} functionToCheck - variable to check
  34547. * @returns {Boolean} answer to: is a function?
  34548. */
  34549. function isFunction(functionToCheck) {
  34550. var getType = {};
  34551. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  34552. }
  34553. /**
  34554. * Get CSS computed property of the given element
  34555. * @method
  34556. * @memberof Popper.Utils
  34557. * @argument {Eement} element
  34558. * @argument {String} property
  34559. */
  34560. function getStyleComputedProperty(element, property) {
  34561. if (element.nodeType !== 1) {
  34562. return [];
  34563. }
  34564. // NOTE: 1 DOM access here
  34565. var window = element.ownerDocument.defaultView;
  34566. var css = window.getComputedStyle(element, null);
  34567. return property ? css[property] : css;
  34568. }
  34569. /**
  34570. * Returns the parentNode or the host of the element
  34571. * @method
  34572. * @memberof Popper.Utils
  34573. * @argument {Element} element
  34574. * @returns {Element} parent
  34575. */
  34576. function getParentNode(element) {
  34577. if (element.nodeName === 'HTML') {
  34578. return element;
  34579. }
  34580. return element.parentNode || element.host;
  34581. }
  34582. /**
  34583. * Returns the scrolling parent of the given element
  34584. * @method
  34585. * @memberof Popper.Utils
  34586. * @argument {Element} element
  34587. * @returns {Element} scroll parent
  34588. */
  34589. function getScrollParent(element) {
  34590. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  34591. if (!element) {
  34592. return document.body;
  34593. }
  34594. switch (element.nodeName) {
  34595. case 'HTML':
  34596. case 'BODY':
  34597. return element.ownerDocument.body;
  34598. case '#document':
  34599. return element.body;
  34600. }
  34601. // Firefox want us to check `-x` and `-y` variations as well
  34602. var _getStyleComputedProp = getStyleComputedProperty(element),
  34603. overflow = _getStyleComputedProp.overflow,
  34604. overflowX = _getStyleComputedProp.overflowX,
  34605. overflowY = _getStyleComputedProp.overflowY;
  34606. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  34607. return element;
  34608. }
  34609. return getScrollParent(getParentNode(element));
  34610. }
  34611. /**
  34612. * Returns the reference node of the reference object, or the reference object itself.
  34613. * @method
  34614. * @memberof Popper.Utils
  34615. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  34616. * @returns {Element} parent
  34617. */
  34618. function getReferenceNode(reference) {
  34619. return reference && reference.referenceNode ? reference.referenceNode : reference;
  34620. }
  34621. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  34622. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  34623. /**
  34624. * Determines if the browser is Internet Explorer
  34625. * @method
  34626. * @memberof Popper.Utils
  34627. * @param {Number} version to check
  34628. * @returns {Boolean} isIE
  34629. */
  34630. function isIE(version) {
  34631. if (version === 11) {
  34632. return isIE11;
  34633. }
  34634. if (version === 10) {
  34635. return isIE10;
  34636. }
  34637. return isIE11 || isIE10;
  34638. }
  34639. /**
  34640. * Returns the offset parent of the given element
  34641. * @method
  34642. * @memberof Popper.Utils
  34643. * @argument {Element} element
  34644. * @returns {Element} offset parent
  34645. */
  34646. function getOffsetParent(element) {
  34647. if (!element) {
  34648. return document.documentElement;
  34649. }
  34650. var noOffsetParent = isIE(10) ? document.body : null;
  34651. // NOTE: 1 DOM access here
  34652. var offsetParent = element.offsetParent || null;
  34653. // Skip hidden elements which don't have an offsetParent
  34654. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  34655. offsetParent = (element = element.nextElementSibling).offsetParent;
  34656. }
  34657. var nodeName = offsetParent && offsetParent.nodeName;
  34658. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  34659. return element ? element.ownerDocument.documentElement : document.documentElement;
  34660. }
  34661. // .offsetParent will return the closest TH, TD or TABLE in case
  34662. // no offsetParent is present, I hate this job...
  34663. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  34664. return getOffsetParent(offsetParent);
  34665. }
  34666. return offsetParent;
  34667. }
  34668. function isOffsetContainer(element) {
  34669. var nodeName = element.nodeName;
  34670. if (nodeName === 'BODY') {
  34671. return false;
  34672. }
  34673. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  34674. }
  34675. /**
  34676. * Finds the root node (document, shadowDOM root) of the given element
  34677. * @method
  34678. * @memberof Popper.Utils
  34679. * @argument {Element} node
  34680. * @returns {Element} root node
  34681. */
  34682. function getRoot(node) {
  34683. if (node.parentNode !== null) {
  34684. return getRoot(node.parentNode);
  34685. }
  34686. return node;
  34687. }
  34688. /**
  34689. * Finds the offset parent common to the two provided nodes
  34690. * @method
  34691. * @memberof Popper.Utils
  34692. * @argument {Element} element1
  34693. * @argument {Element} element2
  34694. * @returns {Element} common offset parent
  34695. */
  34696. function findCommonOffsetParent(element1, element2) {
  34697. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34698. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  34699. return document.documentElement;
  34700. }
  34701. // Here we make sure to give as "start" the element that comes first in the DOM
  34702. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  34703. var start = order ? element1 : element2;
  34704. var end = order ? element2 : element1;
  34705. // Get common ancestor container
  34706. var range = document.createRange();
  34707. range.setStart(start, 0);
  34708. range.setEnd(end, 0);
  34709. var commonAncestorContainer = range.commonAncestorContainer;
  34710. // Both nodes are inside #document
  34711. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  34712. if (isOffsetContainer(commonAncestorContainer)) {
  34713. return commonAncestorContainer;
  34714. }
  34715. return getOffsetParent(commonAncestorContainer);
  34716. }
  34717. // one of the nodes is inside shadowDOM, find which one
  34718. var element1root = getRoot(element1);
  34719. if (element1root.host) {
  34720. return findCommonOffsetParent(element1root.host, element2);
  34721. } else {
  34722. return findCommonOffsetParent(element1, getRoot(element2).host);
  34723. }
  34724. }
  34725. /**
  34726. * Gets the scroll value of the given element in the given side (top and left)
  34727. * @method
  34728. * @memberof Popper.Utils
  34729. * @argument {Element} element
  34730. * @argument {String} side `top` or `left`
  34731. * @returns {number} amount of scrolled pixels
  34732. */
  34733. function getScroll(element) {
  34734. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  34735. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  34736. var nodeName = element.nodeName;
  34737. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34738. var html = element.ownerDocument.documentElement;
  34739. var scrollingElement = element.ownerDocument.scrollingElement || html;
  34740. return scrollingElement[upperSide];
  34741. }
  34742. return element[upperSide];
  34743. }
  34744. /*
  34745. * Sum or subtract the element scroll values (left and top) from a given rect object
  34746. * @method
  34747. * @memberof Popper.Utils
  34748. * @param {Object} rect - Rect object you want to change
  34749. * @param {HTMLElement} element - The element from the function reads the scroll values
  34750. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  34751. * @return {Object} rect - The modifier rect object
  34752. */
  34753. function includeScroll(rect, element) {
  34754. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34755. var scrollTop = getScroll(element, 'top');
  34756. var scrollLeft = getScroll(element, 'left');
  34757. var modifier = subtract ? -1 : 1;
  34758. rect.top += scrollTop * modifier;
  34759. rect.bottom += scrollTop * modifier;
  34760. rect.left += scrollLeft * modifier;
  34761. rect.right += scrollLeft * modifier;
  34762. return rect;
  34763. }
  34764. /*
  34765. * Helper to detect borders of a given element
  34766. * @method
  34767. * @memberof Popper.Utils
  34768. * @param {CSSStyleDeclaration} styles
  34769. * Result of `getStyleComputedProperty` on the given element
  34770. * @param {String} axis - `x` or `y`
  34771. * @return {number} borders - The borders size of the given axis
  34772. */
  34773. function getBordersSize(styles, axis) {
  34774. var sideA = axis === 'x' ? 'Left' : 'Top';
  34775. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  34776. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  34777. }
  34778. function getSize(axis, body, html, computedStyle) {
  34779. 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);
  34780. }
  34781. function getWindowSizes(document) {
  34782. var body = document.body;
  34783. var html = document.documentElement;
  34784. var computedStyle = isIE(10) && getComputedStyle(html);
  34785. return {
  34786. height: getSize('Height', body, html, computedStyle),
  34787. width: getSize('Width', body, html, computedStyle)
  34788. };
  34789. }
  34790. var classCallCheck = function (instance, Constructor) {
  34791. if (!(instance instanceof Constructor)) {
  34792. throw new TypeError("Cannot call a class as a function");
  34793. }
  34794. };
  34795. var createClass = function () {
  34796. function defineProperties(target, props) {
  34797. for (var i = 0; i < props.length; i++) {
  34798. var descriptor = props[i];
  34799. descriptor.enumerable = descriptor.enumerable || false;
  34800. descriptor.configurable = true;
  34801. if ("value" in descriptor) descriptor.writable = true;
  34802. Object.defineProperty(target, descriptor.key, descriptor);
  34803. }
  34804. }
  34805. return function (Constructor, protoProps, staticProps) {
  34806. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  34807. if (staticProps) defineProperties(Constructor, staticProps);
  34808. return Constructor;
  34809. };
  34810. }();
  34811. var defineProperty = function (obj, key, value) {
  34812. if (key in obj) {
  34813. Object.defineProperty(obj, key, {
  34814. value: value,
  34815. enumerable: true,
  34816. configurable: true,
  34817. writable: true
  34818. });
  34819. } else {
  34820. obj[key] = value;
  34821. }
  34822. return obj;
  34823. };
  34824. var _extends = Object.assign || function (target) {
  34825. for (var i = 1; i < arguments.length; i++) {
  34826. var source = arguments[i];
  34827. for (var key in source) {
  34828. if (Object.prototype.hasOwnProperty.call(source, key)) {
  34829. target[key] = source[key];
  34830. }
  34831. }
  34832. }
  34833. return target;
  34834. };
  34835. /**
  34836. * Given element offsets, generate an output similar to getBoundingClientRect
  34837. * @method
  34838. * @memberof Popper.Utils
  34839. * @argument {Object} offsets
  34840. * @returns {Object} ClientRect like output
  34841. */
  34842. function getClientRect(offsets) {
  34843. return _extends({}, offsets, {
  34844. right: offsets.left + offsets.width,
  34845. bottom: offsets.top + offsets.height
  34846. });
  34847. }
  34848. /**
  34849. * Get bounding client rect of given element
  34850. * @method
  34851. * @memberof Popper.Utils
  34852. * @param {HTMLElement} element
  34853. * @return {Object} client rect
  34854. */
  34855. function getBoundingClientRect(element) {
  34856. var rect = {};
  34857. // IE10 10 FIX: Please, don't ask, the element isn't
  34858. // considered in DOM in some circumstances...
  34859. // This isn't reproducible in IE10 compatibility mode of IE11
  34860. try {
  34861. if (isIE(10)) {
  34862. rect = element.getBoundingClientRect();
  34863. var scrollTop = getScroll(element, 'top');
  34864. var scrollLeft = getScroll(element, 'left');
  34865. rect.top += scrollTop;
  34866. rect.left += scrollLeft;
  34867. rect.bottom += scrollTop;
  34868. rect.right += scrollLeft;
  34869. } else {
  34870. rect = element.getBoundingClientRect();
  34871. }
  34872. } catch (e) {}
  34873. var result = {
  34874. left: rect.left,
  34875. top: rect.top,
  34876. width: rect.right - rect.left,
  34877. height: rect.bottom - rect.top
  34878. };
  34879. // subtract scrollbar size from sizes
  34880. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  34881. var width = sizes.width || element.clientWidth || result.width;
  34882. var height = sizes.height || element.clientHeight || result.height;
  34883. var horizScrollbar = element.offsetWidth - width;
  34884. var vertScrollbar = element.offsetHeight - height;
  34885. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  34886. // we make this check conditional for performance reasons
  34887. if (horizScrollbar || vertScrollbar) {
  34888. var styles = getStyleComputedProperty(element);
  34889. horizScrollbar -= getBordersSize(styles, 'x');
  34890. vertScrollbar -= getBordersSize(styles, 'y');
  34891. result.width -= horizScrollbar;
  34892. result.height -= vertScrollbar;
  34893. }
  34894. return getClientRect(result);
  34895. }
  34896. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  34897. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34898. var isIE10 = isIE(10);
  34899. var isHTML = parent.nodeName === 'HTML';
  34900. var childrenRect = getBoundingClientRect(children);
  34901. var parentRect = getBoundingClientRect(parent);
  34902. var scrollParent = getScrollParent(children);
  34903. var styles = getStyleComputedProperty(parent);
  34904. var borderTopWidth = parseFloat(styles.borderTopWidth);
  34905. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  34906. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  34907. if (fixedPosition && isHTML) {
  34908. parentRect.top = Math.max(parentRect.top, 0);
  34909. parentRect.left = Math.max(parentRect.left, 0);
  34910. }
  34911. var offsets = getClientRect({
  34912. top: childrenRect.top - parentRect.top - borderTopWidth,
  34913. left: childrenRect.left - parentRect.left - borderLeftWidth,
  34914. width: childrenRect.width,
  34915. height: childrenRect.height
  34916. });
  34917. offsets.marginTop = 0;
  34918. offsets.marginLeft = 0;
  34919. // Subtract margins of documentElement in case it's being used as parent
  34920. // we do this only on HTML because it's the only element that behaves
  34921. // differently when margins are applied to it. The margins are included in
  34922. // the box of the documentElement, in the other cases not.
  34923. if (!isIE10 && isHTML) {
  34924. var marginTop = parseFloat(styles.marginTop);
  34925. var marginLeft = parseFloat(styles.marginLeft);
  34926. offsets.top -= borderTopWidth - marginTop;
  34927. offsets.bottom -= borderTopWidth - marginTop;
  34928. offsets.left -= borderLeftWidth - marginLeft;
  34929. offsets.right -= borderLeftWidth - marginLeft;
  34930. // Attach marginTop and marginLeft because in some circumstances we may need them
  34931. offsets.marginTop = marginTop;
  34932. offsets.marginLeft = marginLeft;
  34933. }
  34934. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  34935. offsets = includeScroll(offsets, parent);
  34936. }
  34937. return offsets;
  34938. }
  34939. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  34940. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  34941. var html = element.ownerDocument.documentElement;
  34942. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  34943. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  34944. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  34945. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  34946. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  34947. var offset = {
  34948. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  34949. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  34950. width: width,
  34951. height: height
  34952. };
  34953. return getClientRect(offset);
  34954. }
  34955. /**
  34956. * Check if the given element is fixed or is inside a fixed parent
  34957. * @method
  34958. * @memberof Popper.Utils
  34959. * @argument {Element} element
  34960. * @argument {Element} customContainer
  34961. * @returns {Boolean} answer to "isFixed?"
  34962. */
  34963. function isFixed(element) {
  34964. var nodeName = element.nodeName;
  34965. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34966. return false;
  34967. }
  34968. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  34969. return true;
  34970. }
  34971. var parentNode = getParentNode(element);
  34972. if (!parentNode) {
  34973. return false;
  34974. }
  34975. return isFixed(parentNode);
  34976. }
  34977. /**
  34978. * Finds the first parent of an element that has a transformed property defined
  34979. * @method
  34980. * @memberof Popper.Utils
  34981. * @argument {Element} element
  34982. * @returns {Element} first transformed parent or documentElement
  34983. */
  34984. function getFixedPositionOffsetParent(element) {
  34985. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34986. if (!element || !element.parentElement || isIE()) {
  34987. return document.documentElement;
  34988. }
  34989. var el = element.parentElement;
  34990. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  34991. el = el.parentElement;
  34992. }
  34993. return el || document.documentElement;
  34994. }
  34995. /**
  34996. * Computed the boundaries limits and return them
  34997. * @method
  34998. * @memberof Popper.Utils
  34999. * @param {HTMLElement} popper
  35000. * @param {HTMLElement} reference
  35001. * @param {number} padding
  35002. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  35003. * @param {Boolean} fixedPosition - Is in fixed position mode
  35004. * @returns {Object} Coordinates of the boundaries
  35005. */
  35006. function getBoundaries(popper, reference, padding, boundariesElement) {
  35007. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  35008. // NOTE: 1 DOM access here
  35009. var boundaries = { top: 0, left: 0 };
  35010. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  35011. // Handle viewport case
  35012. if (boundariesElement === 'viewport') {
  35013. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  35014. } else {
  35015. // Handle other cases based on DOM element used as boundaries
  35016. var boundariesNode = void 0;
  35017. if (boundariesElement === 'scrollParent') {
  35018. boundariesNode = getScrollParent(getParentNode(reference));
  35019. if (boundariesNode.nodeName === 'BODY') {
  35020. boundariesNode = popper.ownerDocument.documentElement;
  35021. }
  35022. } else if (boundariesElement === 'window') {
  35023. boundariesNode = popper.ownerDocument.documentElement;
  35024. } else {
  35025. boundariesNode = boundariesElement;
  35026. }
  35027. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  35028. // In case of HTML, we need a different computation
  35029. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  35030. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  35031. height = _getWindowSizes.height,
  35032. width = _getWindowSizes.width;
  35033. boundaries.top += offsets.top - offsets.marginTop;
  35034. boundaries.bottom = height + offsets.top;
  35035. boundaries.left += offsets.left - offsets.marginLeft;
  35036. boundaries.right = width + offsets.left;
  35037. } else {
  35038. // for all the other DOM elements, this one is good
  35039. boundaries = offsets;
  35040. }
  35041. }
  35042. // Add paddings
  35043. padding = padding || 0;
  35044. var isPaddingNumber = typeof padding === 'number';
  35045. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  35046. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  35047. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  35048. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  35049. return boundaries;
  35050. }
  35051. function getArea(_ref) {
  35052. var width = _ref.width,
  35053. height = _ref.height;
  35054. return width * height;
  35055. }
  35056. /**
  35057. * Utility used to transform the `auto` placement to the placement with more
  35058. * available space.
  35059. * @method
  35060. * @memberof Popper.Utils
  35061. * @argument {Object} data - The data object generated by update method
  35062. * @argument {Object} options - Modifiers configuration and options
  35063. * @returns {Object} The data object, properly modified
  35064. */
  35065. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  35066. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  35067. if (placement.indexOf('auto') === -1) {
  35068. return placement;
  35069. }
  35070. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  35071. var rects = {
  35072. top: {
  35073. width: boundaries.width,
  35074. height: refRect.top - boundaries.top
  35075. },
  35076. right: {
  35077. width: boundaries.right - refRect.right,
  35078. height: boundaries.height
  35079. },
  35080. bottom: {
  35081. width: boundaries.width,
  35082. height: boundaries.bottom - refRect.bottom
  35083. },
  35084. left: {
  35085. width: refRect.left - boundaries.left,
  35086. height: boundaries.height
  35087. }
  35088. };
  35089. var sortedAreas = Object.keys(rects).map(function (key) {
  35090. return _extends({
  35091. key: key
  35092. }, rects[key], {
  35093. area: getArea(rects[key])
  35094. });
  35095. }).sort(function (a, b) {
  35096. return b.area - a.area;
  35097. });
  35098. var filteredAreas = sortedAreas.filter(function (_ref2) {
  35099. var width = _ref2.width,
  35100. height = _ref2.height;
  35101. return width >= popper.clientWidth && height >= popper.clientHeight;
  35102. });
  35103. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  35104. var variation = placement.split('-')[1];
  35105. return computedPlacement + (variation ? '-' + variation : '');
  35106. }
  35107. /**
  35108. * Get offsets to the reference element
  35109. * @method
  35110. * @memberof Popper.Utils
  35111. * @param {Object} state
  35112. * @param {Element} popper - the popper element
  35113. * @param {Element} reference - the reference element (the popper will be relative to this)
  35114. * @param {Element} fixedPosition - is in fixed position mode
  35115. * @returns {Object} An object containing the offsets which will be applied to the popper
  35116. */
  35117. function getReferenceOffsets(state, popper, reference) {
  35118. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  35119. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  35120. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  35121. }
  35122. /**
  35123. * Get the outer sizes of the given element (offset size + margins)
  35124. * @method
  35125. * @memberof Popper.Utils
  35126. * @argument {Element} element
  35127. * @returns {Object} object containing width and height properties
  35128. */
  35129. function getOuterSizes(element) {
  35130. var window = element.ownerDocument.defaultView;
  35131. var styles = window.getComputedStyle(element);
  35132. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  35133. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  35134. var result = {
  35135. width: element.offsetWidth + y,
  35136. height: element.offsetHeight + x
  35137. };
  35138. return result;
  35139. }
  35140. /**
  35141. * Get the opposite placement of the given one
  35142. * @method
  35143. * @memberof Popper.Utils
  35144. * @argument {String} placement
  35145. * @returns {String} flipped placement
  35146. */
  35147. function getOppositePlacement(placement) {
  35148. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  35149. return placement.replace(/left|right|bottom|top/g, function (matched) {
  35150. return hash[matched];
  35151. });
  35152. }
  35153. /**
  35154. * Get offsets to the popper
  35155. * @method
  35156. * @memberof Popper.Utils
  35157. * @param {Object} position - CSS position the Popper will get applied
  35158. * @param {HTMLElement} popper - the popper element
  35159. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  35160. * @param {String} placement - one of the valid placement options
  35161. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  35162. */
  35163. function getPopperOffsets(popper, referenceOffsets, placement) {
  35164. placement = placement.split('-')[0];
  35165. // Get popper node sizes
  35166. var popperRect = getOuterSizes(popper);
  35167. // Add position, width and height to our offsets object
  35168. var popperOffsets = {
  35169. width: popperRect.width,
  35170. height: popperRect.height
  35171. };
  35172. // depending by the popper placement we have to compute its offsets slightly differently
  35173. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  35174. var mainSide = isHoriz ? 'top' : 'left';
  35175. var secondarySide = isHoriz ? 'left' : 'top';
  35176. var measurement = isHoriz ? 'height' : 'width';
  35177. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  35178. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  35179. if (placement === secondarySide) {
  35180. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  35181. } else {
  35182. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  35183. }
  35184. return popperOffsets;
  35185. }
  35186. /**
  35187. * Mimics the `find` method of Array
  35188. * @method
  35189. * @memberof Popper.Utils
  35190. * @argument {Array} arr
  35191. * @argument prop
  35192. * @argument value
  35193. * @returns index or -1
  35194. */
  35195. function find(arr, check) {
  35196. // use native find if supported
  35197. if (Array.prototype.find) {
  35198. return arr.find(check);
  35199. }
  35200. // use `filter` to obtain the same behavior of `find`
  35201. return arr.filter(check)[0];
  35202. }
  35203. /**
  35204. * Return the index of the matching object
  35205. * @method
  35206. * @memberof Popper.Utils
  35207. * @argument {Array} arr
  35208. * @argument prop
  35209. * @argument value
  35210. * @returns index or -1
  35211. */
  35212. function findIndex(arr, prop, value) {
  35213. // use native findIndex if supported
  35214. if (Array.prototype.findIndex) {
  35215. return arr.findIndex(function (cur) {
  35216. return cur[prop] === value;
  35217. });
  35218. }
  35219. // use `find` + `indexOf` if `findIndex` isn't supported
  35220. var match = find(arr, function (obj) {
  35221. return obj[prop] === value;
  35222. });
  35223. return arr.indexOf(match);
  35224. }
  35225. /**
  35226. * Loop trough the list of modifiers and run them in order,
  35227. * each of them will then edit the data object.
  35228. * @method
  35229. * @memberof Popper.Utils
  35230. * @param {dataObject} data
  35231. * @param {Array} modifiers
  35232. * @param {String} ends - Optional modifier name used as stopper
  35233. * @returns {dataObject}
  35234. */
  35235. function runModifiers(modifiers, data, ends) {
  35236. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  35237. modifiersToRun.forEach(function (modifier) {
  35238. if (modifier['function']) {
  35239. // eslint-disable-line dot-notation
  35240. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  35241. }
  35242. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  35243. if (modifier.enabled && isFunction(fn)) {
  35244. // Add properties to offsets to make them a complete clientRect object
  35245. // we do this before each modifier to make sure the previous one doesn't
  35246. // mess with these values
  35247. data.offsets.popper = getClientRect(data.offsets.popper);
  35248. data.offsets.reference = getClientRect(data.offsets.reference);
  35249. data = fn(data, modifier);
  35250. }
  35251. });
  35252. return data;
  35253. }
  35254. /**
  35255. * Updates the position of the popper, computing the new offsets and applying
  35256. * the new style.<br />
  35257. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  35258. * @method
  35259. * @memberof Popper
  35260. */
  35261. function update() {
  35262. // if popper is destroyed, don't perform any further update
  35263. if (this.state.isDestroyed) {
  35264. return;
  35265. }
  35266. var data = {
  35267. instance: this,
  35268. styles: {},
  35269. arrowStyles: {},
  35270. attributes: {},
  35271. flipped: false,
  35272. offsets: {}
  35273. };
  35274. // compute reference element offsets
  35275. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  35276. // compute auto placement, store placement inside the data object,
  35277. // modifiers will be able to edit `placement` if needed
  35278. // and refer to originalPlacement to know the original value
  35279. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  35280. // store the computed placement inside `originalPlacement`
  35281. data.originalPlacement = data.placement;
  35282. data.positionFixed = this.options.positionFixed;
  35283. // compute the popper offsets
  35284. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  35285. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  35286. // run the modifiers
  35287. data = runModifiers(this.modifiers, data);
  35288. // the first `update` will call `onCreate` callback
  35289. // the other ones will call `onUpdate` callback
  35290. if (!this.state.isCreated) {
  35291. this.state.isCreated = true;
  35292. this.options.onCreate(data);
  35293. } else {
  35294. this.options.onUpdate(data);
  35295. }
  35296. }
  35297. /**
  35298. * Helper used to know if the given modifier is enabled.
  35299. * @method
  35300. * @memberof Popper.Utils
  35301. * @returns {Boolean}
  35302. */
  35303. function isModifierEnabled(modifiers, modifierName) {
  35304. return modifiers.some(function (_ref) {
  35305. var name = _ref.name,
  35306. enabled = _ref.enabled;
  35307. return enabled && name === modifierName;
  35308. });
  35309. }
  35310. /**
  35311. * Get the prefixed supported property name
  35312. * @method
  35313. * @memberof Popper.Utils
  35314. * @argument {String} property (camelCase)
  35315. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  35316. */
  35317. function getSupportedPropertyName(property) {
  35318. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  35319. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  35320. for (var i = 0; i < prefixes.length; i++) {
  35321. var prefix = prefixes[i];
  35322. var toCheck = prefix ? '' + prefix + upperProp : property;
  35323. if (typeof document.body.style[toCheck] !== 'undefined') {
  35324. return toCheck;
  35325. }
  35326. }
  35327. return null;
  35328. }
  35329. /**
  35330. * Destroys the popper.
  35331. * @method
  35332. * @memberof Popper
  35333. */
  35334. function destroy() {
  35335. this.state.isDestroyed = true;
  35336. // touch DOM only if `applyStyle` modifier is enabled
  35337. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  35338. this.popper.removeAttribute('x-placement');
  35339. this.popper.style.position = '';
  35340. this.popper.style.top = '';
  35341. this.popper.style.left = '';
  35342. this.popper.style.right = '';
  35343. this.popper.style.bottom = '';
  35344. this.popper.style.willChange = '';
  35345. this.popper.style[getSupportedPropertyName('transform')] = '';
  35346. }
  35347. this.disableEventListeners();
  35348. // remove the popper if user explicitly asked for the deletion on destroy
  35349. // do not use `remove` because IE11 doesn't support it
  35350. if (this.options.removeOnDestroy) {
  35351. this.popper.parentNode.removeChild(this.popper);
  35352. }
  35353. return this;
  35354. }
  35355. /**
  35356. * Get the window associated with the element
  35357. * @argument {Element} element
  35358. * @returns {Window}
  35359. */
  35360. function getWindow(element) {
  35361. var ownerDocument = element.ownerDocument;
  35362. return ownerDocument ? ownerDocument.defaultView : window;
  35363. }
  35364. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  35365. var isBody = scrollParent.nodeName === 'BODY';
  35366. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  35367. target.addEventListener(event, callback, { passive: true });
  35368. if (!isBody) {
  35369. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  35370. }
  35371. scrollParents.push(target);
  35372. }
  35373. /**
  35374. * Setup needed event listeners used to update the popper position
  35375. * @method
  35376. * @memberof Popper.Utils
  35377. * @private
  35378. */
  35379. function setupEventListeners(reference, options, state, updateBound) {
  35380. // Resize event listener on window
  35381. state.updateBound = updateBound;
  35382. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  35383. // Scroll event listener on scroll parents
  35384. var scrollElement = getScrollParent(reference);
  35385. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  35386. state.scrollElement = scrollElement;
  35387. state.eventsEnabled = true;
  35388. return state;
  35389. }
  35390. /**
  35391. * It will add resize/scroll events and start recalculating
  35392. * position of the popper element when they are triggered.
  35393. * @method
  35394. * @memberof Popper
  35395. */
  35396. function enableEventListeners() {
  35397. if (!this.state.eventsEnabled) {
  35398. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  35399. }
  35400. }
  35401. /**
  35402. * Remove event listeners used to update the popper position
  35403. * @method
  35404. * @memberof Popper.Utils
  35405. * @private
  35406. */
  35407. function removeEventListeners(reference, state) {
  35408. // Remove resize event listener on window
  35409. getWindow(reference).removeEventListener('resize', state.updateBound);
  35410. // Remove scroll event listener on scroll parents
  35411. state.scrollParents.forEach(function (target) {
  35412. target.removeEventListener('scroll', state.updateBound);
  35413. });
  35414. // Reset state
  35415. state.updateBound = null;
  35416. state.scrollParents = [];
  35417. state.scrollElement = null;
  35418. state.eventsEnabled = false;
  35419. return state;
  35420. }
  35421. /**
  35422. * It will remove resize/scroll events and won't recalculate popper position
  35423. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  35424. * unless you call `update` method manually.
  35425. * @method
  35426. * @memberof Popper
  35427. */
  35428. function disableEventListeners() {
  35429. if (this.state.eventsEnabled) {
  35430. cancelAnimationFrame(this.scheduleUpdate);
  35431. this.state = removeEventListeners(this.reference, this.state);
  35432. }
  35433. }
  35434. /**
  35435. * Tells if a given input is a number
  35436. * @method
  35437. * @memberof Popper.Utils
  35438. * @param {*} input to check
  35439. * @return {Boolean}
  35440. */
  35441. function isNumeric(n) {
  35442. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  35443. }
  35444. /**
  35445. * Set the style to the given popper
  35446. * @method
  35447. * @memberof Popper.Utils
  35448. * @argument {Element} element - Element to apply the style to
  35449. * @argument {Object} styles
  35450. * Object with a list of properties and values which will be applied to the element
  35451. */
  35452. function setStyles(element, styles) {
  35453. Object.keys(styles).forEach(function (prop) {
  35454. var unit = '';
  35455. // add unit if the value is numeric and is one of the following
  35456. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  35457. unit = 'px';
  35458. }
  35459. element.style[prop] = styles[prop] + unit;
  35460. });
  35461. }
  35462. /**
  35463. * Set the attributes to the given popper
  35464. * @method
  35465. * @memberof Popper.Utils
  35466. * @argument {Element} element - Element to apply the attributes to
  35467. * @argument {Object} styles
  35468. * Object with a list of properties and values which will be applied to the element
  35469. */
  35470. function setAttributes(element, attributes) {
  35471. Object.keys(attributes).forEach(function (prop) {
  35472. var value = attributes[prop];
  35473. if (value !== false) {
  35474. element.setAttribute(prop, attributes[prop]);
  35475. } else {
  35476. element.removeAttribute(prop);
  35477. }
  35478. });
  35479. }
  35480. /**
  35481. * @function
  35482. * @memberof Modifiers
  35483. * @argument {Object} data - The data object generated by `update` method
  35484. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  35485. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  35486. * @argument {Object} options - Modifiers configuration and options
  35487. * @returns {Object} The same data object
  35488. */
  35489. function applyStyle(data) {
  35490. // any property present in `data.styles` will be applied to the popper,
  35491. // in this way we can make the 3rd party modifiers add custom styles to it
  35492. // Be aware, modifiers could override the properties defined in the previous
  35493. // lines of this modifier!
  35494. setStyles(data.instance.popper, data.styles);
  35495. // any property present in `data.attributes` will be applied to the popper,
  35496. // they will be set as HTML attributes of the element
  35497. setAttributes(data.instance.popper, data.attributes);
  35498. // if arrowElement is defined and arrowStyles has some properties
  35499. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  35500. setStyles(data.arrowElement, data.arrowStyles);
  35501. }
  35502. return data;
  35503. }
  35504. /**
  35505. * Set the x-placement attribute before everything else because it could be used
  35506. * to add margins to the popper margins needs to be calculated to get the
  35507. * correct popper offsets.
  35508. * @method
  35509. * @memberof Popper.modifiers
  35510. * @param {HTMLElement} reference - The reference element used to position the popper
  35511. * @param {HTMLElement} popper - The HTML element used as popper
  35512. * @param {Object} options - Popper.js options
  35513. */
  35514. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  35515. // compute reference element offsets
  35516. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  35517. // compute auto placement, store placement inside the data object,
  35518. // modifiers will be able to edit `placement` if needed
  35519. // and refer to originalPlacement to know the original value
  35520. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  35521. popper.setAttribute('x-placement', placement);
  35522. // Apply `position` to popper before anything else because
  35523. // without the position applied we can't guarantee correct computations
  35524. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  35525. return options;
  35526. }
  35527. /**
  35528. * @function
  35529. * @memberof Popper.Utils
  35530. * @argument {Object} data - The data object generated by `update` method
  35531. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  35532. * @returns {Object} The popper's position offsets rounded
  35533. *
  35534. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  35535. * good as it can be within reason.
  35536. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  35537. *
  35538. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  35539. * as well on High DPI screens).
  35540. *
  35541. * Firefox prefers no rounding for positioning and does not have blurriness on
  35542. * high DPI screens.
  35543. *
  35544. * Only horizontal placement and left/right values need to be considered.
  35545. */
  35546. function getRoundedOffsets(data, shouldRound) {
  35547. var _data$offsets = data.offsets,
  35548. popper = _data$offsets.popper,
  35549. reference = _data$offsets.reference;
  35550. var round = Math.round,
  35551. floor = Math.floor;
  35552. var noRound = function noRound(v) {
  35553. return v;
  35554. };
  35555. var referenceWidth = round(reference.width);
  35556. var popperWidth = round(popper.width);
  35557. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  35558. var isVariation = data.placement.indexOf('-') !== -1;
  35559. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  35560. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  35561. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  35562. var verticalToInteger = !shouldRound ? noRound : round;
  35563. return {
  35564. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  35565. top: verticalToInteger(popper.top),
  35566. bottom: verticalToInteger(popper.bottom),
  35567. right: horizontalToInteger(popper.right)
  35568. };
  35569. }
  35570. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  35571. /**
  35572. * @function
  35573. * @memberof Modifiers
  35574. * @argument {Object} data - The data object generated by `update` method
  35575. * @argument {Object} options - Modifiers configuration and options
  35576. * @returns {Object} The data object, properly modified
  35577. */
  35578. function computeStyle(data, options) {
  35579. var x = options.x,
  35580. y = options.y;
  35581. var popper = data.offsets.popper;
  35582. // Remove this legacy support in Popper.js v2
  35583. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  35584. return modifier.name === 'applyStyle';
  35585. }).gpuAcceleration;
  35586. if (legacyGpuAccelerationOption !== undefined) {
  35587. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  35588. }
  35589. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  35590. var offsetParent = getOffsetParent(data.instance.popper);
  35591. var offsetParentRect = getBoundingClientRect(offsetParent);
  35592. // Styles
  35593. var styles = {
  35594. position: popper.position
  35595. };
  35596. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  35597. var sideA = x === 'bottom' ? 'top' : 'bottom';
  35598. var sideB = y === 'right' ? 'left' : 'right';
  35599. // if gpuAcceleration is set to `true` and transform is supported,
  35600. // we use `translate3d` to apply the position to the popper we
  35601. // automatically use the supported prefixed version if needed
  35602. var prefixedProperty = getSupportedPropertyName('transform');
  35603. // now, let's make a step back and look at this code closely (wtf?)
  35604. // If the content of the popper grows once it's been positioned, it
  35605. // may happen that the popper gets misplaced because of the new content
  35606. // overflowing its reference element
  35607. // To avoid this problem, we provide two options (x and y), which allow
  35608. // the consumer to define the offset origin.
  35609. // If we position a popper on top of a reference element, we can set
  35610. // `x` to `top` to make the popper grow towards its top instead of
  35611. // its bottom.
  35612. var left = void 0,
  35613. top = void 0;
  35614. if (sideA === 'bottom') {
  35615. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  35616. // and not the bottom of the html element
  35617. if (offsetParent.nodeName === 'HTML') {
  35618. top = -offsetParent.clientHeight + offsets.bottom;
  35619. } else {
  35620. top = -offsetParentRect.height + offsets.bottom;
  35621. }
  35622. } else {
  35623. top = offsets.top;
  35624. }
  35625. if (sideB === 'right') {
  35626. if (offsetParent.nodeName === 'HTML') {
  35627. left = -offsetParent.clientWidth + offsets.right;
  35628. } else {
  35629. left = -offsetParentRect.width + offsets.right;
  35630. }
  35631. } else {
  35632. left = offsets.left;
  35633. }
  35634. if (gpuAcceleration && prefixedProperty) {
  35635. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  35636. styles[sideA] = 0;
  35637. styles[sideB] = 0;
  35638. styles.willChange = 'transform';
  35639. } else {
  35640. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  35641. var invertTop = sideA === 'bottom' ? -1 : 1;
  35642. var invertLeft = sideB === 'right' ? -1 : 1;
  35643. styles[sideA] = top * invertTop;
  35644. styles[sideB] = left * invertLeft;
  35645. styles.willChange = sideA + ', ' + sideB;
  35646. }
  35647. // Attributes
  35648. var attributes = {
  35649. 'x-placement': data.placement
  35650. };
  35651. // Update `data` attributes, styles and arrowStyles
  35652. data.attributes = _extends({}, attributes, data.attributes);
  35653. data.styles = _extends({}, styles, data.styles);
  35654. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  35655. return data;
  35656. }
  35657. /**
  35658. * Helper used to know if the given modifier depends from another one.<br />
  35659. * It checks if the needed modifier is listed and enabled.
  35660. * @method
  35661. * @memberof Popper.Utils
  35662. * @param {Array} modifiers - list of modifiers
  35663. * @param {String} requestingName - name of requesting modifier
  35664. * @param {String} requestedName - name of requested modifier
  35665. * @returns {Boolean}
  35666. */
  35667. function isModifierRequired(modifiers, requestingName, requestedName) {
  35668. var requesting = find(modifiers, function (_ref) {
  35669. var name = _ref.name;
  35670. return name === requestingName;
  35671. });
  35672. var isRequired = !!requesting && modifiers.some(function (modifier) {
  35673. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  35674. });
  35675. if (!isRequired) {
  35676. var _requesting = '`' + requestingName + '`';
  35677. var requested = '`' + requestedName + '`';
  35678. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  35679. }
  35680. return isRequired;
  35681. }
  35682. /**
  35683. * @function
  35684. * @memberof Modifiers
  35685. * @argument {Object} data - The data object generated by update method
  35686. * @argument {Object} options - Modifiers configuration and options
  35687. * @returns {Object} The data object, properly modified
  35688. */
  35689. function arrow(data, options) {
  35690. var _data$offsets$arrow;
  35691. // arrow depends on keepTogether in order to work
  35692. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  35693. return data;
  35694. }
  35695. var arrowElement = options.element;
  35696. // if arrowElement is a string, suppose it's a CSS selector
  35697. if (typeof arrowElement === 'string') {
  35698. arrowElement = data.instance.popper.querySelector(arrowElement);
  35699. // if arrowElement is not found, don't run the modifier
  35700. if (!arrowElement) {
  35701. return data;
  35702. }
  35703. } else {
  35704. // if the arrowElement isn't a query selector we must check that the
  35705. // provided DOM node is child of its popper node
  35706. if (!data.instance.popper.contains(arrowElement)) {
  35707. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  35708. return data;
  35709. }
  35710. }
  35711. var placement = data.placement.split('-')[0];
  35712. var _data$offsets = data.offsets,
  35713. popper = _data$offsets.popper,
  35714. reference = _data$offsets.reference;
  35715. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  35716. var len = isVertical ? 'height' : 'width';
  35717. var sideCapitalized = isVertical ? 'Top' : 'Left';
  35718. var side = sideCapitalized.toLowerCase();
  35719. var altSide = isVertical ? 'left' : 'top';
  35720. var opSide = isVertical ? 'bottom' : 'right';
  35721. var arrowElementSize = getOuterSizes(arrowElement)[len];
  35722. //
  35723. // extends keepTogether behavior making sure the popper and its
  35724. // reference have enough pixels in conjunction
  35725. //
  35726. // top/left side
  35727. if (reference[opSide] - arrowElementSize < popper[side]) {
  35728. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  35729. }
  35730. // bottom/right side
  35731. if (reference[side] + arrowElementSize > popper[opSide]) {
  35732. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  35733. }
  35734. data.offsets.popper = getClientRect(data.offsets.popper);
  35735. // compute center of the popper
  35736. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  35737. // Compute the sideValue using the updated popper offsets
  35738. // take popper margin in account because we don't have this info available
  35739. var css = getStyleComputedProperty(data.instance.popper);
  35740. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  35741. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  35742. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  35743. // prevent arrowElement from being placed not contiguously to its popper
  35744. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  35745. data.arrowElement = arrowElement;
  35746. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  35747. return data;
  35748. }
  35749. /**
  35750. * Get the opposite placement variation of the given one
  35751. * @method
  35752. * @memberof Popper.Utils
  35753. * @argument {String} placement variation
  35754. * @returns {String} flipped placement variation
  35755. */
  35756. function getOppositeVariation(variation) {
  35757. if (variation === 'end') {
  35758. return 'start';
  35759. } else if (variation === 'start') {
  35760. return 'end';
  35761. }
  35762. return variation;
  35763. }
  35764. /**
  35765. * List of accepted placements to use as values of the `placement` option.<br />
  35766. * Valid placements are:
  35767. * - `auto`
  35768. * - `top`
  35769. * - `right`
  35770. * - `bottom`
  35771. * - `left`
  35772. *
  35773. * Each placement can have a variation from this list:
  35774. * - `-start`
  35775. * - `-end`
  35776. *
  35777. * Variations are interpreted easily if you think of them as the left to right
  35778. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  35779. * is right.<br />
  35780. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  35781. *
  35782. * Some valid examples are:
  35783. * - `top-end` (on top of reference, right aligned)
  35784. * - `right-start` (on right of reference, top aligned)
  35785. * - `bottom` (on bottom, centered)
  35786. * - `auto-end` (on the side with more space available, alignment depends by placement)
  35787. *
  35788. * @static
  35789. * @type {Array}
  35790. * @enum {String}
  35791. * @readonly
  35792. * @method placements
  35793. * @memberof Popper
  35794. */
  35795. 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'];
  35796. // Get rid of `auto` `auto-start` and `auto-end`
  35797. var validPlacements = placements.slice(3);
  35798. /**
  35799. * Given an initial placement, returns all the subsequent placements
  35800. * clockwise (or counter-clockwise).
  35801. *
  35802. * @method
  35803. * @memberof Popper.Utils
  35804. * @argument {String} placement - A valid placement (it accepts variations)
  35805. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  35806. * @returns {Array} placements including their variations
  35807. */
  35808. function clockwise(placement) {
  35809. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  35810. var index = validPlacements.indexOf(placement);
  35811. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  35812. return counter ? arr.reverse() : arr;
  35813. }
  35814. var BEHAVIORS = {
  35815. FLIP: 'flip',
  35816. CLOCKWISE: 'clockwise',
  35817. COUNTERCLOCKWISE: 'counterclockwise'
  35818. };
  35819. /**
  35820. * @function
  35821. * @memberof Modifiers
  35822. * @argument {Object} data - The data object generated by update method
  35823. * @argument {Object} options - Modifiers configuration and options
  35824. * @returns {Object} The data object, properly modified
  35825. */
  35826. function flip(data, options) {
  35827. // if `inner` modifier is enabled, we can't use the `flip` modifier
  35828. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  35829. return data;
  35830. }
  35831. if (data.flipped && data.placement === data.originalPlacement) {
  35832. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  35833. return data;
  35834. }
  35835. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  35836. var placement = data.placement.split('-')[0];
  35837. var placementOpposite = getOppositePlacement(placement);
  35838. var variation = data.placement.split('-')[1] || '';
  35839. var flipOrder = [];
  35840. switch (options.behavior) {
  35841. case BEHAVIORS.FLIP:
  35842. flipOrder = [placement, placementOpposite];
  35843. break;
  35844. case BEHAVIORS.CLOCKWISE:
  35845. flipOrder = clockwise(placement);
  35846. break;
  35847. case BEHAVIORS.COUNTERCLOCKWISE:
  35848. flipOrder = clockwise(placement, true);
  35849. break;
  35850. default:
  35851. flipOrder = options.behavior;
  35852. }
  35853. flipOrder.forEach(function (step, index) {
  35854. if (placement !== step || flipOrder.length === index + 1) {
  35855. return data;
  35856. }
  35857. placement = data.placement.split('-')[0];
  35858. placementOpposite = getOppositePlacement(placement);
  35859. var popperOffsets = data.offsets.popper;
  35860. var refOffsets = data.offsets.reference;
  35861. // using floor because the reference offsets may contain decimals we are not going to consider here
  35862. var floor = Math.floor;
  35863. 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);
  35864. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  35865. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  35866. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  35867. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  35868. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  35869. // flip the variation if required
  35870. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35871. // flips variation if reference element overflows boundaries
  35872. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  35873. // flips variation if popper content overflows boundaries
  35874. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  35875. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  35876. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  35877. // this boolean to detect any flip loop
  35878. data.flipped = true;
  35879. if (overlapsRef || overflowsBoundaries) {
  35880. placement = flipOrder[index + 1];
  35881. }
  35882. if (flippedVariation) {
  35883. variation = getOppositeVariation(variation);
  35884. }
  35885. data.placement = placement + (variation ? '-' + variation : '');
  35886. // this object contains `position`, we want to preserve it along with
  35887. // any additional property we may add in the future
  35888. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  35889. data = runModifiers(data.instance.modifiers, data, 'flip');
  35890. }
  35891. });
  35892. return data;
  35893. }
  35894. /**
  35895. * @function
  35896. * @memberof Modifiers
  35897. * @argument {Object} data - The data object generated by update method
  35898. * @argument {Object} options - Modifiers configuration and options
  35899. * @returns {Object} The data object, properly modified
  35900. */
  35901. function keepTogether(data) {
  35902. var _data$offsets = data.offsets,
  35903. popper = _data$offsets.popper,
  35904. reference = _data$offsets.reference;
  35905. var placement = data.placement.split('-')[0];
  35906. var floor = Math.floor;
  35907. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35908. var side = isVertical ? 'right' : 'bottom';
  35909. var opSide = isVertical ? 'left' : 'top';
  35910. var measurement = isVertical ? 'width' : 'height';
  35911. if (popper[side] < floor(reference[opSide])) {
  35912. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  35913. }
  35914. if (popper[opSide] > floor(reference[side])) {
  35915. data.offsets.popper[opSide] = floor(reference[side]);
  35916. }
  35917. return data;
  35918. }
  35919. /**
  35920. * Converts a string containing value + unit into a px value number
  35921. * @function
  35922. * @memberof {modifiers~offset}
  35923. * @private
  35924. * @argument {String} str - Value + unit string
  35925. * @argument {String} measurement - `height` or `width`
  35926. * @argument {Object} popperOffsets
  35927. * @argument {Object} referenceOffsets
  35928. * @returns {Number|String}
  35929. * Value in pixels, or original string if no values were extracted
  35930. */
  35931. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  35932. // separate value from unit
  35933. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  35934. var value = +split[1];
  35935. var unit = split[2];
  35936. // If it's not a number it's an operator, I guess
  35937. if (!value) {
  35938. return str;
  35939. }
  35940. if (unit.indexOf('%') === 0) {
  35941. var element = void 0;
  35942. switch (unit) {
  35943. case '%p':
  35944. element = popperOffsets;
  35945. break;
  35946. case '%':
  35947. case '%r':
  35948. default:
  35949. element = referenceOffsets;
  35950. }
  35951. var rect = getClientRect(element);
  35952. return rect[measurement] / 100 * value;
  35953. } else if (unit === 'vh' || unit === 'vw') {
  35954. // if is a vh or vw, we calculate the size based on the viewport
  35955. var size = void 0;
  35956. if (unit === 'vh') {
  35957. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  35958. } else {
  35959. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  35960. }
  35961. return size / 100 * value;
  35962. } else {
  35963. // if is an explicit pixel unit, we get rid of the unit and keep the value
  35964. // if is an implicit unit, it's px, and we return just the value
  35965. return value;
  35966. }
  35967. }
  35968. /**
  35969. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  35970. * @function
  35971. * @memberof {modifiers~offset}
  35972. * @private
  35973. * @argument {String} offset
  35974. * @argument {Object} popperOffsets
  35975. * @argument {Object} referenceOffsets
  35976. * @argument {String} basePlacement
  35977. * @returns {Array} a two cells array with x and y offsets in numbers
  35978. */
  35979. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  35980. var offsets = [0, 0];
  35981. // Use height if placement is left or right and index is 0 otherwise use width
  35982. // in this way the first offset will use an axis and the second one
  35983. // will use the other one
  35984. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  35985. // Split the offset string to obtain a list of values and operands
  35986. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  35987. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  35988. return frag.trim();
  35989. });
  35990. // Detect if the offset string contains a pair of values or a single one
  35991. // they could be separated by comma or space
  35992. var divider = fragments.indexOf(find(fragments, function (frag) {
  35993. return frag.search(/,|\s/) !== -1;
  35994. }));
  35995. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  35996. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  35997. }
  35998. // If divider is found, we divide the list of values and operands to divide
  35999. // them by ofset X and Y.
  36000. var splitRegex = /\s*,\s*|\s+/;
  36001. 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];
  36002. // Convert the values with units to absolute pixels to allow our computations
  36003. ops = ops.map(function (op, index) {
  36004. // Most of the units rely on the orientation of the popper
  36005. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  36006. var mergeWithPrevious = false;
  36007. return op
  36008. // This aggregates any `+` or `-` sign that aren't considered operators
  36009. // e.g.: 10 + +5 => [10, +, +5]
  36010. .reduce(function (a, b) {
  36011. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  36012. a[a.length - 1] = b;
  36013. mergeWithPrevious = true;
  36014. return a;
  36015. } else if (mergeWithPrevious) {
  36016. a[a.length - 1] += b;
  36017. mergeWithPrevious = false;
  36018. return a;
  36019. } else {
  36020. return a.concat(b);
  36021. }
  36022. }, [])
  36023. // Here we convert the string values into number values (in px)
  36024. .map(function (str) {
  36025. return toValue(str, measurement, popperOffsets, referenceOffsets);
  36026. });
  36027. });
  36028. // Loop trough the offsets arrays and execute the operations
  36029. ops.forEach(function (op, index) {
  36030. op.forEach(function (frag, index2) {
  36031. if (isNumeric(frag)) {
  36032. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  36033. }
  36034. });
  36035. });
  36036. return offsets;
  36037. }
  36038. /**
  36039. * @function
  36040. * @memberof Modifiers
  36041. * @argument {Object} data - The data object generated by update method
  36042. * @argument {Object} options - Modifiers configuration and options
  36043. * @argument {Number|String} options.offset=0
  36044. * The offset value as described in the modifier description
  36045. * @returns {Object} The data object, properly modified
  36046. */
  36047. function offset(data, _ref) {
  36048. var offset = _ref.offset;
  36049. var placement = data.placement,
  36050. _data$offsets = data.offsets,
  36051. popper = _data$offsets.popper,
  36052. reference = _data$offsets.reference;
  36053. var basePlacement = placement.split('-')[0];
  36054. var offsets = void 0;
  36055. if (isNumeric(+offset)) {
  36056. offsets = [+offset, 0];
  36057. } else {
  36058. offsets = parseOffset(offset, popper, reference, basePlacement);
  36059. }
  36060. if (basePlacement === 'left') {
  36061. popper.top += offsets[0];
  36062. popper.left -= offsets[1];
  36063. } else if (basePlacement === 'right') {
  36064. popper.top += offsets[0];
  36065. popper.left += offsets[1];
  36066. } else if (basePlacement === 'top') {
  36067. popper.left += offsets[0];
  36068. popper.top -= offsets[1];
  36069. } else if (basePlacement === 'bottom') {
  36070. popper.left += offsets[0];
  36071. popper.top += offsets[1];
  36072. }
  36073. data.popper = popper;
  36074. return data;
  36075. }
  36076. /**
  36077. * @function
  36078. * @memberof Modifiers
  36079. * @argument {Object} data - The data object generated by `update` method
  36080. * @argument {Object} options - Modifiers configuration and options
  36081. * @returns {Object} The data object, properly modified
  36082. */
  36083. function preventOverflow(data, options) {
  36084. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  36085. // If offsetParent is the reference element, we really want to
  36086. // go one step up and use the next offsetParent as reference to
  36087. // avoid to make this modifier completely useless and look like broken
  36088. if (data.instance.reference === boundariesElement) {
  36089. boundariesElement = getOffsetParent(boundariesElement);
  36090. }
  36091. // NOTE: DOM access here
  36092. // resets the popper's position so that the document size can be calculated excluding
  36093. // the size of the popper element itself
  36094. var transformProp = getSupportedPropertyName('transform');
  36095. var popperStyles = data.instance.popper.style; // assignment to help minification
  36096. var top = popperStyles.top,
  36097. left = popperStyles.left,
  36098. transform = popperStyles[transformProp];
  36099. popperStyles.top = '';
  36100. popperStyles.left = '';
  36101. popperStyles[transformProp] = '';
  36102. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  36103. // NOTE: DOM access here
  36104. // restores the original style properties after the offsets have been computed
  36105. popperStyles.top = top;
  36106. popperStyles.left = left;
  36107. popperStyles[transformProp] = transform;
  36108. options.boundaries = boundaries;
  36109. var order = options.priority;
  36110. var popper = data.offsets.popper;
  36111. var check = {
  36112. primary: function primary(placement) {
  36113. var value = popper[placement];
  36114. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  36115. value = Math.max(popper[placement], boundaries[placement]);
  36116. }
  36117. return defineProperty({}, placement, value);
  36118. },
  36119. secondary: function secondary(placement) {
  36120. var mainSide = placement === 'right' ? 'left' : 'top';
  36121. var value = popper[mainSide];
  36122. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  36123. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  36124. }
  36125. return defineProperty({}, mainSide, value);
  36126. }
  36127. };
  36128. order.forEach(function (placement) {
  36129. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  36130. popper = _extends({}, popper, check[side](placement));
  36131. });
  36132. data.offsets.popper = popper;
  36133. return data;
  36134. }
  36135. /**
  36136. * @function
  36137. * @memberof Modifiers
  36138. * @argument {Object} data - The data object generated by `update` method
  36139. * @argument {Object} options - Modifiers configuration and options
  36140. * @returns {Object} The data object, properly modified
  36141. */
  36142. function shift(data) {
  36143. var placement = data.placement;
  36144. var basePlacement = placement.split('-')[0];
  36145. var shiftvariation = placement.split('-')[1];
  36146. // if shift shiftvariation is specified, run the modifier
  36147. if (shiftvariation) {
  36148. var _data$offsets = data.offsets,
  36149. reference = _data$offsets.reference,
  36150. popper = _data$offsets.popper;
  36151. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  36152. var side = isVertical ? 'left' : 'top';
  36153. var measurement = isVertical ? 'width' : 'height';
  36154. var shiftOffsets = {
  36155. start: defineProperty({}, side, reference[side]),
  36156. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  36157. };
  36158. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  36159. }
  36160. return data;
  36161. }
  36162. /**
  36163. * @function
  36164. * @memberof Modifiers
  36165. * @argument {Object} data - The data object generated by update method
  36166. * @argument {Object} options - Modifiers configuration and options
  36167. * @returns {Object} The data object, properly modified
  36168. */
  36169. function hide(data) {
  36170. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  36171. return data;
  36172. }
  36173. var refRect = data.offsets.reference;
  36174. var bound = find(data.instance.modifiers, function (modifier) {
  36175. return modifier.name === 'preventOverflow';
  36176. }).boundaries;
  36177. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  36178. // Avoid unnecessary DOM access if visibility hasn't changed
  36179. if (data.hide === true) {
  36180. return data;
  36181. }
  36182. data.hide = true;
  36183. data.attributes['x-out-of-boundaries'] = '';
  36184. } else {
  36185. // Avoid unnecessary DOM access if visibility hasn't changed
  36186. if (data.hide === false) {
  36187. return data;
  36188. }
  36189. data.hide = false;
  36190. data.attributes['x-out-of-boundaries'] = false;
  36191. }
  36192. return data;
  36193. }
  36194. /**
  36195. * @function
  36196. * @memberof Modifiers
  36197. * @argument {Object} data - The data object generated by `update` method
  36198. * @argument {Object} options - Modifiers configuration and options
  36199. * @returns {Object} The data object, properly modified
  36200. */
  36201. function inner(data) {
  36202. var placement = data.placement;
  36203. var basePlacement = placement.split('-')[0];
  36204. var _data$offsets = data.offsets,
  36205. popper = _data$offsets.popper,
  36206. reference = _data$offsets.reference;
  36207. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  36208. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  36209. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  36210. data.placement = getOppositePlacement(placement);
  36211. data.offsets.popper = getClientRect(popper);
  36212. return data;
  36213. }
  36214. /**
  36215. * Modifier function, each modifier can have a function of this type assigned
  36216. * to its `fn` property.<br />
  36217. * These functions will be called on each update, this means that you must
  36218. * make sure they are performant enough to avoid performance bottlenecks.
  36219. *
  36220. * @function ModifierFn
  36221. * @argument {dataObject} data - The data object generated by `update` method
  36222. * @argument {Object} options - Modifiers configuration and options
  36223. * @returns {dataObject} The data object, properly modified
  36224. */
  36225. /**
  36226. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  36227. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  36228. * needed by the library.
  36229. *
  36230. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  36231. * All the other properties are configurations that could be tweaked.
  36232. * @namespace modifiers
  36233. */
  36234. var modifiers = {
  36235. /**
  36236. * Modifier used to shift the popper on the start or end of its reference
  36237. * element.<br />
  36238. * It will read the variation of the `placement` property.<br />
  36239. * It can be one either `-end` or `-start`.
  36240. * @memberof modifiers
  36241. * @inner
  36242. */
  36243. shift: {
  36244. /** @prop {number} order=100 - Index used to define the order of execution */
  36245. order: 100,
  36246. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36247. enabled: true,
  36248. /** @prop {ModifierFn} */
  36249. fn: shift
  36250. },
  36251. /**
  36252. * The `offset` modifier can shift your popper on both its axis.
  36253. *
  36254. * It accepts the following units:
  36255. * - `px` or unit-less, interpreted as pixels
  36256. * - `%` or `%r`, percentage relative to the length of the reference element
  36257. * - `%p`, percentage relative to the length of the popper element
  36258. * - `vw`, CSS viewport width unit
  36259. * - `vh`, CSS viewport height unit
  36260. *
  36261. * For length is intended the main axis relative to the placement of the popper.<br />
  36262. * This means that if the placement is `top` or `bottom`, the length will be the
  36263. * `width`. In case of `left` or `right`, it will be the `height`.
  36264. *
  36265. * You can provide a single value (as `Number` or `String`), or a pair of values
  36266. * as `String` divided by a comma or one (or more) white spaces.<br />
  36267. * The latter is a deprecated method because it leads to confusion and will be
  36268. * removed in v2.<br />
  36269. * Additionally, it accepts additions and subtractions between different units.
  36270. * Note that multiplications and divisions aren't supported.
  36271. *
  36272. * Valid examples are:
  36273. * ```
  36274. * 10
  36275. * '10%'
  36276. * '10, 10'
  36277. * '10%, 10'
  36278. * '10 + 10%'
  36279. * '10 - 5vh + 3%'
  36280. * '-10px + 5vh, 5px - 6%'
  36281. * ```
  36282. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  36283. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  36284. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  36285. *
  36286. * @memberof modifiers
  36287. * @inner
  36288. */
  36289. offset: {
  36290. /** @prop {number} order=200 - Index used to define the order of execution */
  36291. order: 200,
  36292. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36293. enabled: true,
  36294. /** @prop {ModifierFn} */
  36295. fn: offset,
  36296. /** @prop {Number|String} offset=0
  36297. * The offset value as described in the modifier description
  36298. */
  36299. offset: 0
  36300. },
  36301. /**
  36302. * Modifier used to prevent the popper from being positioned outside the boundary.
  36303. *
  36304. * A scenario exists where the reference itself is not within the boundaries.<br />
  36305. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  36306. * In this case we need to decide whether the popper should either:
  36307. *
  36308. * - detach from the reference and remain "trapped" in the boundaries, or
  36309. * - if it should ignore the boundary and "escape with its reference"
  36310. *
  36311. * When `escapeWithReference` is set to`true` and reference is completely
  36312. * outside its boundaries, the popper will overflow (or completely leave)
  36313. * the boundaries in order to remain attached to the edge of the reference.
  36314. *
  36315. * @memberof modifiers
  36316. * @inner
  36317. */
  36318. preventOverflow: {
  36319. /** @prop {number} order=300 - Index used to define the order of execution */
  36320. order: 300,
  36321. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36322. enabled: true,
  36323. /** @prop {ModifierFn} */
  36324. fn: preventOverflow,
  36325. /**
  36326. * @prop {Array} [priority=['left','right','top','bottom']]
  36327. * Popper will try to prevent overflow following these priorities by default,
  36328. * then, it could overflow on the left and on top of the `boundariesElement`
  36329. */
  36330. priority: ['left', 'right', 'top', 'bottom'],
  36331. /**
  36332. * @prop {number} padding=5
  36333. * Amount of pixel used to define a minimum distance between the boundaries
  36334. * and the popper. This makes sure the popper always has a little padding
  36335. * between the edges of its container
  36336. */
  36337. padding: 5,
  36338. /**
  36339. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  36340. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  36341. * `viewport` or any DOM element.
  36342. */
  36343. boundariesElement: 'scrollParent'
  36344. },
  36345. /**
  36346. * Modifier used to make sure the reference and its popper stay near each other
  36347. * without leaving any gap between the two. Especially useful when the arrow is
  36348. * enabled and you want to ensure that it points to its reference element.
  36349. * It cares only about the first axis. You can still have poppers with margin
  36350. * between the popper and its reference element.
  36351. * @memberof modifiers
  36352. * @inner
  36353. */
  36354. keepTogether: {
  36355. /** @prop {number} order=400 - Index used to define the order of execution */
  36356. order: 400,
  36357. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36358. enabled: true,
  36359. /** @prop {ModifierFn} */
  36360. fn: keepTogether
  36361. },
  36362. /**
  36363. * This modifier is used to move the `arrowElement` of the popper to make
  36364. * sure it is positioned between the reference element and its popper element.
  36365. * It will read the outer size of the `arrowElement` node to detect how many
  36366. * pixels of conjunction are needed.
  36367. *
  36368. * It has no effect if no `arrowElement` is provided.
  36369. * @memberof modifiers
  36370. * @inner
  36371. */
  36372. arrow: {
  36373. /** @prop {number} order=500 - Index used to define the order of execution */
  36374. order: 500,
  36375. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36376. enabled: true,
  36377. /** @prop {ModifierFn} */
  36378. fn: arrow,
  36379. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  36380. element: '[x-arrow]'
  36381. },
  36382. /**
  36383. * Modifier used to flip the popper's placement when it starts to overlap its
  36384. * reference element.
  36385. *
  36386. * Requires the `preventOverflow` modifier before it in order to work.
  36387. *
  36388. * **NOTE:** this modifier will interrupt the current update cycle and will
  36389. * restart it if it detects the need to flip the placement.
  36390. * @memberof modifiers
  36391. * @inner
  36392. */
  36393. flip: {
  36394. /** @prop {number} order=600 - Index used to define the order of execution */
  36395. order: 600,
  36396. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36397. enabled: true,
  36398. /** @prop {ModifierFn} */
  36399. fn: flip,
  36400. /**
  36401. * @prop {String|Array} behavior='flip'
  36402. * The behavior used to change the popper's placement. It can be one of
  36403. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  36404. * placements (with optional variations)
  36405. */
  36406. behavior: 'flip',
  36407. /**
  36408. * @prop {number} padding=5
  36409. * The popper will flip if it hits the edges of the `boundariesElement`
  36410. */
  36411. padding: 5,
  36412. /**
  36413. * @prop {String|HTMLElement} boundariesElement='viewport'
  36414. * The element which will define the boundaries of the popper position.
  36415. * The popper will never be placed outside of the defined boundaries
  36416. * (except if `keepTogether` is enabled)
  36417. */
  36418. boundariesElement: 'viewport',
  36419. /**
  36420. * @prop {Boolean} flipVariations=false
  36421. * The popper will switch placement variation between `-start` and `-end` when
  36422. * the reference element overlaps its boundaries.
  36423. *
  36424. * The original placement should have a set variation.
  36425. */
  36426. flipVariations: false,
  36427. /**
  36428. * @prop {Boolean} flipVariationsByContent=false
  36429. * The popper will switch placement variation between `-start` and `-end` when
  36430. * the popper element overlaps its reference boundaries.
  36431. *
  36432. * The original placement should have a set variation.
  36433. */
  36434. flipVariationsByContent: false
  36435. },
  36436. /**
  36437. * Modifier used to make the popper flow toward the inner of the reference element.
  36438. * By default, when this modifier is disabled, the popper will be placed outside
  36439. * the reference element.
  36440. * @memberof modifiers
  36441. * @inner
  36442. */
  36443. inner: {
  36444. /** @prop {number} order=700 - Index used to define the order of execution */
  36445. order: 700,
  36446. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  36447. enabled: false,
  36448. /** @prop {ModifierFn} */
  36449. fn: inner
  36450. },
  36451. /**
  36452. * Modifier used to hide the popper when its reference element is outside of the
  36453. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  36454. * be used to hide with a CSS selector the popper when its reference is
  36455. * out of boundaries.
  36456. *
  36457. * Requires the `preventOverflow` modifier before it in order to work.
  36458. * @memberof modifiers
  36459. * @inner
  36460. */
  36461. hide: {
  36462. /** @prop {number} order=800 - Index used to define the order of execution */
  36463. order: 800,
  36464. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36465. enabled: true,
  36466. /** @prop {ModifierFn} */
  36467. fn: hide
  36468. },
  36469. /**
  36470. * Computes the style that will be applied to the popper element to gets
  36471. * properly positioned.
  36472. *
  36473. * Note that this modifier will not touch the DOM, it just prepares the styles
  36474. * so that `applyStyle` modifier can apply it. This separation is useful
  36475. * in case you need to replace `applyStyle` with a custom implementation.
  36476. *
  36477. * This modifier has `850` as `order` value to maintain backward compatibility
  36478. * with previous versions of Popper.js. Expect the modifiers ordering method
  36479. * to change in future major versions of the library.
  36480. *
  36481. * @memberof modifiers
  36482. * @inner
  36483. */
  36484. computeStyle: {
  36485. /** @prop {number} order=850 - Index used to define the order of execution */
  36486. order: 850,
  36487. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36488. enabled: true,
  36489. /** @prop {ModifierFn} */
  36490. fn: computeStyle,
  36491. /**
  36492. * @prop {Boolean} gpuAcceleration=true
  36493. * If true, it uses the CSS 3D transformation to position the popper.
  36494. * Otherwise, it will use the `top` and `left` properties
  36495. */
  36496. gpuAcceleration: true,
  36497. /**
  36498. * @prop {string} [x='bottom']
  36499. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  36500. * Change this if your popper should grow in a direction different from `bottom`
  36501. */
  36502. x: 'bottom',
  36503. /**
  36504. * @prop {string} [x='left']
  36505. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  36506. * Change this if your popper should grow in a direction different from `right`
  36507. */
  36508. y: 'right'
  36509. },
  36510. /**
  36511. * Applies the computed styles to the popper element.
  36512. *
  36513. * All the DOM manipulations are limited to this modifier. This is useful in case
  36514. * you want to integrate Popper.js inside a framework or view library and you
  36515. * want to delegate all the DOM manipulations to it.
  36516. *
  36517. * Note that if you disable this modifier, you must make sure the popper element
  36518. * has its position set to `absolute` before Popper.js can do its work!
  36519. *
  36520. * Just disable this modifier and define your own to achieve the desired effect.
  36521. *
  36522. * @memberof modifiers
  36523. * @inner
  36524. */
  36525. applyStyle: {
  36526. /** @prop {number} order=900 - Index used to define the order of execution */
  36527. order: 900,
  36528. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36529. enabled: true,
  36530. /** @prop {ModifierFn} */
  36531. fn: applyStyle,
  36532. /** @prop {Function} */
  36533. onLoad: applyStyleOnLoad,
  36534. /**
  36535. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  36536. * @prop {Boolean} gpuAcceleration=true
  36537. * If true, it uses the CSS 3D transformation to position the popper.
  36538. * Otherwise, it will use the `top` and `left` properties
  36539. */
  36540. gpuAcceleration: undefined
  36541. }
  36542. };
  36543. /**
  36544. * The `dataObject` is an object containing all the information used by Popper.js.
  36545. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  36546. * @name dataObject
  36547. * @property {Object} data.instance The Popper.js instance
  36548. * @property {String} data.placement Placement applied to popper
  36549. * @property {String} data.originalPlacement Placement originally defined on init
  36550. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  36551. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  36552. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  36553. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36554. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36555. * @property {Object} data.boundaries Offsets of the popper boundaries
  36556. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  36557. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  36558. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  36559. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  36560. */
  36561. /**
  36562. * Default options provided to Popper.js constructor.<br />
  36563. * These can be overridden using the `options` argument of Popper.js.<br />
  36564. * To override an option, simply pass an object with the same
  36565. * structure of the `options` object, as the 3rd argument. For example:
  36566. * ```
  36567. * new Popper(ref, pop, {
  36568. * modifiers: {
  36569. * preventOverflow: { enabled: false }
  36570. * }
  36571. * })
  36572. * ```
  36573. * @type {Object}
  36574. * @static
  36575. * @memberof Popper
  36576. */
  36577. var Defaults = {
  36578. /**
  36579. * Popper's placement.
  36580. * @prop {Popper.placements} placement='bottom'
  36581. */
  36582. placement: 'bottom',
  36583. /**
  36584. * Set this to true if you want popper to position it self in 'fixed' mode
  36585. * @prop {Boolean} positionFixed=false
  36586. */
  36587. positionFixed: false,
  36588. /**
  36589. * Whether events (resize, scroll) are initially enabled.
  36590. * @prop {Boolean} eventsEnabled=true
  36591. */
  36592. eventsEnabled: true,
  36593. /**
  36594. * Set to true if you want to automatically remove the popper when
  36595. * you call the `destroy` method.
  36596. * @prop {Boolean} removeOnDestroy=false
  36597. */
  36598. removeOnDestroy: false,
  36599. /**
  36600. * Callback called when the popper is created.<br />
  36601. * By default, it is set to no-op.<br />
  36602. * Access Popper.js instance with `data.instance`.
  36603. * @prop {onCreate}
  36604. */
  36605. onCreate: function onCreate() {},
  36606. /**
  36607. * Callback called when the popper is updated. This callback is not called
  36608. * on the initialization/creation of the popper, but only on subsequent
  36609. * updates.<br />
  36610. * By default, it is set to no-op.<br />
  36611. * Access Popper.js instance with `data.instance`.
  36612. * @prop {onUpdate}
  36613. */
  36614. onUpdate: function onUpdate() {},
  36615. /**
  36616. * List of modifiers used to modify the offsets before they are applied to the popper.
  36617. * They provide most of the functionalities of Popper.js.
  36618. * @prop {modifiers}
  36619. */
  36620. modifiers: modifiers
  36621. };
  36622. /**
  36623. * @callback onCreate
  36624. * @param {dataObject} data
  36625. */
  36626. /**
  36627. * @callback onUpdate
  36628. * @param {dataObject} data
  36629. */
  36630. // Utils
  36631. // Methods
  36632. var Popper = function () {
  36633. /**
  36634. * Creates a new Popper.js instance.
  36635. * @class Popper
  36636. * @param {Element|referenceObject} reference - The reference element used to position the popper
  36637. * @param {Element} popper - The HTML / XML element used as the popper
  36638. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  36639. * @return {Object} instance - The generated Popper.js instance
  36640. */
  36641. function Popper(reference, popper) {
  36642. var _this = this;
  36643. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  36644. classCallCheck(this, Popper);
  36645. this.scheduleUpdate = function () {
  36646. return requestAnimationFrame(_this.update);
  36647. };
  36648. // make update() debounced, so that it only runs at most once-per-tick
  36649. this.update = debounce(this.update.bind(this));
  36650. // with {} we create a new object with the options inside it
  36651. this.options = _extends({}, Popper.Defaults, options);
  36652. // init state
  36653. this.state = {
  36654. isDestroyed: false,
  36655. isCreated: false,
  36656. scrollParents: []
  36657. };
  36658. // get reference and popper elements (allow jQuery wrappers)
  36659. this.reference = reference && reference.jquery ? reference[0] : reference;
  36660. this.popper = popper && popper.jquery ? popper[0] : popper;
  36661. // Deep merge modifiers options
  36662. this.options.modifiers = {};
  36663. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  36664. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  36665. });
  36666. // Refactoring modifiers' list (Object => Array)
  36667. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  36668. return _extends({
  36669. name: name
  36670. }, _this.options.modifiers[name]);
  36671. })
  36672. // sort the modifiers by order
  36673. .sort(function (a, b) {
  36674. return a.order - b.order;
  36675. });
  36676. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  36677. // such code is executed in the same order of its modifier
  36678. // they could add new properties to their options configuration
  36679. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  36680. this.modifiers.forEach(function (modifierOptions) {
  36681. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  36682. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  36683. }
  36684. });
  36685. // fire the first update to position the popper in the right place
  36686. this.update();
  36687. var eventsEnabled = this.options.eventsEnabled;
  36688. if (eventsEnabled) {
  36689. // setup event listeners, they will take care of update the position in specific situations
  36690. this.enableEventListeners();
  36691. }
  36692. this.state.eventsEnabled = eventsEnabled;
  36693. }
  36694. // We can't use class properties because they don't get listed in the
  36695. // class prototype and break stuff like Sinon stubs
  36696. createClass(Popper, [{
  36697. key: 'update',
  36698. value: function update$$1() {
  36699. return update.call(this);
  36700. }
  36701. }, {
  36702. key: 'destroy',
  36703. value: function destroy$$1() {
  36704. return destroy.call(this);
  36705. }
  36706. }, {
  36707. key: 'enableEventListeners',
  36708. value: function enableEventListeners$$1() {
  36709. return enableEventListeners.call(this);
  36710. }
  36711. }, {
  36712. key: 'disableEventListeners',
  36713. value: function disableEventListeners$$1() {
  36714. return disableEventListeners.call(this);
  36715. }
  36716. /**
  36717. * Schedules an update. It will run on the next UI update available.
  36718. * @method scheduleUpdate
  36719. * @memberof Popper
  36720. */
  36721. /**
  36722. * Collection of utilities useful when writing custom modifiers.
  36723. * Starting from version 1.7, this method is available only if you
  36724. * include `popper-utils.js` before `popper.js`.
  36725. *
  36726. * **DEPRECATION**: This way to access PopperUtils is deprecated
  36727. * and will be removed in v2! Use the PopperUtils module directly instead.
  36728. * Due to the high instability of the methods contained in Utils, we can't
  36729. * guarantee them to follow semver. Use them at your own risk!
  36730. * @static
  36731. * @private
  36732. * @type {Object}
  36733. * @deprecated since version 1.8
  36734. * @member Utils
  36735. * @memberof Popper
  36736. */
  36737. }]);
  36738. return Popper;
  36739. }();
  36740. /**
  36741. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  36742. * and lets you use it as replacement of a real DOM node.<br />
  36743. * You can use this method to position a popper relatively to a set of coordinates
  36744. * in case you don't have a DOM node to use as reference.
  36745. *
  36746. * ```
  36747. * new Popper(referenceObject, popperNode);
  36748. * ```
  36749. *
  36750. * NB: This feature isn't supported in Internet Explorer 10.
  36751. * @name referenceObject
  36752. * @property {Function} data.getBoundingClientRect
  36753. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  36754. * @property {number} data.clientWidth
  36755. * An ES6 getter that will return the width of the virtual reference element.
  36756. * @property {number} data.clientHeight
  36757. * An ES6 getter that will return the height of the virtual reference element.
  36758. */
  36759. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  36760. Popper.placements = placements;
  36761. Popper.Defaults = Defaults;
  36762. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  36763. //# sourceMappingURL=popper.js.map
  36764. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  36765. /***/ }),
  36766. /***/ "./node_modules/process/browser.js":
  36767. /*!*****************************************!*\
  36768. !*** ./node_modules/process/browser.js ***!
  36769. \*****************************************/
  36770. /*! no static exports found */
  36771. /***/ (function(module, exports) {
  36772. // shim for using process in browser
  36773. var process = module.exports = {};
  36774. // cached from whatever global is present so that test runners that stub it
  36775. // don't break things. But we need to wrap it in a try catch in case it is
  36776. // wrapped in strict mode code which doesn't define any globals. It's inside a
  36777. // function because try/catches deoptimize in certain engines.
  36778. var cachedSetTimeout;
  36779. var cachedClearTimeout;
  36780. function defaultSetTimout() {
  36781. throw new Error('setTimeout has not been defined');
  36782. }
  36783. function defaultClearTimeout () {
  36784. throw new Error('clearTimeout has not been defined');
  36785. }
  36786. (function () {
  36787. try {
  36788. if (typeof setTimeout === 'function') {
  36789. cachedSetTimeout = setTimeout;
  36790. } else {
  36791. cachedSetTimeout = defaultSetTimout;
  36792. }
  36793. } catch (e) {
  36794. cachedSetTimeout = defaultSetTimout;
  36795. }
  36796. try {
  36797. if (typeof clearTimeout === 'function') {
  36798. cachedClearTimeout = clearTimeout;
  36799. } else {
  36800. cachedClearTimeout = defaultClearTimeout;
  36801. }
  36802. } catch (e) {
  36803. cachedClearTimeout = defaultClearTimeout;
  36804. }
  36805. } ())
  36806. function runTimeout(fun) {
  36807. if (cachedSetTimeout === setTimeout) {
  36808. //normal enviroments in sane situations
  36809. return setTimeout(fun, 0);
  36810. }
  36811. // if setTimeout wasn't available but was latter defined
  36812. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  36813. cachedSetTimeout = setTimeout;
  36814. return setTimeout(fun, 0);
  36815. }
  36816. try {
  36817. // when when somebody has screwed with setTimeout but no I.E. maddness
  36818. return cachedSetTimeout(fun, 0);
  36819. } catch(e){
  36820. try {
  36821. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36822. return cachedSetTimeout.call(null, fun, 0);
  36823. } catch(e){
  36824. // 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
  36825. return cachedSetTimeout.call(this, fun, 0);
  36826. }
  36827. }
  36828. }
  36829. function runClearTimeout(marker) {
  36830. if (cachedClearTimeout === clearTimeout) {
  36831. //normal enviroments in sane situations
  36832. return clearTimeout(marker);
  36833. }
  36834. // if clearTimeout wasn't available but was latter defined
  36835. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  36836. cachedClearTimeout = clearTimeout;
  36837. return clearTimeout(marker);
  36838. }
  36839. try {
  36840. // when when somebody has screwed with setTimeout but no I.E. maddness
  36841. return cachedClearTimeout(marker);
  36842. } catch (e){
  36843. try {
  36844. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36845. return cachedClearTimeout.call(null, marker);
  36846. } catch (e){
  36847. // 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.
  36848. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  36849. return cachedClearTimeout.call(this, marker);
  36850. }
  36851. }
  36852. }
  36853. var queue = [];
  36854. var draining = false;
  36855. var currentQueue;
  36856. var queueIndex = -1;
  36857. function cleanUpNextTick() {
  36858. if (!draining || !currentQueue) {
  36859. return;
  36860. }
  36861. draining = false;
  36862. if (currentQueue.length) {
  36863. queue = currentQueue.concat(queue);
  36864. } else {
  36865. queueIndex = -1;
  36866. }
  36867. if (queue.length) {
  36868. drainQueue();
  36869. }
  36870. }
  36871. function drainQueue() {
  36872. if (draining) {
  36873. return;
  36874. }
  36875. var timeout = runTimeout(cleanUpNextTick);
  36876. draining = true;
  36877. var len = queue.length;
  36878. while(len) {
  36879. currentQueue = queue;
  36880. queue = [];
  36881. while (++queueIndex < len) {
  36882. if (currentQueue) {
  36883. currentQueue[queueIndex].run();
  36884. }
  36885. }
  36886. queueIndex = -1;
  36887. len = queue.length;
  36888. }
  36889. currentQueue = null;
  36890. draining = false;
  36891. runClearTimeout(timeout);
  36892. }
  36893. process.nextTick = function (fun) {
  36894. var args = new Array(arguments.length - 1);
  36895. if (arguments.length > 1) {
  36896. for (var i = 1; i < arguments.length; i++) {
  36897. args[i - 1] = arguments[i];
  36898. }
  36899. }
  36900. queue.push(new Item(fun, args));
  36901. if (queue.length === 1 && !draining) {
  36902. runTimeout(drainQueue);
  36903. }
  36904. };
  36905. // v8 likes predictible objects
  36906. function Item(fun, array) {
  36907. this.fun = fun;
  36908. this.array = array;
  36909. }
  36910. Item.prototype.run = function () {
  36911. this.fun.apply(null, this.array);
  36912. };
  36913. process.title = 'browser';
  36914. process.browser = true;
  36915. process.env = {};
  36916. process.argv = [];
  36917. process.version = ''; // empty string to avoid regexp issues
  36918. process.versions = {};
  36919. function noop() {}
  36920. process.on = noop;
  36921. process.addListener = noop;
  36922. process.once = noop;
  36923. process.off = noop;
  36924. process.removeListener = noop;
  36925. process.removeAllListeners = noop;
  36926. process.emit = noop;
  36927. process.prependListener = noop;
  36928. process.prependOnceListener = noop;
  36929. process.listeners = function (name) { return [] }
  36930. process.binding = function (name) {
  36931. throw new Error('process.binding is not supported');
  36932. };
  36933. process.cwd = function () { return '/' };
  36934. process.chdir = function (dir) {
  36935. throw new Error('process.chdir is not supported');
  36936. };
  36937. process.umask = function() { return 0; };
  36938. /***/ }),
  36939. /***/ "./node_modules/pusher-js/dist/web/pusher.js":
  36940. /*!***************************************************!*\
  36941. !*** ./node_modules/pusher-js/dist/web/pusher.js ***!
  36942. \***************************************************/
  36943. /*! no static exports found */
  36944. /***/ (function(module, exports, __webpack_require__) {
  36945. /* WEBPACK VAR INJECTION */(function(Buffer) {/*!
  36946. * Pusher JavaScript Library v5.0.3
  36947. * https://pusher.com/
  36948. *
  36949. * Copyright 2017, Pusher
  36950. * Released under the MIT licence.
  36951. */
  36952. (function webpackUniversalModuleDefinition(root, factory) {
  36953. if(true)
  36954. module.exports = factory();
  36955. else {}
  36956. })(window, function() {
  36957. return /******/ (function(modules) { // webpackBootstrap
  36958. /******/ // The module cache
  36959. /******/ var installedModules = {};
  36960. /******/
  36961. /******/ // The require function
  36962. /******/ function __webpack_require__(moduleId) {
  36963. /******/
  36964. /******/ // Check if module is in cache
  36965. /******/ if(installedModules[moduleId]) {
  36966. /******/ return installedModules[moduleId].exports;
  36967. /******/ }
  36968. /******/ // Create a new module (and put it into the cache)
  36969. /******/ var module = installedModules[moduleId] = {
  36970. /******/ i: moduleId,
  36971. /******/ l: false,
  36972. /******/ exports: {}
  36973. /******/ };
  36974. /******/
  36975. /******/ // Execute the module function
  36976. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  36977. /******/
  36978. /******/ // Flag the module as loaded
  36979. /******/ module.l = true;
  36980. /******/
  36981. /******/ // Return the exports of the module
  36982. /******/ return module.exports;
  36983. /******/ }
  36984. /******/
  36985. /******/
  36986. /******/ // expose the modules object (__webpack_modules__)
  36987. /******/ __webpack_require__.m = modules;
  36988. /******/
  36989. /******/ // expose the module cache
  36990. /******/ __webpack_require__.c = installedModules;
  36991. /******/
  36992. /******/ // define getter function for harmony exports
  36993. /******/ __webpack_require__.d = function(exports, name, getter) {
  36994. /******/ if(!__webpack_require__.o(exports, name)) {
  36995. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  36996. /******/ }
  36997. /******/ };
  36998. /******/
  36999. /******/ // define __esModule on exports
  37000. /******/ __webpack_require__.r = function(exports) {
  37001. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  37002. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  37003. /******/ }
  37004. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  37005. /******/ };
  37006. /******/
  37007. /******/ // create a fake namespace object
  37008. /******/ // mode & 1: value is a module id, require it
  37009. /******/ // mode & 2: merge all properties of value into the ns
  37010. /******/ // mode & 4: return value when already ns object
  37011. /******/ // mode & 8|1: behave like require
  37012. /******/ __webpack_require__.t = function(value, mode) {
  37013. /******/ if(mode & 1) value = __webpack_require__(value);
  37014. /******/ if(mode & 8) return value;
  37015. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  37016. /******/ var ns = Object.create(null);
  37017. /******/ __webpack_require__.r(ns);
  37018. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  37019. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  37020. /******/ return ns;
  37021. /******/ };
  37022. /******/
  37023. /******/ // getDefaultExport function for compatibility with non-harmony modules
  37024. /******/ __webpack_require__.n = function(module) {
  37025. /******/ var getter = module && module.__esModule ?
  37026. /******/ function getDefault() { return module['default']; } :
  37027. /******/ function getModuleExports() { return module; };
  37028. /******/ __webpack_require__.d(getter, 'a', getter);
  37029. /******/ return getter;
  37030. /******/ };
  37031. /******/
  37032. /******/ // Object.prototype.hasOwnProperty.call
  37033. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  37034. /******/
  37035. /******/ // __webpack_public_path__
  37036. /******/ __webpack_require__.p = "";
  37037. /******/
  37038. /******/
  37039. /******/ // Load entry module and return exports
  37040. /******/ return __webpack_require__(__webpack_require__.s = 2);
  37041. /******/ })
  37042. /************************************************************************/
  37043. /******/ ([
  37044. /* 0 */
  37045. /***/ (function(module, exports, __webpack_require__) {
  37046. (function(nacl) {
  37047. 'use strict';
  37048. // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
  37049. // Public domain.
  37050. //
  37051. // Implementation derived from TweetNaCl version 20140427.
  37052. // See for details: http://tweetnacl.cr.yp.to/
  37053. var gf = function(init) {
  37054. var i, r = new Float64Array(16);
  37055. if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
  37056. return r;
  37057. };
  37058. // Pluggable, initialized in high-level API below.
  37059. var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
  37060. var _0 = new Uint8Array(16);
  37061. var _9 = new Uint8Array(32); _9[0] = 9;
  37062. var gf0 = gf(),
  37063. gf1 = gf([1]),
  37064. _121665 = gf([0xdb41, 1]),
  37065. D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
  37066. D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
  37067. X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
  37068. Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
  37069. I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
  37070. function ts64(x, i, h, l) {
  37071. x[i] = (h >> 24) & 0xff;
  37072. x[i+1] = (h >> 16) & 0xff;
  37073. x[i+2] = (h >> 8) & 0xff;
  37074. x[i+3] = h & 0xff;
  37075. x[i+4] = (l >> 24) & 0xff;
  37076. x[i+5] = (l >> 16) & 0xff;
  37077. x[i+6] = (l >> 8) & 0xff;
  37078. x[i+7] = l & 0xff;
  37079. }
  37080. function vn(x, xi, y, yi, n) {
  37081. var i,d = 0;
  37082. for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
  37083. return (1 & ((d - 1) >>> 8)) - 1;
  37084. }
  37085. function crypto_verify_16(x, xi, y, yi) {
  37086. return vn(x,xi,y,yi,16);
  37087. }
  37088. function crypto_verify_32(x, xi, y, yi) {
  37089. return vn(x,xi,y,yi,32);
  37090. }
  37091. function core_salsa20(o, p, k, c) {
  37092. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37093. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37094. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37095. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37096. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37097. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37098. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37099. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37100. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37101. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37102. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37103. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37104. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37105. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37106. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37107. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37108. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37109. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37110. x15 = j15, u;
  37111. for (var i = 0; i < 20; i += 2) {
  37112. u = x0 + x12 | 0;
  37113. x4 ^= u<<7 | u>>>(32-7);
  37114. u = x4 + x0 | 0;
  37115. x8 ^= u<<9 | u>>>(32-9);
  37116. u = x8 + x4 | 0;
  37117. x12 ^= u<<13 | u>>>(32-13);
  37118. u = x12 + x8 | 0;
  37119. x0 ^= u<<18 | u>>>(32-18);
  37120. u = x5 + x1 | 0;
  37121. x9 ^= u<<7 | u>>>(32-7);
  37122. u = x9 + x5 | 0;
  37123. x13 ^= u<<9 | u>>>(32-9);
  37124. u = x13 + x9 | 0;
  37125. x1 ^= u<<13 | u>>>(32-13);
  37126. u = x1 + x13 | 0;
  37127. x5 ^= u<<18 | u>>>(32-18);
  37128. u = x10 + x6 | 0;
  37129. x14 ^= u<<7 | u>>>(32-7);
  37130. u = x14 + x10 | 0;
  37131. x2 ^= u<<9 | u>>>(32-9);
  37132. u = x2 + x14 | 0;
  37133. x6 ^= u<<13 | u>>>(32-13);
  37134. u = x6 + x2 | 0;
  37135. x10 ^= u<<18 | u>>>(32-18);
  37136. u = x15 + x11 | 0;
  37137. x3 ^= u<<7 | u>>>(32-7);
  37138. u = x3 + x15 | 0;
  37139. x7 ^= u<<9 | u>>>(32-9);
  37140. u = x7 + x3 | 0;
  37141. x11 ^= u<<13 | u>>>(32-13);
  37142. u = x11 + x7 | 0;
  37143. x15 ^= u<<18 | u>>>(32-18);
  37144. u = x0 + x3 | 0;
  37145. x1 ^= u<<7 | u>>>(32-7);
  37146. u = x1 + x0 | 0;
  37147. x2 ^= u<<9 | u>>>(32-9);
  37148. u = x2 + x1 | 0;
  37149. x3 ^= u<<13 | u>>>(32-13);
  37150. u = x3 + x2 | 0;
  37151. x0 ^= u<<18 | u>>>(32-18);
  37152. u = x5 + x4 | 0;
  37153. x6 ^= u<<7 | u>>>(32-7);
  37154. u = x6 + x5 | 0;
  37155. x7 ^= u<<9 | u>>>(32-9);
  37156. u = x7 + x6 | 0;
  37157. x4 ^= u<<13 | u>>>(32-13);
  37158. u = x4 + x7 | 0;
  37159. x5 ^= u<<18 | u>>>(32-18);
  37160. u = x10 + x9 | 0;
  37161. x11 ^= u<<7 | u>>>(32-7);
  37162. u = x11 + x10 | 0;
  37163. x8 ^= u<<9 | u>>>(32-9);
  37164. u = x8 + x11 | 0;
  37165. x9 ^= u<<13 | u>>>(32-13);
  37166. u = x9 + x8 | 0;
  37167. x10 ^= u<<18 | u>>>(32-18);
  37168. u = x15 + x14 | 0;
  37169. x12 ^= u<<7 | u>>>(32-7);
  37170. u = x12 + x15 | 0;
  37171. x13 ^= u<<9 | u>>>(32-9);
  37172. u = x13 + x12 | 0;
  37173. x14 ^= u<<13 | u>>>(32-13);
  37174. u = x14 + x13 | 0;
  37175. x15 ^= u<<18 | u>>>(32-18);
  37176. }
  37177. x0 = x0 + j0 | 0;
  37178. x1 = x1 + j1 | 0;
  37179. x2 = x2 + j2 | 0;
  37180. x3 = x3 + j3 | 0;
  37181. x4 = x4 + j4 | 0;
  37182. x5 = x5 + j5 | 0;
  37183. x6 = x6 + j6 | 0;
  37184. x7 = x7 + j7 | 0;
  37185. x8 = x8 + j8 | 0;
  37186. x9 = x9 + j9 | 0;
  37187. x10 = x10 + j10 | 0;
  37188. x11 = x11 + j11 | 0;
  37189. x12 = x12 + j12 | 0;
  37190. x13 = x13 + j13 | 0;
  37191. x14 = x14 + j14 | 0;
  37192. x15 = x15 + j15 | 0;
  37193. o[ 0] = x0 >>> 0 & 0xff;
  37194. o[ 1] = x0 >>> 8 & 0xff;
  37195. o[ 2] = x0 >>> 16 & 0xff;
  37196. o[ 3] = x0 >>> 24 & 0xff;
  37197. o[ 4] = x1 >>> 0 & 0xff;
  37198. o[ 5] = x1 >>> 8 & 0xff;
  37199. o[ 6] = x1 >>> 16 & 0xff;
  37200. o[ 7] = x1 >>> 24 & 0xff;
  37201. o[ 8] = x2 >>> 0 & 0xff;
  37202. o[ 9] = x2 >>> 8 & 0xff;
  37203. o[10] = x2 >>> 16 & 0xff;
  37204. o[11] = x2 >>> 24 & 0xff;
  37205. o[12] = x3 >>> 0 & 0xff;
  37206. o[13] = x3 >>> 8 & 0xff;
  37207. o[14] = x3 >>> 16 & 0xff;
  37208. o[15] = x3 >>> 24 & 0xff;
  37209. o[16] = x4 >>> 0 & 0xff;
  37210. o[17] = x4 >>> 8 & 0xff;
  37211. o[18] = x4 >>> 16 & 0xff;
  37212. o[19] = x4 >>> 24 & 0xff;
  37213. o[20] = x5 >>> 0 & 0xff;
  37214. o[21] = x5 >>> 8 & 0xff;
  37215. o[22] = x5 >>> 16 & 0xff;
  37216. o[23] = x5 >>> 24 & 0xff;
  37217. o[24] = x6 >>> 0 & 0xff;
  37218. o[25] = x6 >>> 8 & 0xff;
  37219. o[26] = x6 >>> 16 & 0xff;
  37220. o[27] = x6 >>> 24 & 0xff;
  37221. o[28] = x7 >>> 0 & 0xff;
  37222. o[29] = x7 >>> 8 & 0xff;
  37223. o[30] = x7 >>> 16 & 0xff;
  37224. o[31] = x7 >>> 24 & 0xff;
  37225. o[32] = x8 >>> 0 & 0xff;
  37226. o[33] = x8 >>> 8 & 0xff;
  37227. o[34] = x8 >>> 16 & 0xff;
  37228. o[35] = x8 >>> 24 & 0xff;
  37229. o[36] = x9 >>> 0 & 0xff;
  37230. o[37] = x9 >>> 8 & 0xff;
  37231. o[38] = x9 >>> 16 & 0xff;
  37232. o[39] = x9 >>> 24 & 0xff;
  37233. o[40] = x10 >>> 0 & 0xff;
  37234. o[41] = x10 >>> 8 & 0xff;
  37235. o[42] = x10 >>> 16 & 0xff;
  37236. o[43] = x10 >>> 24 & 0xff;
  37237. o[44] = x11 >>> 0 & 0xff;
  37238. o[45] = x11 >>> 8 & 0xff;
  37239. o[46] = x11 >>> 16 & 0xff;
  37240. o[47] = x11 >>> 24 & 0xff;
  37241. o[48] = x12 >>> 0 & 0xff;
  37242. o[49] = x12 >>> 8 & 0xff;
  37243. o[50] = x12 >>> 16 & 0xff;
  37244. o[51] = x12 >>> 24 & 0xff;
  37245. o[52] = x13 >>> 0 & 0xff;
  37246. o[53] = x13 >>> 8 & 0xff;
  37247. o[54] = x13 >>> 16 & 0xff;
  37248. o[55] = x13 >>> 24 & 0xff;
  37249. o[56] = x14 >>> 0 & 0xff;
  37250. o[57] = x14 >>> 8 & 0xff;
  37251. o[58] = x14 >>> 16 & 0xff;
  37252. o[59] = x14 >>> 24 & 0xff;
  37253. o[60] = x15 >>> 0 & 0xff;
  37254. o[61] = x15 >>> 8 & 0xff;
  37255. o[62] = x15 >>> 16 & 0xff;
  37256. o[63] = x15 >>> 24 & 0xff;
  37257. }
  37258. function core_hsalsa20(o,p,k,c) {
  37259. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37260. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37261. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37262. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37263. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37264. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37265. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37266. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37267. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37268. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37269. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37270. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37271. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37272. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37273. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37274. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37275. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37276. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37277. x15 = j15, u;
  37278. for (var i = 0; i < 20; i += 2) {
  37279. u = x0 + x12 | 0;
  37280. x4 ^= u<<7 | u>>>(32-7);
  37281. u = x4 + x0 | 0;
  37282. x8 ^= u<<9 | u>>>(32-9);
  37283. u = x8 + x4 | 0;
  37284. x12 ^= u<<13 | u>>>(32-13);
  37285. u = x12 + x8 | 0;
  37286. x0 ^= u<<18 | u>>>(32-18);
  37287. u = x5 + x1 | 0;
  37288. x9 ^= u<<7 | u>>>(32-7);
  37289. u = x9 + x5 | 0;
  37290. x13 ^= u<<9 | u>>>(32-9);
  37291. u = x13 + x9 | 0;
  37292. x1 ^= u<<13 | u>>>(32-13);
  37293. u = x1 + x13 | 0;
  37294. x5 ^= u<<18 | u>>>(32-18);
  37295. u = x10 + x6 | 0;
  37296. x14 ^= u<<7 | u>>>(32-7);
  37297. u = x14 + x10 | 0;
  37298. x2 ^= u<<9 | u>>>(32-9);
  37299. u = x2 + x14 | 0;
  37300. x6 ^= u<<13 | u>>>(32-13);
  37301. u = x6 + x2 | 0;
  37302. x10 ^= u<<18 | u>>>(32-18);
  37303. u = x15 + x11 | 0;
  37304. x3 ^= u<<7 | u>>>(32-7);
  37305. u = x3 + x15 | 0;
  37306. x7 ^= u<<9 | u>>>(32-9);
  37307. u = x7 + x3 | 0;
  37308. x11 ^= u<<13 | u>>>(32-13);
  37309. u = x11 + x7 | 0;
  37310. x15 ^= u<<18 | u>>>(32-18);
  37311. u = x0 + x3 | 0;
  37312. x1 ^= u<<7 | u>>>(32-7);
  37313. u = x1 + x0 | 0;
  37314. x2 ^= u<<9 | u>>>(32-9);
  37315. u = x2 + x1 | 0;
  37316. x3 ^= u<<13 | u>>>(32-13);
  37317. u = x3 + x2 | 0;
  37318. x0 ^= u<<18 | u>>>(32-18);
  37319. u = x5 + x4 | 0;
  37320. x6 ^= u<<7 | u>>>(32-7);
  37321. u = x6 + x5 | 0;
  37322. x7 ^= u<<9 | u>>>(32-9);
  37323. u = x7 + x6 | 0;
  37324. x4 ^= u<<13 | u>>>(32-13);
  37325. u = x4 + x7 | 0;
  37326. x5 ^= u<<18 | u>>>(32-18);
  37327. u = x10 + x9 | 0;
  37328. x11 ^= u<<7 | u>>>(32-7);
  37329. u = x11 + x10 | 0;
  37330. x8 ^= u<<9 | u>>>(32-9);
  37331. u = x8 + x11 | 0;
  37332. x9 ^= u<<13 | u>>>(32-13);
  37333. u = x9 + x8 | 0;
  37334. x10 ^= u<<18 | u>>>(32-18);
  37335. u = x15 + x14 | 0;
  37336. x12 ^= u<<7 | u>>>(32-7);
  37337. u = x12 + x15 | 0;
  37338. x13 ^= u<<9 | u>>>(32-9);
  37339. u = x13 + x12 | 0;
  37340. x14 ^= u<<13 | u>>>(32-13);
  37341. u = x14 + x13 | 0;
  37342. x15 ^= u<<18 | u>>>(32-18);
  37343. }
  37344. o[ 0] = x0 >>> 0 & 0xff;
  37345. o[ 1] = x0 >>> 8 & 0xff;
  37346. o[ 2] = x0 >>> 16 & 0xff;
  37347. o[ 3] = x0 >>> 24 & 0xff;
  37348. o[ 4] = x5 >>> 0 & 0xff;
  37349. o[ 5] = x5 >>> 8 & 0xff;
  37350. o[ 6] = x5 >>> 16 & 0xff;
  37351. o[ 7] = x5 >>> 24 & 0xff;
  37352. o[ 8] = x10 >>> 0 & 0xff;
  37353. o[ 9] = x10 >>> 8 & 0xff;
  37354. o[10] = x10 >>> 16 & 0xff;
  37355. o[11] = x10 >>> 24 & 0xff;
  37356. o[12] = x15 >>> 0 & 0xff;
  37357. o[13] = x15 >>> 8 & 0xff;
  37358. o[14] = x15 >>> 16 & 0xff;
  37359. o[15] = x15 >>> 24 & 0xff;
  37360. o[16] = x6 >>> 0 & 0xff;
  37361. o[17] = x6 >>> 8 & 0xff;
  37362. o[18] = x6 >>> 16 & 0xff;
  37363. o[19] = x6 >>> 24 & 0xff;
  37364. o[20] = x7 >>> 0 & 0xff;
  37365. o[21] = x7 >>> 8 & 0xff;
  37366. o[22] = x7 >>> 16 & 0xff;
  37367. o[23] = x7 >>> 24 & 0xff;
  37368. o[24] = x8 >>> 0 & 0xff;
  37369. o[25] = x8 >>> 8 & 0xff;
  37370. o[26] = x8 >>> 16 & 0xff;
  37371. o[27] = x8 >>> 24 & 0xff;
  37372. o[28] = x9 >>> 0 & 0xff;
  37373. o[29] = x9 >>> 8 & 0xff;
  37374. o[30] = x9 >>> 16 & 0xff;
  37375. o[31] = x9 >>> 24 & 0xff;
  37376. }
  37377. function crypto_core_salsa20(out,inp,k,c) {
  37378. core_salsa20(out,inp,k,c);
  37379. }
  37380. function crypto_core_hsalsa20(out,inp,k,c) {
  37381. core_hsalsa20(out,inp,k,c);
  37382. }
  37383. var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
  37384. // "expand 32-byte k"
  37385. function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
  37386. var z = new Uint8Array(16), x = new Uint8Array(64);
  37387. var u, i;
  37388. for (i = 0; i < 16; i++) z[i] = 0;
  37389. for (i = 0; i < 8; i++) z[i] = n[i];
  37390. while (b >= 64) {
  37391. crypto_core_salsa20(x,z,k,sigma);
  37392. for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37393. u = 1;
  37394. for (i = 8; i < 16; i++) {
  37395. u = u + (z[i] & 0xff) | 0;
  37396. z[i] = u & 0xff;
  37397. u >>>= 8;
  37398. }
  37399. b -= 64;
  37400. cpos += 64;
  37401. mpos += 64;
  37402. }
  37403. if (b > 0) {
  37404. crypto_core_salsa20(x,z,k,sigma);
  37405. for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37406. }
  37407. return 0;
  37408. }
  37409. function crypto_stream_salsa20(c,cpos,b,n,k) {
  37410. var z = new Uint8Array(16), x = new Uint8Array(64);
  37411. var u, i;
  37412. for (i = 0; i < 16; i++) z[i] = 0;
  37413. for (i = 0; i < 8; i++) z[i] = n[i];
  37414. while (b >= 64) {
  37415. crypto_core_salsa20(x,z,k,sigma);
  37416. for (i = 0; i < 64; i++) c[cpos+i] = x[i];
  37417. u = 1;
  37418. for (i = 8; i < 16; i++) {
  37419. u = u + (z[i] & 0xff) | 0;
  37420. z[i] = u & 0xff;
  37421. u >>>= 8;
  37422. }
  37423. b -= 64;
  37424. cpos += 64;
  37425. }
  37426. if (b > 0) {
  37427. crypto_core_salsa20(x,z,k,sigma);
  37428. for (i = 0; i < b; i++) c[cpos+i] = x[i];
  37429. }
  37430. return 0;
  37431. }
  37432. function crypto_stream(c,cpos,d,n,k) {
  37433. var s = new Uint8Array(32);
  37434. crypto_core_hsalsa20(s,n,k,sigma);
  37435. var sn = new Uint8Array(8);
  37436. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37437. return crypto_stream_salsa20(c,cpos,d,sn,s);
  37438. }
  37439. function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
  37440. var s = new Uint8Array(32);
  37441. crypto_core_hsalsa20(s,n,k,sigma);
  37442. var sn = new Uint8Array(8);
  37443. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37444. return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
  37445. }
  37446. /*
  37447. * Port of Andrew Moon's Poly1305-donna-16. Public domain.
  37448. * https://github.com/floodyberry/poly1305-donna
  37449. */
  37450. var poly1305 = function(key) {
  37451. this.buffer = new Uint8Array(16);
  37452. this.r = new Uint16Array(10);
  37453. this.h = new Uint16Array(10);
  37454. this.pad = new Uint16Array(8);
  37455. this.leftover = 0;
  37456. this.fin = 0;
  37457. var t0, t1, t2, t3, t4, t5, t6, t7;
  37458. t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
  37459. t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37460. t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
  37461. t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37462. t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
  37463. this.r[5] = ((t4 >>> 1)) & 0x1ffe;
  37464. t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37465. t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
  37466. t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37467. this.r[9] = ((t7 >>> 5)) & 0x007f;
  37468. this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
  37469. this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
  37470. this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
  37471. this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
  37472. this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
  37473. this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
  37474. this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
  37475. this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
  37476. };
  37477. poly1305.prototype.blocks = function(m, mpos, bytes) {
  37478. var hibit = this.fin ? 0 : (1 << 11);
  37479. var t0, t1, t2, t3, t4, t5, t6, t7, c;
  37480. var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
  37481. var h0 = this.h[0],
  37482. h1 = this.h[1],
  37483. h2 = this.h[2],
  37484. h3 = this.h[3],
  37485. h4 = this.h[4],
  37486. h5 = this.h[5],
  37487. h6 = this.h[6],
  37488. h7 = this.h[7],
  37489. h8 = this.h[8],
  37490. h9 = this.h[9];
  37491. var r0 = this.r[0],
  37492. r1 = this.r[1],
  37493. r2 = this.r[2],
  37494. r3 = this.r[3],
  37495. r4 = this.r[4],
  37496. r5 = this.r[5],
  37497. r6 = this.r[6],
  37498. r7 = this.r[7],
  37499. r8 = this.r[8],
  37500. r9 = this.r[9];
  37501. while (bytes >= 16) {
  37502. t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
  37503. t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37504. t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
  37505. t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37506. t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
  37507. h5 += ((t4 >>> 1)) & 0x1fff;
  37508. t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37509. t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
  37510. t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37511. h9 += ((t7 >>> 5)) | hibit;
  37512. c = 0;
  37513. d0 = c;
  37514. d0 += h0 * r0;
  37515. d0 += h1 * (5 * r9);
  37516. d0 += h2 * (5 * r8);
  37517. d0 += h3 * (5 * r7);
  37518. d0 += h4 * (5 * r6);
  37519. c = (d0 >>> 13); d0 &= 0x1fff;
  37520. d0 += h5 * (5 * r5);
  37521. d0 += h6 * (5 * r4);
  37522. d0 += h7 * (5 * r3);
  37523. d0 += h8 * (5 * r2);
  37524. d0 += h9 * (5 * r1);
  37525. c += (d0 >>> 13); d0 &= 0x1fff;
  37526. d1 = c;
  37527. d1 += h0 * r1;
  37528. d1 += h1 * r0;
  37529. d1 += h2 * (5 * r9);
  37530. d1 += h3 * (5 * r8);
  37531. d1 += h4 * (5 * r7);
  37532. c = (d1 >>> 13); d1 &= 0x1fff;
  37533. d1 += h5 * (5 * r6);
  37534. d1 += h6 * (5 * r5);
  37535. d1 += h7 * (5 * r4);
  37536. d1 += h8 * (5 * r3);
  37537. d1 += h9 * (5 * r2);
  37538. c += (d1 >>> 13); d1 &= 0x1fff;
  37539. d2 = c;
  37540. d2 += h0 * r2;
  37541. d2 += h1 * r1;
  37542. d2 += h2 * r0;
  37543. d2 += h3 * (5 * r9);
  37544. d2 += h4 * (5 * r8);
  37545. c = (d2 >>> 13); d2 &= 0x1fff;
  37546. d2 += h5 * (5 * r7);
  37547. d2 += h6 * (5 * r6);
  37548. d2 += h7 * (5 * r5);
  37549. d2 += h8 * (5 * r4);
  37550. d2 += h9 * (5 * r3);
  37551. c += (d2 >>> 13); d2 &= 0x1fff;
  37552. d3 = c;
  37553. d3 += h0 * r3;
  37554. d3 += h1 * r2;
  37555. d3 += h2 * r1;
  37556. d3 += h3 * r0;
  37557. d3 += h4 * (5 * r9);
  37558. c = (d3 >>> 13); d3 &= 0x1fff;
  37559. d3 += h5 * (5 * r8);
  37560. d3 += h6 * (5 * r7);
  37561. d3 += h7 * (5 * r6);
  37562. d3 += h8 * (5 * r5);
  37563. d3 += h9 * (5 * r4);
  37564. c += (d3 >>> 13); d3 &= 0x1fff;
  37565. d4 = c;
  37566. d4 += h0 * r4;
  37567. d4 += h1 * r3;
  37568. d4 += h2 * r2;
  37569. d4 += h3 * r1;
  37570. d4 += h4 * r0;
  37571. c = (d4 >>> 13); d4 &= 0x1fff;
  37572. d4 += h5 * (5 * r9);
  37573. d4 += h6 * (5 * r8);
  37574. d4 += h7 * (5 * r7);
  37575. d4 += h8 * (5 * r6);
  37576. d4 += h9 * (5 * r5);
  37577. c += (d4 >>> 13); d4 &= 0x1fff;
  37578. d5 = c;
  37579. d5 += h0 * r5;
  37580. d5 += h1 * r4;
  37581. d5 += h2 * r3;
  37582. d5 += h3 * r2;
  37583. d5 += h4 * r1;
  37584. c = (d5 >>> 13); d5 &= 0x1fff;
  37585. d5 += h5 * r0;
  37586. d5 += h6 * (5 * r9);
  37587. d5 += h7 * (5 * r8);
  37588. d5 += h8 * (5 * r7);
  37589. d5 += h9 * (5 * r6);
  37590. c += (d5 >>> 13); d5 &= 0x1fff;
  37591. d6 = c;
  37592. d6 += h0 * r6;
  37593. d6 += h1 * r5;
  37594. d6 += h2 * r4;
  37595. d6 += h3 * r3;
  37596. d6 += h4 * r2;
  37597. c = (d6 >>> 13); d6 &= 0x1fff;
  37598. d6 += h5 * r1;
  37599. d6 += h6 * r0;
  37600. d6 += h7 * (5 * r9);
  37601. d6 += h8 * (5 * r8);
  37602. d6 += h9 * (5 * r7);
  37603. c += (d6 >>> 13); d6 &= 0x1fff;
  37604. d7 = c;
  37605. d7 += h0 * r7;
  37606. d7 += h1 * r6;
  37607. d7 += h2 * r5;
  37608. d7 += h3 * r4;
  37609. d7 += h4 * r3;
  37610. c = (d7 >>> 13); d7 &= 0x1fff;
  37611. d7 += h5 * r2;
  37612. d7 += h6 * r1;
  37613. d7 += h7 * r0;
  37614. d7 += h8 * (5 * r9);
  37615. d7 += h9 * (5 * r8);
  37616. c += (d7 >>> 13); d7 &= 0x1fff;
  37617. d8 = c;
  37618. d8 += h0 * r8;
  37619. d8 += h1 * r7;
  37620. d8 += h2 * r6;
  37621. d8 += h3 * r5;
  37622. d8 += h4 * r4;
  37623. c = (d8 >>> 13); d8 &= 0x1fff;
  37624. d8 += h5 * r3;
  37625. d8 += h6 * r2;
  37626. d8 += h7 * r1;
  37627. d8 += h8 * r0;
  37628. d8 += h9 * (5 * r9);
  37629. c += (d8 >>> 13); d8 &= 0x1fff;
  37630. d9 = c;
  37631. d9 += h0 * r9;
  37632. d9 += h1 * r8;
  37633. d9 += h2 * r7;
  37634. d9 += h3 * r6;
  37635. d9 += h4 * r5;
  37636. c = (d9 >>> 13); d9 &= 0x1fff;
  37637. d9 += h5 * r4;
  37638. d9 += h6 * r3;
  37639. d9 += h7 * r2;
  37640. d9 += h8 * r1;
  37641. d9 += h9 * r0;
  37642. c += (d9 >>> 13); d9 &= 0x1fff;
  37643. c = (((c << 2) + c)) | 0;
  37644. c = (c + d0) | 0;
  37645. d0 = c & 0x1fff;
  37646. c = (c >>> 13);
  37647. d1 += c;
  37648. h0 = d0;
  37649. h1 = d1;
  37650. h2 = d2;
  37651. h3 = d3;
  37652. h4 = d4;
  37653. h5 = d5;
  37654. h6 = d6;
  37655. h7 = d7;
  37656. h8 = d8;
  37657. h9 = d9;
  37658. mpos += 16;
  37659. bytes -= 16;
  37660. }
  37661. this.h[0] = h0;
  37662. this.h[1] = h1;
  37663. this.h[2] = h2;
  37664. this.h[3] = h3;
  37665. this.h[4] = h4;
  37666. this.h[5] = h5;
  37667. this.h[6] = h6;
  37668. this.h[7] = h7;
  37669. this.h[8] = h8;
  37670. this.h[9] = h9;
  37671. };
  37672. poly1305.prototype.finish = function(mac, macpos) {
  37673. var g = new Uint16Array(10);
  37674. var c, mask, f, i;
  37675. if (this.leftover) {
  37676. i = this.leftover;
  37677. this.buffer[i++] = 1;
  37678. for (; i < 16; i++) this.buffer[i] = 0;
  37679. this.fin = 1;
  37680. this.blocks(this.buffer, 0, 16);
  37681. }
  37682. c = this.h[1] >>> 13;
  37683. this.h[1] &= 0x1fff;
  37684. for (i = 2; i < 10; i++) {
  37685. this.h[i] += c;
  37686. c = this.h[i] >>> 13;
  37687. this.h[i] &= 0x1fff;
  37688. }
  37689. this.h[0] += (c * 5);
  37690. c = this.h[0] >>> 13;
  37691. this.h[0] &= 0x1fff;
  37692. this.h[1] += c;
  37693. c = this.h[1] >>> 13;
  37694. this.h[1] &= 0x1fff;
  37695. this.h[2] += c;
  37696. g[0] = this.h[0] + 5;
  37697. c = g[0] >>> 13;
  37698. g[0] &= 0x1fff;
  37699. for (i = 1; i < 10; i++) {
  37700. g[i] = this.h[i] + c;
  37701. c = g[i] >>> 13;
  37702. g[i] &= 0x1fff;
  37703. }
  37704. g[9] -= (1 << 13);
  37705. mask = (c ^ 1) - 1;
  37706. for (i = 0; i < 10; i++) g[i] &= mask;
  37707. mask = ~mask;
  37708. for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
  37709. this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
  37710. this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
  37711. this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
  37712. this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
  37713. this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
  37714. this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
  37715. this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
  37716. this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
  37717. f = this.h[0] + this.pad[0];
  37718. this.h[0] = f & 0xffff;
  37719. for (i = 1; i < 8; i++) {
  37720. f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
  37721. this.h[i] = f & 0xffff;
  37722. }
  37723. mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
  37724. mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
  37725. mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
  37726. mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
  37727. mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
  37728. mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
  37729. mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
  37730. mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
  37731. mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
  37732. mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
  37733. mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
  37734. mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
  37735. mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
  37736. mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
  37737. mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
  37738. mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
  37739. };
  37740. poly1305.prototype.update = function(m, mpos, bytes) {
  37741. var i, want;
  37742. if (this.leftover) {
  37743. want = (16 - this.leftover);
  37744. if (want > bytes)
  37745. want = bytes;
  37746. for (i = 0; i < want; i++)
  37747. this.buffer[this.leftover + i] = m[mpos+i];
  37748. bytes -= want;
  37749. mpos += want;
  37750. this.leftover += want;
  37751. if (this.leftover < 16)
  37752. return;
  37753. this.blocks(this.buffer, 0, 16);
  37754. this.leftover = 0;
  37755. }
  37756. if (bytes >= 16) {
  37757. want = bytes - (bytes % 16);
  37758. this.blocks(m, mpos, want);
  37759. mpos += want;
  37760. bytes -= want;
  37761. }
  37762. if (bytes) {
  37763. for (i = 0; i < bytes; i++)
  37764. this.buffer[this.leftover + i] = m[mpos+i];
  37765. this.leftover += bytes;
  37766. }
  37767. };
  37768. function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
  37769. var s = new poly1305(k);
  37770. s.update(m, mpos, n);
  37771. s.finish(out, outpos);
  37772. return 0;
  37773. }
  37774. function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
  37775. var x = new Uint8Array(16);
  37776. crypto_onetimeauth(x,0,m,mpos,n,k);
  37777. return crypto_verify_16(h,hpos,x,0);
  37778. }
  37779. function crypto_secretbox(c,m,d,n,k) {
  37780. var i;
  37781. if (d < 32) return -1;
  37782. crypto_stream_xor(c,0,m,0,d,n,k);
  37783. crypto_onetimeauth(c, 16, c, 32, d - 32, c);
  37784. for (i = 0; i < 16; i++) c[i] = 0;
  37785. return 0;
  37786. }
  37787. function crypto_secretbox_open(m,c,d,n,k) {
  37788. var i;
  37789. var x = new Uint8Array(32);
  37790. if (d < 32) return -1;
  37791. crypto_stream(x,0,32,n,k);
  37792. if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
  37793. crypto_stream_xor(m,0,c,0,d,n,k);
  37794. for (i = 0; i < 32; i++) m[i] = 0;
  37795. return 0;
  37796. }
  37797. function set25519(r, a) {
  37798. var i;
  37799. for (i = 0; i < 16; i++) r[i] = a[i]|0;
  37800. }
  37801. function car25519(o) {
  37802. var i, v, c = 1;
  37803. for (i = 0; i < 16; i++) {
  37804. v = o[i] + c + 65535;
  37805. c = Math.floor(v / 65536);
  37806. o[i] = v - c * 65536;
  37807. }
  37808. o[0] += c-1 + 37 * (c-1);
  37809. }
  37810. function sel25519(p, q, b) {
  37811. var t, c = ~(b-1);
  37812. for (var i = 0; i < 16; i++) {
  37813. t = c & (p[i] ^ q[i]);
  37814. p[i] ^= t;
  37815. q[i] ^= t;
  37816. }
  37817. }
  37818. function pack25519(o, n) {
  37819. var i, j, b;
  37820. var m = gf(), t = gf();
  37821. for (i = 0; i < 16; i++) t[i] = n[i];
  37822. car25519(t);
  37823. car25519(t);
  37824. car25519(t);
  37825. for (j = 0; j < 2; j++) {
  37826. m[0] = t[0] - 0xffed;
  37827. for (i = 1; i < 15; i++) {
  37828. m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
  37829. m[i-1] &= 0xffff;
  37830. }
  37831. m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
  37832. b = (m[15]>>16) & 1;
  37833. m[14] &= 0xffff;
  37834. sel25519(t, m, 1-b);
  37835. }
  37836. for (i = 0; i < 16; i++) {
  37837. o[2*i] = t[i] & 0xff;
  37838. o[2*i+1] = t[i]>>8;
  37839. }
  37840. }
  37841. function neq25519(a, b) {
  37842. var c = new Uint8Array(32), d = new Uint8Array(32);
  37843. pack25519(c, a);
  37844. pack25519(d, b);
  37845. return crypto_verify_32(c, 0, d, 0);
  37846. }
  37847. function par25519(a) {
  37848. var d = new Uint8Array(32);
  37849. pack25519(d, a);
  37850. return d[0] & 1;
  37851. }
  37852. function unpack25519(o, n) {
  37853. var i;
  37854. for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
  37855. o[15] &= 0x7fff;
  37856. }
  37857. function A(o, a, b) {
  37858. for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
  37859. }
  37860. function Z(o, a, b) {
  37861. for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
  37862. }
  37863. function M(o, a, b) {
  37864. var v, c,
  37865. t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
  37866. t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
  37867. t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
  37868. t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
  37869. b0 = b[0],
  37870. b1 = b[1],
  37871. b2 = b[2],
  37872. b3 = b[3],
  37873. b4 = b[4],
  37874. b5 = b[5],
  37875. b6 = b[6],
  37876. b7 = b[7],
  37877. b8 = b[8],
  37878. b9 = b[9],
  37879. b10 = b[10],
  37880. b11 = b[11],
  37881. b12 = b[12],
  37882. b13 = b[13],
  37883. b14 = b[14],
  37884. b15 = b[15];
  37885. v = a[0];
  37886. t0 += v * b0;
  37887. t1 += v * b1;
  37888. t2 += v * b2;
  37889. t3 += v * b3;
  37890. t4 += v * b4;
  37891. t5 += v * b5;
  37892. t6 += v * b6;
  37893. t7 += v * b7;
  37894. t8 += v * b8;
  37895. t9 += v * b9;
  37896. t10 += v * b10;
  37897. t11 += v * b11;
  37898. t12 += v * b12;
  37899. t13 += v * b13;
  37900. t14 += v * b14;
  37901. t15 += v * b15;
  37902. v = a[1];
  37903. t1 += v * b0;
  37904. t2 += v * b1;
  37905. t3 += v * b2;
  37906. t4 += v * b3;
  37907. t5 += v * b4;
  37908. t6 += v * b5;
  37909. t7 += v * b6;
  37910. t8 += v * b7;
  37911. t9 += v * b8;
  37912. t10 += v * b9;
  37913. t11 += v * b10;
  37914. t12 += v * b11;
  37915. t13 += v * b12;
  37916. t14 += v * b13;
  37917. t15 += v * b14;
  37918. t16 += v * b15;
  37919. v = a[2];
  37920. t2 += v * b0;
  37921. t3 += v * b1;
  37922. t4 += v * b2;
  37923. t5 += v * b3;
  37924. t6 += v * b4;
  37925. t7 += v * b5;
  37926. t8 += v * b6;
  37927. t9 += v * b7;
  37928. t10 += v * b8;
  37929. t11 += v * b9;
  37930. t12 += v * b10;
  37931. t13 += v * b11;
  37932. t14 += v * b12;
  37933. t15 += v * b13;
  37934. t16 += v * b14;
  37935. t17 += v * b15;
  37936. v = a[3];
  37937. t3 += v * b0;
  37938. t4 += v * b1;
  37939. t5 += v * b2;
  37940. t6 += v * b3;
  37941. t7 += v * b4;
  37942. t8 += v * b5;
  37943. t9 += v * b6;
  37944. t10 += v * b7;
  37945. t11 += v * b8;
  37946. t12 += v * b9;
  37947. t13 += v * b10;
  37948. t14 += v * b11;
  37949. t15 += v * b12;
  37950. t16 += v * b13;
  37951. t17 += v * b14;
  37952. t18 += v * b15;
  37953. v = a[4];
  37954. t4 += v * b0;
  37955. t5 += v * b1;
  37956. t6 += v * b2;
  37957. t7 += v * b3;
  37958. t8 += v * b4;
  37959. t9 += v * b5;
  37960. t10 += v * b6;
  37961. t11 += v * b7;
  37962. t12 += v * b8;
  37963. t13 += v * b9;
  37964. t14 += v * b10;
  37965. t15 += v * b11;
  37966. t16 += v * b12;
  37967. t17 += v * b13;
  37968. t18 += v * b14;
  37969. t19 += v * b15;
  37970. v = a[5];
  37971. t5 += v * b0;
  37972. t6 += v * b1;
  37973. t7 += v * b2;
  37974. t8 += v * b3;
  37975. t9 += v * b4;
  37976. t10 += v * b5;
  37977. t11 += v * b6;
  37978. t12 += v * b7;
  37979. t13 += v * b8;
  37980. t14 += v * b9;
  37981. t15 += v * b10;
  37982. t16 += v * b11;
  37983. t17 += v * b12;
  37984. t18 += v * b13;
  37985. t19 += v * b14;
  37986. t20 += v * b15;
  37987. v = a[6];
  37988. t6 += v * b0;
  37989. t7 += v * b1;
  37990. t8 += v * b2;
  37991. t9 += v * b3;
  37992. t10 += v * b4;
  37993. t11 += v * b5;
  37994. t12 += v * b6;
  37995. t13 += v * b7;
  37996. t14 += v * b8;
  37997. t15 += v * b9;
  37998. t16 += v * b10;
  37999. t17 += v * b11;
  38000. t18 += v * b12;
  38001. t19 += v * b13;
  38002. t20 += v * b14;
  38003. t21 += v * b15;
  38004. v = a[7];
  38005. t7 += v * b0;
  38006. t8 += v * b1;
  38007. t9 += v * b2;
  38008. t10 += v * b3;
  38009. t11 += v * b4;
  38010. t12 += v * b5;
  38011. t13 += v * b6;
  38012. t14 += v * b7;
  38013. t15 += v * b8;
  38014. t16 += v * b9;
  38015. t17 += v * b10;
  38016. t18 += v * b11;
  38017. t19 += v * b12;
  38018. t20 += v * b13;
  38019. t21 += v * b14;
  38020. t22 += v * b15;
  38021. v = a[8];
  38022. t8 += v * b0;
  38023. t9 += v * b1;
  38024. t10 += v * b2;
  38025. t11 += v * b3;
  38026. t12 += v * b4;
  38027. t13 += v * b5;
  38028. t14 += v * b6;
  38029. t15 += v * b7;
  38030. t16 += v * b8;
  38031. t17 += v * b9;
  38032. t18 += v * b10;
  38033. t19 += v * b11;
  38034. t20 += v * b12;
  38035. t21 += v * b13;
  38036. t22 += v * b14;
  38037. t23 += v * b15;
  38038. v = a[9];
  38039. t9 += v * b0;
  38040. t10 += v * b1;
  38041. t11 += v * b2;
  38042. t12 += v * b3;
  38043. t13 += v * b4;
  38044. t14 += v * b5;
  38045. t15 += v * b6;
  38046. t16 += v * b7;
  38047. t17 += v * b8;
  38048. t18 += v * b9;
  38049. t19 += v * b10;
  38050. t20 += v * b11;
  38051. t21 += v * b12;
  38052. t22 += v * b13;
  38053. t23 += v * b14;
  38054. t24 += v * b15;
  38055. v = a[10];
  38056. t10 += v * b0;
  38057. t11 += v * b1;
  38058. t12 += v * b2;
  38059. t13 += v * b3;
  38060. t14 += v * b4;
  38061. t15 += v * b5;
  38062. t16 += v * b6;
  38063. t17 += v * b7;
  38064. t18 += v * b8;
  38065. t19 += v * b9;
  38066. t20 += v * b10;
  38067. t21 += v * b11;
  38068. t22 += v * b12;
  38069. t23 += v * b13;
  38070. t24 += v * b14;
  38071. t25 += v * b15;
  38072. v = a[11];
  38073. t11 += v * b0;
  38074. t12 += v * b1;
  38075. t13 += v * b2;
  38076. t14 += v * b3;
  38077. t15 += v * b4;
  38078. t16 += v * b5;
  38079. t17 += v * b6;
  38080. t18 += v * b7;
  38081. t19 += v * b8;
  38082. t20 += v * b9;
  38083. t21 += v * b10;
  38084. t22 += v * b11;
  38085. t23 += v * b12;
  38086. t24 += v * b13;
  38087. t25 += v * b14;
  38088. t26 += v * b15;
  38089. v = a[12];
  38090. t12 += v * b0;
  38091. t13 += v * b1;
  38092. t14 += v * b2;
  38093. t15 += v * b3;
  38094. t16 += v * b4;
  38095. t17 += v * b5;
  38096. t18 += v * b6;
  38097. t19 += v * b7;
  38098. t20 += v * b8;
  38099. t21 += v * b9;
  38100. t22 += v * b10;
  38101. t23 += v * b11;
  38102. t24 += v * b12;
  38103. t25 += v * b13;
  38104. t26 += v * b14;
  38105. t27 += v * b15;
  38106. v = a[13];
  38107. t13 += v * b0;
  38108. t14 += v * b1;
  38109. t15 += v * b2;
  38110. t16 += v * b3;
  38111. t17 += v * b4;
  38112. t18 += v * b5;
  38113. t19 += v * b6;
  38114. t20 += v * b7;
  38115. t21 += v * b8;
  38116. t22 += v * b9;
  38117. t23 += v * b10;
  38118. t24 += v * b11;
  38119. t25 += v * b12;
  38120. t26 += v * b13;
  38121. t27 += v * b14;
  38122. t28 += v * b15;
  38123. v = a[14];
  38124. t14 += v * b0;
  38125. t15 += v * b1;
  38126. t16 += v * b2;
  38127. t17 += v * b3;
  38128. t18 += v * b4;
  38129. t19 += v * b5;
  38130. t20 += v * b6;
  38131. t21 += v * b7;
  38132. t22 += v * b8;
  38133. t23 += v * b9;
  38134. t24 += v * b10;
  38135. t25 += v * b11;
  38136. t26 += v * b12;
  38137. t27 += v * b13;
  38138. t28 += v * b14;
  38139. t29 += v * b15;
  38140. v = a[15];
  38141. t15 += v * b0;
  38142. t16 += v * b1;
  38143. t17 += v * b2;
  38144. t18 += v * b3;
  38145. t19 += v * b4;
  38146. t20 += v * b5;
  38147. t21 += v * b6;
  38148. t22 += v * b7;
  38149. t23 += v * b8;
  38150. t24 += v * b9;
  38151. t25 += v * b10;
  38152. t26 += v * b11;
  38153. t27 += v * b12;
  38154. t28 += v * b13;
  38155. t29 += v * b14;
  38156. t30 += v * b15;
  38157. t0 += 38 * t16;
  38158. t1 += 38 * t17;
  38159. t2 += 38 * t18;
  38160. t3 += 38 * t19;
  38161. t4 += 38 * t20;
  38162. t5 += 38 * t21;
  38163. t6 += 38 * t22;
  38164. t7 += 38 * t23;
  38165. t8 += 38 * t24;
  38166. t9 += 38 * t25;
  38167. t10 += 38 * t26;
  38168. t11 += 38 * t27;
  38169. t12 += 38 * t28;
  38170. t13 += 38 * t29;
  38171. t14 += 38 * t30;
  38172. // t15 left as is
  38173. // first car
  38174. c = 1;
  38175. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38176. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38177. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38178. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38179. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38180. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38181. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38182. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38183. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38184. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38185. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38186. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38187. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38188. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38189. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38190. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38191. t0 += c-1 + 37 * (c-1);
  38192. // second car
  38193. c = 1;
  38194. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38195. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38196. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38197. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38198. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38199. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38200. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38201. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38202. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38203. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38204. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38205. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38206. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38207. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38208. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38209. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38210. t0 += c-1 + 37 * (c-1);
  38211. o[ 0] = t0;
  38212. o[ 1] = t1;
  38213. o[ 2] = t2;
  38214. o[ 3] = t3;
  38215. o[ 4] = t4;
  38216. o[ 5] = t5;
  38217. o[ 6] = t6;
  38218. o[ 7] = t7;
  38219. o[ 8] = t8;
  38220. o[ 9] = t9;
  38221. o[10] = t10;
  38222. o[11] = t11;
  38223. o[12] = t12;
  38224. o[13] = t13;
  38225. o[14] = t14;
  38226. o[15] = t15;
  38227. }
  38228. function S(o, a) {
  38229. M(o, a, a);
  38230. }
  38231. function inv25519(o, i) {
  38232. var c = gf();
  38233. var a;
  38234. for (a = 0; a < 16; a++) c[a] = i[a];
  38235. for (a = 253; a >= 0; a--) {
  38236. S(c, c);
  38237. if(a !== 2 && a !== 4) M(c, c, i);
  38238. }
  38239. for (a = 0; a < 16; a++) o[a] = c[a];
  38240. }
  38241. function pow2523(o, i) {
  38242. var c = gf();
  38243. var a;
  38244. for (a = 0; a < 16; a++) c[a] = i[a];
  38245. for (a = 250; a >= 0; a--) {
  38246. S(c, c);
  38247. if(a !== 1) M(c, c, i);
  38248. }
  38249. for (a = 0; a < 16; a++) o[a] = c[a];
  38250. }
  38251. function crypto_scalarmult(q, n, p) {
  38252. var z = new Uint8Array(32);
  38253. var x = new Float64Array(80), r, i;
  38254. var a = gf(), b = gf(), c = gf(),
  38255. d = gf(), e = gf(), f = gf();
  38256. for (i = 0; i < 31; i++) z[i] = n[i];
  38257. z[31]=(n[31]&127)|64;
  38258. z[0]&=248;
  38259. unpack25519(x,p);
  38260. for (i = 0; i < 16; i++) {
  38261. b[i]=x[i];
  38262. d[i]=a[i]=c[i]=0;
  38263. }
  38264. a[0]=d[0]=1;
  38265. for (i=254; i>=0; --i) {
  38266. r=(z[i>>>3]>>>(i&7))&1;
  38267. sel25519(a,b,r);
  38268. sel25519(c,d,r);
  38269. A(e,a,c);
  38270. Z(a,a,c);
  38271. A(c,b,d);
  38272. Z(b,b,d);
  38273. S(d,e);
  38274. S(f,a);
  38275. M(a,c,a);
  38276. M(c,b,e);
  38277. A(e,a,c);
  38278. Z(a,a,c);
  38279. S(b,a);
  38280. Z(c,d,f);
  38281. M(a,c,_121665);
  38282. A(a,a,d);
  38283. M(c,c,a);
  38284. M(a,d,f);
  38285. M(d,b,x);
  38286. S(b,e);
  38287. sel25519(a,b,r);
  38288. sel25519(c,d,r);
  38289. }
  38290. for (i = 0; i < 16; i++) {
  38291. x[i+16]=a[i];
  38292. x[i+32]=c[i];
  38293. x[i+48]=b[i];
  38294. x[i+64]=d[i];
  38295. }
  38296. var x32 = x.subarray(32);
  38297. var x16 = x.subarray(16);
  38298. inv25519(x32,x32);
  38299. M(x16,x16,x32);
  38300. pack25519(q,x16);
  38301. return 0;
  38302. }
  38303. function crypto_scalarmult_base(q, n) {
  38304. return crypto_scalarmult(q, n, _9);
  38305. }
  38306. function crypto_box_keypair(y, x) {
  38307. randombytes(x, 32);
  38308. return crypto_scalarmult_base(y, x);
  38309. }
  38310. function crypto_box_beforenm(k, y, x) {
  38311. var s = new Uint8Array(32);
  38312. crypto_scalarmult(s, x, y);
  38313. return crypto_core_hsalsa20(k, _0, s, sigma);
  38314. }
  38315. var crypto_box_afternm = crypto_secretbox;
  38316. var crypto_box_open_afternm = crypto_secretbox_open;
  38317. function crypto_box(c, m, d, n, y, x) {
  38318. var k = new Uint8Array(32);
  38319. crypto_box_beforenm(k, y, x);
  38320. return crypto_box_afternm(c, m, d, n, k);
  38321. }
  38322. function crypto_box_open(m, c, d, n, y, x) {
  38323. var k = new Uint8Array(32);
  38324. crypto_box_beforenm(k, y, x);
  38325. return crypto_box_open_afternm(m, c, d, n, k);
  38326. }
  38327. var K = [
  38328. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  38329. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  38330. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  38331. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  38332. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  38333. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  38334. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  38335. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  38336. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  38337. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  38338. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  38339. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  38340. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  38341. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  38342. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  38343. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  38344. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  38345. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  38346. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  38347. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  38348. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  38349. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  38350. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  38351. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  38352. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  38353. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  38354. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  38355. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  38356. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  38357. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  38358. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  38359. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  38360. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  38361. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  38362. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  38363. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  38364. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  38365. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  38366. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  38367. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  38368. ];
  38369. function crypto_hashblocks_hl(hh, hl, m, n) {
  38370. var wh = new Int32Array(16), wl = new Int32Array(16),
  38371. bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
  38372. bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
  38373. th, tl, i, j, h, l, a, b, c, d;
  38374. var ah0 = hh[0],
  38375. ah1 = hh[1],
  38376. ah2 = hh[2],
  38377. ah3 = hh[3],
  38378. ah4 = hh[4],
  38379. ah5 = hh[5],
  38380. ah6 = hh[6],
  38381. ah7 = hh[7],
  38382. al0 = hl[0],
  38383. al1 = hl[1],
  38384. al2 = hl[2],
  38385. al3 = hl[3],
  38386. al4 = hl[4],
  38387. al5 = hl[5],
  38388. al6 = hl[6],
  38389. al7 = hl[7];
  38390. var pos = 0;
  38391. while (n >= 128) {
  38392. for (i = 0; i < 16; i++) {
  38393. j = 8 * i + pos;
  38394. wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
  38395. wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
  38396. }
  38397. for (i = 0; i < 80; i++) {
  38398. bh0 = ah0;
  38399. bh1 = ah1;
  38400. bh2 = ah2;
  38401. bh3 = ah3;
  38402. bh4 = ah4;
  38403. bh5 = ah5;
  38404. bh6 = ah6;
  38405. bh7 = ah7;
  38406. bl0 = al0;
  38407. bl1 = al1;
  38408. bl2 = al2;
  38409. bl3 = al3;
  38410. bl4 = al4;
  38411. bl5 = al5;
  38412. bl6 = al6;
  38413. bl7 = al7;
  38414. // add
  38415. h = ah7;
  38416. l = al7;
  38417. a = l & 0xffff; b = l >>> 16;
  38418. c = h & 0xffff; d = h >>> 16;
  38419. // Sigma1
  38420. h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
  38421. l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
  38422. a += l & 0xffff; b += l >>> 16;
  38423. c += h & 0xffff; d += h >>> 16;
  38424. // Ch
  38425. h = (ah4 & ah5) ^ (~ah4 & ah6);
  38426. l = (al4 & al5) ^ (~al4 & al6);
  38427. a += l & 0xffff; b += l >>> 16;
  38428. c += h & 0xffff; d += h >>> 16;
  38429. // K
  38430. h = K[i*2];
  38431. l = K[i*2+1];
  38432. a += l & 0xffff; b += l >>> 16;
  38433. c += h & 0xffff; d += h >>> 16;
  38434. // w
  38435. h = wh[i%16];
  38436. l = wl[i%16];
  38437. a += l & 0xffff; b += l >>> 16;
  38438. c += h & 0xffff; d += h >>> 16;
  38439. b += a >>> 16;
  38440. c += b >>> 16;
  38441. d += c >>> 16;
  38442. th = c & 0xffff | d << 16;
  38443. tl = a & 0xffff | b << 16;
  38444. // add
  38445. h = th;
  38446. l = tl;
  38447. a = l & 0xffff; b = l >>> 16;
  38448. c = h & 0xffff; d = h >>> 16;
  38449. // Sigma0
  38450. h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
  38451. l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
  38452. a += l & 0xffff; b += l >>> 16;
  38453. c += h & 0xffff; d += h >>> 16;
  38454. // Maj
  38455. h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
  38456. l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
  38457. a += l & 0xffff; b += l >>> 16;
  38458. c += h & 0xffff; d += h >>> 16;
  38459. b += a >>> 16;
  38460. c += b >>> 16;
  38461. d += c >>> 16;
  38462. bh7 = (c & 0xffff) | (d << 16);
  38463. bl7 = (a & 0xffff) | (b << 16);
  38464. // add
  38465. h = bh3;
  38466. l = bl3;
  38467. a = l & 0xffff; b = l >>> 16;
  38468. c = h & 0xffff; d = h >>> 16;
  38469. h = th;
  38470. l = tl;
  38471. a += l & 0xffff; b += l >>> 16;
  38472. c += h & 0xffff; d += h >>> 16;
  38473. b += a >>> 16;
  38474. c += b >>> 16;
  38475. d += c >>> 16;
  38476. bh3 = (c & 0xffff) | (d << 16);
  38477. bl3 = (a & 0xffff) | (b << 16);
  38478. ah1 = bh0;
  38479. ah2 = bh1;
  38480. ah3 = bh2;
  38481. ah4 = bh3;
  38482. ah5 = bh4;
  38483. ah6 = bh5;
  38484. ah7 = bh6;
  38485. ah0 = bh7;
  38486. al1 = bl0;
  38487. al2 = bl1;
  38488. al3 = bl2;
  38489. al4 = bl3;
  38490. al5 = bl4;
  38491. al6 = bl5;
  38492. al7 = bl6;
  38493. al0 = bl7;
  38494. if (i%16 === 15) {
  38495. for (j = 0; j < 16; j++) {
  38496. // add
  38497. h = wh[j];
  38498. l = wl[j];
  38499. a = l & 0xffff; b = l >>> 16;
  38500. c = h & 0xffff; d = h >>> 16;
  38501. h = wh[(j+9)%16];
  38502. l = wl[(j+9)%16];
  38503. a += l & 0xffff; b += l >>> 16;
  38504. c += h & 0xffff; d += h >>> 16;
  38505. // sigma0
  38506. th = wh[(j+1)%16];
  38507. tl = wl[(j+1)%16];
  38508. h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
  38509. l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
  38510. a += l & 0xffff; b += l >>> 16;
  38511. c += h & 0xffff; d += h >>> 16;
  38512. // sigma1
  38513. th = wh[(j+14)%16];
  38514. tl = wl[(j+14)%16];
  38515. h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
  38516. l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
  38517. a += l & 0xffff; b += l >>> 16;
  38518. c += h & 0xffff; d += h >>> 16;
  38519. b += a >>> 16;
  38520. c += b >>> 16;
  38521. d += c >>> 16;
  38522. wh[j] = (c & 0xffff) | (d << 16);
  38523. wl[j] = (a & 0xffff) | (b << 16);
  38524. }
  38525. }
  38526. }
  38527. // add
  38528. h = ah0;
  38529. l = al0;
  38530. a = l & 0xffff; b = l >>> 16;
  38531. c = h & 0xffff; d = h >>> 16;
  38532. h = hh[0];
  38533. l = hl[0];
  38534. a += l & 0xffff; b += l >>> 16;
  38535. c += h & 0xffff; d += h >>> 16;
  38536. b += a >>> 16;
  38537. c += b >>> 16;
  38538. d += c >>> 16;
  38539. hh[0] = ah0 = (c & 0xffff) | (d << 16);
  38540. hl[0] = al0 = (a & 0xffff) | (b << 16);
  38541. h = ah1;
  38542. l = al1;
  38543. a = l & 0xffff; b = l >>> 16;
  38544. c = h & 0xffff; d = h >>> 16;
  38545. h = hh[1];
  38546. l = hl[1];
  38547. a += l & 0xffff; b += l >>> 16;
  38548. c += h & 0xffff; d += h >>> 16;
  38549. b += a >>> 16;
  38550. c += b >>> 16;
  38551. d += c >>> 16;
  38552. hh[1] = ah1 = (c & 0xffff) | (d << 16);
  38553. hl[1] = al1 = (a & 0xffff) | (b << 16);
  38554. h = ah2;
  38555. l = al2;
  38556. a = l & 0xffff; b = l >>> 16;
  38557. c = h & 0xffff; d = h >>> 16;
  38558. h = hh[2];
  38559. l = hl[2];
  38560. a += l & 0xffff; b += l >>> 16;
  38561. c += h & 0xffff; d += h >>> 16;
  38562. b += a >>> 16;
  38563. c += b >>> 16;
  38564. d += c >>> 16;
  38565. hh[2] = ah2 = (c & 0xffff) | (d << 16);
  38566. hl[2] = al2 = (a & 0xffff) | (b << 16);
  38567. h = ah3;
  38568. l = al3;
  38569. a = l & 0xffff; b = l >>> 16;
  38570. c = h & 0xffff; d = h >>> 16;
  38571. h = hh[3];
  38572. l = hl[3];
  38573. a += l & 0xffff; b += l >>> 16;
  38574. c += h & 0xffff; d += h >>> 16;
  38575. b += a >>> 16;
  38576. c += b >>> 16;
  38577. d += c >>> 16;
  38578. hh[3] = ah3 = (c & 0xffff) | (d << 16);
  38579. hl[3] = al3 = (a & 0xffff) | (b << 16);
  38580. h = ah4;
  38581. l = al4;
  38582. a = l & 0xffff; b = l >>> 16;
  38583. c = h & 0xffff; d = h >>> 16;
  38584. h = hh[4];
  38585. l = hl[4];
  38586. a += l & 0xffff; b += l >>> 16;
  38587. c += h & 0xffff; d += h >>> 16;
  38588. b += a >>> 16;
  38589. c += b >>> 16;
  38590. d += c >>> 16;
  38591. hh[4] = ah4 = (c & 0xffff) | (d << 16);
  38592. hl[4] = al4 = (a & 0xffff) | (b << 16);
  38593. h = ah5;
  38594. l = al5;
  38595. a = l & 0xffff; b = l >>> 16;
  38596. c = h & 0xffff; d = h >>> 16;
  38597. h = hh[5];
  38598. l = hl[5];
  38599. a += l & 0xffff; b += l >>> 16;
  38600. c += h & 0xffff; d += h >>> 16;
  38601. b += a >>> 16;
  38602. c += b >>> 16;
  38603. d += c >>> 16;
  38604. hh[5] = ah5 = (c & 0xffff) | (d << 16);
  38605. hl[5] = al5 = (a & 0xffff) | (b << 16);
  38606. h = ah6;
  38607. l = al6;
  38608. a = l & 0xffff; b = l >>> 16;
  38609. c = h & 0xffff; d = h >>> 16;
  38610. h = hh[6];
  38611. l = hl[6];
  38612. a += l & 0xffff; b += l >>> 16;
  38613. c += h & 0xffff; d += h >>> 16;
  38614. b += a >>> 16;
  38615. c += b >>> 16;
  38616. d += c >>> 16;
  38617. hh[6] = ah6 = (c & 0xffff) | (d << 16);
  38618. hl[6] = al6 = (a & 0xffff) | (b << 16);
  38619. h = ah7;
  38620. l = al7;
  38621. a = l & 0xffff; b = l >>> 16;
  38622. c = h & 0xffff; d = h >>> 16;
  38623. h = hh[7];
  38624. l = hl[7];
  38625. a += l & 0xffff; b += l >>> 16;
  38626. c += h & 0xffff; d += h >>> 16;
  38627. b += a >>> 16;
  38628. c += b >>> 16;
  38629. d += c >>> 16;
  38630. hh[7] = ah7 = (c & 0xffff) | (d << 16);
  38631. hl[7] = al7 = (a & 0xffff) | (b << 16);
  38632. pos += 128;
  38633. n -= 128;
  38634. }
  38635. return n;
  38636. }
  38637. function crypto_hash(out, m, n) {
  38638. var hh = new Int32Array(8),
  38639. hl = new Int32Array(8),
  38640. x = new Uint8Array(256),
  38641. i, b = n;
  38642. hh[0] = 0x6a09e667;
  38643. hh[1] = 0xbb67ae85;
  38644. hh[2] = 0x3c6ef372;
  38645. hh[3] = 0xa54ff53a;
  38646. hh[4] = 0x510e527f;
  38647. hh[5] = 0x9b05688c;
  38648. hh[6] = 0x1f83d9ab;
  38649. hh[7] = 0x5be0cd19;
  38650. hl[0] = 0xf3bcc908;
  38651. hl[1] = 0x84caa73b;
  38652. hl[2] = 0xfe94f82b;
  38653. hl[3] = 0x5f1d36f1;
  38654. hl[4] = 0xade682d1;
  38655. hl[5] = 0x2b3e6c1f;
  38656. hl[6] = 0xfb41bd6b;
  38657. hl[7] = 0x137e2179;
  38658. crypto_hashblocks_hl(hh, hl, m, n);
  38659. n %= 128;
  38660. for (i = 0; i < n; i++) x[i] = m[b-n+i];
  38661. x[n] = 128;
  38662. n = 256-128*(n<112?1:0);
  38663. x[n-9] = 0;
  38664. ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
  38665. crypto_hashblocks_hl(hh, hl, x, n);
  38666. for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
  38667. return 0;
  38668. }
  38669. function add(p, q) {
  38670. var a = gf(), b = gf(), c = gf(),
  38671. d = gf(), e = gf(), f = gf(),
  38672. g = gf(), h = gf(), t = gf();
  38673. Z(a, p[1], p[0]);
  38674. Z(t, q[1], q[0]);
  38675. M(a, a, t);
  38676. A(b, p[0], p[1]);
  38677. A(t, q[0], q[1]);
  38678. M(b, b, t);
  38679. M(c, p[3], q[3]);
  38680. M(c, c, D2);
  38681. M(d, p[2], q[2]);
  38682. A(d, d, d);
  38683. Z(e, b, a);
  38684. Z(f, d, c);
  38685. A(g, d, c);
  38686. A(h, b, a);
  38687. M(p[0], e, f);
  38688. M(p[1], h, g);
  38689. M(p[2], g, f);
  38690. M(p[3], e, h);
  38691. }
  38692. function cswap(p, q, b) {
  38693. var i;
  38694. for (i = 0; i < 4; i++) {
  38695. sel25519(p[i], q[i], b);
  38696. }
  38697. }
  38698. function pack(r, p) {
  38699. var tx = gf(), ty = gf(), zi = gf();
  38700. inv25519(zi, p[2]);
  38701. M(tx, p[0], zi);
  38702. M(ty, p[1], zi);
  38703. pack25519(r, ty);
  38704. r[31] ^= par25519(tx) << 7;
  38705. }
  38706. function scalarmult(p, q, s) {
  38707. var b, i;
  38708. set25519(p[0], gf0);
  38709. set25519(p[1], gf1);
  38710. set25519(p[2], gf1);
  38711. set25519(p[3], gf0);
  38712. for (i = 255; i >= 0; --i) {
  38713. b = (s[(i/8)|0] >> (i&7)) & 1;
  38714. cswap(p, q, b);
  38715. add(q, p);
  38716. add(p, p);
  38717. cswap(p, q, b);
  38718. }
  38719. }
  38720. function scalarbase(p, s) {
  38721. var q = [gf(), gf(), gf(), gf()];
  38722. set25519(q[0], X);
  38723. set25519(q[1], Y);
  38724. set25519(q[2], gf1);
  38725. M(q[3], X, Y);
  38726. scalarmult(p, q, s);
  38727. }
  38728. function crypto_sign_keypair(pk, sk, seeded) {
  38729. var d = new Uint8Array(64);
  38730. var p = [gf(), gf(), gf(), gf()];
  38731. var i;
  38732. if (!seeded) randombytes(sk, 32);
  38733. crypto_hash(d, sk, 32);
  38734. d[0] &= 248;
  38735. d[31] &= 127;
  38736. d[31] |= 64;
  38737. scalarbase(p, d);
  38738. pack(pk, p);
  38739. for (i = 0; i < 32; i++) sk[i+32] = pk[i];
  38740. return 0;
  38741. }
  38742. 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]);
  38743. function modL(r, x) {
  38744. var carry, i, j, k;
  38745. for (i = 63; i >= 32; --i) {
  38746. carry = 0;
  38747. for (j = i - 32, k = i - 12; j < k; ++j) {
  38748. x[j] += carry - 16 * x[i] * L[j - (i - 32)];
  38749. carry = (x[j] + 128) >> 8;
  38750. x[j] -= carry * 256;
  38751. }
  38752. x[j] += carry;
  38753. x[i] = 0;
  38754. }
  38755. carry = 0;
  38756. for (j = 0; j < 32; j++) {
  38757. x[j] += carry - (x[31] >> 4) * L[j];
  38758. carry = x[j] >> 8;
  38759. x[j] &= 255;
  38760. }
  38761. for (j = 0; j < 32; j++) x[j] -= carry * L[j];
  38762. for (i = 0; i < 32; i++) {
  38763. x[i+1] += x[i] >> 8;
  38764. r[i] = x[i] & 255;
  38765. }
  38766. }
  38767. function reduce(r) {
  38768. var x = new Float64Array(64), i;
  38769. for (i = 0; i < 64; i++) x[i] = r[i];
  38770. for (i = 0; i < 64; i++) r[i] = 0;
  38771. modL(r, x);
  38772. }
  38773. // Note: difference from C - smlen returned, not passed as argument.
  38774. function crypto_sign(sm, m, n, sk) {
  38775. var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
  38776. var i, j, x = new Float64Array(64);
  38777. var p = [gf(), gf(), gf(), gf()];
  38778. crypto_hash(d, sk, 32);
  38779. d[0] &= 248;
  38780. d[31] &= 127;
  38781. d[31] |= 64;
  38782. var smlen = n + 64;
  38783. for (i = 0; i < n; i++) sm[64 + i] = m[i];
  38784. for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
  38785. crypto_hash(r, sm.subarray(32), n+32);
  38786. reduce(r);
  38787. scalarbase(p, r);
  38788. pack(sm, p);
  38789. for (i = 32; i < 64; i++) sm[i] = sk[i];
  38790. crypto_hash(h, sm, n + 64);
  38791. reduce(h);
  38792. for (i = 0; i < 64; i++) x[i] = 0;
  38793. for (i = 0; i < 32; i++) x[i] = r[i];
  38794. for (i = 0; i < 32; i++) {
  38795. for (j = 0; j < 32; j++) {
  38796. x[i+j] += h[i] * d[j];
  38797. }
  38798. }
  38799. modL(sm.subarray(32), x);
  38800. return smlen;
  38801. }
  38802. function unpackneg(r, p) {
  38803. var t = gf(), chk = gf(), num = gf(),
  38804. den = gf(), den2 = gf(), den4 = gf(),
  38805. den6 = gf();
  38806. set25519(r[2], gf1);
  38807. unpack25519(r[1], p);
  38808. S(num, r[1]);
  38809. M(den, num, D);
  38810. Z(num, num, r[2]);
  38811. A(den, r[2], den);
  38812. S(den2, den);
  38813. S(den4, den2);
  38814. M(den6, den4, den2);
  38815. M(t, den6, num);
  38816. M(t, t, den);
  38817. pow2523(t, t);
  38818. M(t, t, num);
  38819. M(t, t, den);
  38820. M(t, t, den);
  38821. M(r[0], t, den);
  38822. S(chk, r[0]);
  38823. M(chk, chk, den);
  38824. if (neq25519(chk, num)) M(r[0], r[0], I);
  38825. S(chk, r[0]);
  38826. M(chk, chk, den);
  38827. if (neq25519(chk, num)) return -1;
  38828. if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
  38829. M(r[3], r[0], r[1]);
  38830. return 0;
  38831. }
  38832. function crypto_sign_open(m, sm, n, pk) {
  38833. var i, mlen;
  38834. var t = new Uint8Array(32), h = new Uint8Array(64);
  38835. var p = [gf(), gf(), gf(), gf()],
  38836. q = [gf(), gf(), gf(), gf()];
  38837. mlen = -1;
  38838. if (n < 64) return -1;
  38839. if (unpackneg(q, pk)) return -1;
  38840. for (i = 0; i < n; i++) m[i] = sm[i];
  38841. for (i = 0; i < 32; i++) m[i+32] = pk[i];
  38842. crypto_hash(h, m, n);
  38843. reduce(h);
  38844. scalarmult(p, q, h);
  38845. scalarbase(q, sm.subarray(32));
  38846. add(p, q);
  38847. pack(t, p);
  38848. n -= 64;
  38849. if (crypto_verify_32(sm, 0, t, 0)) {
  38850. for (i = 0; i < n; i++) m[i] = 0;
  38851. return -1;
  38852. }
  38853. for (i = 0; i < n; i++) m[i] = sm[i + 64];
  38854. mlen = n;
  38855. return mlen;
  38856. }
  38857. var crypto_secretbox_KEYBYTES = 32,
  38858. crypto_secretbox_NONCEBYTES = 24,
  38859. crypto_secretbox_ZEROBYTES = 32,
  38860. crypto_secretbox_BOXZEROBYTES = 16,
  38861. crypto_scalarmult_BYTES = 32,
  38862. crypto_scalarmult_SCALARBYTES = 32,
  38863. crypto_box_PUBLICKEYBYTES = 32,
  38864. crypto_box_SECRETKEYBYTES = 32,
  38865. crypto_box_BEFORENMBYTES = 32,
  38866. crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
  38867. crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
  38868. crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
  38869. crypto_sign_BYTES = 64,
  38870. crypto_sign_PUBLICKEYBYTES = 32,
  38871. crypto_sign_SECRETKEYBYTES = 64,
  38872. crypto_sign_SEEDBYTES = 32,
  38873. crypto_hash_BYTES = 64;
  38874. nacl.lowlevel = {
  38875. crypto_core_hsalsa20: crypto_core_hsalsa20,
  38876. crypto_stream_xor: crypto_stream_xor,
  38877. crypto_stream: crypto_stream,
  38878. crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
  38879. crypto_stream_salsa20: crypto_stream_salsa20,
  38880. crypto_onetimeauth: crypto_onetimeauth,
  38881. crypto_onetimeauth_verify: crypto_onetimeauth_verify,
  38882. crypto_verify_16: crypto_verify_16,
  38883. crypto_verify_32: crypto_verify_32,
  38884. crypto_secretbox: crypto_secretbox,
  38885. crypto_secretbox_open: crypto_secretbox_open,
  38886. crypto_scalarmult: crypto_scalarmult,
  38887. crypto_scalarmult_base: crypto_scalarmult_base,
  38888. crypto_box_beforenm: crypto_box_beforenm,
  38889. crypto_box_afternm: crypto_box_afternm,
  38890. crypto_box: crypto_box,
  38891. crypto_box_open: crypto_box_open,
  38892. crypto_box_keypair: crypto_box_keypair,
  38893. crypto_hash: crypto_hash,
  38894. crypto_sign: crypto_sign,
  38895. crypto_sign_keypair: crypto_sign_keypair,
  38896. crypto_sign_open: crypto_sign_open,
  38897. crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
  38898. crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
  38899. crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
  38900. crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
  38901. crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
  38902. crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
  38903. crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
  38904. crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
  38905. crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
  38906. crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
  38907. crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
  38908. crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
  38909. crypto_sign_BYTES: crypto_sign_BYTES,
  38910. crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
  38911. crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
  38912. crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
  38913. crypto_hash_BYTES: crypto_hash_BYTES
  38914. };
  38915. /* High-level API */
  38916. function checkLengths(k, n) {
  38917. if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
  38918. if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
  38919. }
  38920. function checkBoxLengths(pk, sk) {
  38921. if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
  38922. if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
  38923. }
  38924. function checkArrayTypes() {
  38925. for (var i = 0; i < arguments.length; i++) {
  38926. if (!(arguments[i] instanceof Uint8Array))
  38927. throw new TypeError('unexpected type, use Uint8Array');
  38928. }
  38929. }
  38930. function cleanup(arr) {
  38931. for (var i = 0; i < arr.length; i++) arr[i] = 0;
  38932. }
  38933. nacl.randomBytes = function(n) {
  38934. var b = new Uint8Array(n);
  38935. randombytes(b, n);
  38936. return b;
  38937. };
  38938. nacl.secretbox = function(msg, nonce, key) {
  38939. checkArrayTypes(msg, nonce, key);
  38940. checkLengths(key, nonce);
  38941. var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
  38942. var c = new Uint8Array(m.length);
  38943. for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
  38944. crypto_secretbox(c, m, m.length, nonce, key);
  38945. return c.subarray(crypto_secretbox_BOXZEROBYTES);
  38946. };
  38947. nacl.secretbox.open = function(box, nonce, key) {
  38948. checkArrayTypes(box, nonce, key);
  38949. checkLengths(key, nonce);
  38950. var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
  38951. var m = new Uint8Array(c.length);
  38952. for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
  38953. if (c.length < 32) return null;
  38954. if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
  38955. return m.subarray(crypto_secretbox_ZEROBYTES);
  38956. };
  38957. nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
  38958. nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
  38959. nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
  38960. nacl.scalarMult = function(n, p) {
  38961. checkArrayTypes(n, p);
  38962. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38963. if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
  38964. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38965. crypto_scalarmult(q, n, p);
  38966. return q;
  38967. };
  38968. nacl.scalarMult.base = function(n) {
  38969. checkArrayTypes(n);
  38970. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38971. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38972. crypto_scalarmult_base(q, n);
  38973. return q;
  38974. };
  38975. nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
  38976. nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
  38977. nacl.box = function(msg, nonce, publicKey, secretKey) {
  38978. var k = nacl.box.before(publicKey, secretKey);
  38979. return nacl.secretbox(msg, nonce, k);
  38980. };
  38981. nacl.box.before = function(publicKey, secretKey) {
  38982. checkArrayTypes(publicKey, secretKey);
  38983. checkBoxLengths(publicKey, secretKey);
  38984. var k = new Uint8Array(crypto_box_BEFORENMBYTES);
  38985. crypto_box_beforenm(k, publicKey, secretKey);
  38986. return k;
  38987. };
  38988. nacl.box.after = nacl.secretbox;
  38989. nacl.box.open = function(msg, nonce, publicKey, secretKey) {
  38990. var k = nacl.box.before(publicKey, secretKey);
  38991. return nacl.secretbox.open(msg, nonce, k);
  38992. };
  38993. nacl.box.open.after = nacl.secretbox.open;
  38994. nacl.box.keyPair = function() {
  38995. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38996. var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
  38997. crypto_box_keypair(pk, sk);
  38998. return {publicKey: pk, secretKey: sk};
  38999. };
  39000. nacl.box.keyPair.fromSecretKey = function(secretKey) {
  39001. checkArrayTypes(secretKey);
  39002. if (secretKey.length !== crypto_box_SECRETKEYBYTES)
  39003. throw new Error('bad secret key size');
  39004. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  39005. crypto_scalarmult_base(pk, secretKey);
  39006. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  39007. };
  39008. nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
  39009. nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
  39010. nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
  39011. nacl.box.nonceLength = crypto_box_NONCEBYTES;
  39012. nacl.box.overheadLength = nacl.secretbox.overheadLength;
  39013. nacl.sign = function(msg, secretKey) {
  39014. checkArrayTypes(msg, secretKey);
  39015. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  39016. throw new Error('bad secret key size');
  39017. var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
  39018. crypto_sign(signedMsg, msg, msg.length, secretKey);
  39019. return signedMsg;
  39020. };
  39021. nacl.sign.open = function(signedMsg, publicKey) {
  39022. checkArrayTypes(signedMsg, publicKey);
  39023. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  39024. throw new Error('bad public key size');
  39025. var tmp = new Uint8Array(signedMsg.length);
  39026. var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
  39027. if (mlen < 0) return null;
  39028. var m = new Uint8Array(mlen);
  39029. for (var i = 0; i < m.length; i++) m[i] = tmp[i];
  39030. return m;
  39031. };
  39032. nacl.sign.detached = function(msg, secretKey) {
  39033. var signedMsg = nacl.sign(msg, secretKey);
  39034. var sig = new Uint8Array(crypto_sign_BYTES);
  39035. for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
  39036. return sig;
  39037. };
  39038. nacl.sign.detached.verify = function(msg, sig, publicKey) {
  39039. checkArrayTypes(msg, sig, publicKey);
  39040. if (sig.length !== crypto_sign_BYTES)
  39041. throw new Error('bad signature size');
  39042. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  39043. throw new Error('bad public key size');
  39044. var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
  39045. var m = new Uint8Array(crypto_sign_BYTES + msg.length);
  39046. var i;
  39047. for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
  39048. for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
  39049. return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
  39050. };
  39051. nacl.sign.keyPair = function() {
  39052. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39053. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  39054. crypto_sign_keypair(pk, sk);
  39055. return {publicKey: pk, secretKey: sk};
  39056. };
  39057. nacl.sign.keyPair.fromSecretKey = function(secretKey) {
  39058. checkArrayTypes(secretKey);
  39059. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  39060. throw new Error('bad secret key size');
  39061. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39062. for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
  39063. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  39064. };
  39065. nacl.sign.keyPair.fromSeed = function(seed) {
  39066. checkArrayTypes(seed);
  39067. if (seed.length !== crypto_sign_SEEDBYTES)
  39068. throw new Error('bad seed size');
  39069. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39070. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  39071. for (var i = 0; i < 32; i++) sk[i] = seed[i];
  39072. crypto_sign_keypair(pk, sk, true);
  39073. return {publicKey: pk, secretKey: sk};
  39074. };
  39075. nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
  39076. nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
  39077. nacl.sign.seedLength = crypto_sign_SEEDBYTES;
  39078. nacl.sign.signatureLength = crypto_sign_BYTES;
  39079. nacl.hash = function(msg) {
  39080. checkArrayTypes(msg);
  39081. var h = new Uint8Array(crypto_hash_BYTES);
  39082. crypto_hash(h, msg, msg.length);
  39083. return h;
  39084. };
  39085. nacl.hash.hashLength = crypto_hash_BYTES;
  39086. nacl.verify = function(x, y) {
  39087. checkArrayTypes(x, y);
  39088. // Zero length arguments are considered not equal.
  39089. if (x.length === 0 || y.length === 0) return false;
  39090. if (x.length !== y.length) return false;
  39091. return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
  39092. };
  39093. nacl.setPRNG = function(fn) {
  39094. randombytes = fn;
  39095. };
  39096. (function() {
  39097. // Initialize PRNG if environment provides CSPRNG.
  39098. // If not, methods calling randombytes will throw.
  39099. var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
  39100. if (crypto && crypto.getRandomValues) {
  39101. // Browsers.
  39102. var QUOTA = 65536;
  39103. nacl.setPRNG(function(x, n) {
  39104. var i, v = new Uint8Array(n);
  39105. for (i = 0; i < n; i += QUOTA) {
  39106. crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
  39107. }
  39108. for (i = 0; i < n; i++) x[i] = v[i];
  39109. cleanup(v);
  39110. });
  39111. } else if (true) {
  39112. // Node.js.
  39113. crypto = __webpack_require__(3);
  39114. if (crypto && crypto.randomBytes) {
  39115. nacl.setPRNG(function(x, n) {
  39116. var i, v = crypto.randomBytes(n);
  39117. for (i = 0; i < n; i++) x[i] = v[i];
  39118. cleanup(v);
  39119. });
  39120. }
  39121. }
  39122. })();
  39123. })( true && module.exports ? module.exports : (self.nacl = self.nacl || {}));
  39124. /***/ }),
  39125. /* 1 */
  39126. /***/ (function(module, exports, __webpack_require__) {
  39127. // Written in 2014-2016 by Dmitry Chestnykh and Devi Mandiri.
  39128. // Public domain.
  39129. (function(root, f) {
  39130. 'use strict';
  39131. if ( true && module.exports) module.exports = f();
  39132. else if (root.nacl) root.nacl.util = f();
  39133. else {
  39134. root.nacl = {};
  39135. root.nacl.util = f();
  39136. }
  39137. }(this, function() {
  39138. 'use strict';
  39139. var util = {};
  39140. function validateBase64(s) {
  39141. if (!(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s))) {
  39142. throw new TypeError('invalid encoding');
  39143. }
  39144. }
  39145. util.decodeUTF8 = function(s) {
  39146. if (typeof s !== 'string') throw new TypeError('expected string');
  39147. var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
  39148. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39149. return b;
  39150. };
  39151. util.encodeUTF8 = function(arr) {
  39152. var i, s = [];
  39153. for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
  39154. return decodeURIComponent(escape(s.join('')));
  39155. };
  39156. if (typeof atob === 'undefined') {
  39157. // Node.js
  39158. if (typeof Buffer.from !== 'undefined') {
  39159. // Node v6 and later
  39160. util.encodeBase64 = function (arr) { // v6 and later
  39161. return Buffer.from(arr).toString('base64');
  39162. };
  39163. util.decodeBase64 = function (s) {
  39164. validateBase64(s);
  39165. return new Uint8Array(Array.prototype.slice.call(Buffer.from(s, 'base64'), 0));
  39166. };
  39167. } else {
  39168. // Node earlier than v6
  39169. util.encodeBase64 = function (arr) { // v6 and later
  39170. return (new Buffer(arr)).toString('base64');
  39171. };
  39172. util.decodeBase64 = function(s) {
  39173. validateBase64(s);
  39174. return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
  39175. };
  39176. }
  39177. } else {
  39178. // Browsers
  39179. util.encodeBase64 = function(arr) {
  39180. var i, s = [], len = arr.length;
  39181. for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
  39182. return btoa(s.join(''));
  39183. };
  39184. util.decodeBase64 = function(s) {
  39185. validateBase64(s);
  39186. var i, d = atob(s), b = new Uint8Array(d.length);
  39187. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39188. return b;
  39189. };
  39190. }
  39191. return util;
  39192. }));
  39193. /***/ }),
  39194. /* 2 */
  39195. /***/ (function(module, exports, __webpack_require__) {
  39196. // required so we don't have to do require('pusher').default etc.
  39197. module.exports = __webpack_require__(4).default;
  39198. /***/ }),
  39199. /* 3 */
  39200. /***/ (function(module, exports) {
  39201. /* (ignored) */
  39202. /***/ }),
  39203. /* 4 */
  39204. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  39205. "use strict";
  39206. __webpack_require__.r(__webpack_exports__);
  39207. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_receiver_factory.ts
  39208. var ScriptReceiverFactory = (function () {
  39209. function ScriptReceiverFactory(prefix, name) {
  39210. this.lastId = 0;
  39211. this.prefix = prefix;
  39212. this.name = name;
  39213. }
  39214. ScriptReceiverFactory.prototype.create = function (callback) {
  39215. this.lastId++;
  39216. var number = this.lastId;
  39217. var id = this.prefix + number;
  39218. var name = this.name + "[" + number + "]";
  39219. var called = false;
  39220. var callbackWrapper = function () {
  39221. if (!called) {
  39222. callback.apply(null, arguments);
  39223. called = true;
  39224. }
  39225. };
  39226. this[number] = callbackWrapper;
  39227. return { number: number, id: id, name: name, callback: callbackWrapper };
  39228. };
  39229. ScriptReceiverFactory.prototype.remove = function (receiver) {
  39230. delete this[receiver.number];
  39231. };
  39232. return ScriptReceiverFactory;
  39233. }());
  39234. var ScriptReceivers = new ScriptReceiverFactory("_pusher_script_", "Pusher.ScriptReceivers");
  39235. // CONCATENATED MODULE: ./src/core/defaults.ts
  39236. var Defaults = {
  39237. VERSION: "5.0.3",
  39238. PROTOCOL: 7,
  39239. host: 'ws.pusherapp.com',
  39240. ws_port: 80,
  39241. wss_port: 443,
  39242. ws_path: '',
  39243. sockjs_host: 'sockjs.pusher.com',
  39244. sockjs_http_port: 80,
  39245. sockjs_https_port: 443,
  39246. sockjs_path: '/pusher',
  39247. stats_host: 'stats.pusher.com',
  39248. channel_auth_endpoint: '/pusher/auth',
  39249. channel_auth_transport: 'ajax',
  39250. activity_timeout: 120000,
  39251. pong_timeout: 30000,
  39252. unavailable_timeout: 10000,
  39253. cdn_http: "http://js.pusher.com",
  39254. cdn_https: "https://js.pusher.com",
  39255. dependency_suffix: ""
  39256. };
  39257. /* harmony default export */ var defaults = (Defaults);
  39258. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependency_loader.ts
  39259. var dependency_loader_DependencyLoader = (function () {
  39260. function DependencyLoader(options) {
  39261. this.options = options;
  39262. this.receivers = options.receivers || ScriptReceivers;
  39263. this.loading = {};
  39264. }
  39265. DependencyLoader.prototype.load = function (name, options, callback) {
  39266. var self = this;
  39267. if (self.loading[name] && self.loading[name].length > 0) {
  39268. self.loading[name].push(callback);
  39269. }
  39270. else {
  39271. self.loading[name] = [callback];
  39272. var request = runtime.createScriptRequest(self.getPath(name, options));
  39273. var receiver = self.receivers.create(function (error) {
  39274. self.receivers.remove(receiver);
  39275. if (self.loading[name]) {
  39276. var callbacks = self.loading[name];
  39277. delete self.loading[name];
  39278. var successCallback = function (wasSuccessful) {
  39279. if (!wasSuccessful) {
  39280. request.cleanup();
  39281. }
  39282. };
  39283. for (var i = 0; i < callbacks.length; i++) {
  39284. callbacks[i](error, successCallback);
  39285. }
  39286. }
  39287. });
  39288. request.send(receiver);
  39289. }
  39290. };
  39291. DependencyLoader.prototype.getRoot = function (options) {
  39292. var cdn;
  39293. var protocol = runtime.getDocument().location.protocol;
  39294. if ((options && options.useTLS) || protocol === "https:") {
  39295. cdn = this.options.cdn_https;
  39296. }
  39297. else {
  39298. cdn = this.options.cdn_http;
  39299. }
  39300. return cdn.replace(/\/*$/, "") + "/" + this.options.version;
  39301. };
  39302. DependencyLoader.prototype.getPath = function (name, options) {
  39303. return this.getRoot(options) + '/' + name + this.options.suffix + '.js';
  39304. };
  39305. ;
  39306. return DependencyLoader;
  39307. }());
  39308. /* harmony default export */ var dependency_loader = (dependency_loader_DependencyLoader);
  39309. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependencies.ts
  39310. var DependenciesReceivers = new ScriptReceiverFactory("_pusher_dependencies", "Pusher.DependenciesReceivers");
  39311. var Dependencies = new dependency_loader({
  39312. cdn_http: defaults.cdn_http,
  39313. cdn_https: defaults.cdn_https,
  39314. version: defaults.VERSION,
  39315. suffix: defaults.dependency_suffix,
  39316. receivers: DependenciesReceivers
  39317. });
  39318. // CONCATENATED MODULE: ./src/core/base64.ts
  39319. function encode(s) {
  39320. return btoa(utob(s));
  39321. }
  39322. var fromCharCode = String.fromCharCode;
  39323. var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  39324. var b64tab = {};
  39325. for (var base64_i = 0, l = b64chars.length; base64_i < l; base64_i++) {
  39326. b64tab[b64chars.charAt(base64_i)] = base64_i;
  39327. }
  39328. var cb_utob = function (c) {
  39329. var cc = c.charCodeAt(0);
  39330. return cc < 0x80
  39331. ? c
  39332. : cc < 0x800
  39333. ? fromCharCode(0xc0 | (cc >>> 6)) + fromCharCode(0x80 | (cc & 0x3f))
  39334. : fromCharCode(0xe0 | ((cc >>> 12) & 0x0f)) +
  39335. fromCharCode(0x80 | ((cc >>> 6) & 0x3f)) +
  39336. fromCharCode(0x80 | (cc & 0x3f));
  39337. };
  39338. var utob = function (u) {
  39339. return u.replace(/[^\x00-\x7F]/g, cb_utob);
  39340. };
  39341. var cb_encode = function (ccc) {
  39342. var padlen = [0, 2, 1][ccc.length % 3];
  39343. var ord = (ccc.charCodeAt(0) << 16) |
  39344. ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8) |
  39345. (ccc.length > 2 ? ccc.charCodeAt(2) : 0);
  39346. var chars = [
  39347. b64chars.charAt(ord >>> 18),
  39348. b64chars.charAt((ord >>> 12) & 63),
  39349. padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
  39350. padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
  39351. ];
  39352. return chars.join('');
  39353. };
  39354. var btoa = window.btoa ||
  39355. function (b) {
  39356. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  39357. };
  39358. // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
  39359. var Timer = (function () {
  39360. function Timer(set, clear, delay, callback) {
  39361. var _this = this;
  39362. this.clear = clear;
  39363. this.timer = set(function () {
  39364. if (_this.timer) {
  39365. _this.timer = callback(_this.timer);
  39366. }
  39367. }, delay);
  39368. }
  39369. Timer.prototype.isRunning = function () {
  39370. return this.timer !== null;
  39371. };
  39372. Timer.prototype.ensureAborted = function () {
  39373. if (this.timer) {
  39374. this.clear(this.timer);
  39375. this.timer = null;
  39376. }
  39377. };
  39378. return Timer;
  39379. }());
  39380. /* harmony default export */ var abstract_timer = (Timer);
  39381. // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
  39382. var __extends = (undefined && undefined.__extends) || (function () {
  39383. var extendStatics = function (d, b) {
  39384. extendStatics = Object.setPrototypeOf ||
  39385. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39386. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39387. return extendStatics(d, b);
  39388. };
  39389. return function (d, b) {
  39390. extendStatics(d, b);
  39391. function __() { this.constructor = d; }
  39392. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39393. };
  39394. })();
  39395. function timers_clearTimeout(timer) {
  39396. window.clearTimeout(timer);
  39397. }
  39398. function timers_clearInterval(timer) {
  39399. window.clearInterval(timer);
  39400. }
  39401. var OneOffTimer = (function (_super) {
  39402. __extends(OneOffTimer, _super);
  39403. function OneOffTimer(delay, callback) {
  39404. return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
  39405. callback();
  39406. return null;
  39407. }) || this;
  39408. }
  39409. return OneOffTimer;
  39410. }(abstract_timer));
  39411. var PeriodicTimer = (function (_super) {
  39412. __extends(PeriodicTimer, _super);
  39413. function PeriodicTimer(delay, callback) {
  39414. return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
  39415. callback();
  39416. return timer;
  39417. }) || this;
  39418. }
  39419. return PeriodicTimer;
  39420. }(abstract_timer));
  39421. // CONCATENATED MODULE: ./src/core/util.ts
  39422. var Util = {
  39423. now: function () {
  39424. if (Date.now) {
  39425. return Date.now();
  39426. }
  39427. else {
  39428. return new Date().valueOf();
  39429. }
  39430. },
  39431. defer: function (callback) {
  39432. return new OneOffTimer(0, callback);
  39433. },
  39434. method: function (name) {
  39435. var args = [];
  39436. for (var _i = 1; _i < arguments.length; _i++) {
  39437. args[_i - 1] = arguments[_i];
  39438. }
  39439. var boundArguments = Array.prototype.slice.call(arguments, 1);
  39440. return function (object) {
  39441. return object[name].apply(object, boundArguments.concat(arguments));
  39442. };
  39443. }
  39444. };
  39445. /* harmony default export */ var util = (Util);
  39446. // CONCATENATED MODULE: ./src/core/utils/collections.ts
  39447. function extend(target) {
  39448. var sources = [];
  39449. for (var _i = 1; _i < arguments.length; _i++) {
  39450. sources[_i - 1] = arguments[_i];
  39451. }
  39452. for (var i = 0; i < sources.length; i++) {
  39453. var extensions = sources[i];
  39454. for (var property in extensions) {
  39455. if (extensions[property] && extensions[property].constructor &&
  39456. extensions[property].constructor === Object) {
  39457. target[property] = extend(target[property] || {}, extensions[property]);
  39458. }
  39459. else {
  39460. target[property] = extensions[property];
  39461. }
  39462. }
  39463. }
  39464. return target;
  39465. }
  39466. function stringify() {
  39467. var m = ["Pusher"];
  39468. for (var i = 0; i < arguments.length; i++) {
  39469. if (typeof arguments[i] === "string") {
  39470. m.push(arguments[i]);
  39471. }
  39472. else {
  39473. m.push(safeJSONStringify(arguments[i]));
  39474. }
  39475. }
  39476. return m.join(" : ");
  39477. }
  39478. function arrayIndexOf(array, item) {
  39479. var nativeIndexOf = Array.prototype.indexOf;
  39480. if (array === null) {
  39481. return -1;
  39482. }
  39483. if (nativeIndexOf && array.indexOf === nativeIndexOf) {
  39484. return array.indexOf(item);
  39485. }
  39486. for (var i = 0, l = array.length; i < l; i++) {
  39487. if (array[i] === item) {
  39488. return i;
  39489. }
  39490. }
  39491. return -1;
  39492. }
  39493. function objectApply(object, f) {
  39494. for (var key in object) {
  39495. if (Object.prototype.hasOwnProperty.call(object, key)) {
  39496. f(object[key], key, object);
  39497. }
  39498. }
  39499. }
  39500. function keys(object) {
  39501. var keys = [];
  39502. objectApply(object, function (_, key) {
  39503. keys.push(key);
  39504. });
  39505. return keys;
  39506. }
  39507. function values(object) {
  39508. var values = [];
  39509. objectApply(object, function (value) {
  39510. values.push(value);
  39511. });
  39512. return values;
  39513. }
  39514. function apply(array, f, context) {
  39515. for (var i = 0; i < array.length; i++) {
  39516. f.call(context || window, array[i], i, array);
  39517. }
  39518. }
  39519. function map(array, f) {
  39520. var result = [];
  39521. for (var i = 0; i < array.length; i++) {
  39522. result.push(f(array[i], i, array, result));
  39523. }
  39524. return result;
  39525. }
  39526. function mapObject(object, f) {
  39527. var result = {};
  39528. objectApply(object, function (value, key) {
  39529. result[key] = f(value);
  39530. });
  39531. return result;
  39532. }
  39533. function filter(array, test) {
  39534. test = test || function (value) { return !!value; };
  39535. var result = [];
  39536. for (var i = 0; i < array.length; i++) {
  39537. if (test(array[i], i, array, result)) {
  39538. result.push(array[i]);
  39539. }
  39540. }
  39541. return result;
  39542. }
  39543. function filterObject(object, test) {
  39544. var result = {};
  39545. objectApply(object, function (value, key) {
  39546. if ((test && test(value, key, object, result)) || Boolean(value)) {
  39547. result[key] = value;
  39548. }
  39549. });
  39550. return result;
  39551. }
  39552. function flatten(object) {
  39553. var result = [];
  39554. objectApply(object, function (value, key) {
  39555. result.push([key, value]);
  39556. });
  39557. return result;
  39558. }
  39559. function any(array, test) {
  39560. for (var i = 0; i < array.length; i++) {
  39561. if (test(array[i], i, array)) {
  39562. return true;
  39563. }
  39564. }
  39565. return false;
  39566. }
  39567. function collections_all(array, test) {
  39568. for (var i = 0; i < array.length; i++) {
  39569. if (!test(array[i], i, array)) {
  39570. return false;
  39571. }
  39572. }
  39573. return true;
  39574. }
  39575. function encodeParamsObject(data) {
  39576. return mapObject(data, function (value) {
  39577. if (typeof value === "object") {
  39578. value = safeJSONStringify(value);
  39579. }
  39580. return encodeURIComponent(encode(value.toString()));
  39581. });
  39582. }
  39583. function buildQueryString(data) {
  39584. var params = filterObject(data, function (value) {
  39585. return value !== undefined;
  39586. });
  39587. var query = map(flatten(encodeParamsObject(params)), util.method("join", "=")).join("&");
  39588. return query;
  39589. }
  39590. function decycleObject(object) {
  39591. var objects = [], paths = [];
  39592. return (function derez(value, path) {
  39593. var i, name, nu;
  39594. switch (typeof value) {
  39595. case 'object':
  39596. if (!value) {
  39597. return null;
  39598. }
  39599. for (i = 0; i < objects.length; i += 1) {
  39600. if (objects[i] === value) {
  39601. return { $ref: paths[i] };
  39602. }
  39603. }
  39604. objects.push(value);
  39605. paths.push(path);
  39606. if (Object.prototype.toString.apply(value) === '[object Array]') {
  39607. nu = [];
  39608. for (i = 0; i < value.length; i += 1) {
  39609. nu[i] = derez(value[i], path + '[' + i + ']');
  39610. }
  39611. }
  39612. else {
  39613. nu = {};
  39614. for (name in value) {
  39615. if (Object.prototype.hasOwnProperty.call(value, name)) {
  39616. nu[name] = derez(value[name], path + '[' + JSON.stringify(name) + ']');
  39617. }
  39618. }
  39619. }
  39620. return nu;
  39621. case 'number':
  39622. case 'string':
  39623. case 'boolean':
  39624. return value;
  39625. }
  39626. }(object, '$'));
  39627. }
  39628. function safeJSONStringify(source) {
  39629. try {
  39630. return JSON.stringify(source);
  39631. }
  39632. catch (e) {
  39633. return JSON.stringify(decycleObject(source));
  39634. }
  39635. }
  39636. // CONCATENATED MODULE: ./src/core/logger.ts
  39637. var logger_Logger = (function () {
  39638. function Logger() {
  39639. this.globalLog = function (message) {
  39640. if (window.console && window.console.log) {
  39641. window.console.log(message);
  39642. }
  39643. };
  39644. }
  39645. Logger.prototype.debug = function () {
  39646. var args = [];
  39647. for (var _i = 0; _i < arguments.length; _i++) {
  39648. args[_i] = arguments[_i];
  39649. }
  39650. this.log(this.globalLog, args);
  39651. };
  39652. Logger.prototype.warn = function () {
  39653. var args = [];
  39654. for (var _i = 0; _i < arguments.length; _i++) {
  39655. args[_i] = arguments[_i];
  39656. }
  39657. this.log(this.globalLogWarn, args);
  39658. };
  39659. Logger.prototype.error = function () {
  39660. var args = [];
  39661. for (var _i = 0; _i < arguments.length; _i++) {
  39662. args[_i] = arguments[_i];
  39663. }
  39664. this.log(this.globalLogError, args);
  39665. };
  39666. Logger.prototype.globalLogWarn = function (message) {
  39667. if (window.console && window.console.warn) {
  39668. window.console.warn(message);
  39669. }
  39670. else {
  39671. this.globalLog(message);
  39672. }
  39673. };
  39674. Logger.prototype.globalLogError = function (message) {
  39675. if (window.console && window.console.error) {
  39676. window.console.error(message);
  39677. }
  39678. else {
  39679. this.globalLogWarn(message);
  39680. }
  39681. };
  39682. Logger.prototype.log = function (defaultLoggingFunction) {
  39683. var args = [];
  39684. for (var _i = 1; _i < arguments.length; _i++) {
  39685. args[_i - 1] = arguments[_i];
  39686. }
  39687. var message = stringify.apply(this, arguments);
  39688. if (core_pusher.log) {
  39689. core_pusher.log(message);
  39690. }
  39691. else if (core_pusher.logToConsole) {
  39692. var log = defaultLoggingFunction.bind(this);
  39693. log(message);
  39694. }
  39695. };
  39696. return Logger;
  39697. }());
  39698. /* harmony default export */ var logger = (new logger_Logger());
  39699. // CONCATENATED MODULE: ./src/core/utils/url_store.ts
  39700. var urlStore = {
  39701. baseUrl: "https://pusher.com",
  39702. urls: {
  39703. authenticationEndpoint: {
  39704. path: "/docs/authenticating_users",
  39705. },
  39706. javascriptQuickStart: {
  39707. path: "/docs/javascript_quick_start"
  39708. },
  39709. triggeringClientEvents: {
  39710. path: "/docs/client_api_guide/client_events#trigger-events"
  39711. }
  39712. }
  39713. };
  39714. var buildLogSuffix = function (key) {
  39715. var urlPrefix = "See:";
  39716. var urlObj = urlStore.urls[key];
  39717. if (!urlObj)
  39718. return "";
  39719. var url;
  39720. if (urlObj.fullUrl) {
  39721. url = urlObj.fullUrl;
  39722. }
  39723. else if (urlObj.path) {
  39724. url = urlStore.baseUrl + urlObj.path;
  39725. }
  39726. if (!url)
  39727. return "";
  39728. return urlPrefix + " " + url;
  39729. };
  39730. /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
  39731. // CONCATENATED MODULE: ./src/runtimes/isomorphic/auth/xhr_auth.ts
  39732. var ajax = function (context, socketId, callback) {
  39733. var self = this, xhr;
  39734. xhr = runtime.createXHR();
  39735. xhr.open("POST", self.options.authEndpoint, true);
  39736. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  39737. for (var headerName in this.authOptions.headers) {
  39738. xhr.setRequestHeader(headerName, this.authOptions.headers[headerName]);
  39739. }
  39740. xhr.onreadystatechange = function () {
  39741. if (xhr.readyState === 4) {
  39742. if (xhr.status === 200) {
  39743. var data, parsed = false;
  39744. try {
  39745. data = JSON.parse(xhr.responseText);
  39746. parsed = true;
  39747. }
  39748. catch (e) {
  39749. callback(true, 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + xhr.responseText);
  39750. }
  39751. if (parsed) {
  39752. callback(false, data);
  39753. }
  39754. }
  39755. else {
  39756. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  39757. logger.error('Unable to retrieve auth string from auth endpoint - ' +
  39758. ("received status " + xhr.status + " from " + self.options.authEndpoint + ". ") +
  39759. ("Clients must be authenticated to join private or presence channels. " + suffix));
  39760. callback(true, xhr.status);
  39761. }
  39762. }
  39763. };
  39764. xhr.send(this.composeQuery(socketId));
  39765. return xhr;
  39766. };
  39767. /* harmony default export */ var xhr_auth = (ajax);
  39768. // CONCATENATED MODULE: ./src/runtimes/web/auth/jsonp_auth.ts
  39769. var jsonp = function (context, socketId, callback) {
  39770. if (this.authOptions.headers !== undefined) {
  39771. logger.warn('To send headers with the auth request, you must use AJAX, rather than JSONP.');
  39772. }
  39773. var callbackName = context.nextAuthCallbackID.toString();
  39774. context.nextAuthCallbackID++;
  39775. var document = context.getDocument();
  39776. var script = document.createElement("script");
  39777. context.auth_callbacks[callbackName] = function (data) {
  39778. callback(false, data);
  39779. };
  39780. var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
  39781. script.src = this.options.authEndpoint +
  39782. '?callback=' +
  39783. encodeURIComponent(callback_name) +
  39784. '&' +
  39785. this.composeQuery(socketId);
  39786. var head = document.getElementsByTagName("head")[0] || document.documentElement;
  39787. head.insertBefore(script, head.firstChild);
  39788. };
  39789. /* harmony default export */ var jsonp_auth = (jsonp);
  39790. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_request.ts
  39791. var ScriptRequest = (function () {
  39792. function ScriptRequest(src) {
  39793. this.src = src;
  39794. }
  39795. ScriptRequest.prototype.send = function (receiver) {
  39796. var self = this;
  39797. var errorString = "Error loading " + self.src;
  39798. self.script = document.createElement("script");
  39799. self.script.id = receiver.id;
  39800. self.script.src = self.src;
  39801. self.script.type = "text/javascript";
  39802. self.script.charset = "UTF-8";
  39803. if (self.script.addEventListener) {
  39804. self.script.onerror = function () {
  39805. receiver.callback(errorString);
  39806. };
  39807. self.script.onload = function () {
  39808. receiver.callback(null);
  39809. };
  39810. }
  39811. else {
  39812. self.script.onreadystatechange = function () {
  39813. if (self.script.readyState === 'loaded' ||
  39814. self.script.readyState === 'complete') {
  39815. receiver.callback(null);
  39816. }
  39817. };
  39818. }
  39819. if (self.script.async === undefined && document.attachEvent &&
  39820. /opera/i.test(navigator.userAgent)) {
  39821. self.errorScript = document.createElement("script");
  39822. self.errorScript.id = receiver.id + "_error";
  39823. self.errorScript.text = receiver.name + "('" + errorString + "');";
  39824. self.script.async = self.errorScript.async = false;
  39825. }
  39826. else {
  39827. self.script.async = true;
  39828. }
  39829. var head = document.getElementsByTagName('head')[0];
  39830. head.insertBefore(self.script, head.firstChild);
  39831. if (self.errorScript) {
  39832. head.insertBefore(self.errorScript, self.script.nextSibling);
  39833. }
  39834. };
  39835. ScriptRequest.prototype.cleanup = function () {
  39836. if (this.script) {
  39837. this.script.onload = this.script.onerror = null;
  39838. this.script.onreadystatechange = null;
  39839. }
  39840. if (this.script && this.script.parentNode) {
  39841. this.script.parentNode.removeChild(this.script);
  39842. }
  39843. if (this.errorScript && this.errorScript.parentNode) {
  39844. this.errorScript.parentNode.removeChild(this.errorScript);
  39845. }
  39846. this.script = null;
  39847. this.errorScript = null;
  39848. };
  39849. return ScriptRequest;
  39850. }());
  39851. /* harmony default export */ var script_request = (ScriptRequest);
  39852. // CONCATENATED MODULE: ./src/runtimes/web/dom/jsonp_request.ts
  39853. var jsonp_request_JSONPRequest = (function () {
  39854. function JSONPRequest(url, data) {
  39855. this.url = url;
  39856. this.data = data;
  39857. }
  39858. JSONPRequest.prototype.send = function (receiver) {
  39859. if (this.request) {
  39860. return;
  39861. }
  39862. var query = buildQueryString(this.data);
  39863. var url = this.url + "/" + receiver.number + "?" + query;
  39864. this.request = runtime.createScriptRequest(url);
  39865. this.request.send(receiver);
  39866. };
  39867. JSONPRequest.prototype.cleanup = function () {
  39868. if (this.request) {
  39869. this.request.cleanup();
  39870. }
  39871. };
  39872. return JSONPRequest;
  39873. }());
  39874. /* harmony default export */ var jsonp_request = (jsonp_request_JSONPRequest);
  39875. // CONCATENATED MODULE: ./src/runtimes/web/timeline/jsonp_timeline.ts
  39876. var getAgent = function (sender, useTLS) {
  39877. return function (data, callback) {
  39878. var scheme = "http" + (useTLS ? "s" : "") + "://";
  39879. var url = scheme + (sender.host || sender.options.host) + sender.options.path;
  39880. var request = runtime.createJSONPRequest(url, data);
  39881. var receiver = runtime.ScriptReceivers.create(function (error, result) {
  39882. ScriptReceivers.remove(receiver);
  39883. request.cleanup();
  39884. if (result && result.host) {
  39885. sender.host = result.host;
  39886. }
  39887. if (callback) {
  39888. callback(error, result);
  39889. }
  39890. });
  39891. request.send(receiver);
  39892. };
  39893. };
  39894. var jsonp_timeline_jsonp = {
  39895. name: 'jsonp',
  39896. getAgent: getAgent
  39897. };
  39898. /* harmony default export */ var jsonp_timeline = (jsonp_timeline_jsonp);
  39899. // CONCATENATED MODULE: ./src/core/transports/url_schemes.ts
  39900. function getGenericURL(baseScheme, params, path) {
  39901. var scheme = baseScheme + (params.useTLS ? "s" : "");
  39902. var host = params.useTLS ? params.hostTLS : params.hostNonTLS;
  39903. return scheme + "://" + host + path;
  39904. }
  39905. function getGenericPath(key, queryString) {
  39906. var path = "/app/" + key;
  39907. var query = "?protocol=" + defaults.PROTOCOL +
  39908. "&client=js" +
  39909. "&version=" + defaults.VERSION +
  39910. (queryString ? ("&" + queryString) : "");
  39911. return path + query;
  39912. }
  39913. var ws = {
  39914. getInitial: function (key, params) {
  39915. var path = (params.httpPath || "") + getGenericPath(key, "flash=false");
  39916. return getGenericURL("ws", params, path);
  39917. }
  39918. };
  39919. var http = {
  39920. getInitial: function (key, params) {
  39921. var path = (params.httpPath || "/pusher") + getGenericPath(key);
  39922. return getGenericURL("http", params, path);
  39923. }
  39924. };
  39925. var sockjs = {
  39926. getInitial: function (key, params) {
  39927. return getGenericURL("http", params, params.httpPath || "/pusher");
  39928. },
  39929. getPath: function (key, params) {
  39930. return getGenericPath(key);
  39931. }
  39932. };
  39933. // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
  39934. var callback_registry_CallbackRegistry = (function () {
  39935. function CallbackRegistry() {
  39936. this._callbacks = {};
  39937. }
  39938. CallbackRegistry.prototype.get = function (name) {
  39939. return this._callbacks[prefix(name)];
  39940. };
  39941. CallbackRegistry.prototype.add = function (name, callback, context) {
  39942. var prefixedEventName = prefix(name);
  39943. this._callbacks[prefixedEventName] = this._callbacks[prefixedEventName] || [];
  39944. this._callbacks[prefixedEventName].push({
  39945. fn: callback,
  39946. context: context
  39947. });
  39948. };
  39949. CallbackRegistry.prototype.remove = function (name, callback, context) {
  39950. if (!name && !callback && !context) {
  39951. this._callbacks = {};
  39952. return;
  39953. }
  39954. var names = name ? [prefix(name)] : keys(this._callbacks);
  39955. if (callback || context) {
  39956. this.removeCallback(names, callback, context);
  39957. }
  39958. else {
  39959. this.removeAllCallbacks(names);
  39960. }
  39961. };
  39962. CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
  39963. apply(names, function (name) {
  39964. this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
  39965. return (callback && callback !== binding.fn) ||
  39966. (context && context !== binding.context);
  39967. });
  39968. if (this._callbacks[name].length === 0) {
  39969. delete this._callbacks[name];
  39970. }
  39971. }, this);
  39972. };
  39973. CallbackRegistry.prototype.removeAllCallbacks = function (names) {
  39974. apply(names, function (name) {
  39975. delete this._callbacks[name];
  39976. }, this);
  39977. };
  39978. return CallbackRegistry;
  39979. }());
  39980. /* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
  39981. function prefix(name) {
  39982. return "_" + name;
  39983. }
  39984. // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
  39985. var dispatcher_Dispatcher = (function () {
  39986. function Dispatcher(failThrough) {
  39987. this.callbacks = new callback_registry();
  39988. this.global_callbacks = [];
  39989. this.failThrough = failThrough;
  39990. }
  39991. Dispatcher.prototype.bind = function (eventName, callback, context) {
  39992. this.callbacks.add(eventName, callback, context);
  39993. return this;
  39994. };
  39995. Dispatcher.prototype.bind_global = function (callback) {
  39996. this.global_callbacks.push(callback);
  39997. return this;
  39998. };
  39999. Dispatcher.prototype.unbind = function (eventName, callback, context) {
  40000. this.callbacks.remove(eventName, callback, context);
  40001. return this;
  40002. };
  40003. Dispatcher.prototype.unbind_global = function (callback) {
  40004. if (!callback) {
  40005. this.global_callbacks = [];
  40006. return this;
  40007. }
  40008. this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
  40009. return this;
  40010. };
  40011. Dispatcher.prototype.unbind_all = function () {
  40012. this.unbind();
  40013. this.unbind_global();
  40014. return this;
  40015. };
  40016. Dispatcher.prototype.emit = function (eventName, data, metadata) {
  40017. for (var i = 0; i < this.global_callbacks.length; i++) {
  40018. this.global_callbacks[i](eventName, data);
  40019. }
  40020. var callbacks = this.callbacks.get(eventName);
  40021. var args = [];
  40022. if (metadata) {
  40023. args.push(data, metadata);
  40024. }
  40025. else if (data) {
  40026. args.push(data);
  40027. }
  40028. if (callbacks && callbacks.length > 0) {
  40029. for (var i = 0; i < callbacks.length; i++) {
  40030. callbacks[i].fn.apply(callbacks[i].context || window, args);
  40031. }
  40032. }
  40033. else if (this.failThrough) {
  40034. this.failThrough(eventName, data);
  40035. }
  40036. return this;
  40037. };
  40038. return Dispatcher;
  40039. }());
  40040. /* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
  40041. // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
  40042. var transport_connection_extends = (undefined && undefined.__extends) || (function () {
  40043. var extendStatics = function (d, b) {
  40044. extendStatics = Object.setPrototypeOf ||
  40045. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40046. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40047. return extendStatics(d, b);
  40048. };
  40049. return function (d, b) {
  40050. extendStatics(d, b);
  40051. function __() { this.constructor = d; }
  40052. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40053. };
  40054. })();
  40055. var transport_connection_TransportConnection = (function (_super) {
  40056. transport_connection_extends(TransportConnection, _super);
  40057. function TransportConnection(hooks, name, priority, key, options) {
  40058. var _this = _super.call(this) || this;
  40059. _this.initialize = runtime.transportConnectionInitializer;
  40060. _this.hooks = hooks;
  40061. _this.name = name;
  40062. _this.priority = priority;
  40063. _this.key = key;
  40064. _this.options = options;
  40065. _this.state = "new";
  40066. _this.timeline = options.timeline;
  40067. _this.activityTimeout = options.activityTimeout;
  40068. _this.id = _this.timeline.generateUniqueID();
  40069. return _this;
  40070. }
  40071. TransportConnection.prototype.handlesActivityChecks = function () {
  40072. return Boolean(this.hooks.handlesActivityChecks);
  40073. };
  40074. TransportConnection.prototype.supportsPing = function () {
  40075. return Boolean(this.hooks.supportsPing);
  40076. };
  40077. TransportConnection.prototype.connect = function () {
  40078. var _this = this;
  40079. if (this.socket || this.state !== "initialized") {
  40080. return false;
  40081. }
  40082. var url = this.hooks.urls.getInitial(this.key, this.options);
  40083. try {
  40084. this.socket = this.hooks.getSocket(url, this.options);
  40085. }
  40086. catch (e) {
  40087. util.defer(function () {
  40088. _this.onError(e);
  40089. _this.changeState("closed");
  40090. });
  40091. return false;
  40092. }
  40093. this.bindListeners();
  40094. logger.debug("Connecting", { transport: this.name, url: url });
  40095. this.changeState("connecting");
  40096. return true;
  40097. };
  40098. TransportConnection.prototype.close = function () {
  40099. if (this.socket) {
  40100. this.socket.close();
  40101. return true;
  40102. }
  40103. else {
  40104. return false;
  40105. }
  40106. };
  40107. TransportConnection.prototype.send = function (data) {
  40108. var _this = this;
  40109. if (this.state === "open") {
  40110. util.defer(function () {
  40111. if (_this.socket) {
  40112. _this.socket.send(data);
  40113. }
  40114. });
  40115. return true;
  40116. }
  40117. else {
  40118. return false;
  40119. }
  40120. };
  40121. TransportConnection.prototype.ping = function () {
  40122. if (this.state === "open" && this.supportsPing()) {
  40123. this.socket.ping();
  40124. }
  40125. };
  40126. TransportConnection.prototype.onOpen = function () {
  40127. if (this.hooks.beforeOpen) {
  40128. this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
  40129. }
  40130. this.changeState("open");
  40131. this.socket.onopen = undefined;
  40132. };
  40133. TransportConnection.prototype.onError = function (error) {
  40134. this.emit("error", { type: 'WebSocketError', error: error });
  40135. this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
  40136. };
  40137. TransportConnection.prototype.onClose = function (closeEvent) {
  40138. if (closeEvent) {
  40139. this.changeState("closed", {
  40140. code: closeEvent.code,
  40141. reason: closeEvent.reason,
  40142. wasClean: closeEvent.wasClean
  40143. });
  40144. }
  40145. else {
  40146. this.changeState("closed");
  40147. }
  40148. this.unbindListeners();
  40149. this.socket = undefined;
  40150. };
  40151. TransportConnection.prototype.onMessage = function (message) {
  40152. this.emit("message", message);
  40153. };
  40154. TransportConnection.prototype.onActivity = function () {
  40155. this.emit("activity");
  40156. };
  40157. TransportConnection.prototype.bindListeners = function () {
  40158. var _this = this;
  40159. this.socket.onopen = function () {
  40160. _this.onOpen();
  40161. };
  40162. this.socket.onerror = function (error) {
  40163. _this.onError(error);
  40164. };
  40165. this.socket.onclose = function (closeEvent) {
  40166. _this.onClose(closeEvent);
  40167. };
  40168. this.socket.onmessage = function (message) {
  40169. _this.onMessage(message);
  40170. };
  40171. if (this.supportsPing()) {
  40172. this.socket.onactivity = function () { _this.onActivity(); };
  40173. }
  40174. };
  40175. TransportConnection.prototype.unbindListeners = function () {
  40176. if (this.socket) {
  40177. this.socket.onopen = undefined;
  40178. this.socket.onerror = undefined;
  40179. this.socket.onclose = undefined;
  40180. this.socket.onmessage = undefined;
  40181. if (this.supportsPing()) {
  40182. this.socket.onactivity = undefined;
  40183. }
  40184. }
  40185. };
  40186. TransportConnection.prototype.changeState = function (state, params) {
  40187. this.state = state;
  40188. this.timeline.info(this.buildTimelineMessage({
  40189. state: state,
  40190. params: params
  40191. }));
  40192. this.emit(state, params);
  40193. };
  40194. TransportConnection.prototype.buildTimelineMessage = function (message) {
  40195. return extend({ cid: this.id }, message);
  40196. };
  40197. return TransportConnection;
  40198. }(dispatcher));
  40199. /* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
  40200. // CONCATENATED MODULE: ./src/core/transports/transport.ts
  40201. var transport_Transport = (function () {
  40202. function Transport(hooks) {
  40203. this.hooks = hooks;
  40204. }
  40205. Transport.prototype.isSupported = function (environment) {
  40206. return this.hooks.isSupported(environment);
  40207. };
  40208. Transport.prototype.createConnection = function (name, priority, key, options) {
  40209. return new transport_connection(this.hooks, name, priority, key, options);
  40210. };
  40211. return Transport;
  40212. }());
  40213. /* harmony default export */ var transports_transport = (transport_Transport);
  40214. // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
  40215. var WSTransport = new transports_transport({
  40216. urls: ws,
  40217. handlesActivityChecks: false,
  40218. supportsPing: false,
  40219. isInitialized: function () {
  40220. return Boolean(runtime.getWebSocketAPI());
  40221. },
  40222. isSupported: function () {
  40223. return Boolean(runtime.getWebSocketAPI());
  40224. },
  40225. getSocket: function (url) {
  40226. return runtime.createWebSocket(url);
  40227. }
  40228. });
  40229. var httpConfiguration = {
  40230. urls: http,
  40231. handlesActivityChecks: false,
  40232. supportsPing: true,
  40233. isInitialized: function () {
  40234. return true;
  40235. }
  40236. };
  40237. var streamingConfiguration = extend({ getSocket: function (url) {
  40238. return runtime.HTTPFactory.createStreamingSocket(url);
  40239. }
  40240. }, httpConfiguration);
  40241. var pollingConfiguration = extend({ getSocket: function (url) {
  40242. return runtime.HTTPFactory.createPollingSocket(url);
  40243. }
  40244. }, httpConfiguration);
  40245. var xhrConfiguration = {
  40246. isSupported: function () {
  40247. return runtime.isXHRSupported();
  40248. }
  40249. };
  40250. var XHRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xhrConfiguration));
  40251. var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
  40252. var Transports = {
  40253. ws: WSTransport,
  40254. xhr_streaming: XHRStreamingTransport,
  40255. xhr_polling: XHRPollingTransport
  40256. };
  40257. /* harmony default export */ var transports = (Transports);
  40258. // CONCATENATED MODULE: ./src/runtimes/web/transports/transports.ts
  40259. var SockJSTransport = new transports_transport({
  40260. file: "sockjs",
  40261. urls: sockjs,
  40262. handlesActivityChecks: true,
  40263. supportsPing: false,
  40264. isSupported: function () {
  40265. return true;
  40266. },
  40267. isInitialized: function () {
  40268. return window.SockJS !== undefined;
  40269. },
  40270. getSocket: function (url, options) {
  40271. return new window.SockJS(url, null, {
  40272. js_path: Dependencies.getPath("sockjs", {
  40273. useTLS: options.useTLS
  40274. }),
  40275. ignore_null_origin: options.ignoreNullOrigin
  40276. });
  40277. },
  40278. beforeOpen: function (socket, path) {
  40279. socket.send(JSON.stringify({
  40280. path: path
  40281. }));
  40282. }
  40283. });
  40284. var xdrConfiguration = {
  40285. isSupported: function (environment) {
  40286. var yes = runtime.isXDRSupported(environment.useTLS);
  40287. return yes;
  40288. }
  40289. };
  40290. var XDRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xdrConfiguration));
  40291. var XDRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xdrConfiguration));
  40292. transports.xdr_streaming = XDRStreamingTransport;
  40293. transports.xdr_polling = XDRPollingTransport;
  40294. transports.sockjs = SockJSTransport;
  40295. /* harmony default export */ var transports_transports = (transports);
  40296. // CONCATENATED MODULE: ./src/runtimes/web/net_info.ts
  40297. var net_info_extends = (undefined && undefined.__extends) || (function () {
  40298. var extendStatics = function (d, b) {
  40299. extendStatics = Object.setPrototypeOf ||
  40300. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40301. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40302. return extendStatics(d, b);
  40303. };
  40304. return function (d, b) {
  40305. extendStatics(d, b);
  40306. function __() { this.constructor = d; }
  40307. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40308. };
  40309. })();
  40310. var NetInfo = (function (_super) {
  40311. net_info_extends(NetInfo, _super);
  40312. function NetInfo() {
  40313. var _this = _super.call(this) || this;
  40314. var self = _this;
  40315. if (window.addEventListener !== undefined) {
  40316. window.addEventListener("online", function () {
  40317. self.emit('online');
  40318. }, false);
  40319. window.addEventListener("offline", function () {
  40320. self.emit('offline');
  40321. }, false);
  40322. }
  40323. return _this;
  40324. }
  40325. NetInfo.prototype.isOnline = function () {
  40326. if (window.navigator.onLine === undefined) {
  40327. return true;
  40328. }
  40329. else {
  40330. return window.navigator.onLine;
  40331. }
  40332. };
  40333. return NetInfo;
  40334. }(dispatcher));
  40335. var net_info_Network = new NetInfo();
  40336. // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
  40337. var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
  40338. function AssistantToTheTransportManager(manager, transport, options) {
  40339. this.manager = manager;
  40340. this.transport = transport;
  40341. this.minPingDelay = options.minPingDelay;
  40342. this.maxPingDelay = options.maxPingDelay;
  40343. this.pingDelay = undefined;
  40344. }
  40345. AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
  40346. var _this = this;
  40347. options = extend({}, options, {
  40348. activityTimeout: this.pingDelay
  40349. });
  40350. var connection = this.transport.createConnection(name, priority, key, options);
  40351. var openTimestamp = null;
  40352. var onOpen = function () {
  40353. connection.unbind("open", onOpen);
  40354. connection.bind("closed", onClosed);
  40355. openTimestamp = util.now();
  40356. };
  40357. var onClosed = function (closeEvent) {
  40358. connection.unbind("closed", onClosed);
  40359. if (closeEvent.code === 1002 || closeEvent.code === 1003) {
  40360. _this.manager.reportDeath();
  40361. }
  40362. else if (!closeEvent.wasClean && openTimestamp) {
  40363. var lifespan = util.now() - openTimestamp;
  40364. if (lifespan < 2 * _this.maxPingDelay) {
  40365. _this.manager.reportDeath();
  40366. _this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
  40367. }
  40368. }
  40369. };
  40370. connection.bind("open", onOpen);
  40371. return connection;
  40372. };
  40373. AssistantToTheTransportManager.prototype.isSupported = function (environment) {
  40374. return this.manager.isAlive() && this.transport.isSupported(environment);
  40375. };
  40376. return AssistantToTheTransportManager;
  40377. }());
  40378. /* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
  40379. // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
  40380. var Protocol = {
  40381. decodeMessage: function (messageEvent) {
  40382. try {
  40383. var messageData = JSON.parse(messageEvent.data);
  40384. var pusherEventData = messageData.data;
  40385. if (typeof pusherEventData === 'string') {
  40386. try {
  40387. pusherEventData = JSON.parse(messageData.data);
  40388. }
  40389. catch (e) { }
  40390. }
  40391. var pusherEvent = {
  40392. event: messageData.event,
  40393. channel: messageData.channel,
  40394. data: pusherEventData,
  40395. };
  40396. if (messageData.user_id) {
  40397. pusherEvent.user_id = messageData.user_id;
  40398. }
  40399. return pusherEvent;
  40400. }
  40401. catch (e) {
  40402. throw { type: 'MessageParseError', error: e, data: messageEvent.data };
  40403. }
  40404. },
  40405. encodeMessage: function (event) {
  40406. return JSON.stringify(event);
  40407. },
  40408. processHandshake: function (messageEvent) {
  40409. var message = Protocol.decodeMessage(messageEvent);
  40410. if (message.event === "pusher:connection_established") {
  40411. if (!message.data.activity_timeout) {
  40412. throw "No activity timeout specified in handshake";
  40413. }
  40414. return {
  40415. action: "connected",
  40416. id: message.data.socket_id,
  40417. activityTimeout: message.data.activity_timeout * 1000
  40418. };
  40419. }
  40420. else if (message.event === "pusher:error") {
  40421. return {
  40422. action: this.getCloseAction(message.data),
  40423. error: this.getCloseError(message.data)
  40424. };
  40425. }
  40426. else {
  40427. throw "Invalid handshake";
  40428. }
  40429. },
  40430. getCloseAction: function (closeEvent) {
  40431. if (closeEvent.code < 4000) {
  40432. if (closeEvent.code >= 1002 && closeEvent.code <= 1004) {
  40433. return "backoff";
  40434. }
  40435. else {
  40436. return null;
  40437. }
  40438. }
  40439. else if (closeEvent.code === 4000) {
  40440. return "tls_only";
  40441. }
  40442. else if (closeEvent.code < 4100) {
  40443. return "refused";
  40444. }
  40445. else if (closeEvent.code < 4200) {
  40446. return "backoff";
  40447. }
  40448. else if (closeEvent.code < 4300) {
  40449. return "retry";
  40450. }
  40451. else {
  40452. return "refused";
  40453. }
  40454. },
  40455. getCloseError: function (closeEvent) {
  40456. if (closeEvent.code !== 1000 && closeEvent.code !== 1001) {
  40457. return {
  40458. type: 'PusherError',
  40459. data: {
  40460. code: closeEvent.code,
  40461. message: closeEvent.reason || closeEvent.message
  40462. }
  40463. };
  40464. }
  40465. else {
  40466. return null;
  40467. }
  40468. }
  40469. };
  40470. /* harmony default export */ var protocol_protocol = (Protocol);
  40471. // CONCATENATED MODULE: ./src/core/connection/connection.ts
  40472. var connection_extends = (undefined && undefined.__extends) || (function () {
  40473. var extendStatics = function (d, b) {
  40474. extendStatics = Object.setPrototypeOf ||
  40475. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40476. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40477. return extendStatics(d, b);
  40478. };
  40479. return function (d, b) {
  40480. extendStatics(d, b);
  40481. function __() { this.constructor = d; }
  40482. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40483. };
  40484. })();
  40485. var connection_Connection = (function (_super) {
  40486. connection_extends(Connection, _super);
  40487. function Connection(id, transport) {
  40488. var _this = _super.call(this) || this;
  40489. _this.id = id;
  40490. _this.transport = transport;
  40491. _this.activityTimeout = transport.activityTimeout;
  40492. _this.bindListeners();
  40493. return _this;
  40494. }
  40495. Connection.prototype.handlesActivityChecks = function () {
  40496. return this.transport.handlesActivityChecks();
  40497. };
  40498. Connection.prototype.send = function (data) {
  40499. return this.transport.send(data);
  40500. };
  40501. Connection.prototype.send_event = function (name, data, channel) {
  40502. var event = { event: name, data: data };
  40503. if (channel) {
  40504. event.channel = channel;
  40505. }
  40506. logger.debug('Event sent', event);
  40507. return this.send(protocol_protocol.encodeMessage(event));
  40508. };
  40509. Connection.prototype.ping = function () {
  40510. if (this.transport.supportsPing()) {
  40511. this.transport.ping();
  40512. }
  40513. else {
  40514. this.send_event('pusher:ping', {});
  40515. }
  40516. };
  40517. Connection.prototype.close = function () {
  40518. this.transport.close();
  40519. };
  40520. Connection.prototype.bindListeners = function () {
  40521. var _this = this;
  40522. var listeners = {
  40523. message: function (messageEvent) {
  40524. var pusherEvent;
  40525. try {
  40526. pusherEvent = protocol_protocol.decodeMessage(messageEvent);
  40527. }
  40528. catch (e) {
  40529. _this.emit('error', {
  40530. type: 'MessageParseError',
  40531. error: e,
  40532. data: messageEvent.data
  40533. });
  40534. }
  40535. if (pusherEvent !== undefined) {
  40536. logger.debug('Event recd', pusherEvent);
  40537. switch (pusherEvent.event) {
  40538. case 'pusher:error':
  40539. _this.emit('error', { type: 'PusherError', data: pusherEvent.data });
  40540. break;
  40541. case 'pusher:ping':
  40542. _this.emit("ping");
  40543. break;
  40544. case 'pusher:pong':
  40545. _this.emit("pong");
  40546. break;
  40547. }
  40548. _this.emit('message', pusherEvent);
  40549. }
  40550. },
  40551. activity: function () {
  40552. _this.emit("activity");
  40553. },
  40554. error: function (error) {
  40555. _this.emit("error", { type: "WebSocketError", error: error });
  40556. },
  40557. closed: function (closeEvent) {
  40558. unbindListeners();
  40559. if (closeEvent && closeEvent.code) {
  40560. _this.handleCloseEvent(closeEvent);
  40561. }
  40562. _this.transport = null;
  40563. _this.emit("closed");
  40564. }
  40565. };
  40566. var unbindListeners = function () {
  40567. objectApply(listeners, function (listener, event) {
  40568. _this.transport.unbind(event, listener);
  40569. });
  40570. };
  40571. objectApply(listeners, function (listener, event) {
  40572. _this.transport.bind(event, listener);
  40573. });
  40574. };
  40575. Connection.prototype.handleCloseEvent = function (closeEvent) {
  40576. var action = protocol_protocol.getCloseAction(closeEvent);
  40577. var error = protocol_protocol.getCloseError(closeEvent);
  40578. if (error) {
  40579. this.emit('error', error);
  40580. }
  40581. if (action) {
  40582. this.emit(action, { action: action, error: error });
  40583. }
  40584. };
  40585. return Connection;
  40586. }(dispatcher));
  40587. /* harmony default export */ var connection_connection = (connection_Connection);
  40588. // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
  40589. var handshake_Handshake = (function () {
  40590. function Handshake(transport, callback) {
  40591. this.transport = transport;
  40592. this.callback = callback;
  40593. this.bindListeners();
  40594. }
  40595. Handshake.prototype.close = function () {
  40596. this.unbindListeners();
  40597. this.transport.close();
  40598. };
  40599. Handshake.prototype.bindListeners = function () {
  40600. var _this = this;
  40601. this.onMessage = function (m) {
  40602. _this.unbindListeners();
  40603. var result;
  40604. try {
  40605. result = protocol_protocol.processHandshake(m);
  40606. }
  40607. catch (e) {
  40608. _this.finish("error", { error: e });
  40609. _this.transport.close();
  40610. return;
  40611. }
  40612. if (result.action === "connected") {
  40613. _this.finish("connected", {
  40614. connection: new connection_connection(result.id, _this.transport),
  40615. activityTimeout: result.activityTimeout
  40616. });
  40617. }
  40618. else {
  40619. _this.finish(result.action, { error: result.error });
  40620. _this.transport.close();
  40621. }
  40622. };
  40623. this.onClosed = function (closeEvent) {
  40624. _this.unbindListeners();
  40625. var action = protocol_protocol.getCloseAction(closeEvent) || "backoff";
  40626. var error = protocol_protocol.getCloseError(closeEvent);
  40627. _this.finish(action, { error: error });
  40628. };
  40629. this.transport.bind("message", this.onMessage);
  40630. this.transport.bind("closed", this.onClosed);
  40631. };
  40632. Handshake.prototype.unbindListeners = function () {
  40633. this.transport.unbind("message", this.onMessage);
  40634. this.transport.unbind("closed", this.onClosed);
  40635. };
  40636. Handshake.prototype.finish = function (action, params) {
  40637. this.callback(extend({ transport: this.transport, action: action }, params));
  40638. };
  40639. return Handshake;
  40640. }());
  40641. /* harmony default export */ var connection_handshake = (handshake_Handshake);
  40642. // CONCATENATED MODULE: ./src/core/auth/pusher_authorizer.ts
  40643. var pusher_authorizer_PusherAuthorizer = (function () {
  40644. function PusherAuthorizer(channel, options) {
  40645. this.channel = channel;
  40646. var authTransport = options.authTransport;
  40647. if (typeof runtime.getAuthorizers()[authTransport] === "undefined") {
  40648. throw "'" + authTransport + "' is not a recognized auth transport";
  40649. }
  40650. this.type = authTransport;
  40651. this.options = options;
  40652. this.authOptions = (options || {}).auth || {};
  40653. }
  40654. PusherAuthorizer.prototype.composeQuery = function (socketId) {
  40655. var query = 'socket_id=' + encodeURIComponent(socketId) +
  40656. '&channel_name=' + encodeURIComponent(this.channel.name);
  40657. for (var i in this.authOptions.params) {
  40658. query += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(this.authOptions.params[i]);
  40659. }
  40660. return query;
  40661. };
  40662. PusherAuthorizer.prototype.authorize = function (socketId, callback) {
  40663. PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || runtime.getAuthorizers();
  40664. return PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback);
  40665. };
  40666. return PusherAuthorizer;
  40667. }());
  40668. /* harmony default export */ var pusher_authorizer = (pusher_authorizer_PusherAuthorizer);
  40669. // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
  40670. var timeline_sender_TimelineSender = (function () {
  40671. function TimelineSender(timeline, options) {
  40672. this.timeline = timeline;
  40673. this.options = options || {};
  40674. }
  40675. TimelineSender.prototype.send = function (useTLS, callback) {
  40676. if (this.timeline.isEmpty()) {
  40677. return;
  40678. }
  40679. this.timeline.send(runtime.TimelineTransport.getAgent(this, useTLS), callback);
  40680. };
  40681. return TimelineSender;
  40682. }());
  40683. /* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
  40684. // CONCATENATED MODULE: ./src/core/errors.ts
  40685. var errors_extends = (undefined && undefined.__extends) || (function () {
  40686. var extendStatics = function (d, b) {
  40687. extendStatics = Object.setPrototypeOf ||
  40688. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40689. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40690. return extendStatics(d, b);
  40691. };
  40692. return function (d, b) {
  40693. extendStatics(d, b);
  40694. function __() { this.constructor = d; }
  40695. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40696. };
  40697. })();
  40698. var BadEventName = (function (_super) {
  40699. errors_extends(BadEventName, _super);
  40700. function BadEventName(msg) {
  40701. var _newTarget = this.constructor;
  40702. var _this = _super.call(this, msg) || this;
  40703. Object.setPrototypeOf(_this, _newTarget.prototype);
  40704. return _this;
  40705. }
  40706. return BadEventName;
  40707. }(Error));
  40708. var RequestTimedOut = (function (_super) {
  40709. errors_extends(RequestTimedOut, _super);
  40710. function RequestTimedOut(msg) {
  40711. var _newTarget = this.constructor;
  40712. var _this = _super.call(this, msg) || this;
  40713. Object.setPrototypeOf(_this, _newTarget.prototype);
  40714. return _this;
  40715. }
  40716. return RequestTimedOut;
  40717. }(Error));
  40718. var TransportPriorityTooLow = (function (_super) {
  40719. errors_extends(TransportPriorityTooLow, _super);
  40720. function TransportPriorityTooLow(msg) {
  40721. var _newTarget = this.constructor;
  40722. var _this = _super.call(this, msg) || this;
  40723. Object.setPrototypeOf(_this, _newTarget.prototype);
  40724. return _this;
  40725. }
  40726. return TransportPriorityTooLow;
  40727. }(Error));
  40728. var TransportClosed = (function (_super) {
  40729. errors_extends(TransportClosed, _super);
  40730. function TransportClosed(msg) {
  40731. var _newTarget = this.constructor;
  40732. var _this = _super.call(this, msg) || this;
  40733. Object.setPrototypeOf(_this, _newTarget.prototype);
  40734. return _this;
  40735. }
  40736. return TransportClosed;
  40737. }(Error));
  40738. var UnsupportedFeature = (function (_super) {
  40739. errors_extends(UnsupportedFeature, _super);
  40740. function UnsupportedFeature(msg) {
  40741. var _newTarget = this.constructor;
  40742. var _this = _super.call(this, msg) || this;
  40743. Object.setPrototypeOf(_this, _newTarget.prototype);
  40744. return _this;
  40745. }
  40746. return UnsupportedFeature;
  40747. }(Error));
  40748. var UnsupportedTransport = (function (_super) {
  40749. errors_extends(UnsupportedTransport, _super);
  40750. function UnsupportedTransport(msg) {
  40751. var _newTarget = this.constructor;
  40752. var _this = _super.call(this, msg) || this;
  40753. Object.setPrototypeOf(_this, _newTarget.prototype);
  40754. return _this;
  40755. }
  40756. return UnsupportedTransport;
  40757. }(Error));
  40758. var UnsupportedStrategy = (function (_super) {
  40759. errors_extends(UnsupportedStrategy, _super);
  40760. function UnsupportedStrategy(msg) {
  40761. var _newTarget = this.constructor;
  40762. var _this = _super.call(this, msg) || this;
  40763. Object.setPrototypeOf(_this, _newTarget.prototype);
  40764. return _this;
  40765. }
  40766. return UnsupportedStrategy;
  40767. }(Error));
  40768. // CONCATENATED MODULE: ./src/core/channels/channel.ts
  40769. var channel_extends = (undefined && undefined.__extends) || (function () {
  40770. var extendStatics = function (d, b) {
  40771. extendStatics = Object.setPrototypeOf ||
  40772. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40773. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40774. return extendStatics(d, b);
  40775. };
  40776. return function (d, b) {
  40777. extendStatics(d, b);
  40778. function __() { this.constructor = d; }
  40779. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40780. };
  40781. })();
  40782. var channel_Channel = (function (_super) {
  40783. channel_extends(Channel, _super);
  40784. function Channel(name, pusher) {
  40785. var _this = _super.call(this, function (event, data) {
  40786. logger.debug('No callbacks on ' + name + ' for ' + event);
  40787. }) || this;
  40788. _this.name = name;
  40789. _this.pusher = pusher;
  40790. _this.subscribed = false;
  40791. _this.subscriptionPending = false;
  40792. _this.subscriptionCancelled = false;
  40793. return _this;
  40794. }
  40795. Channel.prototype.authorize = function (socketId, callback) {
  40796. return callback(false, {});
  40797. };
  40798. Channel.prototype.trigger = function (event, data) {
  40799. if (event.indexOf("client-") !== 0) {
  40800. throw new BadEventName("Event '" + event + "' does not start with 'client-'");
  40801. }
  40802. if (!this.subscribed) {
  40803. var suffix = url_store.buildLogSuffix("triggeringClientEvents");
  40804. logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
  40805. }
  40806. return this.pusher.send_event(event, data, this.name);
  40807. };
  40808. Channel.prototype.disconnect = function () {
  40809. this.subscribed = false;
  40810. this.subscriptionPending = false;
  40811. };
  40812. Channel.prototype.handleEvent = function (event) {
  40813. var eventName = event.event;
  40814. var data = event.data;
  40815. if (eventName === "pusher_internal:subscription_succeeded") {
  40816. this.handleSubscriptionSucceededEvent(event);
  40817. }
  40818. else if (eventName.indexOf("pusher_internal:") !== 0) {
  40819. var metadata = {};
  40820. this.emit(eventName, data, metadata);
  40821. }
  40822. };
  40823. Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40824. this.subscriptionPending = false;
  40825. this.subscribed = true;
  40826. if (this.subscriptionCancelled) {
  40827. this.pusher.unsubscribe(this.name);
  40828. }
  40829. else {
  40830. this.emit("pusher:subscription_succeeded", event.data);
  40831. }
  40832. };
  40833. Channel.prototype.subscribe = function () {
  40834. var _this = this;
  40835. if (this.subscribed) {
  40836. return;
  40837. }
  40838. this.subscriptionPending = true;
  40839. this.subscriptionCancelled = false;
  40840. this.authorize(this.pusher.connection.socket_id, function (error, data) {
  40841. if (error) {
  40842. logger.error(data);
  40843. _this.emit('pusher:subscription_error', data);
  40844. }
  40845. else {
  40846. _this.pusher.send_event('pusher:subscribe', {
  40847. auth: data.auth,
  40848. channel_data: data.channel_data,
  40849. channel: _this.name
  40850. });
  40851. }
  40852. });
  40853. };
  40854. Channel.prototype.unsubscribe = function () {
  40855. this.subscribed = false;
  40856. this.pusher.send_event('pusher:unsubscribe', {
  40857. channel: this.name
  40858. });
  40859. };
  40860. Channel.prototype.cancelSubscription = function () {
  40861. this.subscriptionCancelled = true;
  40862. };
  40863. Channel.prototype.reinstateSubscription = function () {
  40864. this.subscriptionCancelled = false;
  40865. };
  40866. return Channel;
  40867. }(dispatcher));
  40868. /* harmony default export */ var channels_channel = (channel_Channel);
  40869. // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
  40870. var private_channel_extends = (undefined && undefined.__extends) || (function () {
  40871. var extendStatics = function (d, b) {
  40872. extendStatics = Object.setPrototypeOf ||
  40873. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40874. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40875. return extendStatics(d, b);
  40876. };
  40877. return function (d, b) {
  40878. extendStatics(d, b);
  40879. function __() { this.constructor = d; }
  40880. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40881. };
  40882. })();
  40883. var private_channel_PrivateChannel = (function (_super) {
  40884. private_channel_extends(PrivateChannel, _super);
  40885. function PrivateChannel() {
  40886. return _super !== null && _super.apply(this, arguments) || this;
  40887. }
  40888. PrivateChannel.prototype.authorize = function (socketId, callback) {
  40889. var authorizer = factory.createAuthorizer(this, this.pusher.config);
  40890. return authorizer.authorize(socketId, callback);
  40891. };
  40892. return PrivateChannel;
  40893. }(channels_channel));
  40894. /* harmony default export */ var private_channel = (private_channel_PrivateChannel);
  40895. // CONCATENATED MODULE: ./src/core/channels/members.ts
  40896. var members_Members = (function () {
  40897. function Members() {
  40898. this.reset();
  40899. }
  40900. Members.prototype.get = function (id) {
  40901. if (Object.prototype.hasOwnProperty.call(this.members, id)) {
  40902. return {
  40903. id: id,
  40904. info: this.members[id]
  40905. };
  40906. }
  40907. else {
  40908. return null;
  40909. }
  40910. };
  40911. Members.prototype.each = function (callback) {
  40912. var _this = this;
  40913. objectApply(this.members, function (member, id) {
  40914. callback(_this.get(id));
  40915. });
  40916. };
  40917. Members.prototype.setMyID = function (id) {
  40918. this.myID = id;
  40919. };
  40920. Members.prototype.onSubscription = function (subscriptionData) {
  40921. this.members = subscriptionData.presence.hash;
  40922. this.count = subscriptionData.presence.count;
  40923. this.me = this.get(this.myID);
  40924. };
  40925. Members.prototype.addMember = function (memberData) {
  40926. if (this.get(memberData.user_id) === null) {
  40927. this.count++;
  40928. }
  40929. this.members[memberData.user_id] = memberData.user_info;
  40930. return this.get(memberData.user_id);
  40931. };
  40932. Members.prototype.removeMember = function (memberData) {
  40933. var member = this.get(memberData.user_id);
  40934. if (member) {
  40935. delete this.members[memberData.user_id];
  40936. this.count--;
  40937. }
  40938. return member;
  40939. };
  40940. Members.prototype.reset = function () {
  40941. this.members = {};
  40942. this.count = 0;
  40943. this.myID = null;
  40944. this.me = null;
  40945. };
  40946. return Members;
  40947. }());
  40948. /* harmony default export */ var members = (members_Members);
  40949. // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
  40950. var presence_channel_extends = (undefined && undefined.__extends) || (function () {
  40951. var extendStatics = function (d, b) {
  40952. extendStatics = Object.setPrototypeOf ||
  40953. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40954. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40955. return extendStatics(d, b);
  40956. };
  40957. return function (d, b) {
  40958. extendStatics(d, b);
  40959. function __() { this.constructor = d; }
  40960. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40961. };
  40962. })();
  40963. var presence_channel_PresenceChannel = (function (_super) {
  40964. presence_channel_extends(PresenceChannel, _super);
  40965. function PresenceChannel(name, pusher) {
  40966. var _this = _super.call(this, name, pusher) || this;
  40967. _this.members = new members();
  40968. return _this;
  40969. }
  40970. PresenceChannel.prototype.authorize = function (socketId, callback) {
  40971. var _this = this;
  40972. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40973. if (!error) {
  40974. if (authData.channel_data === undefined) {
  40975. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  40976. logger.error("Invalid auth response for channel '" + _this.name + "'," +
  40977. ("expected 'channel_data' field. " + suffix));
  40978. callback("Invalid auth response");
  40979. return;
  40980. }
  40981. var channelData = JSON.parse(authData.channel_data);
  40982. _this.members.setMyID(channelData.user_id);
  40983. }
  40984. callback(error, authData);
  40985. });
  40986. };
  40987. PresenceChannel.prototype.handleEvent = function (event) {
  40988. var eventName = event.event;
  40989. if (eventName.indexOf("pusher_internal:") === 0) {
  40990. this.handleInternalEvent(event);
  40991. }
  40992. else {
  40993. var data = event.data;
  40994. var metadata = {};
  40995. if (event.user_id) {
  40996. metadata.user_id = event.user_id;
  40997. }
  40998. this.emit(eventName, data, metadata);
  40999. }
  41000. };
  41001. PresenceChannel.prototype.handleInternalEvent = function (event) {
  41002. var eventName = event.event;
  41003. var data = event.data;
  41004. switch (eventName) {
  41005. case "pusher_internal:subscription_succeeded":
  41006. this.handleSubscriptionSucceededEvent(event);
  41007. break;
  41008. case "pusher_internal:member_added":
  41009. var addedMember = this.members.addMember(data);
  41010. this.emit('pusher:member_added', addedMember);
  41011. break;
  41012. case "pusher_internal:member_removed":
  41013. var removedMember = this.members.removeMember(data);
  41014. if (removedMember) {
  41015. this.emit('pusher:member_removed', removedMember);
  41016. }
  41017. break;
  41018. }
  41019. };
  41020. PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
  41021. this.subscriptionPending = false;
  41022. this.subscribed = true;
  41023. if (this.subscriptionCancelled) {
  41024. this.pusher.unsubscribe(this.name);
  41025. }
  41026. else {
  41027. this.members.onSubscription(event.data);
  41028. this.emit("pusher:subscription_succeeded", this.members);
  41029. }
  41030. };
  41031. PresenceChannel.prototype.disconnect = function () {
  41032. this.members.reset();
  41033. _super.prototype.disconnect.call(this);
  41034. };
  41035. return PresenceChannel;
  41036. }(private_channel));
  41037. /* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
  41038. // EXTERNAL MODULE: ./node_modules/tweetnacl/nacl-fast.js
  41039. var nacl_fast = __webpack_require__(0);
  41040. // EXTERNAL MODULE: ./node_modules/tweetnacl-util/nacl-util.js
  41041. var nacl_util = __webpack_require__(1);
  41042. // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
  41043. var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
  41044. var extendStatics = function (d, b) {
  41045. extendStatics = Object.setPrototypeOf ||
  41046. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41047. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41048. return extendStatics(d, b);
  41049. };
  41050. return function (d, b) {
  41051. extendStatics(d, b);
  41052. function __() { this.constructor = d; }
  41053. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41054. };
  41055. })();
  41056. var encrypted_channel_EncryptedChannel = (function (_super) {
  41057. encrypted_channel_extends(EncryptedChannel, _super);
  41058. function EncryptedChannel() {
  41059. var _this = _super !== null && _super.apply(this, arguments) || this;
  41060. _this.key = null;
  41061. return _this;
  41062. }
  41063. EncryptedChannel.prototype.authorize = function (socketId, callback) {
  41064. var _this = this;
  41065. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  41066. if (error) {
  41067. callback(true, authData);
  41068. return;
  41069. }
  41070. var sharedSecret = authData["shared_secret"];
  41071. if (!sharedSecret) {
  41072. var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name;
  41073. callback(true, errorMsg);
  41074. return;
  41075. }
  41076. _this.key = Object(nacl_util["decodeBase64"])(sharedSecret);
  41077. delete authData["shared_secret"];
  41078. callback(false, authData);
  41079. });
  41080. };
  41081. EncryptedChannel.prototype.trigger = function (event, data) {
  41082. throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
  41083. };
  41084. EncryptedChannel.prototype.handleEvent = function (event) {
  41085. var eventName = event.event;
  41086. var data = event.data;
  41087. if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) {
  41088. _super.prototype.handleEvent.call(this, event);
  41089. return;
  41090. }
  41091. this.handleEncryptedEvent(eventName, data);
  41092. };
  41093. EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
  41094. var _this = this;
  41095. if (!this.key) {
  41096. logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
  41097. return;
  41098. }
  41099. if (!data.ciphertext || !data.nonce) {
  41100. logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data);
  41101. return;
  41102. }
  41103. var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext);
  41104. if (cipherText.length < nacl_fast["secretbox"].overheadLength) {
  41105. logger.error("Expected encrypted event ciphertext length to be " + nacl_fast["secretbox"].overheadLength + ", got: " + cipherText.length);
  41106. return;
  41107. }
  41108. var nonce = Object(nacl_util["decodeBase64"])(data.nonce);
  41109. if (nonce.length < nacl_fast["secretbox"].nonceLength) {
  41110. logger.error("Expected encrypted event nonce length to be " + nacl_fast["secretbox"].nonceLength + ", got: " + nonce.length);
  41111. return;
  41112. }
  41113. var bytes = nacl_fast["secretbox"].open(cipherText, nonce, this.key);
  41114. if (bytes === null) {
  41115. logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
  41116. this.authorize(this.pusher.connection.socket_id, function (error, authData) {
  41117. if (error) {
  41118. logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
  41119. return;
  41120. }
  41121. bytes = nacl_fast["secretbox"].open(cipherText, nonce, _this.key);
  41122. if (bytes === null) {
  41123. logger.error("Failed to decrypt event with new key. Dropping encrypted event");
  41124. return;
  41125. }
  41126. _this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41127. return;
  41128. });
  41129. return;
  41130. }
  41131. this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41132. };
  41133. EncryptedChannel.prototype.emitJSON = function (eventName, data) {
  41134. try {
  41135. this.emit(eventName, JSON.parse(data));
  41136. }
  41137. catch (e) {
  41138. this.emit(eventName, data);
  41139. }
  41140. return this;
  41141. };
  41142. return EncryptedChannel;
  41143. }(private_channel));
  41144. /* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
  41145. // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
  41146. var connection_manager_extends = (undefined && undefined.__extends) || (function () {
  41147. var extendStatics = function (d, b) {
  41148. extendStatics = Object.setPrototypeOf ||
  41149. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41150. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41151. return extendStatics(d, b);
  41152. };
  41153. return function (d, b) {
  41154. extendStatics(d, b);
  41155. function __() { this.constructor = d; }
  41156. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41157. };
  41158. })();
  41159. var connection_manager_ConnectionManager = (function (_super) {
  41160. connection_manager_extends(ConnectionManager, _super);
  41161. function ConnectionManager(key, options) {
  41162. var _this = _super.call(this) || this;
  41163. _this.key = key;
  41164. _this.options = options || {};
  41165. _this.state = "initialized";
  41166. _this.connection = null;
  41167. _this.usingTLS = !!options.useTLS;
  41168. _this.timeline = _this.options.timeline;
  41169. _this.errorCallbacks = _this.buildErrorCallbacks();
  41170. _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
  41171. _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
  41172. var Network = runtime.getNetwork();
  41173. Network.bind("online", function () {
  41174. _this.timeline.info({ netinfo: "online" });
  41175. if (_this.state === "connecting" || _this.state === "unavailable") {
  41176. _this.retryIn(0);
  41177. }
  41178. });
  41179. Network.bind("offline", function () {
  41180. _this.timeline.info({ netinfo: "offline" });
  41181. if (_this.connection) {
  41182. _this.sendActivityCheck();
  41183. }
  41184. });
  41185. _this.updateStrategy();
  41186. return _this;
  41187. }
  41188. ConnectionManager.prototype.connect = function () {
  41189. if (this.connection || this.runner) {
  41190. return;
  41191. }
  41192. if (!this.strategy.isSupported()) {
  41193. this.updateState("failed");
  41194. return;
  41195. }
  41196. this.updateState("connecting");
  41197. this.startConnecting();
  41198. this.setUnavailableTimer();
  41199. };
  41200. ;
  41201. ConnectionManager.prototype.send = function (data) {
  41202. if (this.connection) {
  41203. return this.connection.send(data);
  41204. }
  41205. else {
  41206. return false;
  41207. }
  41208. };
  41209. ;
  41210. ConnectionManager.prototype.send_event = function (name, data, channel) {
  41211. if (this.connection) {
  41212. return this.connection.send_event(name, data, channel);
  41213. }
  41214. else {
  41215. return false;
  41216. }
  41217. };
  41218. ;
  41219. ConnectionManager.prototype.disconnect = function () {
  41220. this.disconnectInternally();
  41221. this.updateState("disconnected");
  41222. };
  41223. ;
  41224. ConnectionManager.prototype.isUsingTLS = function () {
  41225. return this.usingTLS;
  41226. };
  41227. ;
  41228. ConnectionManager.prototype.startConnecting = function () {
  41229. var _this = this;
  41230. var callback = function (error, handshake) {
  41231. if (error) {
  41232. _this.runner = _this.strategy.connect(0, callback);
  41233. }
  41234. else {
  41235. if (handshake.action === "error") {
  41236. _this.emit("error", { type: "HandshakeError", error: handshake.error });
  41237. _this.timeline.error({ handshakeError: handshake.error });
  41238. }
  41239. else {
  41240. _this.abortConnecting();
  41241. _this.handshakeCallbacks[handshake.action](handshake);
  41242. }
  41243. }
  41244. };
  41245. this.runner = this.strategy.connect(0, callback);
  41246. };
  41247. ;
  41248. ConnectionManager.prototype.abortConnecting = function () {
  41249. if (this.runner) {
  41250. this.runner.abort();
  41251. this.runner = null;
  41252. }
  41253. };
  41254. ;
  41255. ConnectionManager.prototype.disconnectInternally = function () {
  41256. this.abortConnecting();
  41257. this.clearRetryTimer();
  41258. this.clearUnavailableTimer();
  41259. if (this.connection) {
  41260. var connection = this.abandonConnection();
  41261. connection.close();
  41262. }
  41263. };
  41264. ;
  41265. ConnectionManager.prototype.updateStrategy = function () {
  41266. this.strategy = this.options.getStrategy({
  41267. key: this.key,
  41268. timeline: this.timeline,
  41269. useTLS: this.usingTLS
  41270. });
  41271. };
  41272. ;
  41273. ConnectionManager.prototype.retryIn = function (delay) {
  41274. var _this = this;
  41275. this.timeline.info({ action: "retry", delay: delay });
  41276. if (delay > 0) {
  41277. this.emit("connecting_in", Math.round(delay / 1000));
  41278. }
  41279. this.retryTimer = new OneOffTimer(delay || 0, function () {
  41280. _this.disconnectInternally();
  41281. _this.connect();
  41282. });
  41283. };
  41284. ;
  41285. ConnectionManager.prototype.clearRetryTimer = function () {
  41286. if (this.retryTimer) {
  41287. this.retryTimer.ensureAborted();
  41288. this.retryTimer = null;
  41289. }
  41290. };
  41291. ;
  41292. ConnectionManager.prototype.setUnavailableTimer = function () {
  41293. var _this = this;
  41294. this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
  41295. _this.updateState("unavailable");
  41296. });
  41297. };
  41298. ;
  41299. ConnectionManager.prototype.clearUnavailableTimer = function () {
  41300. if (this.unavailableTimer) {
  41301. this.unavailableTimer.ensureAborted();
  41302. }
  41303. };
  41304. ;
  41305. ConnectionManager.prototype.sendActivityCheck = function () {
  41306. var _this = this;
  41307. this.stopActivityCheck();
  41308. this.connection.ping();
  41309. this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
  41310. _this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
  41311. _this.retryIn(0);
  41312. });
  41313. };
  41314. ;
  41315. ConnectionManager.prototype.resetActivityCheck = function () {
  41316. var _this = this;
  41317. this.stopActivityCheck();
  41318. if (this.connection && !this.connection.handlesActivityChecks()) {
  41319. this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
  41320. _this.sendActivityCheck();
  41321. });
  41322. }
  41323. };
  41324. ;
  41325. ConnectionManager.prototype.stopActivityCheck = function () {
  41326. if (this.activityTimer) {
  41327. this.activityTimer.ensureAborted();
  41328. }
  41329. };
  41330. ;
  41331. ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
  41332. var _this = this;
  41333. return extend({}, errorCallbacks, {
  41334. message: function (message) {
  41335. _this.resetActivityCheck();
  41336. _this.emit('message', message);
  41337. },
  41338. ping: function () {
  41339. _this.send_event('pusher:pong', {});
  41340. },
  41341. activity: function () {
  41342. _this.resetActivityCheck();
  41343. },
  41344. error: function (error) {
  41345. _this.emit("error", { type: "WebSocketError", error: error });
  41346. },
  41347. closed: function () {
  41348. _this.abandonConnection();
  41349. if (_this.shouldRetry()) {
  41350. _this.retryIn(1000);
  41351. }
  41352. }
  41353. });
  41354. };
  41355. ;
  41356. ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
  41357. var _this = this;
  41358. return extend({}, errorCallbacks, {
  41359. connected: function (handshake) {
  41360. _this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
  41361. _this.clearUnavailableTimer();
  41362. _this.setConnection(handshake.connection);
  41363. _this.socket_id = _this.connection.id;
  41364. _this.updateState("connected", { socket_id: _this.socket_id });
  41365. }
  41366. });
  41367. };
  41368. ;
  41369. ConnectionManager.prototype.buildErrorCallbacks = function () {
  41370. var _this = this;
  41371. var withErrorEmitted = function (callback) {
  41372. return function (result) {
  41373. if (result.error) {
  41374. _this.emit("error", { type: "WebSocketError", error: result.error });
  41375. }
  41376. callback(result);
  41377. };
  41378. };
  41379. return {
  41380. tls_only: withErrorEmitted(function () {
  41381. _this.usingTLS = true;
  41382. _this.updateStrategy();
  41383. _this.retryIn(0);
  41384. }),
  41385. refused: withErrorEmitted(function () {
  41386. _this.disconnect();
  41387. }),
  41388. backoff: withErrorEmitted(function () {
  41389. _this.retryIn(1000);
  41390. }),
  41391. retry: withErrorEmitted(function () {
  41392. _this.retryIn(0);
  41393. })
  41394. };
  41395. };
  41396. ;
  41397. ConnectionManager.prototype.setConnection = function (connection) {
  41398. this.connection = connection;
  41399. for (var event in this.connectionCallbacks) {
  41400. this.connection.bind(event, this.connectionCallbacks[event]);
  41401. }
  41402. this.resetActivityCheck();
  41403. };
  41404. ;
  41405. ConnectionManager.prototype.abandonConnection = function () {
  41406. if (!this.connection) {
  41407. return;
  41408. }
  41409. this.stopActivityCheck();
  41410. for (var event in this.connectionCallbacks) {
  41411. this.connection.unbind(event, this.connectionCallbacks[event]);
  41412. }
  41413. var connection = this.connection;
  41414. this.connection = null;
  41415. return connection;
  41416. };
  41417. ConnectionManager.prototype.updateState = function (newState, data) {
  41418. var previousState = this.state;
  41419. this.state = newState;
  41420. if (previousState !== newState) {
  41421. var newStateDescription = newState;
  41422. if (newStateDescription === "connected") {
  41423. newStateDescription += " with new socket ID " + data.socket_id;
  41424. }
  41425. logger.debug('State changed', previousState + ' -> ' + newStateDescription);
  41426. this.timeline.info({ state: newState, params: data });
  41427. this.emit('state_change', { previous: previousState, current: newState });
  41428. this.emit(newState, data);
  41429. }
  41430. };
  41431. ConnectionManager.prototype.shouldRetry = function () {
  41432. return this.state === "connecting" || this.state === "connected";
  41433. };
  41434. return ConnectionManager;
  41435. }(dispatcher));
  41436. /* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
  41437. // CONCATENATED MODULE: ./src/core/channels/channels.ts
  41438. var channels_Channels = (function () {
  41439. function Channels() {
  41440. this.channels = {};
  41441. }
  41442. Channels.prototype.add = function (name, pusher) {
  41443. if (!this.channels[name]) {
  41444. this.channels[name] = createChannel(name, pusher);
  41445. }
  41446. return this.channels[name];
  41447. };
  41448. Channels.prototype.all = function () {
  41449. return values(this.channels);
  41450. };
  41451. Channels.prototype.find = function (name) {
  41452. return this.channels[name];
  41453. };
  41454. Channels.prototype.remove = function (name) {
  41455. var channel = this.channels[name];
  41456. delete this.channels[name];
  41457. return channel;
  41458. };
  41459. Channels.prototype.disconnect = function () {
  41460. objectApply(this.channels, function (channel) {
  41461. channel.disconnect();
  41462. });
  41463. };
  41464. return Channels;
  41465. }());
  41466. /* harmony default export */ var channels = (channels_Channels);
  41467. function createChannel(name, pusher) {
  41468. if (name.indexOf('private-encrypted-') === 0) {
  41469. if (false) { var errorMsg; }
  41470. return factory.createEncryptedChannel(name, pusher);
  41471. }
  41472. else if (name.indexOf('private-') === 0) {
  41473. return factory.createPrivateChannel(name, pusher);
  41474. }
  41475. else if (name.indexOf('presence-') === 0) {
  41476. return factory.createPresenceChannel(name, pusher);
  41477. }
  41478. else {
  41479. return factory.createChannel(name, pusher);
  41480. }
  41481. }
  41482. // CONCATENATED MODULE: ./src/core/utils/factory.ts
  41483. var Factory = {
  41484. createChannels: function () {
  41485. return new channels();
  41486. },
  41487. createConnectionManager: function (key, options) {
  41488. return new connection_manager(key, options);
  41489. },
  41490. createChannel: function (name, pusher) {
  41491. return new channels_channel(name, pusher);
  41492. },
  41493. createPrivateChannel: function (name, pusher) {
  41494. return new private_channel(name, pusher);
  41495. },
  41496. createPresenceChannel: function (name, pusher) {
  41497. return new presence_channel(name, pusher);
  41498. },
  41499. createEncryptedChannel: function (name, pusher) {
  41500. return new encrypted_channel(name, pusher);
  41501. },
  41502. createTimelineSender: function (timeline, options) {
  41503. return new timeline_sender(timeline, options);
  41504. },
  41505. createAuthorizer: function (channel, options) {
  41506. if (options.authorizer) {
  41507. return options.authorizer(channel, options);
  41508. }
  41509. return new pusher_authorizer(channel, options);
  41510. },
  41511. createHandshake: function (transport, callback) {
  41512. return new connection_handshake(transport, callback);
  41513. },
  41514. createAssistantToTheTransportManager: function (manager, transport, options) {
  41515. return new assistant_to_the_transport_manager(manager, transport, options);
  41516. }
  41517. };
  41518. /* harmony default export */ var factory = (Factory);
  41519. // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
  41520. var transport_manager_TransportManager = (function () {
  41521. function TransportManager(options) {
  41522. this.options = options || {};
  41523. this.livesLeft = this.options.lives || Infinity;
  41524. }
  41525. TransportManager.prototype.getAssistant = function (transport) {
  41526. return factory.createAssistantToTheTransportManager(this, transport, {
  41527. minPingDelay: this.options.minPingDelay,
  41528. maxPingDelay: this.options.maxPingDelay
  41529. });
  41530. };
  41531. TransportManager.prototype.isAlive = function () {
  41532. return this.livesLeft > 0;
  41533. };
  41534. TransportManager.prototype.reportDeath = function () {
  41535. this.livesLeft -= 1;
  41536. };
  41537. return TransportManager;
  41538. }());
  41539. /* harmony default export */ var transport_manager = (transport_manager_TransportManager);
  41540. // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
  41541. var sequential_strategy_SequentialStrategy = (function () {
  41542. function SequentialStrategy(strategies, options) {
  41543. this.strategies = strategies;
  41544. this.loop = Boolean(options.loop);
  41545. this.failFast = Boolean(options.failFast);
  41546. this.timeout = options.timeout;
  41547. this.timeoutLimit = options.timeoutLimit;
  41548. }
  41549. SequentialStrategy.prototype.isSupported = function () {
  41550. return any(this.strategies, util.method("isSupported"));
  41551. };
  41552. SequentialStrategy.prototype.connect = function (minPriority, callback) {
  41553. var _this = this;
  41554. var strategies = this.strategies;
  41555. var current = 0;
  41556. var timeout = this.timeout;
  41557. var runner = null;
  41558. var tryNextStrategy = function (error, handshake) {
  41559. if (handshake) {
  41560. callback(null, handshake);
  41561. }
  41562. else {
  41563. current = current + 1;
  41564. if (_this.loop) {
  41565. current = current % strategies.length;
  41566. }
  41567. if (current < strategies.length) {
  41568. if (timeout) {
  41569. timeout = timeout * 2;
  41570. if (_this.timeoutLimit) {
  41571. timeout = Math.min(timeout, _this.timeoutLimit);
  41572. }
  41573. }
  41574. runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
  41575. }
  41576. else {
  41577. callback(true);
  41578. }
  41579. }
  41580. };
  41581. runner = this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: this.failFast }, tryNextStrategy);
  41582. return {
  41583. abort: function () {
  41584. runner.abort();
  41585. },
  41586. forceMinPriority: function (p) {
  41587. minPriority = p;
  41588. if (runner) {
  41589. runner.forceMinPriority(p);
  41590. }
  41591. }
  41592. };
  41593. };
  41594. SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
  41595. var timer = null;
  41596. var runner = null;
  41597. if (options.timeout > 0) {
  41598. timer = new OneOffTimer(options.timeout, function () {
  41599. runner.abort();
  41600. callback(true);
  41601. });
  41602. }
  41603. runner = strategy.connect(minPriority, function (error, handshake) {
  41604. if (error && timer && timer.isRunning() && !options.failFast) {
  41605. return;
  41606. }
  41607. if (timer) {
  41608. timer.ensureAborted();
  41609. }
  41610. callback(error, handshake);
  41611. });
  41612. return {
  41613. abort: function () {
  41614. if (timer) {
  41615. timer.ensureAborted();
  41616. }
  41617. runner.abort();
  41618. },
  41619. forceMinPriority: function (p) {
  41620. runner.forceMinPriority(p);
  41621. }
  41622. };
  41623. };
  41624. return SequentialStrategy;
  41625. }());
  41626. /* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
  41627. // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
  41628. var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
  41629. function BestConnectedEverStrategy(strategies) {
  41630. this.strategies = strategies;
  41631. }
  41632. BestConnectedEverStrategy.prototype.isSupported = function () {
  41633. return any(this.strategies, util.method("isSupported"));
  41634. };
  41635. BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
  41636. return connect(this.strategies, minPriority, function (i, runners) {
  41637. return function (error, handshake) {
  41638. runners[i].error = error;
  41639. if (error) {
  41640. if (allRunnersFailed(runners)) {
  41641. callback(true);
  41642. }
  41643. return;
  41644. }
  41645. apply(runners, function (runner) {
  41646. runner.forceMinPriority(handshake.transport.priority);
  41647. });
  41648. callback(null, handshake);
  41649. };
  41650. });
  41651. };
  41652. return BestConnectedEverStrategy;
  41653. }());
  41654. /* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
  41655. function connect(strategies, minPriority, callbackBuilder) {
  41656. var runners = map(strategies, function (strategy, i, _, rs) {
  41657. return strategy.connect(minPriority, callbackBuilder(i, rs));
  41658. });
  41659. return {
  41660. abort: function () {
  41661. apply(runners, abortRunner);
  41662. },
  41663. forceMinPriority: function (p) {
  41664. apply(runners, function (runner) {
  41665. runner.forceMinPriority(p);
  41666. });
  41667. }
  41668. };
  41669. }
  41670. function allRunnersFailed(runners) {
  41671. return collections_all(runners, function (runner) {
  41672. return Boolean(runner.error);
  41673. });
  41674. }
  41675. function abortRunner(runner) {
  41676. if (!runner.error && !runner.aborted) {
  41677. runner.abort();
  41678. runner.aborted = true;
  41679. }
  41680. }
  41681. // CONCATENATED MODULE: ./src/core/strategies/cached_strategy.ts
  41682. var cached_strategy_CachedStrategy = (function () {
  41683. function CachedStrategy(strategy, transports, options) {
  41684. this.strategy = strategy;
  41685. this.transports = transports;
  41686. this.ttl = options.ttl || 1800 * 1000;
  41687. this.usingTLS = options.useTLS;
  41688. this.timeline = options.timeline;
  41689. }
  41690. CachedStrategy.prototype.isSupported = function () {
  41691. return this.strategy.isSupported();
  41692. };
  41693. CachedStrategy.prototype.connect = function (minPriority, callback) {
  41694. var usingTLS = this.usingTLS;
  41695. var info = fetchTransportCache(usingTLS);
  41696. var strategies = [this.strategy];
  41697. if (info && info.timestamp + this.ttl >= util.now()) {
  41698. var transport = this.transports[info.transport];
  41699. if (transport) {
  41700. this.timeline.info({
  41701. cached: true,
  41702. transport: info.transport,
  41703. latency: info.latency
  41704. });
  41705. strategies.push(new sequential_strategy([transport], {
  41706. timeout: info.latency * 2 + 1000,
  41707. failFast: true
  41708. }));
  41709. }
  41710. }
  41711. var startTimestamp = util.now();
  41712. var runner = strategies.pop().connect(minPriority, function cb(error, handshake) {
  41713. if (error) {
  41714. flushTransportCache(usingTLS);
  41715. if (strategies.length > 0) {
  41716. startTimestamp = util.now();
  41717. runner = strategies.pop().connect(minPriority, cb);
  41718. }
  41719. else {
  41720. callback(error);
  41721. }
  41722. }
  41723. else {
  41724. storeTransportCache(usingTLS, handshake.transport.name, util.now() - startTimestamp);
  41725. callback(null, handshake);
  41726. }
  41727. });
  41728. return {
  41729. abort: function () {
  41730. runner.abort();
  41731. },
  41732. forceMinPriority: function (p) {
  41733. minPriority = p;
  41734. if (runner) {
  41735. runner.forceMinPriority(p);
  41736. }
  41737. }
  41738. };
  41739. };
  41740. return CachedStrategy;
  41741. }());
  41742. /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
  41743. function getTransportCacheKey(usingTLS) {
  41744. return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS");
  41745. }
  41746. function fetchTransportCache(usingTLS) {
  41747. var storage = runtime.getLocalStorage();
  41748. if (storage) {
  41749. try {
  41750. var serializedCache = storage[getTransportCacheKey(usingTLS)];
  41751. if (serializedCache) {
  41752. return JSON.parse(serializedCache);
  41753. }
  41754. }
  41755. catch (e) {
  41756. flushTransportCache(usingTLS);
  41757. }
  41758. }
  41759. return null;
  41760. }
  41761. function storeTransportCache(usingTLS, transport, latency) {
  41762. var storage = runtime.getLocalStorage();
  41763. if (storage) {
  41764. try {
  41765. storage[getTransportCacheKey(usingTLS)] = safeJSONStringify({
  41766. timestamp: util.now(),
  41767. transport: transport,
  41768. latency: latency
  41769. });
  41770. }
  41771. catch (e) {
  41772. }
  41773. }
  41774. }
  41775. function flushTransportCache(usingTLS) {
  41776. var storage = runtime.getLocalStorage();
  41777. if (storage) {
  41778. try {
  41779. delete storage[getTransportCacheKey(usingTLS)];
  41780. }
  41781. catch (e) {
  41782. }
  41783. }
  41784. }
  41785. // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
  41786. var delayed_strategy_DelayedStrategy = (function () {
  41787. function DelayedStrategy(strategy, _a) {
  41788. var number = _a.delay;
  41789. this.strategy = strategy;
  41790. this.options = { delay: number };
  41791. }
  41792. DelayedStrategy.prototype.isSupported = function () {
  41793. return this.strategy.isSupported();
  41794. };
  41795. DelayedStrategy.prototype.connect = function (minPriority, callback) {
  41796. var strategy = this.strategy;
  41797. var runner;
  41798. var timer = new OneOffTimer(this.options.delay, function () {
  41799. runner = strategy.connect(minPriority, callback);
  41800. });
  41801. return {
  41802. abort: function () {
  41803. timer.ensureAborted();
  41804. if (runner) {
  41805. runner.abort();
  41806. }
  41807. },
  41808. forceMinPriority: function (p) {
  41809. minPriority = p;
  41810. if (runner) {
  41811. runner.forceMinPriority(p);
  41812. }
  41813. }
  41814. };
  41815. };
  41816. return DelayedStrategy;
  41817. }());
  41818. /* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
  41819. // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
  41820. var IfStrategy = (function () {
  41821. function IfStrategy(test, trueBranch, falseBranch) {
  41822. this.test = test;
  41823. this.trueBranch = trueBranch;
  41824. this.falseBranch = falseBranch;
  41825. }
  41826. IfStrategy.prototype.isSupported = function () {
  41827. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41828. return branch.isSupported();
  41829. };
  41830. IfStrategy.prototype.connect = function (minPriority, callback) {
  41831. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41832. return branch.connect(minPriority, callback);
  41833. };
  41834. return IfStrategy;
  41835. }());
  41836. /* harmony default export */ var if_strategy = (IfStrategy);
  41837. // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
  41838. var FirstConnectedStrategy = (function () {
  41839. function FirstConnectedStrategy(strategy) {
  41840. this.strategy = strategy;
  41841. }
  41842. FirstConnectedStrategy.prototype.isSupported = function () {
  41843. return this.strategy.isSupported();
  41844. };
  41845. FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
  41846. var runner = this.strategy.connect(minPriority, function (error, handshake) {
  41847. if (handshake) {
  41848. runner.abort();
  41849. }
  41850. callback(error, handshake);
  41851. });
  41852. return runner;
  41853. };
  41854. return FirstConnectedStrategy;
  41855. }());
  41856. /* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
  41857. // CONCATENATED MODULE: ./src/runtimes/web/default_strategy.ts
  41858. function testSupportsStrategy(strategy) {
  41859. return function () {
  41860. return strategy.isSupported();
  41861. };
  41862. }
  41863. var getDefaultStrategy = function (config, defineTransport) {
  41864. var definedTransports = {};
  41865. function defineTransportStrategy(name, type, priority, options, manager) {
  41866. var transport = defineTransport(config, name, type, priority, options, manager);
  41867. definedTransports[name] = transport;
  41868. return transport;
  41869. }
  41870. var ws_options = {
  41871. hostNonTLS: config.wsHost + ":" + config.wsPort,
  41872. hostTLS: config.wsHost + ":" + config.wssPort,
  41873. httpPath: config.wsPath
  41874. };
  41875. var wss_options = extend({}, ws_options, {
  41876. useTLS: true
  41877. });
  41878. var sockjs_options = {
  41879. hostNonTLS: config.httpHost + ":" + config.httpPort,
  41880. hostTLS: config.httpHost + ":" + config.httpsPort,
  41881. httpPath: config.httpPath
  41882. };
  41883. var timeouts = {
  41884. loop: true,
  41885. timeout: 15000,
  41886. timeoutLimit: 60000
  41887. };
  41888. var ws_manager = new transport_manager({
  41889. lives: 2,
  41890. minPingDelay: 10000,
  41891. maxPingDelay: config.activity_timeout
  41892. });
  41893. var streaming_manager = new transport_manager({
  41894. lives: 2,
  41895. minPingDelay: 10000,
  41896. maxPingDelay: config.activity_timeout
  41897. });
  41898. var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager);
  41899. var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager);
  41900. var sockjs_transport = defineTransportStrategy("sockjs", "sockjs", 1, sockjs_options);
  41901. var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, sockjs_options, streaming_manager);
  41902. var xdr_streaming_transport = defineTransportStrategy("xdr_streaming", "xdr_streaming", 1, sockjs_options, streaming_manager);
  41903. var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, sockjs_options);
  41904. var xdr_polling_transport = defineTransportStrategy("xdr_polling", "xdr_polling", 1, sockjs_options);
  41905. var ws_loop = new sequential_strategy([ws_transport], timeouts);
  41906. var wss_loop = new sequential_strategy([wss_transport], timeouts);
  41907. var sockjs_loop = new sequential_strategy([sockjs_transport], timeouts);
  41908. var streaming_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)], timeouts);
  41909. var polling_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)], timeouts);
  41910. 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);
  41911. var http_fallback_loop = new if_strategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
  41912. var wsStrategy;
  41913. if (config.useTLS) {
  41914. wsStrategy = new best_connected_ever_strategy([ws_loop, new delayed_strategy(http_fallback_loop, { delay: 2000 })]);
  41915. }
  41916. else {
  41917. wsStrategy = new best_connected_ever_strategy([
  41918. ws_loop,
  41919. new delayed_strategy(wss_loop, { delay: 2000 }),
  41920. new delayed_strategy(http_fallback_loop, { delay: 5000 })
  41921. ]);
  41922. }
  41923. return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
  41924. ttl: 1800000,
  41925. timeline: config.timeline,
  41926. useTLS: config.useTLS
  41927. });
  41928. };
  41929. /* harmony default export */ var default_strategy = (getDefaultStrategy);
  41930. // CONCATENATED MODULE: ./src/runtimes/web/transports/transport_connection_initializer.ts
  41931. /* harmony default export */ var transport_connection_initializer = (function () {
  41932. var self = this;
  41933. self.timeline.info(self.buildTimelineMessage({
  41934. transport: self.name + (self.options.useTLS ? "s" : "")
  41935. }));
  41936. if (self.hooks.isInitialized()) {
  41937. self.changeState("initialized");
  41938. }
  41939. else if (self.hooks.file) {
  41940. self.changeState("initializing");
  41941. Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function (error, callback) {
  41942. if (self.hooks.isInitialized()) {
  41943. self.changeState("initialized");
  41944. callback(true);
  41945. }
  41946. else {
  41947. if (error) {
  41948. self.onError(error);
  41949. }
  41950. self.onClose();
  41951. callback(false);
  41952. }
  41953. });
  41954. }
  41955. else {
  41956. self.onClose();
  41957. }
  41958. });
  41959. // CONCATENATED MODULE: ./src/runtimes/web/http/http_xdomain_request.ts
  41960. var http_xdomain_request_hooks = {
  41961. getRequest: function (socket) {
  41962. var xdr = new window.XDomainRequest();
  41963. xdr.ontimeout = function () {
  41964. socket.emit("error", new RequestTimedOut());
  41965. socket.close();
  41966. };
  41967. xdr.onerror = function (e) {
  41968. socket.emit("error", e);
  41969. socket.close();
  41970. };
  41971. xdr.onprogress = function () {
  41972. if (xdr.responseText && xdr.responseText.length > 0) {
  41973. socket.onChunk(200, xdr.responseText);
  41974. }
  41975. };
  41976. xdr.onload = function () {
  41977. if (xdr.responseText && xdr.responseText.length > 0) {
  41978. socket.onChunk(200, xdr.responseText);
  41979. }
  41980. socket.emit("finished", 200);
  41981. socket.close();
  41982. };
  41983. return xdr;
  41984. },
  41985. abortRequest: function (xdr) {
  41986. xdr.ontimeout = xdr.onerror = xdr.onprogress = xdr.onload = null;
  41987. xdr.abort();
  41988. }
  41989. };
  41990. /* harmony default export */ var http_xdomain_request = (http_xdomain_request_hooks);
  41991. // CONCATENATED MODULE: ./src/core/http/http_request.ts
  41992. var http_request_extends = (undefined && undefined.__extends) || (function () {
  41993. var extendStatics = function (d, b) {
  41994. extendStatics = Object.setPrototypeOf ||
  41995. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41996. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41997. return extendStatics(d, b);
  41998. };
  41999. return function (d, b) {
  42000. extendStatics(d, b);
  42001. function __() { this.constructor = d; }
  42002. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  42003. };
  42004. })();
  42005. var MAX_BUFFER_LENGTH = 256 * 1024;
  42006. var http_request_HTTPRequest = (function (_super) {
  42007. http_request_extends(HTTPRequest, _super);
  42008. function HTTPRequest(hooks, method, url) {
  42009. var _this = _super.call(this) || this;
  42010. _this.hooks = hooks;
  42011. _this.method = method;
  42012. _this.url = url;
  42013. return _this;
  42014. }
  42015. HTTPRequest.prototype.start = function (payload) {
  42016. var _this = this;
  42017. this.position = 0;
  42018. this.xhr = this.hooks.getRequest(this);
  42019. this.unloader = function () {
  42020. _this.close();
  42021. };
  42022. runtime.addUnloadListener(this.unloader);
  42023. this.xhr.open(this.method, this.url, true);
  42024. if (this.xhr.setRequestHeader) {
  42025. this.xhr.setRequestHeader("Content-Type", "application/json");
  42026. }
  42027. this.xhr.send(payload);
  42028. };
  42029. HTTPRequest.prototype.close = function () {
  42030. if (this.unloader) {
  42031. runtime.removeUnloadListener(this.unloader);
  42032. this.unloader = null;
  42033. }
  42034. if (this.xhr) {
  42035. this.hooks.abortRequest(this.xhr);
  42036. this.xhr = null;
  42037. }
  42038. };
  42039. HTTPRequest.prototype.onChunk = function (status, data) {
  42040. while (true) {
  42041. var chunk = this.advanceBuffer(data);
  42042. if (chunk) {
  42043. this.emit("chunk", { status: status, data: chunk });
  42044. }
  42045. else {
  42046. break;
  42047. }
  42048. }
  42049. if (this.isBufferTooLong(data)) {
  42050. this.emit("buffer_too_long");
  42051. }
  42052. };
  42053. HTTPRequest.prototype.advanceBuffer = function (buffer) {
  42054. var unreadData = buffer.slice(this.position);
  42055. var endOfLinePosition = unreadData.indexOf("\n");
  42056. if (endOfLinePosition !== -1) {
  42057. this.position += endOfLinePosition + 1;
  42058. return unreadData.slice(0, endOfLinePosition);
  42059. }
  42060. else {
  42061. return null;
  42062. }
  42063. };
  42064. HTTPRequest.prototype.isBufferTooLong = function (buffer) {
  42065. return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
  42066. };
  42067. return HTTPRequest;
  42068. }(dispatcher));
  42069. /* harmony default export */ var http_request = (http_request_HTTPRequest);
  42070. // CONCATENATED MODULE: ./src/core/http/state.ts
  42071. var State;
  42072. (function (State) {
  42073. State[State["CONNECTING"] = 0] = "CONNECTING";
  42074. State[State["OPEN"] = 1] = "OPEN";
  42075. State[State["CLOSED"] = 3] = "CLOSED";
  42076. })(State || (State = {}));
  42077. /* harmony default export */ var state = (State);
  42078. // CONCATENATED MODULE: ./src/core/http/http_socket.ts
  42079. var autoIncrement = 1;
  42080. var http_socket_HTTPSocket = (function () {
  42081. function HTTPSocket(hooks, url) {
  42082. this.hooks = hooks;
  42083. this.session = randomNumber(1000) + "/" + randomString(8);
  42084. this.location = getLocation(url);
  42085. this.readyState = state.CONNECTING;
  42086. this.openStream();
  42087. }
  42088. HTTPSocket.prototype.send = function (payload) {
  42089. return this.sendRaw(JSON.stringify([payload]));
  42090. };
  42091. HTTPSocket.prototype.ping = function () {
  42092. this.hooks.sendHeartbeat(this);
  42093. };
  42094. HTTPSocket.prototype.close = function (code, reason) {
  42095. this.onClose(code, reason, true);
  42096. };
  42097. HTTPSocket.prototype.sendRaw = function (payload) {
  42098. if (this.readyState === state.OPEN) {
  42099. try {
  42100. runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload);
  42101. return true;
  42102. }
  42103. catch (e) {
  42104. return false;
  42105. }
  42106. }
  42107. else {
  42108. return false;
  42109. }
  42110. };
  42111. HTTPSocket.prototype.reconnect = function () {
  42112. this.closeStream();
  42113. this.openStream();
  42114. };
  42115. ;
  42116. HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
  42117. this.closeStream();
  42118. this.readyState = state.CLOSED;
  42119. if (this.onclose) {
  42120. this.onclose({
  42121. code: code,
  42122. reason: reason,
  42123. wasClean: wasClean
  42124. });
  42125. }
  42126. };
  42127. HTTPSocket.prototype.onChunk = function (chunk) {
  42128. if (chunk.status !== 200) {
  42129. return;
  42130. }
  42131. if (this.readyState === state.OPEN) {
  42132. this.onActivity();
  42133. }
  42134. var payload;
  42135. var type = chunk.data.slice(0, 1);
  42136. switch (type) {
  42137. case 'o':
  42138. payload = JSON.parse(chunk.data.slice(1) || '{}');
  42139. this.onOpen(payload);
  42140. break;
  42141. case 'a':
  42142. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42143. for (var i = 0; i < payload.length; i++) {
  42144. this.onEvent(payload[i]);
  42145. }
  42146. break;
  42147. case 'm':
  42148. payload = JSON.parse(chunk.data.slice(1) || 'null');
  42149. this.onEvent(payload);
  42150. break;
  42151. case 'h':
  42152. this.hooks.onHeartbeat(this);
  42153. break;
  42154. case 'c':
  42155. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42156. this.onClose(payload[0], payload[1], true);
  42157. break;
  42158. }
  42159. };
  42160. HTTPSocket.prototype.onOpen = function (options) {
  42161. if (this.readyState === state.CONNECTING) {
  42162. if (options && options.hostname) {
  42163. this.location.base = replaceHost(this.location.base, options.hostname);
  42164. }
  42165. this.readyState = state.OPEN;
  42166. if (this.onopen) {
  42167. this.onopen();
  42168. }
  42169. }
  42170. else {
  42171. this.onClose(1006, "Server lost session", true);
  42172. }
  42173. };
  42174. HTTPSocket.prototype.onEvent = function (event) {
  42175. if (this.readyState === state.OPEN && this.onmessage) {
  42176. this.onmessage({ data: event });
  42177. }
  42178. };
  42179. HTTPSocket.prototype.onActivity = function () {
  42180. if (this.onactivity) {
  42181. this.onactivity();
  42182. }
  42183. };
  42184. HTTPSocket.prototype.onError = function (error) {
  42185. if (this.onerror) {
  42186. this.onerror(error);
  42187. }
  42188. };
  42189. HTTPSocket.prototype.openStream = function () {
  42190. var _this = this;
  42191. this.stream = runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
  42192. this.stream.bind("chunk", function (chunk) {
  42193. _this.onChunk(chunk);
  42194. });
  42195. this.stream.bind("finished", function (status) {
  42196. _this.hooks.onFinished(_this, status);
  42197. });
  42198. this.stream.bind("buffer_too_long", function () {
  42199. _this.reconnect();
  42200. });
  42201. try {
  42202. this.stream.start();
  42203. }
  42204. catch (error) {
  42205. util.defer(function () {
  42206. _this.onError(error);
  42207. _this.onClose(1006, "Could not start streaming", false);
  42208. });
  42209. }
  42210. };
  42211. HTTPSocket.prototype.closeStream = function () {
  42212. if (this.stream) {
  42213. this.stream.unbind_all();
  42214. this.stream.close();
  42215. this.stream = null;
  42216. }
  42217. };
  42218. return HTTPSocket;
  42219. }());
  42220. function getLocation(url) {
  42221. var parts = /([^\?]*)\/*(\??.*)/.exec(url);
  42222. return {
  42223. base: parts[1],
  42224. queryString: parts[2]
  42225. };
  42226. }
  42227. function getSendURL(url, session) {
  42228. return url.base + "/" + session + "/xhr_send";
  42229. }
  42230. function getUniqueURL(url) {
  42231. var separator = (url.indexOf('?') === -1) ? "?" : "&";
  42232. return url + separator + "t=" + (+new Date()) + "&n=" + autoIncrement++;
  42233. }
  42234. function replaceHost(url, hostname) {
  42235. var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
  42236. return urlParts[1] + hostname + urlParts[3];
  42237. }
  42238. function randomNumber(max) {
  42239. return Math.floor(Math.random() * max);
  42240. }
  42241. function randomString(length) {
  42242. var result = [];
  42243. for (var i = 0; i < length; i++) {
  42244. result.push(randomNumber(32).toString(32));
  42245. }
  42246. return result.join('');
  42247. }
  42248. /* harmony default export */ var http_socket = (http_socket_HTTPSocket);
  42249. // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts
  42250. var http_streaming_socket_hooks = {
  42251. getReceiveURL: function (url, session) {
  42252. return url.base + "/" + session + "/xhr_streaming" + url.queryString;
  42253. },
  42254. onHeartbeat: function (socket) {
  42255. socket.sendRaw("[]");
  42256. },
  42257. sendHeartbeat: function (socket) {
  42258. socket.sendRaw("[]");
  42259. },
  42260. onFinished: function (socket, status) {
  42261. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42262. }
  42263. };
  42264. /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks);
  42265. // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts
  42266. var http_polling_socket_hooks = {
  42267. getReceiveURL: function (url, session) {
  42268. return url.base + "/" + session + "/xhr" + url.queryString;
  42269. },
  42270. onHeartbeat: function () {
  42271. },
  42272. sendHeartbeat: function (socket) {
  42273. socket.sendRaw("[]");
  42274. },
  42275. onFinished: function (socket, status) {
  42276. if (status === 200) {
  42277. socket.reconnect();
  42278. }
  42279. else {
  42280. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42281. }
  42282. }
  42283. };
  42284. /* harmony default export */ var http_polling_socket = (http_polling_socket_hooks);
  42285. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http_xhr_request.ts
  42286. var http_xhr_request_hooks = {
  42287. getRequest: function (socket) {
  42288. var Constructor = runtime.getXHRAPI();
  42289. var xhr = new Constructor();
  42290. xhr.onreadystatechange = xhr.onprogress = function () {
  42291. switch (xhr.readyState) {
  42292. case 3:
  42293. if (xhr.responseText && xhr.responseText.length > 0) {
  42294. socket.onChunk(xhr.status, xhr.responseText);
  42295. }
  42296. break;
  42297. case 4:
  42298. if (xhr.responseText && xhr.responseText.length > 0) {
  42299. socket.onChunk(xhr.status, xhr.responseText);
  42300. }
  42301. socket.emit("finished", xhr.status);
  42302. socket.close();
  42303. break;
  42304. }
  42305. };
  42306. return xhr;
  42307. },
  42308. abortRequest: function (xhr) {
  42309. xhr.onreadystatechange = null;
  42310. xhr.abort();
  42311. }
  42312. };
  42313. /* harmony default export */ var http_xhr_request = (http_xhr_request_hooks);
  42314. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http.ts
  42315. var HTTP = {
  42316. createStreamingSocket: function (url) {
  42317. return this.createSocket(http_streaming_socket, url);
  42318. },
  42319. createPollingSocket: function (url) {
  42320. return this.createSocket(http_polling_socket, url);
  42321. },
  42322. createSocket: function (hooks, url) {
  42323. return new http_socket(hooks, url);
  42324. },
  42325. createXHR: function (method, url) {
  42326. return this.createRequest(http_xhr_request, method, url);
  42327. },
  42328. createRequest: function (hooks, method, url) {
  42329. return new http_request(hooks, method, url);
  42330. }
  42331. };
  42332. /* harmony default export */ var http_http = (HTTP);
  42333. // CONCATENATED MODULE: ./src/runtimes/web/http/http.ts
  42334. http_http.createXDR = function (method, url) {
  42335. return this.createRequest(http_xdomain_request, method, url);
  42336. };
  42337. /* harmony default export */ var web_http_http = (http_http);
  42338. // CONCATENATED MODULE: ./src/runtimes/web/runtime.ts
  42339. var Runtime = {
  42340. nextAuthCallbackID: 1,
  42341. auth_callbacks: {},
  42342. ScriptReceivers: ScriptReceivers,
  42343. DependenciesReceivers: DependenciesReceivers,
  42344. getDefaultStrategy: default_strategy,
  42345. Transports: transports_transports,
  42346. transportConnectionInitializer: transport_connection_initializer,
  42347. HTTPFactory: web_http_http,
  42348. TimelineTransport: jsonp_timeline,
  42349. getXHRAPI: function () {
  42350. return window.XMLHttpRequest;
  42351. },
  42352. getWebSocketAPI: function () {
  42353. return window.WebSocket || window.MozWebSocket;
  42354. },
  42355. setup: function (PusherClass) {
  42356. var _this = this;
  42357. window.Pusher = PusherClass;
  42358. var initializeOnDocumentBody = function () {
  42359. _this.onDocumentBody(PusherClass.ready);
  42360. };
  42361. if (!window.JSON) {
  42362. Dependencies.load("json2", {}, initializeOnDocumentBody);
  42363. }
  42364. else {
  42365. initializeOnDocumentBody();
  42366. }
  42367. },
  42368. getDocument: function () {
  42369. return document;
  42370. },
  42371. getProtocol: function () {
  42372. return this.getDocument().location.protocol;
  42373. },
  42374. getAuthorizers: function () {
  42375. return { ajax: xhr_auth, jsonp: jsonp_auth };
  42376. },
  42377. onDocumentBody: function (callback) {
  42378. var _this = this;
  42379. if (document.body) {
  42380. callback();
  42381. }
  42382. else {
  42383. setTimeout(function () {
  42384. _this.onDocumentBody(callback);
  42385. }, 0);
  42386. }
  42387. },
  42388. createJSONPRequest: function (url, data) {
  42389. return new jsonp_request(url, data);
  42390. },
  42391. createScriptRequest: function (src) {
  42392. return new script_request(src);
  42393. },
  42394. getLocalStorage: function () {
  42395. try {
  42396. return window.localStorage;
  42397. }
  42398. catch (e) {
  42399. return undefined;
  42400. }
  42401. },
  42402. createXHR: function () {
  42403. if (this.getXHRAPI()) {
  42404. return this.createXMLHttpRequest();
  42405. }
  42406. else {
  42407. return this.createMicrosoftXHR();
  42408. }
  42409. },
  42410. createXMLHttpRequest: function () {
  42411. var Constructor = this.getXHRAPI();
  42412. return new Constructor();
  42413. },
  42414. createMicrosoftXHR: function () {
  42415. return new ActiveXObject("Microsoft.XMLHTTP");
  42416. },
  42417. getNetwork: function () {
  42418. return net_info_Network;
  42419. },
  42420. createWebSocket: function (url) {
  42421. var Constructor = this.getWebSocketAPI();
  42422. return new Constructor(url);
  42423. },
  42424. createSocketRequest: function (method, url) {
  42425. if (this.isXHRSupported()) {
  42426. return this.HTTPFactory.createXHR(method, url);
  42427. }
  42428. else if (this.isXDRSupported(url.indexOf("https:") === 0)) {
  42429. return this.HTTPFactory.createXDR(method, url);
  42430. }
  42431. else {
  42432. throw "Cross-origin HTTP requests are not supported";
  42433. }
  42434. },
  42435. isXHRSupported: function () {
  42436. var Constructor = this.getXHRAPI();
  42437. return Boolean(Constructor) && (new Constructor()).withCredentials !== undefined;
  42438. },
  42439. isXDRSupported: function (useTLS) {
  42440. var protocol = useTLS ? "https:" : "http:";
  42441. var documentProtocol = this.getProtocol();
  42442. return Boolean((window['XDomainRequest'])) && documentProtocol === protocol;
  42443. },
  42444. addUnloadListener: function (listener) {
  42445. if (window.addEventListener !== undefined) {
  42446. window.addEventListener("unload", listener, false);
  42447. }
  42448. else if (window.attachEvent !== undefined) {
  42449. window.attachEvent("onunload", listener);
  42450. }
  42451. },
  42452. removeUnloadListener: function (listener) {
  42453. if (window.addEventListener !== undefined) {
  42454. window.removeEventListener("unload", listener, false);
  42455. }
  42456. else if (window.detachEvent !== undefined) {
  42457. window.detachEvent("onunload", listener);
  42458. }
  42459. }
  42460. };
  42461. /* harmony default export */ var runtime = (Runtime);
  42462. // CONCATENATED MODULE: ./src/core/timeline/level.ts
  42463. var TimelineLevel;
  42464. (function (TimelineLevel) {
  42465. TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
  42466. TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
  42467. TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
  42468. })(TimelineLevel || (TimelineLevel = {}));
  42469. /* harmony default export */ var timeline_level = (TimelineLevel);
  42470. // CONCATENATED MODULE: ./src/core/timeline/timeline.ts
  42471. var timeline_Timeline = (function () {
  42472. function Timeline(key, session, options) {
  42473. this.key = key;
  42474. this.session = session;
  42475. this.events = [];
  42476. this.options = options || {};
  42477. this.sent = 0;
  42478. this.uniqueID = 0;
  42479. }
  42480. Timeline.prototype.log = function (level, event) {
  42481. if (level <= this.options.level) {
  42482. this.events.push(extend({}, event, { timestamp: util.now() }));
  42483. if (this.options.limit && this.events.length > this.options.limit) {
  42484. this.events.shift();
  42485. }
  42486. }
  42487. };
  42488. Timeline.prototype.error = function (event) {
  42489. this.log(timeline_level.ERROR, event);
  42490. };
  42491. Timeline.prototype.info = function (event) {
  42492. this.log(timeline_level.INFO, event);
  42493. };
  42494. Timeline.prototype.debug = function (event) {
  42495. this.log(timeline_level.DEBUG, event);
  42496. };
  42497. Timeline.prototype.isEmpty = function () {
  42498. return this.events.length === 0;
  42499. };
  42500. Timeline.prototype.send = function (sendfn, callback) {
  42501. var _this = this;
  42502. var data = extend({
  42503. session: this.session,
  42504. bundle: this.sent + 1,
  42505. key: this.key,
  42506. lib: "js",
  42507. version: this.options.version,
  42508. cluster: this.options.cluster,
  42509. features: this.options.features,
  42510. timeline: this.events
  42511. }, this.options.params);
  42512. this.events = [];
  42513. sendfn(data, function (error, result) {
  42514. if (!error) {
  42515. _this.sent++;
  42516. }
  42517. if (callback) {
  42518. callback(error, result);
  42519. }
  42520. });
  42521. return true;
  42522. };
  42523. Timeline.prototype.generateUniqueID = function () {
  42524. this.uniqueID++;
  42525. return this.uniqueID;
  42526. };
  42527. return Timeline;
  42528. }());
  42529. /* harmony default export */ var timeline_timeline = (timeline_Timeline);
  42530. // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
  42531. var transport_strategy_TransportStrategy = (function () {
  42532. function TransportStrategy(name, priority, transport, options) {
  42533. this.name = name;
  42534. this.priority = priority;
  42535. this.transport = transport;
  42536. this.options = options || {};
  42537. }
  42538. TransportStrategy.prototype.isSupported = function () {
  42539. return this.transport.isSupported({
  42540. useTLS: this.options.useTLS
  42541. });
  42542. };
  42543. TransportStrategy.prototype.connect = function (minPriority, callback) {
  42544. var _this = this;
  42545. if (!this.isSupported()) {
  42546. return failAttempt(new UnsupportedStrategy(), callback);
  42547. }
  42548. else if (this.priority < minPriority) {
  42549. return failAttempt(new TransportPriorityTooLow(), callback);
  42550. }
  42551. var connected = false;
  42552. var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options);
  42553. var handshake = null;
  42554. var onInitialized = function () {
  42555. transport.unbind("initialized", onInitialized);
  42556. transport.connect();
  42557. };
  42558. var onOpen = function () {
  42559. handshake = factory.createHandshake(transport, function (result) {
  42560. connected = true;
  42561. unbindListeners();
  42562. callback(null, result);
  42563. });
  42564. };
  42565. var onError = function (error) {
  42566. unbindListeners();
  42567. callback(error);
  42568. };
  42569. var onClosed = function () {
  42570. unbindListeners();
  42571. var serializedTransport;
  42572. serializedTransport = safeJSONStringify(transport);
  42573. callback(new TransportClosed(serializedTransport));
  42574. };
  42575. var unbindListeners = function () {
  42576. transport.unbind("initialized", onInitialized);
  42577. transport.unbind("open", onOpen);
  42578. transport.unbind("error", onError);
  42579. transport.unbind("closed", onClosed);
  42580. };
  42581. transport.bind("initialized", onInitialized);
  42582. transport.bind("open", onOpen);
  42583. transport.bind("error", onError);
  42584. transport.bind("closed", onClosed);
  42585. transport.initialize();
  42586. return {
  42587. abort: function () {
  42588. if (connected) {
  42589. return;
  42590. }
  42591. unbindListeners();
  42592. if (handshake) {
  42593. handshake.close();
  42594. }
  42595. else {
  42596. transport.close();
  42597. }
  42598. },
  42599. forceMinPriority: function (p) {
  42600. if (connected) {
  42601. return;
  42602. }
  42603. if (_this.priority < p) {
  42604. if (handshake) {
  42605. handshake.close();
  42606. }
  42607. else {
  42608. transport.close();
  42609. }
  42610. }
  42611. }
  42612. };
  42613. };
  42614. return TransportStrategy;
  42615. }());
  42616. /* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
  42617. function failAttempt(error, callback) {
  42618. util.defer(function () {
  42619. callback(error);
  42620. });
  42621. return {
  42622. abort: function () { },
  42623. forceMinPriority: function () { }
  42624. };
  42625. }
  42626. // CONCATENATED MODULE: ./src/core/strategies/strategy_builder.ts
  42627. var strategy_builder_Transports = runtime.Transports;
  42628. var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
  42629. var transportClass = strategy_builder_Transports[type];
  42630. if (!transportClass) {
  42631. throw new UnsupportedTransport(type);
  42632. }
  42633. var enabled = (!config.enabledTransports ||
  42634. arrayIndexOf(config.enabledTransports, name) !== -1) &&
  42635. (!config.disabledTransports ||
  42636. arrayIndexOf(config.disabledTransports, name) === -1);
  42637. var transport;
  42638. if (enabled) {
  42639. transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, extend({
  42640. key: config.key,
  42641. useTLS: config.useTLS,
  42642. timeline: config.timeline,
  42643. ignoreNullOrigin: config.ignoreNullOrigin
  42644. }, options));
  42645. }
  42646. else {
  42647. transport = strategy_builder_UnsupportedStrategy;
  42648. }
  42649. return transport;
  42650. };
  42651. var strategy_builder_UnsupportedStrategy = {
  42652. isSupported: function () {
  42653. return false;
  42654. },
  42655. connect: function (_, callback) {
  42656. var deferred = util.defer(function () {
  42657. callback(new UnsupportedStrategy());
  42658. });
  42659. return {
  42660. abort: function () {
  42661. deferred.ensureAborted();
  42662. },
  42663. forceMinPriority: function () { }
  42664. };
  42665. }
  42666. };
  42667. // CONCATENATED MODULE: ./src/core/config.ts
  42668. var getGlobalConfig = function () {
  42669. return {
  42670. wsHost: defaults.host,
  42671. wsPort: defaults.ws_port,
  42672. wssPort: defaults.wss_port,
  42673. wsPath: defaults.ws_path,
  42674. httpHost: defaults.sockjs_host,
  42675. httpPort: defaults.sockjs_http_port,
  42676. httpsPort: defaults.sockjs_https_port,
  42677. httpPath: defaults.sockjs_path,
  42678. statsHost: defaults.stats_host,
  42679. authEndpoint: defaults.channel_auth_endpoint,
  42680. authTransport: defaults.channel_auth_transport,
  42681. activity_timeout: defaults.activity_timeout,
  42682. pong_timeout: defaults.pong_timeout,
  42683. unavailable_timeout: defaults.unavailable_timeout
  42684. };
  42685. };
  42686. var getClusterConfig = function (clusterName) {
  42687. return {
  42688. wsHost: 'ws-' + clusterName + '.pusher.com',
  42689. httpHost: 'sockjs-' + clusterName + '.pusher.com'
  42690. };
  42691. };
  42692. // CONCATENATED MODULE: ./src/core/pusher.ts
  42693. var pusher_Pusher = (function () {
  42694. function Pusher(app_key, options) {
  42695. var _this = this;
  42696. checkAppKey(app_key);
  42697. options = options || {};
  42698. if (!options.cluster && !(options.wsHost || options.httpHost)) {
  42699. var suffix = url_store.buildLogSuffix('javascriptQuickStart');
  42700. logger.warn("You should always specify a cluster when connecting. " + suffix);
  42701. }
  42702. this.key = app_key;
  42703. this.config = extend(getGlobalConfig(), options.cluster ? getClusterConfig(options.cluster) : {}, options);
  42704. this.channels = factory.createChannels();
  42705. this.global_emitter = new dispatcher();
  42706. this.sessionID = Math.floor(Math.random() * 1000000000);
  42707. this.timeline = new timeline_timeline(this.key, this.sessionID, {
  42708. cluster: this.config.cluster,
  42709. features: Pusher.getClientFeatures(),
  42710. params: this.config.timelineParams || {},
  42711. limit: 50,
  42712. level: timeline_level.INFO,
  42713. version: defaults.VERSION
  42714. });
  42715. if (!this.config.disableStats) {
  42716. this.timelineSender = factory.createTimelineSender(this.timeline, {
  42717. host: this.config.statsHost,
  42718. path: '/timeline/v2/' + runtime.TimelineTransport.name
  42719. });
  42720. }
  42721. var getStrategy = function (options) {
  42722. var config = extend({}, _this.config, options);
  42723. return runtime.getDefaultStrategy(config, strategy_builder_defineTransport);
  42724. };
  42725. this.connection = factory.createConnectionManager(this.key, extend({
  42726. getStrategy: getStrategy,
  42727. timeline: this.timeline,
  42728. activityTimeout: this.config.activity_timeout,
  42729. pongTimeout: this.config.pong_timeout,
  42730. unavailableTimeout: this.config.unavailable_timeout
  42731. }, this.config, { useTLS: this.shouldUseTLS() }));
  42732. this.connection.bind('connected', function () {
  42733. _this.subscribeAll();
  42734. if (_this.timelineSender) {
  42735. _this.timelineSender.send(_this.connection.isUsingTLS());
  42736. }
  42737. });
  42738. this.connection.bind('message', function (event) {
  42739. var eventName = event.event;
  42740. var internal = eventName.indexOf('pusher_internal:') === 0;
  42741. if (event.channel) {
  42742. var channel = _this.channel(event.channel);
  42743. if (channel) {
  42744. channel.handleEvent(event);
  42745. }
  42746. }
  42747. if (!internal) {
  42748. _this.global_emitter.emit(event.event, event.data);
  42749. }
  42750. });
  42751. this.connection.bind('connecting', function () {
  42752. _this.channels.disconnect();
  42753. });
  42754. this.connection.bind('disconnected', function () {
  42755. _this.channels.disconnect();
  42756. });
  42757. this.connection.bind('error', function (err) {
  42758. logger.warn(err);
  42759. });
  42760. Pusher.instances.push(this);
  42761. this.timeline.info({ instances: Pusher.instances.length });
  42762. if (Pusher.isReady) {
  42763. this.connect();
  42764. }
  42765. }
  42766. Pusher.ready = function () {
  42767. Pusher.isReady = true;
  42768. for (var i = 0, l = Pusher.instances.length; i < l; i++) {
  42769. Pusher.instances[i].connect();
  42770. }
  42771. };
  42772. Pusher.getClientFeatures = function () {
  42773. return keys(filterObject({ ws: runtime.Transports.ws }, function (t) {
  42774. return t.isSupported({});
  42775. }));
  42776. };
  42777. Pusher.prototype.channel = function (name) {
  42778. return this.channels.find(name);
  42779. };
  42780. Pusher.prototype.allChannels = function () {
  42781. return this.channels.all();
  42782. };
  42783. Pusher.prototype.connect = function () {
  42784. this.connection.connect();
  42785. if (this.timelineSender) {
  42786. if (!this.timelineSenderTimer) {
  42787. var usingTLS = this.connection.isUsingTLS();
  42788. var timelineSender = this.timelineSender;
  42789. this.timelineSenderTimer = new PeriodicTimer(60000, function () {
  42790. timelineSender.send(usingTLS);
  42791. });
  42792. }
  42793. }
  42794. };
  42795. Pusher.prototype.disconnect = function () {
  42796. this.connection.disconnect();
  42797. if (this.timelineSenderTimer) {
  42798. this.timelineSenderTimer.ensureAborted();
  42799. this.timelineSenderTimer = null;
  42800. }
  42801. };
  42802. Pusher.prototype.bind = function (event_name, callback, context) {
  42803. this.global_emitter.bind(event_name, callback, context);
  42804. return this;
  42805. };
  42806. Pusher.prototype.unbind = function (event_name, callback, context) {
  42807. this.global_emitter.unbind(event_name, callback, context);
  42808. return this;
  42809. };
  42810. Pusher.prototype.bind_global = function (callback) {
  42811. this.global_emitter.bind_global(callback);
  42812. return this;
  42813. };
  42814. Pusher.prototype.unbind_global = function (callback) {
  42815. this.global_emitter.unbind_global(callback);
  42816. return this;
  42817. };
  42818. Pusher.prototype.unbind_all = function (callback) {
  42819. this.global_emitter.unbind_all();
  42820. return this;
  42821. };
  42822. Pusher.prototype.subscribeAll = function () {
  42823. var channelName;
  42824. for (channelName in this.channels.channels) {
  42825. if (this.channels.channels.hasOwnProperty(channelName)) {
  42826. this.subscribe(channelName);
  42827. }
  42828. }
  42829. };
  42830. Pusher.prototype.subscribe = function (channel_name) {
  42831. var channel = this.channels.add(channel_name, this);
  42832. if (channel.subscriptionPending && channel.subscriptionCancelled) {
  42833. channel.reinstateSubscription();
  42834. }
  42835. else if (!channel.subscriptionPending &&
  42836. this.connection.state === 'connected') {
  42837. channel.subscribe();
  42838. }
  42839. return channel;
  42840. };
  42841. Pusher.prototype.unsubscribe = function (channel_name) {
  42842. var channel = this.channels.find(channel_name);
  42843. if (channel && channel.subscriptionPending) {
  42844. channel.cancelSubscription();
  42845. }
  42846. else {
  42847. channel = this.channels.remove(channel_name);
  42848. if (channel && this.connection.state === 'connected') {
  42849. channel.unsubscribe();
  42850. }
  42851. }
  42852. };
  42853. Pusher.prototype.send_event = function (event_name, data, channel) {
  42854. return this.connection.send_event(event_name, data, channel);
  42855. };
  42856. Pusher.prototype.shouldUseTLS = function () {
  42857. if (runtime.getProtocol() === 'https:') {
  42858. return true;
  42859. }
  42860. else if (this.config.forceTLS === true) {
  42861. return true;
  42862. }
  42863. else {
  42864. return Boolean(this.config.encrypted);
  42865. }
  42866. };
  42867. Pusher.instances = [];
  42868. Pusher.isReady = false;
  42869. Pusher.logToConsole = false;
  42870. Pusher.Runtime = runtime;
  42871. Pusher.ScriptReceivers = runtime.ScriptReceivers;
  42872. Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
  42873. Pusher.auth_callbacks = runtime.auth_callbacks;
  42874. return Pusher;
  42875. }());
  42876. /* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
  42877. function checkAppKey(key) {
  42878. if (key === null || key === undefined) {
  42879. throw 'You must pass your app key when you instantiate Pusher.';
  42880. }
  42881. }
  42882. runtime.setup(pusher_Pusher);
  42883. /***/ })
  42884. /******/ ]);
  42885. });
  42886. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  42887. /***/ }),
  42888. /***/ "./node_modules/setimmediate/setImmediate.js":
  42889. /*!***************************************************!*\
  42890. !*** ./node_modules/setimmediate/setImmediate.js ***!
  42891. \***************************************************/
  42892. /*! no static exports found */
  42893. /***/ (function(module, exports, __webpack_require__) {
  42894. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  42895. "use strict";
  42896. if (global.setImmediate) {
  42897. return;
  42898. }
  42899. var nextHandle = 1; // Spec says greater than zero
  42900. var tasksByHandle = {};
  42901. var currentlyRunningATask = false;
  42902. var doc = global.document;
  42903. var registerImmediate;
  42904. function setImmediate(callback) {
  42905. // Callback can either be a function or a string
  42906. if (typeof callback !== "function") {
  42907. callback = new Function("" + callback);
  42908. }
  42909. // Copy function arguments
  42910. var args = new Array(arguments.length - 1);
  42911. for (var i = 0; i < args.length; i++) {
  42912. args[i] = arguments[i + 1];
  42913. }
  42914. // Store and register the task
  42915. var task = { callback: callback, args: args };
  42916. tasksByHandle[nextHandle] = task;
  42917. registerImmediate(nextHandle);
  42918. return nextHandle++;
  42919. }
  42920. function clearImmediate(handle) {
  42921. delete tasksByHandle[handle];
  42922. }
  42923. function run(task) {
  42924. var callback = task.callback;
  42925. var args = task.args;
  42926. switch (args.length) {
  42927. case 0:
  42928. callback();
  42929. break;
  42930. case 1:
  42931. callback(args[0]);
  42932. break;
  42933. case 2:
  42934. callback(args[0], args[1]);
  42935. break;
  42936. case 3:
  42937. callback(args[0], args[1], args[2]);
  42938. break;
  42939. default:
  42940. callback.apply(undefined, args);
  42941. break;
  42942. }
  42943. }
  42944. function runIfPresent(handle) {
  42945. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  42946. // So if we're currently running a task, we'll need to delay this invocation.
  42947. if (currentlyRunningATask) {
  42948. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  42949. // "too much recursion" error.
  42950. setTimeout(runIfPresent, 0, handle);
  42951. } else {
  42952. var task = tasksByHandle[handle];
  42953. if (task) {
  42954. currentlyRunningATask = true;
  42955. try {
  42956. run(task);
  42957. } finally {
  42958. clearImmediate(handle);
  42959. currentlyRunningATask = false;
  42960. }
  42961. }
  42962. }
  42963. }
  42964. function installNextTickImplementation() {
  42965. registerImmediate = function(handle) {
  42966. process.nextTick(function () { runIfPresent(handle); });
  42967. };
  42968. }
  42969. function canUsePostMessage() {
  42970. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  42971. // where `global.postMessage` means something completely different and can't be used for this purpose.
  42972. if (global.postMessage && !global.importScripts) {
  42973. var postMessageIsAsynchronous = true;
  42974. var oldOnMessage = global.onmessage;
  42975. global.onmessage = function() {
  42976. postMessageIsAsynchronous = false;
  42977. };
  42978. global.postMessage("", "*");
  42979. global.onmessage = oldOnMessage;
  42980. return postMessageIsAsynchronous;
  42981. }
  42982. }
  42983. function installPostMessageImplementation() {
  42984. // Installs an event handler on `global` for the `message` event: see
  42985. // * https://developer.mozilla.org/en/DOM/window.postMessage
  42986. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  42987. var messagePrefix = "setImmediate$" + Math.random() + "$";
  42988. var onGlobalMessage = function(event) {
  42989. if (event.source === global &&
  42990. typeof event.data === "string" &&
  42991. event.data.indexOf(messagePrefix) === 0) {
  42992. runIfPresent(+event.data.slice(messagePrefix.length));
  42993. }
  42994. };
  42995. if (global.addEventListener) {
  42996. global.addEventListener("message", onGlobalMessage, false);
  42997. } else {
  42998. global.attachEvent("onmessage", onGlobalMessage);
  42999. }
  43000. registerImmediate = function(handle) {
  43001. global.postMessage(messagePrefix + handle, "*");
  43002. };
  43003. }
  43004. function installMessageChannelImplementation() {
  43005. var channel = new MessageChannel();
  43006. channel.port1.onmessage = function(event) {
  43007. var handle = event.data;
  43008. runIfPresent(handle);
  43009. };
  43010. registerImmediate = function(handle) {
  43011. channel.port2.postMessage(handle);
  43012. };
  43013. }
  43014. function installReadyStateChangeImplementation() {
  43015. var html = doc.documentElement;
  43016. registerImmediate = function(handle) {
  43017. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  43018. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  43019. var script = doc.createElement("script");
  43020. script.onreadystatechange = function () {
  43021. runIfPresent(handle);
  43022. script.onreadystatechange = null;
  43023. html.removeChild(script);
  43024. script = null;
  43025. };
  43026. html.appendChild(script);
  43027. };
  43028. }
  43029. function installSetTimeoutImplementation() {
  43030. registerImmediate = function(handle) {
  43031. setTimeout(runIfPresent, 0, handle);
  43032. };
  43033. }
  43034. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  43035. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  43036. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  43037. // Don't get fooled by e.g. browserify environments.
  43038. if ({}.toString.call(global.process) === "[object process]") {
  43039. // For Node.js before 0.9
  43040. installNextTickImplementation();
  43041. } else if (canUsePostMessage()) {
  43042. // For non-IE10 modern browsers
  43043. installPostMessageImplementation();
  43044. } else if (global.MessageChannel) {
  43045. // For web workers, where supported
  43046. installMessageChannelImplementation();
  43047. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  43048. // For IE 6–8
  43049. installReadyStateChangeImplementation();
  43050. } else {
  43051. // For older browsers
  43052. installSetTimeoutImplementation();
  43053. }
  43054. attachTo.setImmediate = setImmediate;
  43055. attachTo.clearImmediate = clearImmediate;
  43056. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  43057. /* 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")))
  43058. /***/ }),
  43059. /***/ "./node_modules/timers-browserify/main.js":
  43060. /*!************************************************!*\
  43061. !*** ./node_modules/timers-browserify/main.js ***!
  43062. \************************************************/
  43063. /*! no static exports found */
  43064. /***/ (function(module, exports, __webpack_require__) {
  43065. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  43066. (typeof self !== "undefined" && self) ||
  43067. window;
  43068. var apply = Function.prototype.apply;
  43069. // DOM APIs, for completeness
  43070. exports.setTimeout = function() {
  43071. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  43072. };
  43073. exports.setInterval = function() {
  43074. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  43075. };
  43076. exports.clearTimeout =
  43077. exports.clearInterval = function(timeout) {
  43078. if (timeout) {
  43079. timeout.close();
  43080. }
  43081. };
  43082. function Timeout(id, clearFn) {
  43083. this._id = id;
  43084. this._clearFn = clearFn;
  43085. }
  43086. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  43087. Timeout.prototype.close = function() {
  43088. this._clearFn.call(scope, this._id);
  43089. };
  43090. // Does not start the time, just sets up the members needed.
  43091. exports.enroll = function(item, msecs) {
  43092. clearTimeout(item._idleTimeoutId);
  43093. item._idleTimeout = msecs;
  43094. };
  43095. exports.unenroll = function(item) {
  43096. clearTimeout(item._idleTimeoutId);
  43097. item._idleTimeout = -1;
  43098. };
  43099. exports._unrefActive = exports.active = function(item) {
  43100. clearTimeout(item._idleTimeoutId);
  43101. var msecs = item._idleTimeout;
  43102. if (msecs >= 0) {
  43103. item._idleTimeoutId = setTimeout(function onTimeout() {
  43104. if (item._onTimeout)
  43105. item._onTimeout();
  43106. }, msecs);
  43107. }
  43108. };
  43109. // setimmediate attaches itself to the global object
  43110. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  43111. // On some exotic environments, it's not clear which object `setimmediate` was
  43112. // able to install onto. Search each possibility in the same order as the
  43113. // `setimmediate` library.
  43114. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  43115. (typeof global !== "undefined" && global.setImmediate) ||
  43116. (this && this.setImmediate);
  43117. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  43118. (typeof global !== "undefined" && global.clearImmediate) ||
  43119. (this && this.clearImmediate);
  43120. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  43121. /***/ }),
  43122. /***/ "./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&":
  43123. /*!*******************************************************************************************************************************************************************************************************************!*\
  43124. !*** ./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& ***!
  43125. \*******************************************************************************************************************************************************************************************************************/
  43126. /*! exports provided: render, staticRenderFns */
  43127. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43128. "use strict";
  43129. __webpack_require__.r(__webpack_exports__);
  43130. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43131. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43132. var render = function() {
  43133. var _vm = this
  43134. var _h = _vm.$createElement
  43135. var _c = _vm._self._c || _h
  43136. return _vm._m(0)
  43137. }
  43138. var staticRenderFns = [
  43139. function() {
  43140. var _vm = this
  43141. var _h = _vm.$createElement
  43142. var _c = _vm._self._c || _h
  43143. return _c("div", { staticClass: "container" }, [
  43144. _c("div", { staticClass: "row justify-content-center" }, [
  43145. _c("div", { staticClass: "col-md-8" }, [
  43146. _c("div", { staticClass: "card" }, [
  43147. _c("div", { staticClass: "card-header" }, [
  43148. _vm._v("Example Component")
  43149. ]),
  43150. _vm._v(" "),
  43151. _c("div", { staticClass: "card-body" }, [
  43152. _vm._v(
  43153. "\n I'm an example component.\n "
  43154. )
  43155. ])
  43156. ])
  43157. ])
  43158. ])
  43159. ])
  43160. }
  43161. ]
  43162. render._withStripped = true
  43163. /***/ }),
  43164. /***/ "./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&":
  43165. /*!************************************************************************************************************************************************************************************************************!*\
  43166. !*** ./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& ***!
  43167. \************************************************************************************************************************************************************************************************************/
  43168. /*! exports provided: render, staticRenderFns */
  43169. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43170. "use strict";
  43171. __webpack_require__.r(__webpack_exports__);
  43172. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43173. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43174. var render = function() {
  43175. var _vm = this
  43176. var _h = _vm.$createElement
  43177. var _c = _vm._self._c || _h
  43178. return _c(
  43179. "div",
  43180. [
  43181. _c(
  43182. "modal",
  43183. {
  43184. attrs: {
  43185. id: "asseteditModal",
  43186. tabindex: "-1",
  43187. role: "dialog",
  43188. "aria-labelledby": "asseteditModalLabel"
  43189. }
  43190. },
  43191. [
  43192. _c(
  43193. "h5",
  43194. {
  43195. staticClass: "modal-title",
  43196. attrs: { slot: "header", id: "asseteditModalLabel" },
  43197. slot: "header"
  43198. },
  43199. [_vm._v("\n Edit Work Order Information\n ")]
  43200. ),
  43201. _vm._v(" "),
  43202. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43203. _c("div", { staticClass: "form-group" }, [
  43204. _c("label", { attrs: { for: "manufacturer" } }, [
  43205. _vm._v("Manufacturer")
  43206. ]),
  43207. _vm._v(" "),
  43208. _c("input", {
  43209. directives: [
  43210. {
  43211. name: "model",
  43212. rawName: "v-model.lazy",
  43213. value: _vm.data.pcmanu,
  43214. expression: "data.pcmanu",
  43215. modifiers: { lazy: true }
  43216. }
  43217. ],
  43218. staticClass: "form-control",
  43219. attrs: {
  43220. type: "text",
  43221. name: "manufacturer",
  43222. id: "manufacturer"
  43223. },
  43224. domProps: { value: _vm.data.pcmanu },
  43225. on: {
  43226. change: function($event) {
  43227. return _vm.$set(_vm.data, "pcmanu", $event.target.value)
  43228. }
  43229. }
  43230. })
  43231. ]),
  43232. _vm._v(" "),
  43233. _c("div", { staticClass: "form-group" }, [
  43234. _c("label", { attrs: { for: "make" } }, [_vm._v("Make")]),
  43235. _vm._v(" "),
  43236. _c("input", {
  43237. directives: [
  43238. {
  43239. name: "model",
  43240. rawName: "v-model.lazy",
  43241. value: _vm.data.pcmake,
  43242. expression: "data.pcmake",
  43243. modifiers: { lazy: true }
  43244. }
  43245. ],
  43246. staticClass: "form-control",
  43247. attrs: { type: "text", name: "make", id: "make" },
  43248. domProps: { value: _vm.data.pcmake },
  43249. on: {
  43250. change: function($event) {
  43251. return _vm.$set(_vm.data, "pcmake", $event.target.value)
  43252. }
  43253. }
  43254. })
  43255. ]),
  43256. _vm._v(" "),
  43257. _c("div", { staticClass: "form-group" }, [
  43258. _c("label", { attrs: { for: "nickname" } }, [_vm._v("Nickname")]),
  43259. _vm._v(" "),
  43260. _c("input", {
  43261. directives: [
  43262. {
  43263. name: "model",
  43264. rawName: "v-model.lazy",
  43265. value: _vm.data.pcnickname,
  43266. expression: "data.pcnickname",
  43267. modifiers: { lazy: true }
  43268. }
  43269. ],
  43270. staticClass: "form-control",
  43271. attrs: { type: "text", name: "nickname", id: "nickname" },
  43272. domProps: { value: _vm.data.pcnickname },
  43273. on: {
  43274. change: function($event) {
  43275. return _vm.$set(_vm.data, "pcnickname", $event.target.value)
  43276. }
  43277. }
  43278. })
  43279. ]),
  43280. _vm._v(" "),
  43281. _c("div", { staticClass: "form-group" }, [
  43282. _c("label", { attrs: { for: "os" } }, [_vm._v("OS")]),
  43283. _vm._v(" "),
  43284. _c("input", {
  43285. directives: [
  43286. {
  43287. name: "model",
  43288. rawName: "v-model.lazy",
  43289. value: _vm.pcextra[2],
  43290. expression: "pcextra[2]",
  43291. modifiers: { lazy: true }
  43292. }
  43293. ],
  43294. staticClass: "form-control",
  43295. attrs: { type: "text", name: "os", id: "os" },
  43296. domProps: { value: _vm.pcextra[2] },
  43297. on: {
  43298. change: function($event) {
  43299. return _vm.$set(_vm.pcextra, 2, $event.target.value)
  43300. }
  43301. }
  43302. })
  43303. ]),
  43304. _vm._v(" "),
  43305. _c("div", { staticClass: "form-group" }, [
  43306. _c("label", { attrs: { for: "serial" } }, [
  43307. _vm._v("Serial Number")
  43308. ]),
  43309. _vm._v(" "),
  43310. _c("input", {
  43311. directives: [
  43312. {
  43313. name: "model",
  43314. rawName: "v-model.lazy",
  43315. value: _vm.pcextra[104],
  43316. expression: "pcextra[104]",
  43317. modifiers: { lazy: true }
  43318. }
  43319. ],
  43320. staticClass: "form-control",
  43321. attrs: { type: "text", id: "serial", name: "serial" },
  43322. domProps: { value: _vm.pcextra[104] },
  43323. on: {
  43324. change: function($event) {
  43325. return _vm.$set(_vm.pcextra, 104, $event.target.value)
  43326. }
  43327. }
  43328. })
  43329. ]),
  43330. _vm._v(" "),
  43331. _c("div", { staticClass: "form-group" }, [
  43332. _c("label", { attrs: { for: "cpu" } }, [_vm._v("CPU")]),
  43333. _vm._v(" "),
  43334. _c("input", {
  43335. directives: [
  43336. {
  43337. name: "model",
  43338. rawName: "v-model.lazy",
  43339. value: _vm.pcextra[101],
  43340. expression: "pcextra[101]",
  43341. modifiers: { lazy: true }
  43342. }
  43343. ],
  43344. staticClass: "form-control",
  43345. attrs: { type: "text", id: "cpu", name: "cpu" },
  43346. domProps: { value: _vm.pcextra[101] },
  43347. on: {
  43348. change: function($event) {
  43349. return _vm.$set(_vm.pcextra, 101, $event.target.value)
  43350. }
  43351. }
  43352. })
  43353. ]),
  43354. _vm._v(" "),
  43355. _c("div", { staticClass: "form-group" }, [
  43356. _c("label", { attrs: { for: "ram" } }, [_vm._v("RAM")]),
  43357. _vm._v(" "),
  43358. _c("input", {
  43359. directives: [
  43360. {
  43361. name: "model",
  43362. rawName: "v-model.lazy",
  43363. value: _vm.pcextra[100],
  43364. expression: "pcextra[100]",
  43365. modifiers: { lazy: true }
  43366. }
  43367. ],
  43368. staticClass: "form-control",
  43369. attrs: { type: "text", name: "ram", id: "ram" },
  43370. domProps: { value: _vm.pcextra[100] },
  43371. on: {
  43372. change: function($event) {
  43373. return _vm.$set(_vm.pcextra, 100, $event.target.value)
  43374. }
  43375. }
  43376. })
  43377. ]),
  43378. _vm._v(" "),
  43379. _c("div", { staticClass: "form-group" }, [
  43380. _c("label", { attrs: { for: "graphics" } }, [_vm._v("Graphics")]),
  43381. _vm._v(" "),
  43382. _c("input", {
  43383. directives: [
  43384. {
  43385. name: "model",
  43386. rawName: "v-model.lazy",
  43387. value: _vm.pcextra[4],
  43388. expression: "pcextra[4]",
  43389. modifiers: { lazy: true }
  43390. }
  43391. ],
  43392. staticClass: "form-control",
  43393. attrs: { type: "text", name: "graphics", id: "grapics" },
  43394. domProps: { value: _vm.pcextra[4] },
  43395. on: {
  43396. change: function($event) {
  43397. return _vm.$set(_vm.pcextra, 4, $event.target.value)
  43398. }
  43399. }
  43400. })
  43401. ])
  43402. ]),
  43403. _vm._v(" "),
  43404. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43405. _c(
  43406. "button",
  43407. {
  43408. staticClass: "btn btn-secondary",
  43409. attrs: { type: "button", "data-dismiss": "modal" }
  43410. },
  43411. [_vm._v("Close")]
  43412. ),
  43413. _vm._v(" "),
  43414. _c(
  43415. "button",
  43416. {
  43417. staticClass: "btn btn-primary",
  43418. attrs: { type: "button" },
  43419. on: {
  43420. click: function($event) {
  43421. return _vm.updateAsset()
  43422. }
  43423. }
  43424. },
  43425. [_vm._v("Save")]
  43426. )
  43427. ])
  43428. ]
  43429. ),
  43430. _vm._v(" "),
  43431. _c("h4", { staticClass: "text-center" }, [
  43432. _vm._v(
  43433. _vm._s(this.data.pcmanu) + " " + _vm._s(this.data.pcmake) + " - "
  43434. ),
  43435. _c("small", { staticClass: "text-muted" }, [
  43436. _vm._v(_vm._s(this.data.pcnickname))
  43437. ])
  43438. ]),
  43439. _vm._v(" "),
  43440. _c("p", [_vm._v("OS: " + _vm._s(this.pcextra[2]))]),
  43441. _vm._v(" "),
  43442. _c("p", [_vm._v("S/N: " + _vm._s(this.pcextra[104]))]),
  43443. _vm._v(" "),
  43444. _c("p", [_vm._v("CPU: " + _vm._s(this.pcextra[101]))]),
  43445. _vm._v(" "),
  43446. _c("p", [_vm._v("RAM: " + _vm._s(this.pcextra[100]))]),
  43447. _vm._v(" "),
  43448. _c("p", [_vm._v("Graphics: " + _vm._s(this.pcextra[4]))]),
  43449. _vm._v(" "),
  43450. _c(
  43451. "button",
  43452. {
  43453. staticClass: "btn btn-primary",
  43454. attrs: {
  43455. type: "button",
  43456. "data-toggle": "modal",
  43457. "data-target": "#asseteditModal"
  43458. }
  43459. },
  43460. [_vm._v("Edit")]
  43461. )
  43462. ],
  43463. 1
  43464. )
  43465. }
  43466. var staticRenderFns = []
  43467. render._withStripped = true
  43468. /***/ }),
  43469. /***/ "./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&":
  43470. /*!*******************************************************************************************************************************************************************************************************************************!*\
  43471. !*** ./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& ***!
  43472. \*******************************************************************************************************************************************************************************************************************************/
  43473. /*! exports provided: render, staticRenderFns */
  43474. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43475. "use strict";
  43476. __webpack_require__.r(__webpack_exports__);
  43477. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43478. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43479. var render = function() {
  43480. var _vm = this
  43481. var _h = _vm.$createElement
  43482. var _c = _vm._self._c || _h
  43483. return _c("div", { staticClass: "dropdown", class: { open: _vm.open } }, [
  43484. _c("div", { staticClass: "input-group" }, [
  43485. _c("input", {
  43486. directives: [
  43487. {
  43488. name: "model",
  43489. rawName: "v-model",
  43490. value: _vm.searchText,
  43491. expression: "searchText"
  43492. }
  43493. ],
  43494. staticClass: "form-control",
  43495. attrs: { type: "text" },
  43496. domProps: { value: _vm.searchText },
  43497. on: {
  43498. input: [
  43499. function($event) {
  43500. if ($event.target.composing) {
  43501. return
  43502. }
  43503. _vm.searchText = $event.target.value
  43504. },
  43505. _vm.searchChanged
  43506. ]
  43507. }
  43508. }),
  43509. _vm._v(" "),
  43510. _c("div", { staticClass: "form-group-append" }, [
  43511. _c(
  43512. "a",
  43513. {
  43514. staticClass: "toggle input-group-text bg-primary text-light",
  43515. on: {
  43516. mousedown: function($event) {
  43517. $event.preventDefault()
  43518. },
  43519. click: function($event) {
  43520. return _vm.setOpen(!_vm.open)
  43521. }
  43522. }
  43523. },
  43524. [
  43525. _c("span", { staticClass: "arrow-up" }, [_vm._v("▲")]),
  43526. _vm._v(" "),
  43527. _c("span", { staticClass: "arrow-down" }, [_vm._v("▼")])
  43528. ]
  43529. )
  43530. ])
  43531. ]),
  43532. _vm._v(" "),
  43533. _c(
  43534. "ul",
  43535. { staticClass: "suggestion-list list-unstyled" },
  43536. _vm._l(_vm.matches, function(suggestion, index) {
  43537. return _c(
  43538. "li",
  43539. {
  43540. key: index,
  43541. on: {
  43542. mousedown: function($event) {
  43543. $event.preventDefault()
  43544. },
  43545. click: function($event) {
  43546. return _vm.suggestionSelected(suggestion)
  43547. }
  43548. }
  43549. },
  43550. [_vm._v("\n " + _vm._s(suggestion[1]) + "\n ")]
  43551. )
  43552. }),
  43553. 0
  43554. )
  43555. ])
  43556. }
  43557. var staticRenderFns = []
  43558. render._withStripped = true
  43559. /***/ }),
  43560. /***/ "./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&":
  43561. /*!************************************************************************************************************************************************************************************************************************!*\
  43562. !*** ./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& ***!
  43563. \************************************************************************************************************************************************************************************************************************/
  43564. /*! exports provided: render, staticRenderFns */
  43565. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43566. "use strict";
  43567. __webpack_require__.r(__webpack_exports__);
  43568. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43569. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43570. var render = function() {
  43571. var _vm = this
  43572. var _h = _vm.$createElement
  43573. var _c = _vm._self._c || _h
  43574. return _c(
  43575. "modal",
  43576. {
  43577. attrs: {
  43578. id: _vm.id,
  43579. tabindex: "-1",
  43580. role: "dialog",
  43581. "aria-labelledby": _vm.id + "Label"
  43582. }
  43583. },
  43584. [
  43585. _c(
  43586. "h5",
  43587. {
  43588. staticClass: "modal-title",
  43589. attrs: { slot: "header", id: _vm.id + "Label" },
  43590. slot: "header"
  43591. },
  43592. [_vm._v("\n Edit Credential\n ")]
  43593. ),
  43594. _vm._v(" "),
  43595. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43596. _c(
  43597. "div",
  43598. { staticClass: "form" },
  43599. [
  43600. _c("autocomplete-custom-dropdown", {
  43601. attrs: {
  43602. options: _vm.descriptions,
  43603. value: _vm.creddesc,
  43604. "allow-custom": true
  43605. },
  43606. model: {
  43607. value: _vm.creddesc,
  43608. callback: function($$v) {
  43609. _vm.creddesc = $$v
  43610. },
  43611. expression: "creddesc"
  43612. }
  43613. })
  43614. ],
  43615. 1
  43616. ),
  43617. _vm._v(" "),
  43618. _c("div", { staticClass: "form-group" }, [
  43619. _c("label", { attrs: { for: "newusername" } }, [_vm._v("Username")]),
  43620. _vm._v(" "),
  43621. _c("input", {
  43622. directives: [
  43623. {
  43624. name: "model",
  43625. rawName: "v-model",
  43626. value: _vm.data.creduser,
  43627. expression: "data.creduser"
  43628. }
  43629. ],
  43630. staticClass: "form-control credential",
  43631. attrs: {
  43632. type: "text",
  43633. name: "newusername" + _vm.data.credid,
  43634. id: "newusername" + _vm.data.credid
  43635. },
  43636. domProps: { value: _vm.data.creduser },
  43637. on: {
  43638. input: function($event) {
  43639. if ($event.target.composing) {
  43640. return
  43641. }
  43642. _vm.$set(_vm.data, "creduser", $event.target.value)
  43643. }
  43644. }
  43645. })
  43646. ]),
  43647. _vm._v(" "),
  43648. _c("div", { staticClass: "form-group" }, [
  43649. _c("label", { attrs: { for: "newpassword" } }, [_vm._v("Password")]),
  43650. _vm._v(" "),
  43651. _c("input", {
  43652. directives: [
  43653. {
  43654. name: "model",
  43655. rawName: "v-model",
  43656. value: _vm.data.credpass,
  43657. expression: "data.credpass"
  43658. }
  43659. ],
  43660. staticClass: "form-control credential",
  43661. attrs: {
  43662. type: "text",
  43663. name: "newpassword" + _vm.data.credid,
  43664. id: "newpassword" + _vm.data.credid
  43665. },
  43666. domProps: { value: _vm.data.credpass },
  43667. on: {
  43668. input: function($event) {
  43669. if ($event.target.composing) {
  43670. return
  43671. }
  43672. _vm.$set(_vm.data, "credpass", $event.target.value)
  43673. }
  43674. }
  43675. }),
  43676. _vm._v(" "),
  43677. _c(
  43678. "button",
  43679. {
  43680. staticClass: "btn btn-secondary",
  43681. attrs: { type: "button" },
  43682. on: {
  43683. click: function($event) {
  43684. return _vm.getRandomPassword(_vm.data.credid)
  43685. }
  43686. }
  43687. },
  43688. [_vm._v("Generate Random")]
  43689. )
  43690. ]),
  43691. _vm._v(" "),
  43692. _c("div", { staticClass: "form-group" })
  43693. ]),
  43694. _vm._v(" "),
  43695. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43696. _c(
  43697. "button",
  43698. {
  43699. staticClass: "btn btn-secondary",
  43700. attrs: { type: "button", "data-dismiss": "modal" }
  43701. },
  43702. [_vm._v("Close")]
  43703. ),
  43704. _vm._v(" "),
  43705. _c(
  43706. "button",
  43707. {
  43708. staticClass: "btn btn-primary",
  43709. attrs: { type: "button" },
  43710. on: {
  43711. click: function($event) {
  43712. return _vm.updateCredential()
  43713. }
  43714. }
  43715. },
  43716. [_vm._v("Save")]
  43717. )
  43718. ])
  43719. ]
  43720. )
  43721. }
  43722. var staticRenderFns = []
  43723. render._withStripped = true
  43724. /***/ }),
  43725. /***/ "./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&":
  43726. /*!******************************************************************************************************************************************************************************************************************!*\
  43727. !*** ./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& ***!
  43728. \******************************************************************************************************************************************************************************************************************/
  43729. /*! exports provided: render, staticRenderFns */
  43730. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43731. "use strict";
  43732. __webpack_require__.r(__webpack_exports__);
  43733. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43734. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43735. var render = function() {
  43736. var _vm = this
  43737. var _h = _vm.$createElement
  43738. var _c = _vm._self._c || _h
  43739. return _c(
  43740. "div",
  43741. [
  43742. _c("credential-form-modal", {
  43743. attrs: {
  43744. "modal-id": "newCredentialModal",
  43745. descriptions: _vm.creddescList,
  43746. create: true,
  43747. pcid: _vm.pcid
  43748. }
  43749. }),
  43750. _vm._v(" "),
  43751. _c(
  43752. "button",
  43753. {
  43754. staticClass: "btn btn-primary",
  43755. attrs: {
  43756. type: "button",
  43757. "data-toggle": "modal",
  43758. "data-target": "#newCredentialModal"
  43759. }
  43760. },
  43761. [_vm._v("New Credential")]
  43762. ),
  43763. _vm._v(" "),
  43764. _vm._l(_vm.credentials, function(credential) {
  43765. return _c(
  43766. "div",
  43767. { key: credential.credid },
  43768. [
  43769. _c("credential", {
  43770. attrs: { credential: credential, descriptions: _vm.creddescList }
  43771. })
  43772. ],
  43773. 1
  43774. )
  43775. })
  43776. ],
  43777. 2
  43778. )
  43779. }
  43780. var staticRenderFns = []
  43781. render._withStripped = true
  43782. /***/ }),
  43783. /***/ "./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&":
  43784. /*!*************************************************************************************************************************************************************************************************************!*\
  43785. !*** ./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& ***!
  43786. \*************************************************************************************************************************************************************************************************************/
  43787. /*! exports provided: render, staticRenderFns */
  43788. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43789. "use strict";
  43790. __webpack_require__.r(__webpack_exports__);
  43791. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43792. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43793. var render = function() {
  43794. var _vm = this
  43795. var _h = _vm.$createElement
  43796. var _c = _vm._self._c || _h
  43797. return _c(
  43798. "div",
  43799. { staticClass: "bg-lightgray m-1 p-2 border rounded container-fluid" },
  43800. [
  43801. _c("credential-form-modal", {
  43802. attrs: {
  43803. descriptions: _vm.creddescList,
  43804. "modal-id": "credential" + this.data.credid + "editModal",
  43805. populateWith: this.data
  43806. }
  43807. }),
  43808. _vm._v(" "),
  43809. _c(
  43810. "modal",
  43811. {
  43812. attrs: {
  43813. id: "credential" + this.data.credid + "deleteModal",
  43814. tabindex: "-1"
  43815. }
  43816. },
  43817. [
  43818. _c(
  43819. "h5",
  43820. {
  43821. staticClass: "modal-title",
  43822. attrs: {
  43823. slot: "header",
  43824. id: "credential" + this.data.credid + "deleteModalLabel"
  43825. },
  43826. slot: "header"
  43827. },
  43828. [_vm._v("\r\n Delete Credential\r\n ")]
  43829. ),
  43830. _vm._v(" "),
  43831. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43832. _vm._v("\r\n Are you sure?\r\n ")
  43833. ]),
  43834. _vm._v(" "),
  43835. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43836. _c(
  43837. "button",
  43838. {
  43839. staticClass: "btn btn-secondary",
  43840. attrs: { type: "button", "data-dismiss": "modal" }
  43841. },
  43842. [_vm._v("Cancel")]
  43843. ),
  43844. _vm._v(" "),
  43845. _c(
  43846. "button",
  43847. {
  43848. staticClass: "btn btn-danger",
  43849. attrs: { type: "button" },
  43850. on: {
  43851. click: function($event) {
  43852. return _vm.deleteCredential()
  43853. }
  43854. }
  43855. },
  43856. [_vm._v("Confirm")]
  43857. )
  43858. ])
  43859. ]
  43860. ),
  43861. _vm._v(" "),
  43862. _c("div", { staticClass: "row no-gutters" }, [
  43863. _c("div", { staticClass: "h5 col-3 text-left" }, [
  43864. _vm._v(_vm._s(this.data.creddesc))
  43865. ]),
  43866. _vm._v(" "),
  43867. _c("div", { staticClass: "col-9 text-right" }, [
  43868. _vm._v(_vm._s(this.data.creddate))
  43869. ])
  43870. ]),
  43871. _vm._v(" "),
  43872. _c("div", { staticClass: "row" }, [
  43873. _c("div", { staticClass: "col-lg-9" }, [
  43874. _c("div", [
  43875. _vm._m(0),
  43876. _vm._v(" "),
  43877. _c("input", {
  43878. staticClass: "border-0 credential",
  43879. attrs: {
  43880. type: "text",
  43881. id: "username" + this.data.credid,
  43882. readonly: ""
  43883. },
  43884. domProps: { value: this.data.creduser }
  43885. }),
  43886. _vm._v(" "),
  43887. _c(
  43888. "button",
  43889. {
  43890. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43891. attrs: {
  43892. id: "btn-username" + this.data.credid,
  43893. "data-clipboard-target": "#username" + this.data.credid
  43894. }
  43895. },
  43896. [_c("i", { staticClass: "far fa-clone" })]
  43897. )
  43898. ]),
  43899. _vm._v(" "),
  43900. _c("div", [
  43901. _vm._m(1),
  43902. _vm._v(" "),
  43903. _c("input", {
  43904. staticClass: "border-0 credential",
  43905. attrs: {
  43906. type: "text",
  43907. id: "password" + this.data.credid,
  43908. readonly: ""
  43909. },
  43910. domProps: { value: this.data.credpass }
  43911. }),
  43912. _vm._v(" "),
  43913. _c(
  43914. "button",
  43915. {
  43916. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43917. attrs: {
  43918. id: "btn-password" + this.data.credid,
  43919. "data-clipboard-target": "#password" + this.data.credid
  43920. }
  43921. },
  43922. [_c("i", { staticClass: "far fa-clone" })]
  43923. )
  43924. ])
  43925. ]),
  43926. _vm._v(" "),
  43927. _c(
  43928. "div",
  43929. {
  43930. staticClass: "btn-group col-lg-2 align-self-end w-25 w-lg-auto",
  43931. attrs: { role: "group", "aria-label": "Edit and Delete" }
  43932. },
  43933. [
  43934. _c(
  43935. "button",
  43936. {
  43937. staticClass: "btn btn-sm btn-secondary p-lg-1",
  43938. attrs: {
  43939. type: "button",
  43940. "data-toggle": "modal",
  43941. "data-target": "#credential" + this.data.credid + "editModal"
  43942. }
  43943. },
  43944. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  43945. ),
  43946. _vm._v(" "),
  43947. _c(
  43948. "button",
  43949. {
  43950. staticClass: "btn btn-sm btn-danger p-lg-1",
  43951. attrs: {
  43952. type: "button",
  43953. "data-toggle": "modal",
  43954. "data-target":
  43955. "#credential" + this.data.credid + "deleteModal"
  43956. }
  43957. },
  43958. [_c("i", { staticClass: "fas fa-fw fa-trash-alt" })]
  43959. )
  43960. ]
  43961. )
  43962. ])
  43963. ],
  43964. 1
  43965. )
  43966. }
  43967. var staticRenderFns = [
  43968. function() {
  43969. var _vm = this
  43970. var _h = _vm.$createElement
  43971. var _c = _vm._self._c || _h
  43972. return _c("label", { attrs: { for: "username" } }, [
  43973. _c("i", { staticClass: "fas fa-fw fa-user" })
  43974. ])
  43975. },
  43976. function() {
  43977. var _vm = this
  43978. var _h = _vm.$createElement
  43979. var _c = _vm._self._c || _h
  43980. return _c("label", { attrs: { for: "password" } }, [
  43981. _c("i", { staticClass: "fas fa-fw fa-key" })
  43982. ])
  43983. }
  43984. ]
  43985. render._withStripped = true
  43986. /***/ }),
  43987. /***/ "./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&":
  43988. /*!************************************************************************************************************************************************************************************************************!*\
  43989. !*** ./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& ***!
  43990. \************************************************************************************************************************************************************************************************************/
  43991. /*! exports provided: render, staticRenderFns */
  43992. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43993. "use strict";
  43994. __webpack_require__.r(__webpack_exports__);
  43995. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43996. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43997. var render = function() {
  43998. var _vm = this
  43999. var _h = _vm.$createElement
  44000. var _c = _vm._self._c || _h
  44001. return _c(
  44002. "ul",
  44003. { staticClass: "list-unstyled" },
  44004. _vm._l(_vm.errorList, function(error) {
  44005. return _c("li", { key: error, staticClass: "text-danger" }, [
  44006. _vm._v(" " + _vm._s(error) + " ")
  44007. ])
  44008. }),
  44009. 0
  44010. )
  44011. }
  44012. var staticRenderFns = []
  44013. render._withStripped = true
  44014. /***/ }),
  44015. /***/ "./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&":
  44016. /*!********************************************************************************************************************************************************************************************************!*\
  44017. !*** ./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& ***!
  44018. \********************************************************************************************************************************************************************************************************/
  44019. /*! exports provided: render, staticRenderFns */
  44020. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44021. "use strict";
  44022. __webpack_require__.r(__webpack_exports__);
  44023. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44024. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44025. var render = function() {
  44026. var _vm = this
  44027. var _h = _vm.$createElement
  44028. var _c = _vm._self._c || _h
  44029. return _c("div", { staticClass: "modal fade" }, [
  44030. _c(
  44031. "div",
  44032. { staticClass: "modal-dialog modal-lg", attrs: { role: "document" } },
  44033. [
  44034. _c("div", { staticClass: "modal-content" }, [
  44035. _c(
  44036. "div",
  44037. { staticClass: "modal-header" },
  44038. [_vm._m(0), _vm._v(" "), _vm._t("header")],
  44039. 2
  44040. ),
  44041. _vm._v(" "),
  44042. _c("div", { staticClass: "modal-body" }, [_vm._t("body")], 2),
  44043. _vm._v(" "),
  44044. _c("div", { staticClass: "modal-footer" }, [_vm._t("footer")], 2)
  44045. ])
  44046. ]
  44047. )
  44048. ])
  44049. }
  44050. var staticRenderFns = [
  44051. function() {
  44052. var _vm = this
  44053. var _h = _vm.$createElement
  44054. var _c = _vm._self._c || _h
  44055. return _c(
  44056. "button",
  44057. {
  44058. staticClass: "close",
  44059. attrs: {
  44060. type: "button",
  44061. "data-dismiss": "modal",
  44062. "aria-label": "Close"
  44063. }
  44064. },
  44065. [_c("span", { attrs: { "aria-hidden": "true" } }, [_vm._v("×")])]
  44066. )
  44067. }
  44068. ]
  44069. render._withStripped = true
  44070. /***/ }),
  44071. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/note-form-modal.vue?vue&type=template&id=0435c624&":
  44072. /*!******************************************************************************************************************************************************************************************************************!*\
  44073. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/note-form-modal.vue?vue&type=template&id=0435c624& ***!
  44074. \******************************************************************************************************************************************************************************************************************/
  44075. /*! exports provided: render, staticRenderFns */
  44076. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44077. "use strict";
  44078. __webpack_require__.r(__webpack_exports__);
  44079. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44080. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44081. var render = function() {
  44082. var _vm = this
  44083. var _h = _vm.$createElement
  44084. var _c = _vm._self._c || _h
  44085. return _c(
  44086. "modal",
  44087. {
  44088. attrs: {
  44089. id: _vm.modalId,
  44090. tabindex: "-1",
  44091. role: "dialog",
  44092. "aria-labelledby": _vm.modalId + "Label"
  44093. }
  44094. },
  44095. [
  44096. _c(
  44097. "h5",
  44098. {
  44099. staticClass: "modal-title",
  44100. attrs: { slot: "header", id: _vm.modalId + "Label" },
  44101. slot: "header"
  44102. },
  44103. [_vm._v("\n Edit Note\n ")]
  44104. ),
  44105. _vm._v(" "),
  44106. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44107. _c("div", { staticClass: "form-group" }, [
  44108. _c("label", { attrs: { for: "content" } }, [_vm._v("Content")]),
  44109. _vm._v(" "),
  44110. _c("textarea", {
  44111. directives: [
  44112. {
  44113. name: "model",
  44114. rawName: "v-model",
  44115. value: _vm.note.thenote,
  44116. expression: "note.thenote"
  44117. }
  44118. ],
  44119. staticClass: "form-control",
  44120. attrs: {
  44121. name: "content" + _vm.note.noteid,
  44122. id: "content" + _vm.note.noteid
  44123. },
  44124. domProps: { value: _vm.note.thenote },
  44125. on: {
  44126. input: function($event) {
  44127. if ($event.target.composing) {
  44128. return
  44129. }
  44130. _vm.$set(_vm.note, "thenote", $event.target.value)
  44131. }
  44132. }
  44133. })
  44134. ])
  44135. ]),
  44136. _vm._v(" "),
  44137. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44138. _c(
  44139. "button",
  44140. {
  44141. staticClass: "btn btn-secondary",
  44142. attrs: { type: "button", "data-dismiss": "modal" }
  44143. },
  44144. [_vm._v("Close")]
  44145. ),
  44146. _vm._v(" "),
  44147. _c(
  44148. "button",
  44149. {
  44150. staticClass: "btn btn-primary",
  44151. attrs: { type: "button" },
  44152. on: {
  44153. click: function($event) {
  44154. return _vm.updateNote(_vm.note)
  44155. }
  44156. }
  44157. },
  44158. [_vm._v("Save")]
  44159. )
  44160. ])
  44161. ]
  44162. )
  44163. }
  44164. var staticRenderFns = []
  44165. render._withStripped = true
  44166. /***/ }),
  44167. /***/ "./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&":
  44168. /*!********************************************************************************************************************************************************************************************************!*\
  44169. !*** ./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& ***!
  44170. \********************************************************************************************************************************************************************************************************/
  44171. /*! exports provided: render, staticRenderFns */
  44172. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44173. "use strict";
  44174. __webpack_require__.r(__webpack_exports__);
  44175. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44176. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44177. var render = function() {
  44178. var _vm = this
  44179. var _h = _vm.$createElement
  44180. var _c = _vm._self._c || _h
  44181. return _c(
  44182. "ul",
  44183. { staticClass: "list-unstyled" },
  44184. [
  44185. _c("div", { staticClass: "row" }, [
  44186. _c(
  44187. "div",
  44188. {
  44189. staticClass:
  44190. "col-md-2 d-flex justify-content-center justify-content-md-start"
  44191. },
  44192. [
  44193. _c(
  44194. "button",
  44195. {
  44196. staticClass: "btn btn-primary m-2",
  44197. attrs: {
  44198. type: "button",
  44199. "data-toggle": "collapse",
  44200. "data-target": "#note" + _vm.noteType + "add"
  44201. }
  44202. },
  44203. [
  44204. _c("i", { staticClass: "fas fa-fw fa-plus" }),
  44205. _vm._v(" Add New Note")
  44206. ]
  44207. )
  44208. ]
  44209. ),
  44210. _vm._v(" "),
  44211. _c("div", { staticClass: "col-md-10" }, [
  44212. _c(
  44213. "div",
  44214. {
  44215. staticClass: "collapse",
  44216. attrs: { id: "note" + _vm.noteType + "add" }
  44217. },
  44218. [
  44219. _c(
  44220. "div",
  44221. {
  44222. staticClass:
  44223. "d-flex flex-wrap flex-md-nowrap justify-content-center"
  44224. },
  44225. [
  44226. _c("textarea", {
  44227. directives: [
  44228. {
  44229. name: "model",
  44230. rawName: "v-model",
  44231. value: _vm.newNote.thenote,
  44232. expression: "newNote.thenote"
  44233. }
  44234. ],
  44235. staticClass: "form-control",
  44236. attrs: {
  44237. name: "newnote" + _vm.noteType,
  44238. id: "newnote" + _vm.noteType
  44239. },
  44240. domProps: { value: _vm.newNote.thenote },
  44241. on: {
  44242. input: function($event) {
  44243. if ($event.target.composing) {
  44244. return
  44245. }
  44246. _vm.$set(_vm.newNote, "thenote", $event.target.value)
  44247. }
  44248. }
  44249. }),
  44250. _vm._v(" "),
  44251. _c(
  44252. "button",
  44253. {
  44254. staticClass: "btn btn-secondary m-2",
  44255. attrs: { type: "button" },
  44256. on: {
  44257. click: function($event) {
  44258. return _vm.createNote()
  44259. }
  44260. }
  44261. },
  44262. [_vm._v("Save")]
  44263. )
  44264. ]
  44265. )
  44266. ]
  44267. )
  44268. ])
  44269. ]),
  44270. _vm._v(" "),
  44271. _vm._l(this.notes, function(note, index) {
  44272. return _c(
  44273. "li",
  44274. { key: index, staticClass: "row no-gutters mb-2" },
  44275. [
  44276. _c("note-form-modal", {
  44277. attrs: {
  44278. "modal-id": "note" + note.noteid + "editModal",
  44279. "populate-with": note
  44280. }
  44281. }),
  44282. _vm._v(" "),
  44283. _c(
  44284. "div",
  44285. {
  44286. staticClass: "col-md-1 d-flex flex-column mx-md-3",
  44287. class: _vm.noteOrders[index]
  44288. },
  44289. [
  44290. _c("div", { staticClass: "text-center p-0 m-0" }, [
  44291. _vm._v(_vm._s(note.noteuser))
  44292. ]),
  44293. _vm._v(" "),
  44294. _c(
  44295. "div",
  44296. { staticClass: "text-muted text-small text-center p-0 m-0" },
  44297. [_vm._v(_vm._s(_vm.getHRDate(note.notetime)))]
  44298. ),
  44299. _vm._v(" "),
  44300. _c(
  44301. "div",
  44302. { staticClass: "btn-group justify-content-center p-0 m-0" },
  44303. [
  44304. _vm.authusername === note.noteuser ||
  44305. _vm.authusername === "admin"
  44306. ? [
  44307. _c(
  44308. "button",
  44309. {
  44310. staticClass: "btn btn-sm btn-primary m-1",
  44311. attrs: {
  44312. "data-toggle": "modal",
  44313. "data-target":
  44314. "#note" + note.noteid + "editModal"
  44315. }
  44316. },
  44317. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  44318. ),
  44319. _vm._v(" "),
  44320. _vm._m(0, true),
  44321. _vm._v(" "),
  44322. _vm._m(1, true)
  44323. ]
  44324. : _vm._e()
  44325. ],
  44326. 2
  44327. )
  44328. ]
  44329. ),
  44330. _vm._v(" "),
  44331. _c("div", { staticClass: "col-md-10" }, [
  44332. _c("div", { staticClass: "card m-2" }, [
  44333. _c("div", { staticClass: "card-body p-2" }, [
  44334. _vm._v(
  44335. "\n " +
  44336. _vm._s(note.thenote) +
  44337. "\n "
  44338. )
  44339. ])
  44340. ])
  44341. ])
  44342. ],
  44343. 1
  44344. )
  44345. })
  44346. ],
  44347. 2
  44348. )
  44349. }
  44350. var staticRenderFns = [
  44351. function() {
  44352. var _vm = this
  44353. var _h = _vm.$createElement
  44354. var _c = _vm._self._c || _h
  44355. return _c("button", { staticClass: "btn btn-sm btn-danger m-1" }, [
  44356. _c("i", { staticClass: "fas fa-fw fa-trash-alt" })
  44357. ])
  44358. },
  44359. function() {
  44360. var _vm = this
  44361. var _h = _vm.$createElement
  44362. var _c = _vm._self._c || _h
  44363. return _c("button", { staticClass: "btn btn-sm btn-primary m-1" }, [
  44364. _c("i", { staticClass: "fa fa-fw fa-random" })
  44365. ])
  44366. }
  44367. ]
  44368. render._withStripped = true
  44369. /***/ }),
  44370. /***/ "./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&":
  44371. /*!********************************************************************************************************************************************************************************************************************!*\
  44372. !*** ./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& ***!
  44373. \********************************************************************************************************************************************************************************************************************/
  44374. /*! exports provided: render, staticRenderFns */
  44375. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44376. "use strict";
  44377. __webpack_require__.r(__webpack_exports__);
  44378. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44379. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44380. var render = function() {
  44381. var _vm = this
  44382. var _h = _vm.$createElement
  44383. var _c = _vm._self._c || _h
  44384. return _c(
  44385. "modal",
  44386. {
  44387. attrs: {
  44388. id: _vm.id,
  44389. tabindex: "-1",
  44390. role: "dialog",
  44391. "aria-labelledby": _vm.id + "Label"
  44392. }
  44393. },
  44394. [
  44395. _c(
  44396. "h5",
  44397. {
  44398. staticClass: "modal-title",
  44399. attrs: { slot: "header", id: _vm.id + "Label" },
  44400. slot: "header"
  44401. },
  44402. [_vm._v("\r\n Edit Work Order Information\r\n ")]
  44403. ),
  44404. _vm._v(" "),
  44405. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44406. _c(
  44407. "div",
  44408. { staticClass: "form-group" },
  44409. [
  44410. _c("label", { attrs: { for: "probdesc" } }, [
  44411. _vm._v("Problem Description")
  44412. ]),
  44413. _vm._v(" "),
  44414. _c("textarea", {
  44415. directives: [
  44416. {
  44417. name: "model",
  44418. rawName: "v-model",
  44419. value: _vm.data.probdesc,
  44420. expression: "data.probdesc"
  44421. }
  44422. ],
  44423. class: {
  44424. "form-control": true,
  44425. "is-invalid": _vm.errors.probdesc
  44426. },
  44427. attrs: { id: "probdesc", name: "probdesc" },
  44428. domProps: { value: _vm.data.probdesc },
  44429. on: {
  44430. input: function($event) {
  44431. if ($event.target.composing) {
  44432. return
  44433. }
  44434. _vm.$set(_vm.data, "probdesc", $event.target.value)
  44435. }
  44436. }
  44437. }),
  44438. _vm._v(" "),
  44439. _c("errorlist", { attrs: { errors: _vm.errors.probdesc } })
  44440. ],
  44441. 1
  44442. ),
  44443. _vm._v(" "),
  44444. _c(
  44445. "div",
  44446. { staticClass: "form-group" },
  44447. [
  44448. _c("label", { attrs: { for: "suggested" } }, [
  44449. _vm._v("Suggested Solution")
  44450. ]),
  44451. _vm._v(" "),
  44452. _c("textarea", {
  44453. directives: [
  44454. {
  44455. name: "model",
  44456. rawName: "v-model",
  44457. value: _vm.data.suggested,
  44458. expression: "data.suggested"
  44459. }
  44460. ],
  44461. class: {
  44462. "form-control": true,
  44463. "is-invalid": _vm.errors.suggested
  44464. },
  44465. attrs: { id: "suggested", name: "suggested" },
  44466. domProps: { value: _vm.data.suggested },
  44467. on: {
  44468. input: function($event) {
  44469. if ($event.target.composing) {
  44470. return
  44471. }
  44472. _vm.$set(_vm.data, "suggested", $event.target.value)
  44473. }
  44474. }
  44475. }),
  44476. _vm._v(" "),
  44477. _c("errorlist", { attrs: { errors: _vm.errors.suggested } })
  44478. ],
  44479. 1
  44480. ),
  44481. _vm._v(" "),
  44482. _c(
  44483. "div",
  44484. { staticClass: "form-group" },
  44485. [
  44486. _c("label", { attrs: { for: "storelist" } }, [_vm._v("Store")]),
  44487. _vm._v(" "),
  44488. _c("autocomplete-custom-dropdown", {
  44489. attrs: { options: _vm.storeList, value: this.store },
  44490. model: {
  44491. value: _vm.store,
  44492. callback: function($$v) {
  44493. _vm.store = $$v
  44494. },
  44495. expression: "store"
  44496. }
  44497. })
  44498. ],
  44499. 1
  44500. )
  44501. ]),
  44502. _vm._v(" "),
  44503. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44504. _c(
  44505. "button",
  44506. {
  44507. staticClass: "btn btn-secondary",
  44508. attrs: { type: "button", "data-dismiss": "modal" }
  44509. },
  44510. [_vm._v("Close")]
  44511. ),
  44512. _vm._v(" "),
  44513. _c(
  44514. "button",
  44515. {
  44516. staticClass: "btn btn-primary",
  44517. attrs: { type: "button" },
  44518. on: {
  44519. click: function($event) {
  44520. return _vm.updateWorkOrder()
  44521. }
  44522. }
  44523. },
  44524. [_vm._v("Save")]
  44525. )
  44526. ])
  44527. ]
  44528. )
  44529. }
  44530. var staticRenderFns = []
  44531. render._withStripped = true
  44532. /***/ }),
  44533. /***/ "./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&":
  44534. /*!*********************************************************************************************************************************************************************************************************!*\
  44535. !*** ./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& ***!
  44536. \*********************************************************************************************************************************************************************************************************/
  44537. /*! exports provided: render, staticRenderFns */
  44538. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44539. "use strict";
  44540. __webpack_require__.r(__webpack_exports__);
  44541. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44542. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44543. var render = function() {
  44544. var _vm = this
  44545. var _h = _vm.$createElement
  44546. var _c = _vm._self._c || _h
  44547. return _c(
  44548. "div",
  44549. [
  44550. _c("woinfo-edit-modal", {
  44551. attrs: {
  44552. "modal-id": "workordereditModal",
  44553. "populate-with": this.data,
  44554. "store-list": this.storeList
  44555. }
  44556. }),
  44557. _vm._v(" "),
  44558. _c("p", [
  44559. _c("i", { staticClass: "fas fa-fw fa-info-circle" }),
  44560. _vm._v(" "),
  44561. _c("span", { domProps: { textContent: _vm._s(this.data.probdesc) } })
  44562. ]),
  44563. _vm._v(" "),
  44564. _c("p", [
  44565. _c("i", { staticClass: "far fa-fw fa-lightbulb" }),
  44566. _vm._v(" "),
  44567. _c("span", { domProps: { textContent: _vm._s(this.data.suggested) } })
  44568. ]),
  44569. _vm._v(" "),
  44570. _c("p", [
  44571. _c("i", { staticClass: "fas fa-fw fa-paste" }),
  44572. _vm._v(" "),
  44573. _c("span", { domProps: { textContent: _vm._s(this.data.woid) } })
  44574. ]),
  44575. _vm._v(" "),
  44576. _c("p", [
  44577. _c("i", { staticClass: "fas fa-fw fa-building" }),
  44578. _vm._v(" "),
  44579. _c("span", [_vm._v(_vm._s(_vm.storeList[_vm.data.storeid]))])
  44580. ]),
  44581. _vm._v(" "),
  44582. _c("p", [
  44583. _c("i", { staticClass: "fas fa-fw fa-sign-in-alt" }),
  44584. _vm._v(" "),
  44585. _c(
  44586. "span",
  44587. {
  44588. staticClass: "dashed-underline",
  44589. attrs: {
  44590. "data-toggle": "tooltip",
  44591. "data-placement": "bottom",
  44592. title: this.getHRDate(this.data.dropdate)
  44593. }
  44594. },
  44595. [
  44596. _vm._v(
  44597. "\n " +
  44598. _vm._s(Math.floor(this.daysSinceToday(this.data.dropdate))) +
  44599. " days ago\n "
  44600. )
  44601. ]
  44602. )
  44603. ]),
  44604. _vm._v(" "),
  44605. _c("p", [
  44606. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  44607. _vm._v(" "),
  44608. !this.isZero(this.data.pickupdate)
  44609. ? _c(
  44610. "span",
  44611. {
  44612. staticClass: "dashed-underline",
  44613. attrs: {
  44614. "data-toggle": "tooltip",
  44615. "data-placement": "bottom",
  44616. title: this.getHRDate(this.data.pickupdate)
  44617. }
  44618. },
  44619. [
  44620. _vm._v(
  44621. "\n " +
  44622. _vm._s(
  44623. Math.floor(this.daysSinceToday(this.data.pickupdate))
  44624. ) +
  44625. " days ago\n "
  44626. )
  44627. ]
  44628. )
  44629. : _vm._e()
  44630. ]),
  44631. _vm._v(" "),
  44632. _c(
  44633. "button",
  44634. {
  44635. staticClass: "btn btn-primary",
  44636. attrs: {
  44637. type: "button",
  44638. "data-toggle": "modal",
  44639. "data-target": "#workordereditModal"
  44640. }
  44641. },
  44642. [_vm._v("Edit")]
  44643. )
  44644. ],
  44645. 1
  44646. )
  44647. }
  44648. var staticRenderFns = []
  44649. render._withStripped = true
  44650. /***/ }),
  44651. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  44652. /*!********************************************************************!*\
  44653. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  44654. \********************************************************************/
  44655. /*! exports provided: default */
  44656. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44657. "use strict";
  44658. __webpack_require__.r(__webpack_exports__);
  44659. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  44660. /* globals __VUE_SSR_CONTEXT__ */
  44661. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  44662. // This module is a runtime utility for cleaner component module output and will
  44663. // be included in the final webpack user bundle.
  44664. function normalizeComponent (
  44665. scriptExports,
  44666. render,
  44667. staticRenderFns,
  44668. functionalTemplate,
  44669. injectStyles,
  44670. scopeId,
  44671. moduleIdentifier, /* server only */
  44672. shadowMode /* vue-cli only */
  44673. ) {
  44674. // Vue.extend constructor export interop
  44675. var options = typeof scriptExports === 'function'
  44676. ? scriptExports.options
  44677. : scriptExports
  44678. // render functions
  44679. if (render) {
  44680. options.render = render
  44681. options.staticRenderFns = staticRenderFns
  44682. options._compiled = true
  44683. }
  44684. // functional template
  44685. if (functionalTemplate) {
  44686. options.functional = true
  44687. }
  44688. // scopedId
  44689. if (scopeId) {
  44690. options._scopeId = 'data-v-' + scopeId
  44691. }
  44692. var hook
  44693. if (moduleIdentifier) { // server build
  44694. hook = function (context) {
  44695. // 2.3 injection
  44696. context =
  44697. context || // cached call
  44698. (this.$vnode && this.$vnode.ssrContext) || // stateful
  44699. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  44700. // 2.2 with runInNewContext: true
  44701. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  44702. context = __VUE_SSR_CONTEXT__
  44703. }
  44704. // inject component styles
  44705. if (injectStyles) {
  44706. injectStyles.call(this, context)
  44707. }
  44708. // register component module identifier for async chunk inferrence
  44709. if (context && context._registeredComponents) {
  44710. context._registeredComponents.add(moduleIdentifier)
  44711. }
  44712. }
  44713. // used by ssr in case component is cached and beforeCreate
  44714. // never gets called
  44715. options._ssrRegister = hook
  44716. } else if (injectStyles) {
  44717. hook = shadowMode
  44718. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  44719. : injectStyles
  44720. }
  44721. if (hook) {
  44722. if (options.functional) {
  44723. // for template-only hot-reload because in that case the render fn doesn't
  44724. // go through the normalizer
  44725. options._injectStyles = hook
  44726. // register for functioal component in vue file
  44727. var originalRender = options.render
  44728. options.render = function renderWithStyleInjection (h, context) {
  44729. hook.call(context)
  44730. return originalRender(h, context)
  44731. }
  44732. } else {
  44733. // inject component registration as beforeCreate hook
  44734. var existing = options.beforeCreate
  44735. options.beforeCreate = existing
  44736. ? [].concat(existing, hook)
  44737. : [hook]
  44738. }
  44739. }
  44740. return {
  44741. exports: scriptExports,
  44742. options: options
  44743. }
  44744. }
  44745. /***/ }),
  44746. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  44747. /*!*************************************************!*\
  44748. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  44749. \*************************************************/
  44750. /*! no static exports found */
  44751. /***/ (function(module, exports, __webpack_require__) {
  44752. "use strict";
  44753. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  44754. * Vue.js v2.6.11
  44755. * (c) 2014-2019 Evan You
  44756. * Released under the MIT License.
  44757. */
  44758. /* */
  44759. var emptyObject = Object.freeze({});
  44760. // These helpers produce better VM code in JS engines due to their
  44761. // explicitness and function inlining.
  44762. function isUndef (v) {
  44763. return v === undefined || v === null
  44764. }
  44765. function isDef (v) {
  44766. return v !== undefined && v !== null
  44767. }
  44768. function isTrue (v) {
  44769. return v === true
  44770. }
  44771. function isFalse (v) {
  44772. return v === false
  44773. }
  44774. /**
  44775. * Check if value is primitive.
  44776. */
  44777. function isPrimitive (value) {
  44778. return (
  44779. typeof value === 'string' ||
  44780. typeof value === 'number' ||
  44781. // $flow-disable-line
  44782. typeof value === 'symbol' ||
  44783. typeof value === 'boolean'
  44784. )
  44785. }
  44786. /**
  44787. * Quick object check - this is primarily used to tell
  44788. * Objects from primitive values when we know the value
  44789. * is a JSON-compliant type.
  44790. */
  44791. function isObject (obj) {
  44792. return obj !== null && typeof obj === 'object'
  44793. }
  44794. /**
  44795. * Get the raw type string of a value, e.g., [object Object].
  44796. */
  44797. var _toString = Object.prototype.toString;
  44798. function toRawType (value) {
  44799. return _toString.call(value).slice(8, -1)
  44800. }
  44801. /**
  44802. * Strict object type check. Only returns true
  44803. * for plain JavaScript objects.
  44804. */
  44805. function isPlainObject (obj) {
  44806. return _toString.call(obj) === '[object Object]'
  44807. }
  44808. function isRegExp (v) {
  44809. return _toString.call(v) === '[object RegExp]'
  44810. }
  44811. /**
  44812. * Check if val is a valid array index.
  44813. */
  44814. function isValidArrayIndex (val) {
  44815. var n = parseFloat(String(val));
  44816. return n >= 0 && Math.floor(n) === n && isFinite(val)
  44817. }
  44818. function isPromise (val) {
  44819. return (
  44820. isDef(val) &&
  44821. typeof val.then === 'function' &&
  44822. typeof val.catch === 'function'
  44823. )
  44824. }
  44825. /**
  44826. * Convert a value to a string that is actually rendered.
  44827. */
  44828. function toString (val) {
  44829. return val == null
  44830. ? ''
  44831. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  44832. ? JSON.stringify(val, null, 2)
  44833. : String(val)
  44834. }
  44835. /**
  44836. * Convert an input value to a number for persistence.
  44837. * If the conversion fails, return original string.
  44838. */
  44839. function toNumber (val) {
  44840. var n = parseFloat(val);
  44841. return isNaN(n) ? val : n
  44842. }
  44843. /**
  44844. * Make a map and return a function for checking if a key
  44845. * is in that map.
  44846. */
  44847. function makeMap (
  44848. str,
  44849. expectsLowerCase
  44850. ) {
  44851. var map = Object.create(null);
  44852. var list = str.split(',');
  44853. for (var i = 0; i < list.length; i++) {
  44854. map[list[i]] = true;
  44855. }
  44856. return expectsLowerCase
  44857. ? function (val) { return map[val.toLowerCase()]; }
  44858. : function (val) { return map[val]; }
  44859. }
  44860. /**
  44861. * Check if a tag is a built-in tag.
  44862. */
  44863. var isBuiltInTag = makeMap('slot,component', true);
  44864. /**
  44865. * Check if an attribute is a reserved attribute.
  44866. */
  44867. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  44868. /**
  44869. * Remove an item from an array.
  44870. */
  44871. function remove (arr, item) {
  44872. if (arr.length) {
  44873. var index = arr.indexOf(item);
  44874. if (index > -1) {
  44875. return arr.splice(index, 1)
  44876. }
  44877. }
  44878. }
  44879. /**
  44880. * Check whether an object has the property.
  44881. */
  44882. var hasOwnProperty = Object.prototype.hasOwnProperty;
  44883. function hasOwn (obj, key) {
  44884. return hasOwnProperty.call(obj, key)
  44885. }
  44886. /**
  44887. * Create a cached version of a pure function.
  44888. */
  44889. function cached (fn) {
  44890. var cache = Object.create(null);
  44891. return (function cachedFn (str) {
  44892. var hit = cache[str];
  44893. return hit || (cache[str] = fn(str))
  44894. })
  44895. }
  44896. /**
  44897. * Camelize a hyphen-delimited string.
  44898. */
  44899. var camelizeRE = /-(\w)/g;
  44900. var camelize = cached(function (str) {
  44901. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  44902. });
  44903. /**
  44904. * Capitalize a string.
  44905. */
  44906. var capitalize = cached(function (str) {
  44907. return str.charAt(0).toUpperCase() + str.slice(1)
  44908. });
  44909. /**
  44910. * Hyphenate a camelCase string.
  44911. */
  44912. var hyphenateRE = /\B([A-Z])/g;
  44913. var hyphenate = cached(function (str) {
  44914. return str.replace(hyphenateRE, '-$1').toLowerCase()
  44915. });
  44916. /**
  44917. * Simple bind polyfill for environments that do not support it,
  44918. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  44919. * since native bind is now performant enough in most browsers.
  44920. * But removing it would mean breaking code that was able to run in
  44921. * PhantomJS 1.x, so this must be kept for backward compatibility.
  44922. */
  44923. /* istanbul ignore next */
  44924. function polyfillBind (fn, ctx) {
  44925. function boundFn (a) {
  44926. var l = arguments.length;
  44927. return l
  44928. ? l > 1
  44929. ? fn.apply(ctx, arguments)
  44930. : fn.call(ctx, a)
  44931. : fn.call(ctx)
  44932. }
  44933. boundFn._length = fn.length;
  44934. return boundFn
  44935. }
  44936. function nativeBind (fn, ctx) {
  44937. return fn.bind(ctx)
  44938. }
  44939. var bind = Function.prototype.bind
  44940. ? nativeBind
  44941. : polyfillBind;
  44942. /**
  44943. * Convert an Array-like object to a real Array.
  44944. */
  44945. function toArray (list, start) {
  44946. start = start || 0;
  44947. var i = list.length - start;
  44948. var ret = new Array(i);
  44949. while (i--) {
  44950. ret[i] = list[i + start];
  44951. }
  44952. return ret
  44953. }
  44954. /**
  44955. * Mix properties into target object.
  44956. */
  44957. function extend (to, _from) {
  44958. for (var key in _from) {
  44959. to[key] = _from[key];
  44960. }
  44961. return to
  44962. }
  44963. /**
  44964. * Merge an Array of Objects into a single Object.
  44965. */
  44966. function toObject (arr) {
  44967. var res = {};
  44968. for (var i = 0; i < arr.length; i++) {
  44969. if (arr[i]) {
  44970. extend(res, arr[i]);
  44971. }
  44972. }
  44973. return res
  44974. }
  44975. /* eslint-disable no-unused-vars */
  44976. /**
  44977. * Perform no operation.
  44978. * Stubbing args to make Flow happy without leaving useless transpiled code
  44979. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  44980. */
  44981. function noop (a, b, c) {}
  44982. /**
  44983. * Always return false.
  44984. */
  44985. var no = function (a, b, c) { return false; };
  44986. /* eslint-enable no-unused-vars */
  44987. /**
  44988. * Return the same value.
  44989. */
  44990. var identity = function (_) { return _; };
  44991. /**
  44992. * Generate a string containing static keys from compiler modules.
  44993. */
  44994. function genStaticKeys (modules) {
  44995. return modules.reduce(function (keys, m) {
  44996. return keys.concat(m.staticKeys || [])
  44997. }, []).join(',')
  44998. }
  44999. /**
  45000. * Check if two values are loosely equal - that is,
  45001. * if they are plain objects, do they have the same shape?
  45002. */
  45003. function looseEqual (a, b) {
  45004. if (a === b) { return true }
  45005. var isObjectA = isObject(a);
  45006. var isObjectB = isObject(b);
  45007. if (isObjectA && isObjectB) {
  45008. try {
  45009. var isArrayA = Array.isArray(a);
  45010. var isArrayB = Array.isArray(b);
  45011. if (isArrayA && isArrayB) {
  45012. return a.length === b.length && a.every(function (e, i) {
  45013. return looseEqual(e, b[i])
  45014. })
  45015. } else if (a instanceof Date && b instanceof Date) {
  45016. return a.getTime() === b.getTime()
  45017. } else if (!isArrayA && !isArrayB) {
  45018. var keysA = Object.keys(a);
  45019. var keysB = Object.keys(b);
  45020. return keysA.length === keysB.length && keysA.every(function (key) {
  45021. return looseEqual(a[key], b[key])
  45022. })
  45023. } else {
  45024. /* istanbul ignore next */
  45025. return false
  45026. }
  45027. } catch (e) {
  45028. /* istanbul ignore next */
  45029. return false
  45030. }
  45031. } else if (!isObjectA && !isObjectB) {
  45032. return String(a) === String(b)
  45033. } else {
  45034. return false
  45035. }
  45036. }
  45037. /**
  45038. * Return the first index at which a loosely equal value can be
  45039. * found in the array (if value is a plain object, the array must
  45040. * contain an object of the same shape), or -1 if it is not present.
  45041. */
  45042. function looseIndexOf (arr, val) {
  45043. for (var i = 0; i < arr.length; i++) {
  45044. if (looseEqual(arr[i], val)) { return i }
  45045. }
  45046. return -1
  45047. }
  45048. /**
  45049. * Ensure a function is called only once.
  45050. */
  45051. function once (fn) {
  45052. var called = false;
  45053. return function () {
  45054. if (!called) {
  45055. called = true;
  45056. fn.apply(this, arguments);
  45057. }
  45058. }
  45059. }
  45060. var SSR_ATTR = 'data-server-rendered';
  45061. var ASSET_TYPES = [
  45062. 'component',
  45063. 'directive',
  45064. 'filter'
  45065. ];
  45066. var LIFECYCLE_HOOKS = [
  45067. 'beforeCreate',
  45068. 'created',
  45069. 'beforeMount',
  45070. 'mounted',
  45071. 'beforeUpdate',
  45072. 'updated',
  45073. 'beforeDestroy',
  45074. 'destroyed',
  45075. 'activated',
  45076. 'deactivated',
  45077. 'errorCaptured',
  45078. 'serverPrefetch'
  45079. ];
  45080. /* */
  45081. var config = ({
  45082. /**
  45083. * Option merge strategies (used in core/util/options)
  45084. */
  45085. // $flow-disable-line
  45086. optionMergeStrategies: Object.create(null),
  45087. /**
  45088. * Whether to suppress warnings.
  45089. */
  45090. silent: false,
  45091. /**
  45092. * Show production mode tip message on boot?
  45093. */
  45094. productionTip: "development" !== 'production',
  45095. /**
  45096. * Whether to enable devtools
  45097. */
  45098. devtools: "development" !== 'production',
  45099. /**
  45100. * Whether to record perf
  45101. */
  45102. performance: false,
  45103. /**
  45104. * Error handler for watcher errors
  45105. */
  45106. errorHandler: null,
  45107. /**
  45108. * Warn handler for watcher warns
  45109. */
  45110. warnHandler: null,
  45111. /**
  45112. * Ignore certain custom elements
  45113. */
  45114. ignoredElements: [],
  45115. /**
  45116. * Custom user key aliases for v-on
  45117. */
  45118. // $flow-disable-line
  45119. keyCodes: Object.create(null),
  45120. /**
  45121. * Check if a tag is reserved so that it cannot be registered as a
  45122. * component. This is platform-dependent and may be overwritten.
  45123. */
  45124. isReservedTag: no,
  45125. /**
  45126. * Check if an attribute is reserved so that it cannot be used as a component
  45127. * prop. This is platform-dependent and may be overwritten.
  45128. */
  45129. isReservedAttr: no,
  45130. /**
  45131. * Check if a tag is an unknown element.
  45132. * Platform-dependent.
  45133. */
  45134. isUnknownElement: no,
  45135. /**
  45136. * Get the namespace of an element
  45137. */
  45138. getTagNamespace: noop,
  45139. /**
  45140. * Parse the real tag name for the specific platform.
  45141. */
  45142. parsePlatformTagName: identity,
  45143. /**
  45144. * Check if an attribute must be bound using property, e.g. value
  45145. * Platform-dependent.
  45146. */
  45147. mustUseProp: no,
  45148. /**
  45149. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  45150. * This will significantly reduce performance if set to false.
  45151. */
  45152. async: true,
  45153. /**
  45154. * Exposed for legacy reasons
  45155. */
  45156. _lifecycleHooks: LIFECYCLE_HOOKS
  45157. });
  45158. /* */
  45159. /**
  45160. * unicode letters used for parsing html tags, component names and property paths.
  45161. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  45162. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  45163. */
  45164. 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/;
  45165. /**
  45166. * Check if a string starts with $ or _
  45167. */
  45168. function isReserved (str) {
  45169. var c = (str + '').charCodeAt(0);
  45170. return c === 0x24 || c === 0x5F
  45171. }
  45172. /**
  45173. * Define a property.
  45174. */
  45175. function def (obj, key, val, enumerable) {
  45176. Object.defineProperty(obj, key, {
  45177. value: val,
  45178. enumerable: !!enumerable,
  45179. writable: true,
  45180. configurable: true
  45181. });
  45182. }
  45183. /**
  45184. * Parse simple path.
  45185. */
  45186. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  45187. function parsePath (path) {
  45188. if (bailRE.test(path)) {
  45189. return
  45190. }
  45191. var segments = path.split('.');
  45192. return function (obj) {
  45193. for (var i = 0; i < segments.length; i++) {
  45194. if (!obj) { return }
  45195. obj = obj[segments[i]];
  45196. }
  45197. return obj
  45198. }
  45199. }
  45200. /* */
  45201. // can we use __proto__?
  45202. var hasProto = '__proto__' in {};
  45203. // Browser environment sniffing
  45204. var inBrowser = typeof window !== 'undefined';
  45205. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  45206. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  45207. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  45208. var isIE = UA && /msie|trident/.test(UA);
  45209. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  45210. var isEdge = UA && UA.indexOf('edge/') > 0;
  45211. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  45212. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  45213. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  45214. var isPhantomJS = UA && /phantomjs/.test(UA);
  45215. var isFF = UA && UA.match(/firefox\/(\d+)/);
  45216. // Firefox has a "watch" function on Object.prototype...
  45217. var nativeWatch = ({}).watch;
  45218. var supportsPassive = false;
  45219. if (inBrowser) {
  45220. try {
  45221. var opts = {};
  45222. Object.defineProperty(opts, 'passive', ({
  45223. get: function get () {
  45224. /* istanbul ignore next */
  45225. supportsPassive = true;
  45226. }
  45227. })); // https://github.com/facebook/flow/issues/285
  45228. window.addEventListener('test-passive', null, opts);
  45229. } catch (e) {}
  45230. }
  45231. // this needs to be lazy-evaled because vue may be required before
  45232. // vue-server-renderer can set VUE_ENV
  45233. var _isServer;
  45234. var isServerRendering = function () {
  45235. if (_isServer === undefined) {
  45236. /* istanbul ignore if */
  45237. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  45238. // detect presence of vue-server-renderer and avoid
  45239. // Webpack shimming the process
  45240. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  45241. } else {
  45242. _isServer = false;
  45243. }
  45244. }
  45245. return _isServer
  45246. };
  45247. // detect devtools
  45248. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  45249. /* istanbul ignore next */
  45250. function isNative (Ctor) {
  45251. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  45252. }
  45253. var hasSymbol =
  45254. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  45255. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  45256. var _Set;
  45257. /* istanbul ignore if */ // $flow-disable-line
  45258. if (typeof Set !== 'undefined' && isNative(Set)) {
  45259. // use native Set when available.
  45260. _Set = Set;
  45261. } else {
  45262. // a non-standard Set polyfill that only works with primitive keys.
  45263. _Set = /*@__PURE__*/(function () {
  45264. function Set () {
  45265. this.set = Object.create(null);
  45266. }
  45267. Set.prototype.has = function has (key) {
  45268. return this.set[key] === true
  45269. };
  45270. Set.prototype.add = function add (key) {
  45271. this.set[key] = true;
  45272. };
  45273. Set.prototype.clear = function clear () {
  45274. this.set = Object.create(null);
  45275. };
  45276. return Set;
  45277. }());
  45278. }
  45279. /* */
  45280. var warn = noop;
  45281. var tip = noop;
  45282. var generateComponentTrace = (noop); // work around flow check
  45283. var formatComponentName = (noop);
  45284. {
  45285. var hasConsole = typeof console !== 'undefined';
  45286. var classifyRE = /(?:^|[-_])(\w)/g;
  45287. var classify = function (str) { return str
  45288. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  45289. .replace(/[-_]/g, ''); };
  45290. warn = function (msg, vm) {
  45291. var trace = vm ? generateComponentTrace(vm) : '';
  45292. if (config.warnHandler) {
  45293. config.warnHandler.call(null, msg, vm, trace);
  45294. } else if (hasConsole && (!config.silent)) {
  45295. console.error(("[Vue warn]: " + msg + trace));
  45296. }
  45297. };
  45298. tip = function (msg, vm) {
  45299. if (hasConsole && (!config.silent)) {
  45300. console.warn("[Vue tip]: " + msg + (
  45301. vm ? generateComponentTrace(vm) : ''
  45302. ));
  45303. }
  45304. };
  45305. formatComponentName = function (vm, includeFile) {
  45306. if (vm.$root === vm) {
  45307. return '<Root>'
  45308. }
  45309. var options = typeof vm === 'function' && vm.cid != null
  45310. ? vm.options
  45311. : vm._isVue
  45312. ? vm.$options || vm.constructor.options
  45313. : vm;
  45314. var name = options.name || options._componentTag;
  45315. var file = options.__file;
  45316. if (!name && file) {
  45317. var match = file.match(/([^/\\]+)\.vue$/);
  45318. name = match && match[1];
  45319. }
  45320. return (
  45321. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  45322. (file && includeFile !== false ? (" at " + file) : '')
  45323. )
  45324. };
  45325. var repeat = function (str, n) {
  45326. var res = '';
  45327. while (n) {
  45328. if (n % 2 === 1) { res += str; }
  45329. if (n > 1) { str += str; }
  45330. n >>= 1;
  45331. }
  45332. return res
  45333. };
  45334. generateComponentTrace = function (vm) {
  45335. if (vm._isVue && vm.$parent) {
  45336. var tree = [];
  45337. var currentRecursiveSequence = 0;
  45338. while (vm) {
  45339. if (tree.length > 0) {
  45340. var last = tree[tree.length - 1];
  45341. if (last.constructor === vm.constructor) {
  45342. currentRecursiveSequence++;
  45343. vm = vm.$parent;
  45344. continue
  45345. } else if (currentRecursiveSequence > 0) {
  45346. tree[tree.length - 1] = [last, currentRecursiveSequence];
  45347. currentRecursiveSequence = 0;
  45348. }
  45349. }
  45350. tree.push(vm);
  45351. vm = vm.$parent;
  45352. }
  45353. return '\n\nfound in\n\n' + tree
  45354. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  45355. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  45356. : formatComponentName(vm))); })
  45357. .join('\n')
  45358. } else {
  45359. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  45360. }
  45361. };
  45362. }
  45363. /* */
  45364. var uid = 0;
  45365. /**
  45366. * A dep is an observable that can have multiple
  45367. * directives subscribing to it.
  45368. */
  45369. var Dep = function Dep () {
  45370. this.id = uid++;
  45371. this.subs = [];
  45372. };
  45373. Dep.prototype.addSub = function addSub (sub) {
  45374. this.subs.push(sub);
  45375. };
  45376. Dep.prototype.removeSub = function removeSub (sub) {
  45377. remove(this.subs, sub);
  45378. };
  45379. Dep.prototype.depend = function depend () {
  45380. if (Dep.target) {
  45381. Dep.target.addDep(this);
  45382. }
  45383. };
  45384. Dep.prototype.notify = function notify () {
  45385. // stabilize the subscriber list first
  45386. var subs = this.subs.slice();
  45387. if (!config.async) {
  45388. // subs aren't sorted in scheduler if not running async
  45389. // we need to sort them now to make sure they fire in correct
  45390. // order
  45391. subs.sort(function (a, b) { return a.id - b.id; });
  45392. }
  45393. for (var i = 0, l = subs.length; i < l; i++) {
  45394. subs[i].update();
  45395. }
  45396. };
  45397. // The current target watcher being evaluated.
  45398. // This is globally unique because only one watcher
  45399. // can be evaluated at a time.
  45400. Dep.target = null;
  45401. var targetStack = [];
  45402. function pushTarget (target) {
  45403. targetStack.push(target);
  45404. Dep.target = target;
  45405. }
  45406. function popTarget () {
  45407. targetStack.pop();
  45408. Dep.target = targetStack[targetStack.length - 1];
  45409. }
  45410. /* */
  45411. var VNode = function VNode (
  45412. tag,
  45413. data,
  45414. children,
  45415. text,
  45416. elm,
  45417. context,
  45418. componentOptions,
  45419. asyncFactory
  45420. ) {
  45421. this.tag = tag;
  45422. this.data = data;
  45423. this.children = children;
  45424. this.text = text;
  45425. this.elm = elm;
  45426. this.ns = undefined;
  45427. this.context = context;
  45428. this.fnContext = undefined;
  45429. this.fnOptions = undefined;
  45430. this.fnScopeId = undefined;
  45431. this.key = data && data.key;
  45432. this.componentOptions = componentOptions;
  45433. this.componentInstance = undefined;
  45434. this.parent = undefined;
  45435. this.raw = false;
  45436. this.isStatic = false;
  45437. this.isRootInsert = true;
  45438. this.isComment = false;
  45439. this.isCloned = false;
  45440. this.isOnce = false;
  45441. this.asyncFactory = asyncFactory;
  45442. this.asyncMeta = undefined;
  45443. this.isAsyncPlaceholder = false;
  45444. };
  45445. var prototypeAccessors = { child: { configurable: true } };
  45446. // DEPRECATED: alias for componentInstance for backwards compat.
  45447. /* istanbul ignore next */
  45448. prototypeAccessors.child.get = function () {
  45449. return this.componentInstance
  45450. };
  45451. Object.defineProperties( VNode.prototype, prototypeAccessors );
  45452. var createEmptyVNode = function (text) {
  45453. if ( text === void 0 ) text = '';
  45454. var node = new VNode();
  45455. node.text = text;
  45456. node.isComment = true;
  45457. return node
  45458. };
  45459. function createTextVNode (val) {
  45460. return new VNode(undefined, undefined, undefined, String(val))
  45461. }
  45462. // optimized shallow clone
  45463. // used for static nodes and slot nodes because they may be reused across
  45464. // multiple renders, cloning them avoids errors when DOM manipulations rely
  45465. // on their elm reference.
  45466. function cloneVNode (vnode) {
  45467. var cloned = new VNode(
  45468. vnode.tag,
  45469. vnode.data,
  45470. // #7975
  45471. // clone children array to avoid mutating original in case of cloning
  45472. // a child.
  45473. vnode.children && vnode.children.slice(),
  45474. vnode.text,
  45475. vnode.elm,
  45476. vnode.context,
  45477. vnode.componentOptions,
  45478. vnode.asyncFactory
  45479. );
  45480. cloned.ns = vnode.ns;
  45481. cloned.isStatic = vnode.isStatic;
  45482. cloned.key = vnode.key;
  45483. cloned.isComment = vnode.isComment;
  45484. cloned.fnContext = vnode.fnContext;
  45485. cloned.fnOptions = vnode.fnOptions;
  45486. cloned.fnScopeId = vnode.fnScopeId;
  45487. cloned.asyncMeta = vnode.asyncMeta;
  45488. cloned.isCloned = true;
  45489. return cloned
  45490. }
  45491. /*
  45492. * not type checking this file because flow doesn't play well with
  45493. * dynamically accessing methods on Array prototype
  45494. */
  45495. var arrayProto = Array.prototype;
  45496. var arrayMethods = Object.create(arrayProto);
  45497. var methodsToPatch = [
  45498. 'push',
  45499. 'pop',
  45500. 'shift',
  45501. 'unshift',
  45502. 'splice',
  45503. 'sort',
  45504. 'reverse'
  45505. ];
  45506. /**
  45507. * Intercept mutating methods and emit events
  45508. */
  45509. methodsToPatch.forEach(function (method) {
  45510. // cache original method
  45511. var original = arrayProto[method];
  45512. def(arrayMethods, method, function mutator () {
  45513. var args = [], len = arguments.length;
  45514. while ( len-- ) args[ len ] = arguments[ len ];
  45515. var result = original.apply(this, args);
  45516. var ob = this.__ob__;
  45517. var inserted;
  45518. switch (method) {
  45519. case 'push':
  45520. case 'unshift':
  45521. inserted = args;
  45522. break
  45523. case 'splice':
  45524. inserted = args.slice(2);
  45525. break
  45526. }
  45527. if (inserted) { ob.observeArray(inserted); }
  45528. // notify change
  45529. ob.dep.notify();
  45530. return result
  45531. });
  45532. });
  45533. /* */
  45534. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  45535. /**
  45536. * In some cases we may want to disable observation inside a component's
  45537. * update computation.
  45538. */
  45539. var shouldObserve = true;
  45540. function toggleObserving (value) {
  45541. shouldObserve = value;
  45542. }
  45543. /**
  45544. * Observer class that is attached to each observed
  45545. * object. Once attached, the observer converts the target
  45546. * object's property keys into getter/setters that
  45547. * collect dependencies and dispatch updates.
  45548. */
  45549. var Observer = function Observer (value) {
  45550. this.value = value;
  45551. this.dep = new Dep();
  45552. this.vmCount = 0;
  45553. def(value, '__ob__', this);
  45554. if (Array.isArray(value)) {
  45555. if (hasProto) {
  45556. protoAugment(value, arrayMethods);
  45557. } else {
  45558. copyAugment(value, arrayMethods, arrayKeys);
  45559. }
  45560. this.observeArray(value);
  45561. } else {
  45562. this.walk(value);
  45563. }
  45564. };
  45565. /**
  45566. * Walk through all properties and convert them into
  45567. * getter/setters. This method should only be called when
  45568. * value type is Object.
  45569. */
  45570. Observer.prototype.walk = function walk (obj) {
  45571. var keys = Object.keys(obj);
  45572. for (var i = 0; i < keys.length; i++) {
  45573. defineReactive$$1(obj, keys[i]);
  45574. }
  45575. };
  45576. /**
  45577. * Observe a list of Array items.
  45578. */
  45579. Observer.prototype.observeArray = function observeArray (items) {
  45580. for (var i = 0, l = items.length; i < l; i++) {
  45581. observe(items[i]);
  45582. }
  45583. };
  45584. // helpers
  45585. /**
  45586. * Augment a target Object or Array by intercepting
  45587. * the prototype chain using __proto__
  45588. */
  45589. function protoAugment (target, src) {
  45590. /* eslint-disable no-proto */
  45591. target.__proto__ = src;
  45592. /* eslint-enable no-proto */
  45593. }
  45594. /**
  45595. * Augment a target Object or Array by defining
  45596. * hidden properties.
  45597. */
  45598. /* istanbul ignore next */
  45599. function copyAugment (target, src, keys) {
  45600. for (var i = 0, l = keys.length; i < l; i++) {
  45601. var key = keys[i];
  45602. def(target, key, src[key]);
  45603. }
  45604. }
  45605. /**
  45606. * Attempt to create an observer instance for a value,
  45607. * returns the new observer if successfully observed,
  45608. * or the existing observer if the value already has one.
  45609. */
  45610. function observe (value, asRootData) {
  45611. if (!isObject(value) || value instanceof VNode) {
  45612. return
  45613. }
  45614. var ob;
  45615. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  45616. ob = value.__ob__;
  45617. } else if (
  45618. shouldObserve &&
  45619. !isServerRendering() &&
  45620. (Array.isArray(value) || isPlainObject(value)) &&
  45621. Object.isExtensible(value) &&
  45622. !value._isVue
  45623. ) {
  45624. ob = new Observer(value);
  45625. }
  45626. if (asRootData && ob) {
  45627. ob.vmCount++;
  45628. }
  45629. return ob
  45630. }
  45631. /**
  45632. * Define a reactive property on an Object.
  45633. */
  45634. function defineReactive$$1 (
  45635. obj,
  45636. key,
  45637. val,
  45638. customSetter,
  45639. shallow
  45640. ) {
  45641. var dep = new Dep();
  45642. var property = Object.getOwnPropertyDescriptor(obj, key);
  45643. if (property && property.configurable === false) {
  45644. return
  45645. }
  45646. // cater for pre-defined getter/setters
  45647. var getter = property && property.get;
  45648. var setter = property && property.set;
  45649. if ((!getter || setter) && arguments.length === 2) {
  45650. val = obj[key];
  45651. }
  45652. var childOb = !shallow && observe(val);
  45653. Object.defineProperty(obj, key, {
  45654. enumerable: true,
  45655. configurable: true,
  45656. get: function reactiveGetter () {
  45657. var value = getter ? getter.call(obj) : val;
  45658. if (Dep.target) {
  45659. dep.depend();
  45660. if (childOb) {
  45661. childOb.dep.depend();
  45662. if (Array.isArray(value)) {
  45663. dependArray(value);
  45664. }
  45665. }
  45666. }
  45667. return value
  45668. },
  45669. set: function reactiveSetter (newVal) {
  45670. var value = getter ? getter.call(obj) : val;
  45671. /* eslint-disable no-self-compare */
  45672. if (newVal === value || (newVal !== newVal && value !== value)) {
  45673. return
  45674. }
  45675. /* eslint-enable no-self-compare */
  45676. if (customSetter) {
  45677. customSetter();
  45678. }
  45679. // #7981: for accessor properties without setter
  45680. if (getter && !setter) { return }
  45681. if (setter) {
  45682. setter.call(obj, newVal);
  45683. } else {
  45684. val = newVal;
  45685. }
  45686. childOb = !shallow && observe(newVal);
  45687. dep.notify();
  45688. }
  45689. });
  45690. }
  45691. /**
  45692. * Set a property on an object. Adds the new property and
  45693. * triggers change notification if the property doesn't
  45694. * already exist.
  45695. */
  45696. function set (target, key, val) {
  45697. if (isUndef(target) || isPrimitive(target)
  45698. ) {
  45699. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  45700. }
  45701. if (Array.isArray(target) && isValidArrayIndex(key)) {
  45702. target.length = Math.max(target.length, key);
  45703. target.splice(key, 1, val);
  45704. return val
  45705. }
  45706. if (key in target && !(key in Object.prototype)) {
  45707. target[key] = val;
  45708. return val
  45709. }
  45710. var ob = (target).__ob__;
  45711. if (target._isVue || (ob && ob.vmCount)) {
  45712. warn(
  45713. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  45714. 'at runtime - declare it upfront in the data option.'
  45715. );
  45716. return val
  45717. }
  45718. if (!ob) {
  45719. target[key] = val;
  45720. return val
  45721. }
  45722. defineReactive$$1(ob.value, key, val);
  45723. ob.dep.notify();
  45724. return val
  45725. }
  45726. /**
  45727. * Delete a property and trigger change if necessary.
  45728. */
  45729. function del (target, key) {
  45730. if (isUndef(target) || isPrimitive(target)
  45731. ) {
  45732. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  45733. }
  45734. if (Array.isArray(target) && isValidArrayIndex(key)) {
  45735. target.splice(key, 1);
  45736. return
  45737. }
  45738. var ob = (target).__ob__;
  45739. if (target._isVue || (ob && ob.vmCount)) {
  45740. warn(
  45741. 'Avoid deleting properties on a Vue instance or its root $data ' +
  45742. '- just set it to null.'
  45743. );
  45744. return
  45745. }
  45746. if (!hasOwn(target, key)) {
  45747. return
  45748. }
  45749. delete target[key];
  45750. if (!ob) {
  45751. return
  45752. }
  45753. ob.dep.notify();
  45754. }
  45755. /**
  45756. * Collect dependencies on array elements when the array is touched, since
  45757. * we cannot intercept array element access like property getters.
  45758. */
  45759. function dependArray (value) {
  45760. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  45761. e = value[i];
  45762. e && e.__ob__ && e.__ob__.dep.depend();
  45763. if (Array.isArray(e)) {
  45764. dependArray(e);
  45765. }
  45766. }
  45767. }
  45768. /* */
  45769. /**
  45770. * Option overwriting strategies are functions that handle
  45771. * how to merge a parent option value and a child option
  45772. * value into the final value.
  45773. */
  45774. var strats = config.optionMergeStrategies;
  45775. /**
  45776. * Options with restrictions
  45777. */
  45778. {
  45779. strats.el = strats.propsData = function (parent, child, vm, key) {
  45780. if (!vm) {
  45781. warn(
  45782. "option \"" + key + "\" can only be used during instance " +
  45783. 'creation with the `new` keyword.'
  45784. );
  45785. }
  45786. return defaultStrat(parent, child)
  45787. };
  45788. }
  45789. /**
  45790. * Helper that recursively merges two data objects together.
  45791. */
  45792. function mergeData (to, from) {
  45793. if (!from) { return to }
  45794. var key, toVal, fromVal;
  45795. var keys = hasSymbol
  45796. ? Reflect.ownKeys(from)
  45797. : Object.keys(from);
  45798. for (var i = 0; i < keys.length; i++) {
  45799. key = keys[i];
  45800. // in case the object is already observed...
  45801. if (key === '__ob__') { continue }
  45802. toVal = to[key];
  45803. fromVal = from[key];
  45804. if (!hasOwn(to, key)) {
  45805. set(to, key, fromVal);
  45806. } else if (
  45807. toVal !== fromVal &&
  45808. isPlainObject(toVal) &&
  45809. isPlainObject(fromVal)
  45810. ) {
  45811. mergeData(toVal, fromVal);
  45812. }
  45813. }
  45814. return to
  45815. }
  45816. /**
  45817. * Data
  45818. */
  45819. function mergeDataOrFn (
  45820. parentVal,
  45821. childVal,
  45822. vm
  45823. ) {
  45824. if (!vm) {
  45825. // in a Vue.extend merge, both should be functions
  45826. if (!childVal) {
  45827. return parentVal
  45828. }
  45829. if (!parentVal) {
  45830. return childVal
  45831. }
  45832. // when parentVal & childVal are both present,
  45833. // we need to return a function that returns the
  45834. // merged result of both functions... no need to
  45835. // check if parentVal is a function here because
  45836. // it has to be a function to pass previous merges.
  45837. return function mergedDataFn () {
  45838. return mergeData(
  45839. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  45840. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  45841. )
  45842. }
  45843. } else {
  45844. return function mergedInstanceDataFn () {
  45845. // instance merge
  45846. var instanceData = typeof childVal === 'function'
  45847. ? childVal.call(vm, vm)
  45848. : childVal;
  45849. var defaultData = typeof parentVal === 'function'
  45850. ? parentVal.call(vm, vm)
  45851. : parentVal;
  45852. if (instanceData) {
  45853. return mergeData(instanceData, defaultData)
  45854. } else {
  45855. return defaultData
  45856. }
  45857. }
  45858. }
  45859. }
  45860. strats.data = function (
  45861. parentVal,
  45862. childVal,
  45863. vm
  45864. ) {
  45865. if (!vm) {
  45866. if (childVal && typeof childVal !== 'function') {
  45867. warn(
  45868. 'The "data" option should be a function ' +
  45869. 'that returns a per-instance value in component ' +
  45870. 'definitions.',
  45871. vm
  45872. );
  45873. return parentVal
  45874. }
  45875. return mergeDataOrFn(parentVal, childVal)
  45876. }
  45877. return mergeDataOrFn(parentVal, childVal, vm)
  45878. };
  45879. /**
  45880. * Hooks and props are merged as arrays.
  45881. */
  45882. function mergeHook (
  45883. parentVal,
  45884. childVal
  45885. ) {
  45886. var res = childVal
  45887. ? parentVal
  45888. ? parentVal.concat(childVal)
  45889. : Array.isArray(childVal)
  45890. ? childVal
  45891. : [childVal]
  45892. : parentVal;
  45893. return res
  45894. ? dedupeHooks(res)
  45895. : res
  45896. }
  45897. function dedupeHooks (hooks) {
  45898. var res = [];
  45899. for (var i = 0; i < hooks.length; i++) {
  45900. if (res.indexOf(hooks[i]) === -1) {
  45901. res.push(hooks[i]);
  45902. }
  45903. }
  45904. return res
  45905. }
  45906. LIFECYCLE_HOOKS.forEach(function (hook) {
  45907. strats[hook] = mergeHook;
  45908. });
  45909. /**
  45910. * Assets
  45911. *
  45912. * When a vm is present (instance creation), we need to do
  45913. * a three-way merge between constructor options, instance
  45914. * options and parent options.
  45915. */
  45916. function mergeAssets (
  45917. parentVal,
  45918. childVal,
  45919. vm,
  45920. key
  45921. ) {
  45922. var res = Object.create(parentVal || null);
  45923. if (childVal) {
  45924. assertObjectType(key, childVal, vm);
  45925. return extend(res, childVal)
  45926. } else {
  45927. return res
  45928. }
  45929. }
  45930. ASSET_TYPES.forEach(function (type) {
  45931. strats[type + 's'] = mergeAssets;
  45932. });
  45933. /**
  45934. * Watchers.
  45935. *
  45936. * Watchers hashes should not overwrite one
  45937. * another, so we merge them as arrays.
  45938. */
  45939. strats.watch = function (
  45940. parentVal,
  45941. childVal,
  45942. vm,
  45943. key
  45944. ) {
  45945. // work around Firefox's Object.prototype.watch...
  45946. if (parentVal === nativeWatch) { parentVal = undefined; }
  45947. if (childVal === nativeWatch) { childVal = undefined; }
  45948. /* istanbul ignore if */
  45949. if (!childVal) { return Object.create(parentVal || null) }
  45950. {
  45951. assertObjectType(key, childVal, vm);
  45952. }
  45953. if (!parentVal) { return childVal }
  45954. var ret = {};
  45955. extend(ret, parentVal);
  45956. for (var key$1 in childVal) {
  45957. var parent = ret[key$1];
  45958. var child = childVal[key$1];
  45959. if (parent && !Array.isArray(parent)) {
  45960. parent = [parent];
  45961. }
  45962. ret[key$1] = parent
  45963. ? parent.concat(child)
  45964. : Array.isArray(child) ? child : [child];
  45965. }
  45966. return ret
  45967. };
  45968. /**
  45969. * Other object hashes.
  45970. */
  45971. strats.props =
  45972. strats.methods =
  45973. strats.inject =
  45974. strats.computed = function (
  45975. parentVal,
  45976. childVal,
  45977. vm,
  45978. key
  45979. ) {
  45980. if (childVal && "development" !== 'production') {
  45981. assertObjectType(key, childVal, vm);
  45982. }
  45983. if (!parentVal) { return childVal }
  45984. var ret = Object.create(null);
  45985. extend(ret, parentVal);
  45986. if (childVal) { extend(ret, childVal); }
  45987. return ret
  45988. };
  45989. strats.provide = mergeDataOrFn;
  45990. /**
  45991. * Default strategy.
  45992. */
  45993. var defaultStrat = function (parentVal, childVal) {
  45994. return childVal === undefined
  45995. ? parentVal
  45996. : childVal
  45997. };
  45998. /**
  45999. * Validate component names
  46000. */
  46001. function checkComponents (options) {
  46002. for (var key in options.components) {
  46003. validateComponentName(key);
  46004. }
  46005. }
  46006. function validateComponentName (name) {
  46007. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  46008. warn(
  46009. 'Invalid component name: "' + name + '". Component names ' +
  46010. 'should conform to valid custom element name in html5 specification.'
  46011. );
  46012. }
  46013. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  46014. warn(
  46015. 'Do not use built-in or reserved HTML elements as component ' +
  46016. 'id: ' + name
  46017. );
  46018. }
  46019. }
  46020. /**
  46021. * Ensure all props option syntax are normalized into the
  46022. * Object-based format.
  46023. */
  46024. function normalizeProps (options, vm) {
  46025. var props = options.props;
  46026. if (!props) { return }
  46027. var res = {};
  46028. var i, val, name;
  46029. if (Array.isArray(props)) {
  46030. i = props.length;
  46031. while (i--) {
  46032. val = props[i];
  46033. if (typeof val === 'string') {
  46034. name = camelize(val);
  46035. res[name] = { type: null };
  46036. } else {
  46037. warn('props must be strings when using array syntax.');
  46038. }
  46039. }
  46040. } else if (isPlainObject(props)) {
  46041. for (var key in props) {
  46042. val = props[key];
  46043. name = camelize(key);
  46044. res[name] = isPlainObject(val)
  46045. ? val
  46046. : { type: val };
  46047. }
  46048. } else {
  46049. warn(
  46050. "Invalid value for option \"props\": expected an Array or an Object, " +
  46051. "but got " + (toRawType(props)) + ".",
  46052. vm
  46053. );
  46054. }
  46055. options.props = res;
  46056. }
  46057. /**
  46058. * Normalize all injections into Object-based format
  46059. */
  46060. function normalizeInject (options, vm) {
  46061. var inject = options.inject;
  46062. if (!inject) { return }
  46063. var normalized = options.inject = {};
  46064. if (Array.isArray(inject)) {
  46065. for (var i = 0; i < inject.length; i++) {
  46066. normalized[inject[i]] = { from: inject[i] };
  46067. }
  46068. } else if (isPlainObject(inject)) {
  46069. for (var key in inject) {
  46070. var val = inject[key];
  46071. normalized[key] = isPlainObject(val)
  46072. ? extend({ from: key }, val)
  46073. : { from: val };
  46074. }
  46075. } else {
  46076. warn(
  46077. "Invalid value for option \"inject\": expected an Array or an Object, " +
  46078. "but got " + (toRawType(inject)) + ".",
  46079. vm
  46080. );
  46081. }
  46082. }
  46083. /**
  46084. * Normalize raw function directives into object format.
  46085. */
  46086. function normalizeDirectives (options) {
  46087. var dirs = options.directives;
  46088. if (dirs) {
  46089. for (var key in dirs) {
  46090. var def$$1 = dirs[key];
  46091. if (typeof def$$1 === 'function') {
  46092. dirs[key] = { bind: def$$1, update: def$$1 };
  46093. }
  46094. }
  46095. }
  46096. }
  46097. function assertObjectType (name, value, vm) {
  46098. if (!isPlainObject(value)) {
  46099. warn(
  46100. "Invalid value for option \"" + name + "\": expected an Object, " +
  46101. "but got " + (toRawType(value)) + ".",
  46102. vm
  46103. );
  46104. }
  46105. }
  46106. /**
  46107. * Merge two option objects into a new one.
  46108. * Core utility used in both instantiation and inheritance.
  46109. */
  46110. function mergeOptions (
  46111. parent,
  46112. child,
  46113. vm
  46114. ) {
  46115. {
  46116. checkComponents(child);
  46117. }
  46118. if (typeof child === 'function') {
  46119. child = child.options;
  46120. }
  46121. normalizeProps(child, vm);
  46122. normalizeInject(child, vm);
  46123. normalizeDirectives(child);
  46124. // Apply extends and mixins on the child options,
  46125. // but only if it is a raw options object that isn't
  46126. // the result of another mergeOptions call.
  46127. // Only merged options has the _base property.
  46128. if (!child._base) {
  46129. if (child.extends) {
  46130. parent = mergeOptions(parent, child.extends, vm);
  46131. }
  46132. if (child.mixins) {
  46133. for (var i = 0, l = child.mixins.length; i < l; i++) {
  46134. parent = mergeOptions(parent, child.mixins[i], vm);
  46135. }
  46136. }
  46137. }
  46138. var options = {};
  46139. var key;
  46140. for (key in parent) {
  46141. mergeField(key);
  46142. }
  46143. for (key in child) {
  46144. if (!hasOwn(parent, key)) {
  46145. mergeField(key);
  46146. }
  46147. }
  46148. function mergeField (key) {
  46149. var strat = strats[key] || defaultStrat;
  46150. options[key] = strat(parent[key], child[key], vm, key);
  46151. }
  46152. return options
  46153. }
  46154. /**
  46155. * Resolve an asset.
  46156. * This function is used because child instances need access
  46157. * to assets defined in its ancestor chain.
  46158. */
  46159. function resolveAsset (
  46160. options,
  46161. type,
  46162. id,
  46163. warnMissing
  46164. ) {
  46165. /* istanbul ignore if */
  46166. if (typeof id !== 'string') {
  46167. return
  46168. }
  46169. var assets = options[type];
  46170. // check local registration variations first
  46171. if (hasOwn(assets, id)) { return assets[id] }
  46172. var camelizedId = camelize(id);
  46173. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  46174. var PascalCaseId = capitalize(camelizedId);
  46175. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  46176. // fallback to prototype chain
  46177. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  46178. if (warnMissing && !res) {
  46179. warn(
  46180. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  46181. options
  46182. );
  46183. }
  46184. return res
  46185. }
  46186. /* */
  46187. function validateProp (
  46188. key,
  46189. propOptions,
  46190. propsData,
  46191. vm
  46192. ) {
  46193. var prop = propOptions[key];
  46194. var absent = !hasOwn(propsData, key);
  46195. var value = propsData[key];
  46196. // boolean casting
  46197. var booleanIndex = getTypeIndex(Boolean, prop.type);
  46198. if (booleanIndex > -1) {
  46199. if (absent && !hasOwn(prop, 'default')) {
  46200. value = false;
  46201. } else if (value === '' || value === hyphenate(key)) {
  46202. // only cast empty string / same name to boolean if
  46203. // boolean has higher priority
  46204. var stringIndex = getTypeIndex(String, prop.type);
  46205. if (stringIndex < 0 || booleanIndex < stringIndex) {
  46206. value = true;
  46207. }
  46208. }
  46209. }
  46210. // check default value
  46211. if (value === undefined) {
  46212. value = getPropDefaultValue(vm, prop, key);
  46213. // since the default value is a fresh copy,
  46214. // make sure to observe it.
  46215. var prevShouldObserve = shouldObserve;
  46216. toggleObserving(true);
  46217. observe(value);
  46218. toggleObserving(prevShouldObserve);
  46219. }
  46220. {
  46221. assertProp(prop, key, value, vm, absent);
  46222. }
  46223. return value
  46224. }
  46225. /**
  46226. * Get the default value of a prop.
  46227. */
  46228. function getPropDefaultValue (vm, prop, key) {
  46229. // no default, return undefined
  46230. if (!hasOwn(prop, 'default')) {
  46231. return undefined
  46232. }
  46233. var def = prop.default;
  46234. // warn against non-factory defaults for Object & Array
  46235. if (isObject(def)) {
  46236. warn(
  46237. 'Invalid default value for prop "' + key + '": ' +
  46238. 'Props with type Object/Array must use a factory function ' +
  46239. 'to return the default value.',
  46240. vm
  46241. );
  46242. }
  46243. // the raw prop value was also undefined from previous render,
  46244. // return previous default value to avoid unnecessary watcher trigger
  46245. if (vm && vm.$options.propsData &&
  46246. vm.$options.propsData[key] === undefined &&
  46247. vm._props[key] !== undefined
  46248. ) {
  46249. return vm._props[key]
  46250. }
  46251. // call factory function for non-Function types
  46252. // a value is Function if its prototype is function even across different execution context
  46253. return typeof def === 'function' && getType(prop.type) !== 'Function'
  46254. ? def.call(vm)
  46255. : def
  46256. }
  46257. /**
  46258. * Assert whether a prop is valid.
  46259. */
  46260. function assertProp (
  46261. prop,
  46262. name,
  46263. value,
  46264. vm,
  46265. absent
  46266. ) {
  46267. if (prop.required && absent) {
  46268. warn(
  46269. 'Missing required prop: "' + name + '"',
  46270. vm
  46271. );
  46272. return
  46273. }
  46274. if (value == null && !prop.required) {
  46275. return
  46276. }
  46277. var type = prop.type;
  46278. var valid = !type || type === true;
  46279. var expectedTypes = [];
  46280. if (type) {
  46281. if (!Array.isArray(type)) {
  46282. type = [type];
  46283. }
  46284. for (var i = 0; i < type.length && !valid; i++) {
  46285. var assertedType = assertType(value, type[i]);
  46286. expectedTypes.push(assertedType.expectedType || '');
  46287. valid = assertedType.valid;
  46288. }
  46289. }
  46290. if (!valid) {
  46291. warn(
  46292. getInvalidTypeMessage(name, value, expectedTypes),
  46293. vm
  46294. );
  46295. return
  46296. }
  46297. var validator = prop.validator;
  46298. if (validator) {
  46299. if (!validator(value)) {
  46300. warn(
  46301. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  46302. vm
  46303. );
  46304. }
  46305. }
  46306. }
  46307. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  46308. function assertType (value, type) {
  46309. var valid;
  46310. var expectedType = getType(type);
  46311. if (simpleCheckRE.test(expectedType)) {
  46312. var t = typeof value;
  46313. valid = t === expectedType.toLowerCase();
  46314. // for primitive wrapper objects
  46315. if (!valid && t === 'object') {
  46316. valid = value instanceof type;
  46317. }
  46318. } else if (expectedType === 'Object') {
  46319. valid = isPlainObject(value);
  46320. } else if (expectedType === 'Array') {
  46321. valid = Array.isArray(value);
  46322. } else {
  46323. valid = value instanceof type;
  46324. }
  46325. return {
  46326. valid: valid,
  46327. expectedType: expectedType
  46328. }
  46329. }
  46330. /**
  46331. * Use function string name to check built-in types,
  46332. * because a simple equality check will fail when running
  46333. * across different vms / iframes.
  46334. */
  46335. function getType (fn) {
  46336. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  46337. return match ? match[1] : ''
  46338. }
  46339. function isSameType (a, b) {
  46340. return getType(a) === getType(b)
  46341. }
  46342. function getTypeIndex (type, expectedTypes) {
  46343. if (!Array.isArray(expectedTypes)) {
  46344. return isSameType(expectedTypes, type) ? 0 : -1
  46345. }
  46346. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  46347. if (isSameType(expectedTypes[i], type)) {
  46348. return i
  46349. }
  46350. }
  46351. return -1
  46352. }
  46353. function getInvalidTypeMessage (name, value, expectedTypes) {
  46354. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  46355. " Expected " + (expectedTypes.map(capitalize).join(', '));
  46356. var expectedType = expectedTypes[0];
  46357. var receivedType = toRawType(value);
  46358. var expectedValue = styleValue(value, expectedType);
  46359. var receivedValue = styleValue(value, receivedType);
  46360. // check if we need to specify expected value
  46361. if (expectedTypes.length === 1 &&
  46362. isExplicable(expectedType) &&
  46363. !isBoolean(expectedType, receivedType)) {
  46364. message += " with value " + expectedValue;
  46365. }
  46366. message += ", got " + receivedType + " ";
  46367. // check if we need to specify received value
  46368. if (isExplicable(receivedType)) {
  46369. message += "with value " + receivedValue + ".";
  46370. }
  46371. return message
  46372. }
  46373. function styleValue (value, type) {
  46374. if (type === 'String') {
  46375. return ("\"" + value + "\"")
  46376. } else if (type === 'Number') {
  46377. return ("" + (Number(value)))
  46378. } else {
  46379. return ("" + value)
  46380. }
  46381. }
  46382. function isExplicable (value) {
  46383. var explicitTypes = ['string', 'number', 'boolean'];
  46384. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  46385. }
  46386. function isBoolean () {
  46387. var args = [], len = arguments.length;
  46388. while ( len-- ) args[ len ] = arguments[ len ];
  46389. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  46390. }
  46391. /* */
  46392. function handleError (err, vm, info) {
  46393. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  46394. // See: https://github.com/vuejs/vuex/issues/1505
  46395. pushTarget();
  46396. try {
  46397. if (vm) {
  46398. var cur = vm;
  46399. while ((cur = cur.$parent)) {
  46400. var hooks = cur.$options.errorCaptured;
  46401. if (hooks) {
  46402. for (var i = 0; i < hooks.length; i++) {
  46403. try {
  46404. var capture = hooks[i].call(cur, err, vm, info) === false;
  46405. if (capture) { return }
  46406. } catch (e) {
  46407. globalHandleError(e, cur, 'errorCaptured hook');
  46408. }
  46409. }
  46410. }
  46411. }
  46412. }
  46413. globalHandleError(err, vm, info);
  46414. } finally {
  46415. popTarget();
  46416. }
  46417. }
  46418. function invokeWithErrorHandling (
  46419. handler,
  46420. context,
  46421. args,
  46422. vm,
  46423. info
  46424. ) {
  46425. var res;
  46426. try {
  46427. res = args ? handler.apply(context, args) : handler.call(context);
  46428. if (res && !res._isVue && isPromise(res) && !res._handled) {
  46429. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  46430. // issue #9511
  46431. // avoid catch triggering multiple times when nested calls
  46432. res._handled = true;
  46433. }
  46434. } catch (e) {
  46435. handleError(e, vm, info);
  46436. }
  46437. return res
  46438. }
  46439. function globalHandleError (err, vm, info) {
  46440. if (config.errorHandler) {
  46441. try {
  46442. return config.errorHandler.call(null, err, vm, info)
  46443. } catch (e) {
  46444. // if the user intentionally throws the original error in the handler,
  46445. // do not log it twice
  46446. if (e !== err) {
  46447. logError(e, null, 'config.errorHandler');
  46448. }
  46449. }
  46450. }
  46451. logError(err, vm, info);
  46452. }
  46453. function logError (err, vm, info) {
  46454. {
  46455. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  46456. }
  46457. /* istanbul ignore else */
  46458. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  46459. console.error(err);
  46460. } else {
  46461. throw err
  46462. }
  46463. }
  46464. /* */
  46465. var isUsingMicroTask = false;
  46466. var callbacks = [];
  46467. var pending = false;
  46468. function flushCallbacks () {
  46469. pending = false;
  46470. var copies = callbacks.slice(0);
  46471. callbacks.length = 0;
  46472. for (var i = 0; i < copies.length; i++) {
  46473. copies[i]();
  46474. }
  46475. }
  46476. // Here we have async deferring wrappers using microtasks.
  46477. // In 2.5 we used (macro) tasks (in combination with microtasks).
  46478. // However, it has subtle problems when state is changed right before repaint
  46479. // (e.g. #6813, out-in transitions).
  46480. // Also, using (macro) tasks in event handler would cause some weird behaviors
  46481. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  46482. // So we now use microtasks everywhere, again.
  46483. // A major drawback of this tradeoff is that there are some scenarios
  46484. // where microtasks have too high a priority and fire in between supposedly
  46485. // sequential events (e.g. #4521, #6690, which have workarounds)
  46486. // or even between bubbling of the same event (#6566).
  46487. var timerFunc;
  46488. // The nextTick behavior leverages the microtask queue, which can be accessed
  46489. // via either native Promise.then or MutationObserver.
  46490. // MutationObserver has wider support, however it is seriously bugged in
  46491. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  46492. // completely stops working after triggering a few times... so, if native
  46493. // Promise is available, we will use it:
  46494. /* istanbul ignore next, $flow-disable-line */
  46495. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  46496. var p = Promise.resolve();
  46497. timerFunc = function () {
  46498. p.then(flushCallbacks);
  46499. // In problematic UIWebViews, Promise.then doesn't completely break, but
  46500. // it can get stuck in a weird state where callbacks are pushed into the
  46501. // microtask queue but the queue isn't being flushed, until the browser
  46502. // needs to do some other work, e.g. handle a timer. Therefore we can
  46503. // "force" the microtask queue to be flushed by adding an empty timer.
  46504. if (isIOS) { setTimeout(noop); }
  46505. };
  46506. isUsingMicroTask = true;
  46507. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  46508. isNative(MutationObserver) ||
  46509. // PhantomJS and iOS 7.x
  46510. MutationObserver.toString() === '[object MutationObserverConstructor]'
  46511. )) {
  46512. // Use MutationObserver where native Promise is not available,
  46513. // e.g. PhantomJS, iOS7, Android 4.4
  46514. // (#6466 MutationObserver is unreliable in IE11)
  46515. var counter = 1;
  46516. var observer = new MutationObserver(flushCallbacks);
  46517. var textNode = document.createTextNode(String(counter));
  46518. observer.observe(textNode, {
  46519. characterData: true
  46520. });
  46521. timerFunc = function () {
  46522. counter = (counter + 1) % 2;
  46523. textNode.data = String(counter);
  46524. };
  46525. isUsingMicroTask = true;
  46526. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  46527. // Fallback to setImmediate.
  46528. // Technically it leverages the (macro) task queue,
  46529. // but it is still a better choice than setTimeout.
  46530. timerFunc = function () {
  46531. setImmediate(flushCallbacks);
  46532. };
  46533. } else {
  46534. // Fallback to setTimeout.
  46535. timerFunc = function () {
  46536. setTimeout(flushCallbacks, 0);
  46537. };
  46538. }
  46539. function nextTick (cb, ctx) {
  46540. var _resolve;
  46541. callbacks.push(function () {
  46542. if (cb) {
  46543. try {
  46544. cb.call(ctx);
  46545. } catch (e) {
  46546. handleError(e, ctx, 'nextTick');
  46547. }
  46548. } else if (_resolve) {
  46549. _resolve(ctx);
  46550. }
  46551. });
  46552. if (!pending) {
  46553. pending = true;
  46554. timerFunc();
  46555. }
  46556. // $flow-disable-line
  46557. if (!cb && typeof Promise !== 'undefined') {
  46558. return new Promise(function (resolve) {
  46559. _resolve = resolve;
  46560. })
  46561. }
  46562. }
  46563. /* */
  46564. var mark;
  46565. var measure;
  46566. {
  46567. var perf = inBrowser && window.performance;
  46568. /* istanbul ignore if */
  46569. if (
  46570. perf &&
  46571. perf.mark &&
  46572. perf.measure &&
  46573. perf.clearMarks &&
  46574. perf.clearMeasures
  46575. ) {
  46576. mark = function (tag) { return perf.mark(tag); };
  46577. measure = function (name, startTag, endTag) {
  46578. perf.measure(name, startTag, endTag);
  46579. perf.clearMarks(startTag);
  46580. perf.clearMarks(endTag);
  46581. // perf.clearMeasures(name)
  46582. };
  46583. }
  46584. }
  46585. /* not type checking this file because flow doesn't play well with Proxy */
  46586. var initProxy;
  46587. {
  46588. var allowedGlobals = makeMap(
  46589. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  46590. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  46591. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  46592. 'require' // for Webpack/Browserify
  46593. );
  46594. var warnNonPresent = function (target, key) {
  46595. warn(
  46596. "Property or method \"" + key + "\" is not defined on the instance but " +
  46597. 'referenced during render. Make sure that this property is reactive, ' +
  46598. 'either in the data option, or for class-based components, by ' +
  46599. 'initializing the property. ' +
  46600. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  46601. target
  46602. );
  46603. };
  46604. var warnReservedPrefix = function (target, key) {
  46605. warn(
  46606. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  46607. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  46608. 'prevent conflicts with Vue internals. ' +
  46609. 'See: https://vuejs.org/v2/api/#data',
  46610. target
  46611. );
  46612. };
  46613. var hasProxy =
  46614. typeof Proxy !== 'undefined' && isNative(Proxy);
  46615. if (hasProxy) {
  46616. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  46617. config.keyCodes = new Proxy(config.keyCodes, {
  46618. set: function set (target, key, value) {
  46619. if (isBuiltInModifier(key)) {
  46620. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  46621. return false
  46622. } else {
  46623. target[key] = value;
  46624. return true
  46625. }
  46626. }
  46627. });
  46628. }
  46629. var hasHandler = {
  46630. has: function has (target, key) {
  46631. var has = key in target;
  46632. var isAllowed = allowedGlobals(key) ||
  46633. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  46634. if (!has && !isAllowed) {
  46635. if (key in target.$data) { warnReservedPrefix(target, key); }
  46636. else { warnNonPresent(target, key); }
  46637. }
  46638. return has || !isAllowed
  46639. }
  46640. };
  46641. var getHandler = {
  46642. get: function get (target, key) {
  46643. if (typeof key === 'string' && !(key in target)) {
  46644. if (key in target.$data) { warnReservedPrefix(target, key); }
  46645. else { warnNonPresent(target, key); }
  46646. }
  46647. return target[key]
  46648. }
  46649. };
  46650. initProxy = function initProxy (vm) {
  46651. if (hasProxy) {
  46652. // determine which proxy handler to use
  46653. var options = vm.$options;
  46654. var handlers = options.render && options.render._withStripped
  46655. ? getHandler
  46656. : hasHandler;
  46657. vm._renderProxy = new Proxy(vm, handlers);
  46658. } else {
  46659. vm._renderProxy = vm;
  46660. }
  46661. };
  46662. }
  46663. /* */
  46664. var seenObjects = new _Set();
  46665. /**
  46666. * Recursively traverse an object to evoke all converted
  46667. * getters, so that every nested property inside the object
  46668. * is collected as a "deep" dependency.
  46669. */
  46670. function traverse (val) {
  46671. _traverse(val, seenObjects);
  46672. seenObjects.clear();
  46673. }
  46674. function _traverse (val, seen) {
  46675. var i, keys;
  46676. var isA = Array.isArray(val);
  46677. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  46678. return
  46679. }
  46680. if (val.__ob__) {
  46681. var depId = val.__ob__.dep.id;
  46682. if (seen.has(depId)) {
  46683. return
  46684. }
  46685. seen.add(depId);
  46686. }
  46687. if (isA) {
  46688. i = val.length;
  46689. while (i--) { _traverse(val[i], seen); }
  46690. } else {
  46691. keys = Object.keys(val);
  46692. i = keys.length;
  46693. while (i--) { _traverse(val[keys[i]], seen); }
  46694. }
  46695. }
  46696. /* */
  46697. var normalizeEvent = cached(function (name) {
  46698. var passive = name.charAt(0) === '&';
  46699. name = passive ? name.slice(1) : name;
  46700. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  46701. name = once$$1 ? name.slice(1) : name;
  46702. var capture = name.charAt(0) === '!';
  46703. name = capture ? name.slice(1) : name;
  46704. return {
  46705. name: name,
  46706. once: once$$1,
  46707. capture: capture,
  46708. passive: passive
  46709. }
  46710. });
  46711. function createFnInvoker (fns, vm) {
  46712. function invoker () {
  46713. var arguments$1 = arguments;
  46714. var fns = invoker.fns;
  46715. if (Array.isArray(fns)) {
  46716. var cloned = fns.slice();
  46717. for (var i = 0; i < cloned.length; i++) {
  46718. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  46719. }
  46720. } else {
  46721. // return handler return value for single handlers
  46722. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  46723. }
  46724. }
  46725. invoker.fns = fns;
  46726. return invoker
  46727. }
  46728. function updateListeners (
  46729. on,
  46730. oldOn,
  46731. add,
  46732. remove$$1,
  46733. createOnceHandler,
  46734. vm
  46735. ) {
  46736. var name, def$$1, cur, old, event;
  46737. for (name in on) {
  46738. def$$1 = cur = on[name];
  46739. old = oldOn[name];
  46740. event = normalizeEvent(name);
  46741. if (isUndef(cur)) {
  46742. warn(
  46743. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  46744. vm
  46745. );
  46746. } else if (isUndef(old)) {
  46747. if (isUndef(cur.fns)) {
  46748. cur = on[name] = createFnInvoker(cur, vm);
  46749. }
  46750. if (isTrue(event.once)) {
  46751. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  46752. }
  46753. add(event.name, cur, event.capture, event.passive, event.params);
  46754. } else if (cur !== old) {
  46755. old.fns = cur;
  46756. on[name] = old;
  46757. }
  46758. }
  46759. for (name in oldOn) {
  46760. if (isUndef(on[name])) {
  46761. event = normalizeEvent(name);
  46762. remove$$1(event.name, oldOn[name], event.capture);
  46763. }
  46764. }
  46765. }
  46766. /* */
  46767. function mergeVNodeHook (def, hookKey, hook) {
  46768. if (def instanceof VNode) {
  46769. def = def.data.hook || (def.data.hook = {});
  46770. }
  46771. var invoker;
  46772. var oldHook = def[hookKey];
  46773. function wrappedHook () {
  46774. hook.apply(this, arguments);
  46775. // important: remove merged hook to ensure it's called only once
  46776. // and prevent memory leak
  46777. remove(invoker.fns, wrappedHook);
  46778. }
  46779. if (isUndef(oldHook)) {
  46780. // no existing hook
  46781. invoker = createFnInvoker([wrappedHook]);
  46782. } else {
  46783. /* istanbul ignore if */
  46784. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  46785. // already a merged invoker
  46786. invoker = oldHook;
  46787. invoker.fns.push(wrappedHook);
  46788. } else {
  46789. // existing plain hook
  46790. invoker = createFnInvoker([oldHook, wrappedHook]);
  46791. }
  46792. }
  46793. invoker.merged = true;
  46794. def[hookKey] = invoker;
  46795. }
  46796. /* */
  46797. function extractPropsFromVNodeData (
  46798. data,
  46799. Ctor,
  46800. tag
  46801. ) {
  46802. // we are only extracting raw values here.
  46803. // validation and default values are handled in the child
  46804. // component itself.
  46805. var propOptions = Ctor.options.props;
  46806. if (isUndef(propOptions)) {
  46807. return
  46808. }
  46809. var res = {};
  46810. var attrs = data.attrs;
  46811. var props = data.props;
  46812. if (isDef(attrs) || isDef(props)) {
  46813. for (var key in propOptions) {
  46814. var altKey = hyphenate(key);
  46815. {
  46816. var keyInLowerCase = key.toLowerCase();
  46817. if (
  46818. key !== keyInLowerCase &&
  46819. attrs && hasOwn(attrs, keyInLowerCase)
  46820. ) {
  46821. tip(
  46822. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  46823. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  46824. " \"" + key + "\". " +
  46825. "Note that HTML attributes are case-insensitive and camelCased " +
  46826. "props need to use their kebab-case equivalents when using in-DOM " +
  46827. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  46828. );
  46829. }
  46830. }
  46831. checkProp(res, props, key, altKey, true) ||
  46832. checkProp(res, attrs, key, altKey, false);
  46833. }
  46834. }
  46835. return res
  46836. }
  46837. function checkProp (
  46838. res,
  46839. hash,
  46840. key,
  46841. altKey,
  46842. preserve
  46843. ) {
  46844. if (isDef(hash)) {
  46845. if (hasOwn(hash, key)) {
  46846. res[key] = hash[key];
  46847. if (!preserve) {
  46848. delete hash[key];
  46849. }
  46850. return true
  46851. } else if (hasOwn(hash, altKey)) {
  46852. res[key] = hash[altKey];
  46853. if (!preserve) {
  46854. delete hash[altKey];
  46855. }
  46856. return true
  46857. }
  46858. }
  46859. return false
  46860. }
  46861. /* */
  46862. // The template compiler attempts to minimize the need for normalization by
  46863. // statically analyzing the template at compile time.
  46864. //
  46865. // For plain HTML markup, normalization can be completely skipped because the
  46866. // generated render function is guaranteed to return Array<VNode>. There are
  46867. // two cases where extra normalization is needed:
  46868. // 1. When the children contains components - because a functional component
  46869. // may return an Array instead of a single root. In this case, just a simple
  46870. // normalization is needed - if any child is an Array, we flatten the whole
  46871. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  46872. // because functional components already normalize their own children.
  46873. function simpleNormalizeChildren (children) {
  46874. for (var i = 0; i < children.length; i++) {
  46875. if (Array.isArray(children[i])) {
  46876. return Array.prototype.concat.apply([], children)
  46877. }
  46878. }
  46879. return children
  46880. }
  46881. // 2. When the children contains constructs that always generated nested Arrays,
  46882. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  46883. // with hand-written render functions / JSX. In such cases a full normalization
  46884. // is needed to cater to all possible types of children values.
  46885. function normalizeChildren (children) {
  46886. return isPrimitive(children)
  46887. ? [createTextVNode(children)]
  46888. : Array.isArray(children)
  46889. ? normalizeArrayChildren(children)
  46890. : undefined
  46891. }
  46892. function isTextNode (node) {
  46893. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  46894. }
  46895. function normalizeArrayChildren (children, nestedIndex) {
  46896. var res = [];
  46897. var i, c, lastIndex, last;
  46898. for (i = 0; i < children.length; i++) {
  46899. c = children[i];
  46900. if (isUndef(c) || typeof c === 'boolean') { continue }
  46901. lastIndex = res.length - 1;
  46902. last = res[lastIndex];
  46903. // nested
  46904. if (Array.isArray(c)) {
  46905. if (c.length > 0) {
  46906. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  46907. // merge adjacent text nodes
  46908. if (isTextNode(c[0]) && isTextNode(last)) {
  46909. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  46910. c.shift();
  46911. }
  46912. res.push.apply(res, c);
  46913. }
  46914. } else if (isPrimitive(c)) {
  46915. if (isTextNode(last)) {
  46916. // merge adjacent text nodes
  46917. // this is necessary for SSR hydration because text nodes are
  46918. // essentially merged when rendered to HTML strings
  46919. res[lastIndex] = createTextVNode(last.text + c);
  46920. } else if (c !== '') {
  46921. // convert primitive to vnode
  46922. res.push(createTextVNode(c));
  46923. }
  46924. } else {
  46925. if (isTextNode(c) && isTextNode(last)) {
  46926. // merge adjacent text nodes
  46927. res[lastIndex] = createTextVNode(last.text + c.text);
  46928. } else {
  46929. // default key for nested array children (likely generated by v-for)
  46930. if (isTrue(children._isVList) &&
  46931. isDef(c.tag) &&
  46932. isUndef(c.key) &&
  46933. isDef(nestedIndex)) {
  46934. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  46935. }
  46936. res.push(c);
  46937. }
  46938. }
  46939. }
  46940. return res
  46941. }
  46942. /* */
  46943. function initProvide (vm) {
  46944. var provide = vm.$options.provide;
  46945. if (provide) {
  46946. vm._provided = typeof provide === 'function'
  46947. ? provide.call(vm)
  46948. : provide;
  46949. }
  46950. }
  46951. function initInjections (vm) {
  46952. var result = resolveInject(vm.$options.inject, vm);
  46953. if (result) {
  46954. toggleObserving(false);
  46955. Object.keys(result).forEach(function (key) {
  46956. /* istanbul ignore else */
  46957. {
  46958. defineReactive$$1(vm, key, result[key], function () {
  46959. warn(
  46960. "Avoid mutating an injected value directly since the changes will be " +
  46961. "overwritten whenever the provided component re-renders. " +
  46962. "injection being mutated: \"" + key + "\"",
  46963. vm
  46964. );
  46965. });
  46966. }
  46967. });
  46968. toggleObserving(true);
  46969. }
  46970. }
  46971. function resolveInject (inject, vm) {
  46972. if (inject) {
  46973. // inject is :any because flow is not smart enough to figure out cached
  46974. var result = Object.create(null);
  46975. var keys = hasSymbol
  46976. ? Reflect.ownKeys(inject)
  46977. : Object.keys(inject);
  46978. for (var i = 0; i < keys.length; i++) {
  46979. var key = keys[i];
  46980. // #6574 in case the inject object is observed...
  46981. if (key === '__ob__') { continue }
  46982. var provideKey = inject[key].from;
  46983. var source = vm;
  46984. while (source) {
  46985. if (source._provided && hasOwn(source._provided, provideKey)) {
  46986. result[key] = source._provided[provideKey];
  46987. break
  46988. }
  46989. source = source.$parent;
  46990. }
  46991. if (!source) {
  46992. if ('default' in inject[key]) {
  46993. var provideDefault = inject[key].default;
  46994. result[key] = typeof provideDefault === 'function'
  46995. ? provideDefault.call(vm)
  46996. : provideDefault;
  46997. } else {
  46998. warn(("Injection \"" + key + "\" not found"), vm);
  46999. }
  47000. }
  47001. }
  47002. return result
  47003. }
  47004. }
  47005. /* */
  47006. /**
  47007. * Runtime helper for resolving raw children VNodes into a slot object.
  47008. */
  47009. function resolveSlots (
  47010. children,
  47011. context
  47012. ) {
  47013. if (!children || !children.length) {
  47014. return {}
  47015. }
  47016. var slots = {};
  47017. for (var i = 0, l = children.length; i < l; i++) {
  47018. var child = children[i];
  47019. var data = child.data;
  47020. // remove slot attribute if the node is resolved as a Vue slot node
  47021. if (data && data.attrs && data.attrs.slot) {
  47022. delete data.attrs.slot;
  47023. }
  47024. // named slots should only be respected if the vnode was rendered in the
  47025. // same context.
  47026. if ((child.context === context || child.fnContext === context) &&
  47027. data && data.slot != null
  47028. ) {
  47029. var name = data.slot;
  47030. var slot = (slots[name] || (slots[name] = []));
  47031. if (child.tag === 'template') {
  47032. slot.push.apply(slot, child.children || []);
  47033. } else {
  47034. slot.push(child);
  47035. }
  47036. } else {
  47037. (slots.default || (slots.default = [])).push(child);
  47038. }
  47039. }
  47040. // ignore slots that contains only whitespace
  47041. for (var name$1 in slots) {
  47042. if (slots[name$1].every(isWhitespace)) {
  47043. delete slots[name$1];
  47044. }
  47045. }
  47046. return slots
  47047. }
  47048. function isWhitespace (node) {
  47049. return (node.isComment && !node.asyncFactory) || node.text === ' '
  47050. }
  47051. /* */
  47052. function normalizeScopedSlots (
  47053. slots,
  47054. normalSlots,
  47055. prevSlots
  47056. ) {
  47057. var res;
  47058. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  47059. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  47060. var key = slots && slots.$key;
  47061. if (!slots) {
  47062. res = {};
  47063. } else if (slots._normalized) {
  47064. // fast path 1: child component re-render only, parent did not change
  47065. return slots._normalized
  47066. } else if (
  47067. isStable &&
  47068. prevSlots &&
  47069. prevSlots !== emptyObject &&
  47070. key === prevSlots.$key &&
  47071. !hasNormalSlots &&
  47072. !prevSlots.$hasNormal
  47073. ) {
  47074. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  47075. // only need to normalize once
  47076. return prevSlots
  47077. } else {
  47078. res = {};
  47079. for (var key$1 in slots) {
  47080. if (slots[key$1] && key$1[0] !== '$') {
  47081. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  47082. }
  47083. }
  47084. }
  47085. // expose normal slots on scopedSlots
  47086. for (var key$2 in normalSlots) {
  47087. if (!(key$2 in res)) {
  47088. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  47089. }
  47090. }
  47091. // avoriaz seems to mock a non-extensible $scopedSlots object
  47092. // and when that is passed down this would cause an error
  47093. if (slots && Object.isExtensible(slots)) {
  47094. (slots)._normalized = res;
  47095. }
  47096. def(res, '$stable', isStable);
  47097. def(res, '$key', key);
  47098. def(res, '$hasNormal', hasNormalSlots);
  47099. return res
  47100. }
  47101. function normalizeScopedSlot(normalSlots, key, fn) {
  47102. var normalized = function () {
  47103. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  47104. res = res && typeof res === 'object' && !Array.isArray(res)
  47105. ? [res] // single vnode
  47106. : normalizeChildren(res);
  47107. return res && (
  47108. res.length === 0 ||
  47109. (res.length === 1 && res[0].isComment) // #9658
  47110. ) ? undefined
  47111. : res
  47112. };
  47113. // this is a slot using the new v-slot syntax without scope. although it is
  47114. // compiled as a scoped slot, render fn users would expect it to be present
  47115. // on this.$slots because the usage is semantically a normal slot.
  47116. if (fn.proxy) {
  47117. Object.defineProperty(normalSlots, key, {
  47118. get: normalized,
  47119. enumerable: true,
  47120. configurable: true
  47121. });
  47122. }
  47123. return normalized
  47124. }
  47125. function proxyNormalSlot(slots, key) {
  47126. return function () { return slots[key]; }
  47127. }
  47128. /* */
  47129. /**
  47130. * Runtime helper for rendering v-for lists.
  47131. */
  47132. function renderList (
  47133. val,
  47134. render
  47135. ) {
  47136. var ret, i, l, keys, key;
  47137. if (Array.isArray(val) || typeof val === 'string') {
  47138. ret = new Array(val.length);
  47139. for (i = 0, l = val.length; i < l; i++) {
  47140. ret[i] = render(val[i], i);
  47141. }
  47142. } else if (typeof val === 'number') {
  47143. ret = new Array(val);
  47144. for (i = 0; i < val; i++) {
  47145. ret[i] = render(i + 1, i);
  47146. }
  47147. } else if (isObject(val)) {
  47148. if (hasSymbol && val[Symbol.iterator]) {
  47149. ret = [];
  47150. var iterator = val[Symbol.iterator]();
  47151. var result = iterator.next();
  47152. while (!result.done) {
  47153. ret.push(render(result.value, ret.length));
  47154. result = iterator.next();
  47155. }
  47156. } else {
  47157. keys = Object.keys(val);
  47158. ret = new Array(keys.length);
  47159. for (i = 0, l = keys.length; i < l; i++) {
  47160. key = keys[i];
  47161. ret[i] = render(val[key], key, i);
  47162. }
  47163. }
  47164. }
  47165. if (!isDef(ret)) {
  47166. ret = [];
  47167. }
  47168. (ret)._isVList = true;
  47169. return ret
  47170. }
  47171. /* */
  47172. /**
  47173. * Runtime helper for rendering <slot>
  47174. */
  47175. function renderSlot (
  47176. name,
  47177. fallback,
  47178. props,
  47179. bindObject
  47180. ) {
  47181. var scopedSlotFn = this.$scopedSlots[name];
  47182. var nodes;
  47183. if (scopedSlotFn) { // scoped slot
  47184. props = props || {};
  47185. if (bindObject) {
  47186. if (!isObject(bindObject)) {
  47187. warn(
  47188. 'slot v-bind without argument expects an Object',
  47189. this
  47190. );
  47191. }
  47192. props = extend(extend({}, bindObject), props);
  47193. }
  47194. nodes = scopedSlotFn(props) || fallback;
  47195. } else {
  47196. nodes = this.$slots[name] || fallback;
  47197. }
  47198. var target = props && props.slot;
  47199. if (target) {
  47200. return this.$createElement('template', { slot: target }, nodes)
  47201. } else {
  47202. return nodes
  47203. }
  47204. }
  47205. /* */
  47206. /**
  47207. * Runtime helper for resolving filters
  47208. */
  47209. function resolveFilter (id) {
  47210. return resolveAsset(this.$options, 'filters', id, true) || identity
  47211. }
  47212. /* */
  47213. function isKeyNotMatch (expect, actual) {
  47214. if (Array.isArray(expect)) {
  47215. return expect.indexOf(actual) === -1
  47216. } else {
  47217. return expect !== actual
  47218. }
  47219. }
  47220. /**
  47221. * Runtime helper for checking keyCodes from config.
  47222. * exposed as Vue.prototype._k
  47223. * passing in eventKeyName as last argument separately for backwards compat
  47224. */
  47225. function checkKeyCodes (
  47226. eventKeyCode,
  47227. key,
  47228. builtInKeyCode,
  47229. eventKeyName,
  47230. builtInKeyName
  47231. ) {
  47232. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  47233. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  47234. return isKeyNotMatch(builtInKeyName, eventKeyName)
  47235. } else if (mappedKeyCode) {
  47236. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  47237. } else if (eventKeyName) {
  47238. return hyphenate(eventKeyName) !== key
  47239. }
  47240. }
  47241. /* */
  47242. /**
  47243. * Runtime helper for merging v-bind="object" into a VNode's data.
  47244. */
  47245. function bindObjectProps (
  47246. data,
  47247. tag,
  47248. value,
  47249. asProp,
  47250. isSync
  47251. ) {
  47252. if (value) {
  47253. if (!isObject(value)) {
  47254. warn(
  47255. 'v-bind without argument expects an Object or Array value',
  47256. this
  47257. );
  47258. } else {
  47259. if (Array.isArray(value)) {
  47260. value = toObject(value);
  47261. }
  47262. var hash;
  47263. var loop = function ( key ) {
  47264. if (
  47265. key === 'class' ||
  47266. key === 'style' ||
  47267. isReservedAttribute(key)
  47268. ) {
  47269. hash = data;
  47270. } else {
  47271. var type = data.attrs && data.attrs.type;
  47272. hash = asProp || config.mustUseProp(tag, type, key)
  47273. ? data.domProps || (data.domProps = {})
  47274. : data.attrs || (data.attrs = {});
  47275. }
  47276. var camelizedKey = camelize(key);
  47277. var hyphenatedKey = hyphenate(key);
  47278. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  47279. hash[key] = value[key];
  47280. if (isSync) {
  47281. var on = data.on || (data.on = {});
  47282. on[("update:" + key)] = function ($event) {
  47283. value[key] = $event;
  47284. };
  47285. }
  47286. }
  47287. };
  47288. for (var key in value) loop( key );
  47289. }
  47290. }
  47291. return data
  47292. }
  47293. /* */
  47294. /**
  47295. * Runtime helper for rendering static trees.
  47296. */
  47297. function renderStatic (
  47298. index,
  47299. isInFor
  47300. ) {
  47301. var cached = this._staticTrees || (this._staticTrees = []);
  47302. var tree = cached[index];
  47303. // if has already-rendered static tree and not inside v-for,
  47304. // we can reuse the same tree.
  47305. if (tree && !isInFor) {
  47306. return tree
  47307. }
  47308. // otherwise, render a fresh tree.
  47309. tree = cached[index] = this.$options.staticRenderFns[index].call(
  47310. this._renderProxy,
  47311. null,
  47312. this // for render fns generated for functional component templates
  47313. );
  47314. markStatic(tree, ("__static__" + index), false);
  47315. return tree
  47316. }
  47317. /**
  47318. * Runtime helper for v-once.
  47319. * Effectively it means marking the node as static with a unique key.
  47320. */
  47321. function markOnce (
  47322. tree,
  47323. index,
  47324. key
  47325. ) {
  47326. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  47327. return tree
  47328. }
  47329. function markStatic (
  47330. tree,
  47331. key,
  47332. isOnce
  47333. ) {
  47334. if (Array.isArray(tree)) {
  47335. for (var i = 0; i < tree.length; i++) {
  47336. if (tree[i] && typeof tree[i] !== 'string') {
  47337. markStaticNode(tree[i], (key + "_" + i), isOnce);
  47338. }
  47339. }
  47340. } else {
  47341. markStaticNode(tree, key, isOnce);
  47342. }
  47343. }
  47344. function markStaticNode (node, key, isOnce) {
  47345. node.isStatic = true;
  47346. node.key = key;
  47347. node.isOnce = isOnce;
  47348. }
  47349. /* */
  47350. function bindObjectListeners (data, value) {
  47351. if (value) {
  47352. if (!isPlainObject(value)) {
  47353. warn(
  47354. 'v-on without argument expects an Object value',
  47355. this
  47356. );
  47357. } else {
  47358. var on = data.on = data.on ? extend({}, data.on) : {};
  47359. for (var key in value) {
  47360. var existing = on[key];
  47361. var ours = value[key];
  47362. on[key] = existing ? [].concat(existing, ours) : ours;
  47363. }
  47364. }
  47365. }
  47366. return data
  47367. }
  47368. /* */
  47369. function resolveScopedSlots (
  47370. fns, // see flow/vnode
  47371. res,
  47372. // the following are added in 2.6
  47373. hasDynamicKeys,
  47374. contentHashKey
  47375. ) {
  47376. res = res || { $stable: !hasDynamicKeys };
  47377. for (var i = 0; i < fns.length; i++) {
  47378. var slot = fns[i];
  47379. if (Array.isArray(slot)) {
  47380. resolveScopedSlots(slot, res, hasDynamicKeys);
  47381. } else if (slot) {
  47382. // marker for reverse proxying v-slot without scope on this.$slots
  47383. if (slot.proxy) {
  47384. slot.fn.proxy = true;
  47385. }
  47386. res[slot.key] = slot.fn;
  47387. }
  47388. }
  47389. if (contentHashKey) {
  47390. (res).$key = contentHashKey;
  47391. }
  47392. return res
  47393. }
  47394. /* */
  47395. function bindDynamicKeys (baseObj, values) {
  47396. for (var i = 0; i < values.length; i += 2) {
  47397. var key = values[i];
  47398. if (typeof key === 'string' && key) {
  47399. baseObj[values[i]] = values[i + 1];
  47400. } else if (key !== '' && key !== null) {
  47401. // null is a special value for explicitly removing a binding
  47402. warn(
  47403. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  47404. this
  47405. );
  47406. }
  47407. }
  47408. return baseObj
  47409. }
  47410. // helper to dynamically append modifier runtime markers to event names.
  47411. // ensure only append when value is already string, otherwise it will be cast
  47412. // to string and cause the type check to miss.
  47413. function prependModifier (value, symbol) {
  47414. return typeof value === 'string' ? symbol + value : value
  47415. }
  47416. /* */
  47417. function installRenderHelpers (target) {
  47418. target._o = markOnce;
  47419. target._n = toNumber;
  47420. target._s = toString;
  47421. target._l = renderList;
  47422. target._t = renderSlot;
  47423. target._q = looseEqual;
  47424. target._i = looseIndexOf;
  47425. target._m = renderStatic;
  47426. target._f = resolveFilter;
  47427. target._k = checkKeyCodes;
  47428. target._b = bindObjectProps;
  47429. target._v = createTextVNode;
  47430. target._e = createEmptyVNode;
  47431. target._u = resolveScopedSlots;
  47432. target._g = bindObjectListeners;
  47433. target._d = bindDynamicKeys;
  47434. target._p = prependModifier;
  47435. }
  47436. /* */
  47437. function FunctionalRenderContext (
  47438. data,
  47439. props,
  47440. children,
  47441. parent,
  47442. Ctor
  47443. ) {
  47444. var this$1 = this;
  47445. var options = Ctor.options;
  47446. // ensure the createElement function in functional components
  47447. // gets a unique context - this is necessary for correct named slot check
  47448. var contextVm;
  47449. if (hasOwn(parent, '_uid')) {
  47450. contextVm = Object.create(parent);
  47451. // $flow-disable-line
  47452. contextVm._original = parent;
  47453. } else {
  47454. // the context vm passed in is a functional context as well.
  47455. // in this case we want to make sure we are able to get a hold to the
  47456. // real context instance.
  47457. contextVm = parent;
  47458. // $flow-disable-line
  47459. parent = parent._original;
  47460. }
  47461. var isCompiled = isTrue(options._compiled);
  47462. var needNormalization = !isCompiled;
  47463. this.data = data;
  47464. this.props = props;
  47465. this.children = children;
  47466. this.parent = parent;
  47467. this.listeners = data.on || emptyObject;
  47468. this.injections = resolveInject(options.inject, parent);
  47469. this.slots = function () {
  47470. if (!this$1.$slots) {
  47471. normalizeScopedSlots(
  47472. data.scopedSlots,
  47473. this$1.$slots = resolveSlots(children, parent)
  47474. );
  47475. }
  47476. return this$1.$slots
  47477. };
  47478. Object.defineProperty(this, 'scopedSlots', ({
  47479. enumerable: true,
  47480. get: function get () {
  47481. return normalizeScopedSlots(data.scopedSlots, this.slots())
  47482. }
  47483. }));
  47484. // support for compiled functional template
  47485. if (isCompiled) {
  47486. // exposing $options for renderStatic()
  47487. this.$options = options;
  47488. // pre-resolve slots for renderSlot()
  47489. this.$slots = this.slots();
  47490. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  47491. }
  47492. if (options._scopeId) {
  47493. this._c = function (a, b, c, d) {
  47494. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  47495. if (vnode && !Array.isArray(vnode)) {
  47496. vnode.fnScopeId = options._scopeId;
  47497. vnode.fnContext = parent;
  47498. }
  47499. return vnode
  47500. };
  47501. } else {
  47502. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  47503. }
  47504. }
  47505. installRenderHelpers(FunctionalRenderContext.prototype);
  47506. function createFunctionalComponent (
  47507. Ctor,
  47508. propsData,
  47509. data,
  47510. contextVm,
  47511. children
  47512. ) {
  47513. var options = Ctor.options;
  47514. var props = {};
  47515. var propOptions = options.props;
  47516. if (isDef(propOptions)) {
  47517. for (var key in propOptions) {
  47518. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  47519. }
  47520. } else {
  47521. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  47522. if (isDef(data.props)) { mergeProps(props, data.props); }
  47523. }
  47524. var renderContext = new FunctionalRenderContext(
  47525. data,
  47526. props,
  47527. children,
  47528. contextVm,
  47529. Ctor
  47530. );
  47531. var vnode = options.render.call(null, renderContext._c, renderContext);
  47532. if (vnode instanceof VNode) {
  47533. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  47534. } else if (Array.isArray(vnode)) {
  47535. var vnodes = normalizeChildren(vnode) || [];
  47536. var res = new Array(vnodes.length);
  47537. for (var i = 0; i < vnodes.length; i++) {
  47538. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  47539. }
  47540. return res
  47541. }
  47542. }
  47543. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  47544. // #7817 clone node before setting fnContext, otherwise if the node is reused
  47545. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  47546. // that should not be matched to match.
  47547. var clone = cloneVNode(vnode);
  47548. clone.fnContext = contextVm;
  47549. clone.fnOptions = options;
  47550. {
  47551. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  47552. }
  47553. if (data.slot) {
  47554. (clone.data || (clone.data = {})).slot = data.slot;
  47555. }
  47556. return clone
  47557. }
  47558. function mergeProps (to, from) {
  47559. for (var key in from) {
  47560. to[camelize(key)] = from[key];
  47561. }
  47562. }
  47563. /* */
  47564. /* */
  47565. /* */
  47566. /* */
  47567. // inline hooks to be invoked on component VNodes during patch
  47568. var componentVNodeHooks = {
  47569. init: function init (vnode, hydrating) {
  47570. if (
  47571. vnode.componentInstance &&
  47572. !vnode.componentInstance._isDestroyed &&
  47573. vnode.data.keepAlive
  47574. ) {
  47575. // kept-alive components, treat as a patch
  47576. var mountedNode = vnode; // work around flow
  47577. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  47578. } else {
  47579. var child = vnode.componentInstance = createComponentInstanceForVnode(
  47580. vnode,
  47581. activeInstance
  47582. );
  47583. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  47584. }
  47585. },
  47586. prepatch: function prepatch (oldVnode, vnode) {
  47587. var options = vnode.componentOptions;
  47588. var child = vnode.componentInstance = oldVnode.componentInstance;
  47589. updateChildComponent(
  47590. child,
  47591. options.propsData, // updated props
  47592. options.listeners, // updated listeners
  47593. vnode, // new parent vnode
  47594. options.children // new children
  47595. );
  47596. },
  47597. insert: function insert (vnode) {
  47598. var context = vnode.context;
  47599. var componentInstance = vnode.componentInstance;
  47600. if (!componentInstance._isMounted) {
  47601. componentInstance._isMounted = true;
  47602. callHook(componentInstance, 'mounted');
  47603. }
  47604. if (vnode.data.keepAlive) {
  47605. if (context._isMounted) {
  47606. // vue-router#1212
  47607. // During updates, a kept-alive component's child components may
  47608. // change, so directly walking the tree here may call activated hooks
  47609. // on incorrect children. Instead we push them into a queue which will
  47610. // be processed after the whole patch process ended.
  47611. queueActivatedComponent(componentInstance);
  47612. } else {
  47613. activateChildComponent(componentInstance, true /* direct */);
  47614. }
  47615. }
  47616. },
  47617. destroy: function destroy (vnode) {
  47618. var componentInstance = vnode.componentInstance;
  47619. if (!componentInstance._isDestroyed) {
  47620. if (!vnode.data.keepAlive) {
  47621. componentInstance.$destroy();
  47622. } else {
  47623. deactivateChildComponent(componentInstance, true /* direct */);
  47624. }
  47625. }
  47626. }
  47627. };
  47628. var hooksToMerge = Object.keys(componentVNodeHooks);
  47629. function createComponent (
  47630. Ctor,
  47631. data,
  47632. context,
  47633. children,
  47634. tag
  47635. ) {
  47636. if (isUndef(Ctor)) {
  47637. return
  47638. }
  47639. var baseCtor = context.$options._base;
  47640. // plain options object: turn it into a constructor
  47641. if (isObject(Ctor)) {
  47642. Ctor = baseCtor.extend(Ctor);
  47643. }
  47644. // if at this stage it's not a constructor or an async component factory,
  47645. // reject.
  47646. if (typeof Ctor !== 'function') {
  47647. {
  47648. warn(("Invalid Component definition: " + (String(Ctor))), context);
  47649. }
  47650. return
  47651. }
  47652. // async component
  47653. var asyncFactory;
  47654. if (isUndef(Ctor.cid)) {
  47655. asyncFactory = Ctor;
  47656. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  47657. if (Ctor === undefined) {
  47658. // return a placeholder node for async component, which is rendered
  47659. // as a comment node but preserves all the raw information for the node.
  47660. // the information will be used for async server-rendering and hydration.
  47661. return createAsyncPlaceholder(
  47662. asyncFactory,
  47663. data,
  47664. context,
  47665. children,
  47666. tag
  47667. )
  47668. }
  47669. }
  47670. data = data || {};
  47671. // resolve constructor options in case global mixins are applied after
  47672. // component constructor creation
  47673. resolveConstructorOptions(Ctor);
  47674. // transform component v-model data into props & events
  47675. if (isDef(data.model)) {
  47676. transformModel(Ctor.options, data);
  47677. }
  47678. // extract props
  47679. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  47680. // functional component
  47681. if (isTrue(Ctor.options.functional)) {
  47682. return createFunctionalComponent(Ctor, propsData, data, context, children)
  47683. }
  47684. // extract listeners, since these needs to be treated as
  47685. // child component listeners instead of DOM listeners
  47686. var listeners = data.on;
  47687. // replace with listeners with .native modifier
  47688. // so it gets processed during parent component patch.
  47689. data.on = data.nativeOn;
  47690. if (isTrue(Ctor.options.abstract)) {
  47691. // abstract components do not keep anything
  47692. // other than props & listeners & slot
  47693. // work around flow
  47694. var slot = data.slot;
  47695. data = {};
  47696. if (slot) {
  47697. data.slot = slot;
  47698. }
  47699. }
  47700. // install component management hooks onto the placeholder node
  47701. installComponentHooks(data);
  47702. // return a placeholder vnode
  47703. var name = Ctor.options.name || tag;
  47704. var vnode = new VNode(
  47705. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  47706. data, undefined, undefined, undefined, context,
  47707. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  47708. asyncFactory
  47709. );
  47710. return vnode
  47711. }
  47712. function createComponentInstanceForVnode (
  47713. vnode, // we know it's MountedComponentVNode but flow doesn't
  47714. parent // activeInstance in lifecycle state
  47715. ) {
  47716. var options = {
  47717. _isComponent: true,
  47718. _parentVnode: vnode,
  47719. parent: parent
  47720. };
  47721. // check inline-template render functions
  47722. var inlineTemplate = vnode.data.inlineTemplate;
  47723. if (isDef(inlineTemplate)) {
  47724. options.render = inlineTemplate.render;
  47725. options.staticRenderFns = inlineTemplate.staticRenderFns;
  47726. }
  47727. return new vnode.componentOptions.Ctor(options)
  47728. }
  47729. function installComponentHooks (data) {
  47730. var hooks = data.hook || (data.hook = {});
  47731. for (var i = 0; i < hooksToMerge.length; i++) {
  47732. var key = hooksToMerge[i];
  47733. var existing = hooks[key];
  47734. var toMerge = componentVNodeHooks[key];
  47735. if (existing !== toMerge && !(existing && existing._merged)) {
  47736. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  47737. }
  47738. }
  47739. }
  47740. function mergeHook$1 (f1, f2) {
  47741. var merged = function (a, b) {
  47742. // flow complains about extra args which is why we use any
  47743. f1(a, b);
  47744. f2(a, b);
  47745. };
  47746. merged._merged = true;
  47747. return merged
  47748. }
  47749. // transform component v-model info (value and callback) into
  47750. // prop and event handler respectively.
  47751. function transformModel (options, data) {
  47752. var prop = (options.model && options.model.prop) || 'value';
  47753. var event = (options.model && options.model.event) || 'input'
  47754. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  47755. var on = data.on || (data.on = {});
  47756. var existing = on[event];
  47757. var callback = data.model.callback;
  47758. if (isDef(existing)) {
  47759. if (
  47760. Array.isArray(existing)
  47761. ? existing.indexOf(callback) === -1
  47762. : existing !== callback
  47763. ) {
  47764. on[event] = [callback].concat(existing);
  47765. }
  47766. } else {
  47767. on[event] = callback;
  47768. }
  47769. }
  47770. /* */
  47771. var SIMPLE_NORMALIZE = 1;
  47772. var ALWAYS_NORMALIZE = 2;
  47773. // wrapper function for providing a more flexible interface
  47774. // without getting yelled at by flow
  47775. function createElement (
  47776. context,
  47777. tag,
  47778. data,
  47779. children,
  47780. normalizationType,
  47781. alwaysNormalize
  47782. ) {
  47783. if (Array.isArray(data) || isPrimitive(data)) {
  47784. normalizationType = children;
  47785. children = data;
  47786. data = undefined;
  47787. }
  47788. if (isTrue(alwaysNormalize)) {
  47789. normalizationType = ALWAYS_NORMALIZE;
  47790. }
  47791. return _createElement(context, tag, data, children, normalizationType)
  47792. }
  47793. function _createElement (
  47794. context,
  47795. tag,
  47796. data,
  47797. children,
  47798. normalizationType
  47799. ) {
  47800. if (isDef(data) && isDef((data).__ob__)) {
  47801. warn(
  47802. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  47803. 'Always create fresh vnode data objects in each render!',
  47804. context
  47805. );
  47806. return createEmptyVNode()
  47807. }
  47808. // object syntax in v-bind
  47809. if (isDef(data) && isDef(data.is)) {
  47810. tag = data.is;
  47811. }
  47812. if (!tag) {
  47813. // in case of component :is set to falsy value
  47814. return createEmptyVNode()
  47815. }
  47816. // warn against non-primitive key
  47817. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  47818. ) {
  47819. {
  47820. warn(
  47821. 'Avoid using non-primitive value as key, ' +
  47822. 'use string/number value instead.',
  47823. context
  47824. );
  47825. }
  47826. }
  47827. // support single function children as default scoped slot
  47828. if (Array.isArray(children) &&
  47829. typeof children[0] === 'function'
  47830. ) {
  47831. data = data || {};
  47832. data.scopedSlots = { default: children[0] };
  47833. children.length = 0;
  47834. }
  47835. if (normalizationType === ALWAYS_NORMALIZE) {
  47836. children = normalizeChildren(children);
  47837. } else if (normalizationType === SIMPLE_NORMALIZE) {
  47838. children = simpleNormalizeChildren(children);
  47839. }
  47840. var vnode, ns;
  47841. if (typeof tag === 'string') {
  47842. var Ctor;
  47843. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  47844. if (config.isReservedTag(tag)) {
  47845. // platform built-in elements
  47846. if (isDef(data) && isDef(data.nativeOn)) {
  47847. warn(
  47848. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  47849. context
  47850. );
  47851. }
  47852. vnode = new VNode(
  47853. config.parsePlatformTagName(tag), data, children,
  47854. undefined, undefined, context
  47855. );
  47856. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  47857. // component
  47858. vnode = createComponent(Ctor, data, context, children, tag);
  47859. } else {
  47860. // unknown or unlisted namespaced elements
  47861. // check at runtime because it may get assigned a namespace when its
  47862. // parent normalizes children
  47863. vnode = new VNode(
  47864. tag, data, children,
  47865. undefined, undefined, context
  47866. );
  47867. }
  47868. } else {
  47869. // direct component options / constructor
  47870. vnode = createComponent(tag, data, context, children);
  47871. }
  47872. if (Array.isArray(vnode)) {
  47873. return vnode
  47874. } else if (isDef(vnode)) {
  47875. if (isDef(ns)) { applyNS(vnode, ns); }
  47876. if (isDef(data)) { registerDeepBindings(data); }
  47877. return vnode
  47878. } else {
  47879. return createEmptyVNode()
  47880. }
  47881. }
  47882. function applyNS (vnode, ns, force) {
  47883. vnode.ns = ns;
  47884. if (vnode.tag === 'foreignObject') {
  47885. // use default namespace inside foreignObject
  47886. ns = undefined;
  47887. force = true;
  47888. }
  47889. if (isDef(vnode.children)) {
  47890. for (var i = 0, l = vnode.children.length; i < l; i++) {
  47891. var child = vnode.children[i];
  47892. if (isDef(child.tag) && (
  47893. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  47894. applyNS(child, ns, force);
  47895. }
  47896. }
  47897. }
  47898. }
  47899. // ref #5318
  47900. // necessary to ensure parent re-render when deep bindings like :style and
  47901. // :class are used on slot nodes
  47902. function registerDeepBindings (data) {
  47903. if (isObject(data.style)) {
  47904. traverse(data.style);
  47905. }
  47906. if (isObject(data.class)) {
  47907. traverse(data.class);
  47908. }
  47909. }
  47910. /* */
  47911. function initRender (vm) {
  47912. vm._vnode = null; // the root of the child tree
  47913. vm._staticTrees = null; // v-once cached trees
  47914. var options = vm.$options;
  47915. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  47916. var renderContext = parentVnode && parentVnode.context;
  47917. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  47918. vm.$scopedSlots = emptyObject;
  47919. // bind the createElement fn to this instance
  47920. // so that we get proper render context inside it.
  47921. // args order: tag, data, children, normalizationType, alwaysNormalize
  47922. // internal version is used by render functions compiled from templates
  47923. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  47924. // normalization is always applied for the public version, used in
  47925. // user-written render functions.
  47926. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  47927. // $attrs & $listeners are exposed for easier HOC creation.
  47928. // they need to be reactive so that HOCs using them are always updated
  47929. var parentData = parentVnode && parentVnode.data;
  47930. /* istanbul ignore else */
  47931. {
  47932. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  47933. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  47934. }, true);
  47935. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  47936. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  47937. }, true);
  47938. }
  47939. }
  47940. var currentRenderingInstance = null;
  47941. function renderMixin (Vue) {
  47942. // install runtime convenience helpers
  47943. installRenderHelpers(Vue.prototype);
  47944. Vue.prototype.$nextTick = function (fn) {
  47945. return nextTick(fn, this)
  47946. };
  47947. Vue.prototype._render = function () {
  47948. var vm = this;
  47949. var ref = vm.$options;
  47950. var render = ref.render;
  47951. var _parentVnode = ref._parentVnode;
  47952. if (_parentVnode) {
  47953. vm.$scopedSlots = normalizeScopedSlots(
  47954. _parentVnode.data.scopedSlots,
  47955. vm.$slots,
  47956. vm.$scopedSlots
  47957. );
  47958. }
  47959. // set parent vnode. this allows render functions to have access
  47960. // to the data on the placeholder node.
  47961. vm.$vnode = _parentVnode;
  47962. // render self
  47963. var vnode;
  47964. try {
  47965. // There's no need to maintain a stack because all render fns are called
  47966. // separately from one another. Nested component's render fns are called
  47967. // when parent component is patched.
  47968. currentRenderingInstance = vm;
  47969. vnode = render.call(vm._renderProxy, vm.$createElement);
  47970. } catch (e) {
  47971. handleError(e, vm, "render");
  47972. // return error render result,
  47973. // or previous vnode to prevent render error causing blank component
  47974. /* istanbul ignore else */
  47975. if (vm.$options.renderError) {
  47976. try {
  47977. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  47978. } catch (e) {
  47979. handleError(e, vm, "renderError");
  47980. vnode = vm._vnode;
  47981. }
  47982. } else {
  47983. vnode = vm._vnode;
  47984. }
  47985. } finally {
  47986. currentRenderingInstance = null;
  47987. }
  47988. // if the returned array contains only a single node, allow it
  47989. if (Array.isArray(vnode) && vnode.length === 1) {
  47990. vnode = vnode[0];
  47991. }
  47992. // return empty vnode in case the render function errored out
  47993. if (!(vnode instanceof VNode)) {
  47994. if (Array.isArray(vnode)) {
  47995. warn(
  47996. 'Multiple root nodes returned from render function. Render function ' +
  47997. 'should return a single root node.',
  47998. vm
  47999. );
  48000. }
  48001. vnode = createEmptyVNode();
  48002. }
  48003. // set parent
  48004. vnode.parent = _parentVnode;
  48005. return vnode
  48006. };
  48007. }
  48008. /* */
  48009. function ensureCtor (comp, base) {
  48010. if (
  48011. comp.__esModule ||
  48012. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  48013. ) {
  48014. comp = comp.default;
  48015. }
  48016. return isObject(comp)
  48017. ? base.extend(comp)
  48018. : comp
  48019. }
  48020. function createAsyncPlaceholder (
  48021. factory,
  48022. data,
  48023. context,
  48024. children,
  48025. tag
  48026. ) {
  48027. var node = createEmptyVNode();
  48028. node.asyncFactory = factory;
  48029. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  48030. return node
  48031. }
  48032. function resolveAsyncComponent (
  48033. factory,
  48034. baseCtor
  48035. ) {
  48036. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  48037. return factory.errorComp
  48038. }
  48039. if (isDef(factory.resolved)) {
  48040. return factory.resolved
  48041. }
  48042. var owner = currentRenderingInstance;
  48043. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  48044. // already pending
  48045. factory.owners.push(owner);
  48046. }
  48047. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  48048. return factory.loadingComp
  48049. }
  48050. if (owner && !isDef(factory.owners)) {
  48051. var owners = factory.owners = [owner];
  48052. var sync = true;
  48053. var timerLoading = null;
  48054. var timerTimeout = null
  48055. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  48056. var forceRender = function (renderCompleted) {
  48057. for (var i = 0, l = owners.length; i < l; i++) {
  48058. (owners[i]).$forceUpdate();
  48059. }
  48060. if (renderCompleted) {
  48061. owners.length = 0;
  48062. if (timerLoading !== null) {
  48063. clearTimeout(timerLoading);
  48064. timerLoading = null;
  48065. }
  48066. if (timerTimeout !== null) {
  48067. clearTimeout(timerTimeout);
  48068. timerTimeout = null;
  48069. }
  48070. }
  48071. };
  48072. var resolve = once(function (res) {
  48073. // cache resolved
  48074. factory.resolved = ensureCtor(res, baseCtor);
  48075. // invoke callbacks only if this is not a synchronous resolve
  48076. // (async resolves are shimmed as synchronous during SSR)
  48077. if (!sync) {
  48078. forceRender(true);
  48079. } else {
  48080. owners.length = 0;
  48081. }
  48082. });
  48083. var reject = once(function (reason) {
  48084. warn(
  48085. "Failed to resolve async component: " + (String(factory)) +
  48086. (reason ? ("\nReason: " + reason) : '')
  48087. );
  48088. if (isDef(factory.errorComp)) {
  48089. factory.error = true;
  48090. forceRender(true);
  48091. }
  48092. });
  48093. var res = factory(resolve, reject);
  48094. if (isObject(res)) {
  48095. if (isPromise(res)) {
  48096. // () => Promise
  48097. if (isUndef(factory.resolved)) {
  48098. res.then(resolve, reject);
  48099. }
  48100. } else if (isPromise(res.component)) {
  48101. res.component.then(resolve, reject);
  48102. if (isDef(res.error)) {
  48103. factory.errorComp = ensureCtor(res.error, baseCtor);
  48104. }
  48105. if (isDef(res.loading)) {
  48106. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  48107. if (res.delay === 0) {
  48108. factory.loading = true;
  48109. } else {
  48110. timerLoading = setTimeout(function () {
  48111. timerLoading = null;
  48112. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  48113. factory.loading = true;
  48114. forceRender(false);
  48115. }
  48116. }, res.delay || 200);
  48117. }
  48118. }
  48119. if (isDef(res.timeout)) {
  48120. timerTimeout = setTimeout(function () {
  48121. timerTimeout = null;
  48122. if (isUndef(factory.resolved)) {
  48123. reject(
  48124. "timeout (" + (res.timeout) + "ms)"
  48125. );
  48126. }
  48127. }, res.timeout);
  48128. }
  48129. }
  48130. }
  48131. sync = false;
  48132. // return in case resolved synchronously
  48133. return factory.loading
  48134. ? factory.loadingComp
  48135. : factory.resolved
  48136. }
  48137. }
  48138. /* */
  48139. function isAsyncPlaceholder (node) {
  48140. return node.isComment && node.asyncFactory
  48141. }
  48142. /* */
  48143. function getFirstComponentChild (children) {
  48144. if (Array.isArray(children)) {
  48145. for (var i = 0; i < children.length; i++) {
  48146. var c = children[i];
  48147. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  48148. return c
  48149. }
  48150. }
  48151. }
  48152. }
  48153. /* */
  48154. /* */
  48155. function initEvents (vm) {
  48156. vm._events = Object.create(null);
  48157. vm._hasHookEvent = false;
  48158. // init parent attached events
  48159. var listeners = vm.$options._parentListeners;
  48160. if (listeners) {
  48161. updateComponentListeners(vm, listeners);
  48162. }
  48163. }
  48164. var target;
  48165. function add (event, fn) {
  48166. target.$on(event, fn);
  48167. }
  48168. function remove$1 (event, fn) {
  48169. target.$off(event, fn);
  48170. }
  48171. function createOnceHandler (event, fn) {
  48172. var _target = target;
  48173. return function onceHandler () {
  48174. var res = fn.apply(null, arguments);
  48175. if (res !== null) {
  48176. _target.$off(event, onceHandler);
  48177. }
  48178. }
  48179. }
  48180. function updateComponentListeners (
  48181. vm,
  48182. listeners,
  48183. oldListeners
  48184. ) {
  48185. target = vm;
  48186. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  48187. target = undefined;
  48188. }
  48189. function eventsMixin (Vue) {
  48190. var hookRE = /^hook:/;
  48191. Vue.prototype.$on = function (event, fn) {
  48192. var vm = this;
  48193. if (Array.isArray(event)) {
  48194. for (var i = 0, l = event.length; i < l; i++) {
  48195. vm.$on(event[i], fn);
  48196. }
  48197. } else {
  48198. (vm._events[event] || (vm._events[event] = [])).push(fn);
  48199. // optimize hook:event cost by using a boolean flag marked at registration
  48200. // instead of a hash lookup
  48201. if (hookRE.test(event)) {
  48202. vm._hasHookEvent = true;
  48203. }
  48204. }
  48205. return vm
  48206. };
  48207. Vue.prototype.$once = function (event, fn) {
  48208. var vm = this;
  48209. function on () {
  48210. vm.$off(event, on);
  48211. fn.apply(vm, arguments);
  48212. }
  48213. on.fn = fn;
  48214. vm.$on(event, on);
  48215. return vm
  48216. };
  48217. Vue.prototype.$off = function (event, fn) {
  48218. var vm = this;
  48219. // all
  48220. if (!arguments.length) {
  48221. vm._events = Object.create(null);
  48222. return vm
  48223. }
  48224. // array of events
  48225. if (Array.isArray(event)) {
  48226. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  48227. vm.$off(event[i$1], fn);
  48228. }
  48229. return vm
  48230. }
  48231. // specific event
  48232. var cbs = vm._events[event];
  48233. if (!cbs) {
  48234. return vm
  48235. }
  48236. if (!fn) {
  48237. vm._events[event] = null;
  48238. return vm
  48239. }
  48240. // specific handler
  48241. var cb;
  48242. var i = cbs.length;
  48243. while (i--) {
  48244. cb = cbs[i];
  48245. if (cb === fn || cb.fn === fn) {
  48246. cbs.splice(i, 1);
  48247. break
  48248. }
  48249. }
  48250. return vm
  48251. };
  48252. Vue.prototype.$emit = function (event) {
  48253. var vm = this;
  48254. {
  48255. var lowerCaseEvent = event.toLowerCase();
  48256. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  48257. tip(
  48258. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  48259. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  48260. "Note that HTML attributes are case-insensitive and you cannot use " +
  48261. "v-on to listen to camelCase events when using in-DOM templates. " +
  48262. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  48263. );
  48264. }
  48265. }
  48266. var cbs = vm._events[event];
  48267. if (cbs) {
  48268. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  48269. var args = toArray(arguments, 1);
  48270. var info = "event handler for \"" + event + "\"";
  48271. for (var i = 0, l = cbs.length; i < l; i++) {
  48272. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  48273. }
  48274. }
  48275. return vm
  48276. };
  48277. }
  48278. /* */
  48279. var activeInstance = null;
  48280. var isUpdatingChildComponent = false;
  48281. function setActiveInstance(vm) {
  48282. var prevActiveInstance = activeInstance;
  48283. activeInstance = vm;
  48284. return function () {
  48285. activeInstance = prevActiveInstance;
  48286. }
  48287. }
  48288. function initLifecycle (vm) {
  48289. var options = vm.$options;
  48290. // locate first non-abstract parent
  48291. var parent = options.parent;
  48292. if (parent && !options.abstract) {
  48293. while (parent.$options.abstract && parent.$parent) {
  48294. parent = parent.$parent;
  48295. }
  48296. parent.$children.push(vm);
  48297. }
  48298. vm.$parent = parent;
  48299. vm.$root = parent ? parent.$root : vm;
  48300. vm.$children = [];
  48301. vm.$refs = {};
  48302. vm._watcher = null;
  48303. vm._inactive = null;
  48304. vm._directInactive = false;
  48305. vm._isMounted = false;
  48306. vm._isDestroyed = false;
  48307. vm._isBeingDestroyed = false;
  48308. }
  48309. function lifecycleMixin (Vue) {
  48310. Vue.prototype._update = function (vnode, hydrating) {
  48311. var vm = this;
  48312. var prevEl = vm.$el;
  48313. var prevVnode = vm._vnode;
  48314. var restoreActiveInstance = setActiveInstance(vm);
  48315. vm._vnode = vnode;
  48316. // Vue.prototype.__patch__ is injected in entry points
  48317. // based on the rendering backend used.
  48318. if (!prevVnode) {
  48319. // initial render
  48320. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  48321. } else {
  48322. // updates
  48323. vm.$el = vm.__patch__(prevVnode, vnode);
  48324. }
  48325. restoreActiveInstance();
  48326. // update __vue__ reference
  48327. if (prevEl) {
  48328. prevEl.__vue__ = null;
  48329. }
  48330. if (vm.$el) {
  48331. vm.$el.__vue__ = vm;
  48332. }
  48333. // if parent is an HOC, update its $el as well
  48334. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  48335. vm.$parent.$el = vm.$el;
  48336. }
  48337. // updated hook is called by the scheduler to ensure that children are
  48338. // updated in a parent's updated hook.
  48339. };
  48340. Vue.prototype.$forceUpdate = function () {
  48341. var vm = this;
  48342. if (vm._watcher) {
  48343. vm._watcher.update();
  48344. }
  48345. };
  48346. Vue.prototype.$destroy = function () {
  48347. var vm = this;
  48348. if (vm._isBeingDestroyed) {
  48349. return
  48350. }
  48351. callHook(vm, 'beforeDestroy');
  48352. vm._isBeingDestroyed = true;
  48353. // remove self from parent
  48354. var parent = vm.$parent;
  48355. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  48356. remove(parent.$children, vm);
  48357. }
  48358. // teardown watchers
  48359. if (vm._watcher) {
  48360. vm._watcher.teardown();
  48361. }
  48362. var i = vm._watchers.length;
  48363. while (i--) {
  48364. vm._watchers[i].teardown();
  48365. }
  48366. // remove reference from data ob
  48367. // frozen object may not have observer.
  48368. if (vm._data.__ob__) {
  48369. vm._data.__ob__.vmCount--;
  48370. }
  48371. // call the last hook...
  48372. vm._isDestroyed = true;
  48373. // invoke destroy hooks on current rendered tree
  48374. vm.__patch__(vm._vnode, null);
  48375. // fire destroyed hook
  48376. callHook(vm, 'destroyed');
  48377. // turn off all instance listeners.
  48378. vm.$off();
  48379. // remove __vue__ reference
  48380. if (vm.$el) {
  48381. vm.$el.__vue__ = null;
  48382. }
  48383. // release circular reference (#6759)
  48384. if (vm.$vnode) {
  48385. vm.$vnode.parent = null;
  48386. }
  48387. };
  48388. }
  48389. function mountComponent (
  48390. vm,
  48391. el,
  48392. hydrating
  48393. ) {
  48394. vm.$el = el;
  48395. if (!vm.$options.render) {
  48396. vm.$options.render = createEmptyVNode;
  48397. {
  48398. /* istanbul ignore if */
  48399. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  48400. vm.$options.el || el) {
  48401. warn(
  48402. 'You are using the runtime-only build of Vue where the template ' +
  48403. 'compiler is not available. Either pre-compile the templates into ' +
  48404. 'render functions, or use the compiler-included build.',
  48405. vm
  48406. );
  48407. } else {
  48408. warn(
  48409. 'Failed to mount component: template or render function not defined.',
  48410. vm
  48411. );
  48412. }
  48413. }
  48414. }
  48415. callHook(vm, 'beforeMount');
  48416. var updateComponent;
  48417. /* istanbul ignore if */
  48418. if (config.performance && mark) {
  48419. updateComponent = function () {
  48420. var name = vm._name;
  48421. var id = vm._uid;
  48422. var startTag = "vue-perf-start:" + id;
  48423. var endTag = "vue-perf-end:" + id;
  48424. mark(startTag);
  48425. var vnode = vm._render();
  48426. mark(endTag);
  48427. measure(("vue " + name + " render"), startTag, endTag);
  48428. mark(startTag);
  48429. vm._update(vnode, hydrating);
  48430. mark(endTag);
  48431. measure(("vue " + name + " patch"), startTag, endTag);
  48432. };
  48433. } else {
  48434. updateComponent = function () {
  48435. vm._update(vm._render(), hydrating);
  48436. };
  48437. }
  48438. // we set this to vm._watcher inside the watcher's constructor
  48439. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  48440. // component's mounted hook), which relies on vm._watcher being already defined
  48441. new Watcher(vm, updateComponent, noop, {
  48442. before: function before () {
  48443. if (vm._isMounted && !vm._isDestroyed) {
  48444. callHook(vm, 'beforeUpdate');
  48445. }
  48446. }
  48447. }, true /* isRenderWatcher */);
  48448. hydrating = false;
  48449. // manually mounted instance, call mounted on self
  48450. // mounted is called for render-created child components in its inserted hook
  48451. if (vm.$vnode == null) {
  48452. vm._isMounted = true;
  48453. callHook(vm, 'mounted');
  48454. }
  48455. return vm
  48456. }
  48457. function updateChildComponent (
  48458. vm,
  48459. propsData,
  48460. listeners,
  48461. parentVnode,
  48462. renderChildren
  48463. ) {
  48464. {
  48465. isUpdatingChildComponent = true;
  48466. }
  48467. // determine whether component has slot children
  48468. // we need to do this before overwriting $options._renderChildren.
  48469. // check if there are dynamic scopedSlots (hand-written or compiled but with
  48470. // dynamic slot names). Static scoped slots compiled from template has the
  48471. // "$stable" marker.
  48472. var newScopedSlots = parentVnode.data.scopedSlots;
  48473. var oldScopedSlots = vm.$scopedSlots;
  48474. var hasDynamicScopedSlot = !!(
  48475. (newScopedSlots && !newScopedSlots.$stable) ||
  48476. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  48477. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  48478. );
  48479. // Any static slot children from the parent may have changed during parent's
  48480. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  48481. // update is necessary to ensure correctness.
  48482. var needsForceUpdate = !!(
  48483. renderChildren || // has new static slots
  48484. vm.$options._renderChildren || // has old static slots
  48485. hasDynamicScopedSlot
  48486. );
  48487. vm.$options._parentVnode = parentVnode;
  48488. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  48489. if (vm._vnode) { // update child tree's parent
  48490. vm._vnode.parent = parentVnode;
  48491. }
  48492. vm.$options._renderChildren = renderChildren;
  48493. // update $attrs and $listeners hash
  48494. // these are also reactive so they may trigger child update if the child
  48495. // used them during render
  48496. vm.$attrs = parentVnode.data.attrs || emptyObject;
  48497. vm.$listeners = listeners || emptyObject;
  48498. // update props
  48499. if (propsData && vm.$options.props) {
  48500. toggleObserving(false);
  48501. var props = vm._props;
  48502. var propKeys = vm.$options._propKeys || [];
  48503. for (var i = 0; i < propKeys.length; i++) {
  48504. var key = propKeys[i];
  48505. var propOptions = vm.$options.props; // wtf flow?
  48506. props[key] = validateProp(key, propOptions, propsData, vm);
  48507. }
  48508. toggleObserving(true);
  48509. // keep a copy of raw propsData
  48510. vm.$options.propsData = propsData;
  48511. }
  48512. // update listeners
  48513. listeners = listeners || emptyObject;
  48514. var oldListeners = vm.$options._parentListeners;
  48515. vm.$options._parentListeners = listeners;
  48516. updateComponentListeners(vm, listeners, oldListeners);
  48517. // resolve slots + force update if has children
  48518. if (needsForceUpdate) {
  48519. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  48520. vm.$forceUpdate();
  48521. }
  48522. {
  48523. isUpdatingChildComponent = false;
  48524. }
  48525. }
  48526. function isInInactiveTree (vm) {
  48527. while (vm && (vm = vm.$parent)) {
  48528. if (vm._inactive) { return true }
  48529. }
  48530. return false
  48531. }
  48532. function activateChildComponent (vm, direct) {
  48533. if (direct) {
  48534. vm._directInactive = false;
  48535. if (isInInactiveTree(vm)) {
  48536. return
  48537. }
  48538. } else if (vm._directInactive) {
  48539. return
  48540. }
  48541. if (vm._inactive || vm._inactive === null) {
  48542. vm._inactive = false;
  48543. for (var i = 0; i < vm.$children.length; i++) {
  48544. activateChildComponent(vm.$children[i]);
  48545. }
  48546. callHook(vm, 'activated');
  48547. }
  48548. }
  48549. function deactivateChildComponent (vm, direct) {
  48550. if (direct) {
  48551. vm._directInactive = true;
  48552. if (isInInactiveTree(vm)) {
  48553. return
  48554. }
  48555. }
  48556. if (!vm._inactive) {
  48557. vm._inactive = true;
  48558. for (var i = 0; i < vm.$children.length; i++) {
  48559. deactivateChildComponent(vm.$children[i]);
  48560. }
  48561. callHook(vm, 'deactivated');
  48562. }
  48563. }
  48564. function callHook (vm, hook) {
  48565. // #7573 disable dep collection when invoking lifecycle hooks
  48566. pushTarget();
  48567. var handlers = vm.$options[hook];
  48568. var info = hook + " hook";
  48569. if (handlers) {
  48570. for (var i = 0, j = handlers.length; i < j; i++) {
  48571. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  48572. }
  48573. }
  48574. if (vm._hasHookEvent) {
  48575. vm.$emit('hook:' + hook);
  48576. }
  48577. popTarget();
  48578. }
  48579. /* */
  48580. var MAX_UPDATE_COUNT = 100;
  48581. var queue = [];
  48582. var activatedChildren = [];
  48583. var has = {};
  48584. var circular = {};
  48585. var waiting = false;
  48586. var flushing = false;
  48587. var index = 0;
  48588. /**
  48589. * Reset the scheduler's state.
  48590. */
  48591. function resetSchedulerState () {
  48592. index = queue.length = activatedChildren.length = 0;
  48593. has = {};
  48594. {
  48595. circular = {};
  48596. }
  48597. waiting = flushing = false;
  48598. }
  48599. // Async edge case #6566 requires saving the timestamp when event listeners are
  48600. // attached. However, calling performance.now() has a perf overhead especially
  48601. // if the page has thousands of event listeners. Instead, we take a timestamp
  48602. // every time the scheduler flushes and use that for all event listeners
  48603. // attached during that flush.
  48604. var currentFlushTimestamp = 0;
  48605. // Async edge case fix requires storing an event listener's attach timestamp.
  48606. var getNow = Date.now;
  48607. // Determine what event timestamp the browser is using. Annoyingly, the
  48608. // timestamp can either be hi-res (relative to page load) or low-res
  48609. // (relative to UNIX epoch), so in order to compare time we have to use the
  48610. // same timestamp type when saving the flush timestamp.
  48611. // All IE versions use low-res event timestamps, and have problematic clock
  48612. // implementations (#9632)
  48613. if (inBrowser && !isIE) {
  48614. var performance = window.performance;
  48615. if (
  48616. performance &&
  48617. typeof performance.now === 'function' &&
  48618. getNow() > document.createEvent('Event').timeStamp
  48619. ) {
  48620. // if the event timestamp, although evaluated AFTER the Date.now(), is
  48621. // smaller than it, it means the event is using a hi-res timestamp,
  48622. // and we need to use the hi-res version for event listener timestamps as
  48623. // well.
  48624. getNow = function () { return performance.now(); };
  48625. }
  48626. }
  48627. /**
  48628. * Flush both queues and run the watchers.
  48629. */
  48630. function flushSchedulerQueue () {
  48631. currentFlushTimestamp = getNow();
  48632. flushing = true;
  48633. var watcher, id;
  48634. // Sort queue before flush.
  48635. // This ensures that:
  48636. // 1. Components are updated from parent to child. (because parent is always
  48637. // created before the child)
  48638. // 2. A component's user watchers are run before its render watcher (because
  48639. // user watchers are created before the render watcher)
  48640. // 3. If a component is destroyed during a parent component's watcher run,
  48641. // its watchers can be skipped.
  48642. queue.sort(function (a, b) { return a.id - b.id; });
  48643. // do not cache length because more watchers might be pushed
  48644. // as we run existing watchers
  48645. for (index = 0; index < queue.length; index++) {
  48646. watcher = queue[index];
  48647. if (watcher.before) {
  48648. watcher.before();
  48649. }
  48650. id = watcher.id;
  48651. has[id] = null;
  48652. watcher.run();
  48653. // in dev build, check and stop circular updates.
  48654. if (has[id] != null) {
  48655. circular[id] = (circular[id] || 0) + 1;
  48656. if (circular[id] > MAX_UPDATE_COUNT) {
  48657. warn(
  48658. 'You may have an infinite update loop ' + (
  48659. watcher.user
  48660. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  48661. : "in a component render function."
  48662. ),
  48663. watcher.vm
  48664. );
  48665. break
  48666. }
  48667. }
  48668. }
  48669. // keep copies of post queues before resetting state
  48670. var activatedQueue = activatedChildren.slice();
  48671. var updatedQueue = queue.slice();
  48672. resetSchedulerState();
  48673. // call component updated and activated hooks
  48674. callActivatedHooks(activatedQueue);
  48675. callUpdatedHooks(updatedQueue);
  48676. // devtool hook
  48677. /* istanbul ignore if */
  48678. if (devtools && config.devtools) {
  48679. devtools.emit('flush');
  48680. }
  48681. }
  48682. function callUpdatedHooks (queue) {
  48683. var i = queue.length;
  48684. while (i--) {
  48685. var watcher = queue[i];
  48686. var vm = watcher.vm;
  48687. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  48688. callHook(vm, 'updated');
  48689. }
  48690. }
  48691. }
  48692. /**
  48693. * Queue a kept-alive component that was activated during patch.
  48694. * The queue will be processed after the entire tree has been patched.
  48695. */
  48696. function queueActivatedComponent (vm) {
  48697. // setting _inactive to false here so that a render function can
  48698. // rely on checking whether it's in an inactive tree (e.g. router-view)
  48699. vm._inactive = false;
  48700. activatedChildren.push(vm);
  48701. }
  48702. function callActivatedHooks (queue) {
  48703. for (var i = 0; i < queue.length; i++) {
  48704. queue[i]._inactive = true;
  48705. activateChildComponent(queue[i], true /* true */);
  48706. }
  48707. }
  48708. /**
  48709. * Push a watcher into the watcher queue.
  48710. * Jobs with duplicate IDs will be skipped unless it's
  48711. * pushed when the queue is being flushed.
  48712. */
  48713. function queueWatcher (watcher) {
  48714. var id = watcher.id;
  48715. if (has[id] == null) {
  48716. has[id] = true;
  48717. if (!flushing) {
  48718. queue.push(watcher);
  48719. } else {
  48720. // if already flushing, splice the watcher based on its id
  48721. // if already past its id, it will be run next immediately.
  48722. var i = queue.length - 1;
  48723. while (i > index && queue[i].id > watcher.id) {
  48724. i--;
  48725. }
  48726. queue.splice(i + 1, 0, watcher);
  48727. }
  48728. // queue the flush
  48729. if (!waiting) {
  48730. waiting = true;
  48731. if (!config.async) {
  48732. flushSchedulerQueue();
  48733. return
  48734. }
  48735. nextTick(flushSchedulerQueue);
  48736. }
  48737. }
  48738. }
  48739. /* */
  48740. var uid$2 = 0;
  48741. /**
  48742. * A watcher parses an expression, collects dependencies,
  48743. * and fires callback when the expression value changes.
  48744. * This is used for both the $watch() api and directives.
  48745. */
  48746. var Watcher = function Watcher (
  48747. vm,
  48748. expOrFn,
  48749. cb,
  48750. options,
  48751. isRenderWatcher
  48752. ) {
  48753. this.vm = vm;
  48754. if (isRenderWatcher) {
  48755. vm._watcher = this;
  48756. }
  48757. vm._watchers.push(this);
  48758. // options
  48759. if (options) {
  48760. this.deep = !!options.deep;
  48761. this.user = !!options.user;
  48762. this.lazy = !!options.lazy;
  48763. this.sync = !!options.sync;
  48764. this.before = options.before;
  48765. } else {
  48766. this.deep = this.user = this.lazy = this.sync = false;
  48767. }
  48768. this.cb = cb;
  48769. this.id = ++uid$2; // uid for batching
  48770. this.active = true;
  48771. this.dirty = this.lazy; // for lazy watchers
  48772. this.deps = [];
  48773. this.newDeps = [];
  48774. this.depIds = new _Set();
  48775. this.newDepIds = new _Set();
  48776. this.expression = expOrFn.toString();
  48777. // parse expression for getter
  48778. if (typeof expOrFn === 'function') {
  48779. this.getter = expOrFn;
  48780. } else {
  48781. this.getter = parsePath(expOrFn);
  48782. if (!this.getter) {
  48783. this.getter = noop;
  48784. warn(
  48785. "Failed watching path: \"" + expOrFn + "\" " +
  48786. 'Watcher only accepts simple dot-delimited paths. ' +
  48787. 'For full control, use a function instead.',
  48788. vm
  48789. );
  48790. }
  48791. }
  48792. this.value = this.lazy
  48793. ? undefined
  48794. : this.get();
  48795. };
  48796. /**
  48797. * Evaluate the getter, and re-collect dependencies.
  48798. */
  48799. Watcher.prototype.get = function get () {
  48800. pushTarget(this);
  48801. var value;
  48802. var vm = this.vm;
  48803. try {
  48804. value = this.getter.call(vm, vm);
  48805. } catch (e) {
  48806. if (this.user) {
  48807. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  48808. } else {
  48809. throw e
  48810. }
  48811. } finally {
  48812. // "touch" every property so they are all tracked as
  48813. // dependencies for deep watching
  48814. if (this.deep) {
  48815. traverse(value);
  48816. }
  48817. popTarget();
  48818. this.cleanupDeps();
  48819. }
  48820. return value
  48821. };
  48822. /**
  48823. * Add a dependency to this directive.
  48824. */
  48825. Watcher.prototype.addDep = function addDep (dep) {
  48826. var id = dep.id;
  48827. if (!this.newDepIds.has(id)) {
  48828. this.newDepIds.add(id);
  48829. this.newDeps.push(dep);
  48830. if (!this.depIds.has(id)) {
  48831. dep.addSub(this);
  48832. }
  48833. }
  48834. };
  48835. /**
  48836. * Clean up for dependency collection.
  48837. */
  48838. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  48839. var i = this.deps.length;
  48840. while (i--) {
  48841. var dep = this.deps[i];
  48842. if (!this.newDepIds.has(dep.id)) {
  48843. dep.removeSub(this);
  48844. }
  48845. }
  48846. var tmp = this.depIds;
  48847. this.depIds = this.newDepIds;
  48848. this.newDepIds = tmp;
  48849. this.newDepIds.clear();
  48850. tmp = this.deps;
  48851. this.deps = this.newDeps;
  48852. this.newDeps = tmp;
  48853. this.newDeps.length = 0;
  48854. };
  48855. /**
  48856. * Subscriber interface.
  48857. * Will be called when a dependency changes.
  48858. */
  48859. Watcher.prototype.update = function update () {
  48860. /* istanbul ignore else */
  48861. if (this.lazy) {
  48862. this.dirty = true;
  48863. } else if (this.sync) {
  48864. this.run();
  48865. } else {
  48866. queueWatcher(this);
  48867. }
  48868. };
  48869. /**
  48870. * Scheduler job interface.
  48871. * Will be called by the scheduler.
  48872. */
  48873. Watcher.prototype.run = function run () {
  48874. if (this.active) {
  48875. var value = this.get();
  48876. if (
  48877. value !== this.value ||
  48878. // Deep watchers and watchers on Object/Arrays should fire even
  48879. // when the value is the same, because the value may
  48880. // have mutated.
  48881. isObject(value) ||
  48882. this.deep
  48883. ) {
  48884. // set new value
  48885. var oldValue = this.value;
  48886. this.value = value;
  48887. if (this.user) {
  48888. try {
  48889. this.cb.call(this.vm, value, oldValue);
  48890. } catch (e) {
  48891. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  48892. }
  48893. } else {
  48894. this.cb.call(this.vm, value, oldValue);
  48895. }
  48896. }
  48897. }
  48898. };
  48899. /**
  48900. * Evaluate the value of the watcher.
  48901. * This only gets called for lazy watchers.
  48902. */
  48903. Watcher.prototype.evaluate = function evaluate () {
  48904. this.value = this.get();
  48905. this.dirty = false;
  48906. };
  48907. /**
  48908. * Depend on all deps collected by this watcher.
  48909. */
  48910. Watcher.prototype.depend = function depend () {
  48911. var i = this.deps.length;
  48912. while (i--) {
  48913. this.deps[i].depend();
  48914. }
  48915. };
  48916. /**
  48917. * Remove self from all dependencies' subscriber list.
  48918. */
  48919. Watcher.prototype.teardown = function teardown () {
  48920. if (this.active) {
  48921. // remove self from vm's watcher list
  48922. // this is a somewhat expensive operation so we skip it
  48923. // if the vm is being destroyed.
  48924. if (!this.vm._isBeingDestroyed) {
  48925. remove(this.vm._watchers, this);
  48926. }
  48927. var i = this.deps.length;
  48928. while (i--) {
  48929. this.deps[i].removeSub(this);
  48930. }
  48931. this.active = false;
  48932. }
  48933. };
  48934. /* */
  48935. var sharedPropertyDefinition = {
  48936. enumerable: true,
  48937. configurable: true,
  48938. get: noop,
  48939. set: noop
  48940. };
  48941. function proxy (target, sourceKey, key) {
  48942. sharedPropertyDefinition.get = function proxyGetter () {
  48943. return this[sourceKey][key]
  48944. };
  48945. sharedPropertyDefinition.set = function proxySetter (val) {
  48946. this[sourceKey][key] = val;
  48947. };
  48948. Object.defineProperty(target, key, sharedPropertyDefinition);
  48949. }
  48950. function initState (vm) {
  48951. vm._watchers = [];
  48952. var opts = vm.$options;
  48953. if (opts.props) { initProps(vm, opts.props); }
  48954. if (opts.methods) { initMethods(vm, opts.methods); }
  48955. if (opts.data) {
  48956. initData(vm);
  48957. } else {
  48958. observe(vm._data = {}, true /* asRootData */);
  48959. }
  48960. if (opts.computed) { initComputed(vm, opts.computed); }
  48961. if (opts.watch && opts.watch !== nativeWatch) {
  48962. initWatch(vm, opts.watch);
  48963. }
  48964. }
  48965. function initProps (vm, propsOptions) {
  48966. var propsData = vm.$options.propsData || {};
  48967. var props = vm._props = {};
  48968. // cache prop keys so that future props updates can iterate using Array
  48969. // instead of dynamic object key enumeration.
  48970. var keys = vm.$options._propKeys = [];
  48971. var isRoot = !vm.$parent;
  48972. // root instance props should be converted
  48973. if (!isRoot) {
  48974. toggleObserving(false);
  48975. }
  48976. var loop = function ( key ) {
  48977. keys.push(key);
  48978. var value = validateProp(key, propsOptions, propsData, vm);
  48979. /* istanbul ignore else */
  48980. {
  48981. var hyphenatedKey = hyphenate(key);
  48982. if (isReservedAttribute(hyphenatedKey) ||
  48983. config.isReservedAttr(hyphenatedKey)) {
  48984. warn(
  48985. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  48986. vm
  48987. );
  48988. }
  48989. defineReactive$$1(props, key, value, function () {
  48990. if (!isRoot && !isUpdatingChildComponent) {
  48991. warn(
  48992. "Avoid mutating a prop directly since the value will be " +
  48993. "overwritten whenever the parent component re-renders. " +
  48994. "Instead, use a data or computed property based on the prop's " +
  48995. "value. Prop being mutated: \"" + key + "\"",
  48996. vm
  48997. );
  48998. }
  48999. });
  49000. }
  49001. // static props are already proxied on the component's prototype
  49002. // during Vue.extend(). We only need to proxy props defined at
  49003. // instantiation here.
  49004. if (!(key in vm)) {
  49005. proxy(vm, "_props", key);
  49006. }
  49007. };
  49008. for (var key in propsOptions) loop( key );
  49009. toggleObserving(true);
  49010. }
  49011. function initData (vm) {
  49012. var data = vm.$options.data;
  49013. data = vm._data = typeof data === 'function'
  49014. ? getData(data, vm)
  49015. : data || {};
  49016. if (!isPlainObject(data)) {
  49017. data = {};
  49018. warn(
  49019. 'data functions should return an object:\n' +
  49020. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  49021. vm
  49022. );
  49023. }
  49024. // proxy data on instance
  49025. var keys = Object.keys(data);
  49026. var props = vm.$options.props;
  49027. var methods = vm.$options.methods;
  49028. var i = keys.length;
  49029. while (i--) {
  49030. var key = keys[i];
  49031. {
  49032. if (methods && hasOwn(methods, key)) {
  49033. warn(
  49034. ("Method \"" + key + "\" has already been defined as a data property."),
  49035. vm
  49036. );
  49037. }
  49038. }
  49039. if (props && hasOwn(props, key)) {
  49040. warn(
  49041. "The data property \"" + key + "\" is already declared as a prop. " +
  49042. "Use prop default value instead.",
  49043. vm
  49044. );
  49045. } else if (!isReserved(key)) {
  49046. proxy(vm, "_data", key);
  49047. }
  49048. }
  49049. // observe data
  49050. observe(data, true /* asRootData */);
  49051. }
  49052. function getData (data, vm) {
  49053. // #7573 disable dep collection when invoking data getters
  49054. pushTarget();
  49055. try {
  49056. return data.call(vm, vm)
  49057. } catch (e) {
  49058. handleError(e, vm, "data()");
  49059. return {}
  49060. } finally {
  49061. popTarget();
  49062. }
  49063. }
  49064. var computedWatcherOptions = { lazy: true };
  49065. function initComputed (vm, computed) {
  49066. // $flow-disable-line
  49067. var watchers = vm._computedWatchers = Object.create(null);
  49068. // computed properties are just getters during SSR
  49069. var isSSR = isServerRendering();
  49070. for (var key in computed) {
  49071. var userDef = computed[key];
  49072. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  49073. if (getter == null) {
  49074. warn(
  49075. ("Getter is missing for computed property \"" + key + "\"."),
  49076. vm
  49077. );
  49078. }
  49079. if (!isSSR) {
  49080. // create internal watcher for the computed property.
  49081. watchers[key] = new Watcher(
  49082. vm,
  49083. getter || noop,
  49084. noop,
  49085. computedWatcherOptions
  49086. );
  49087. }
  49088. // component-defined computed properties are already defined on the
  49089. // component prototype. We only need to define computed properties defined
  49090. // at instantiation here.
  49091. if (!(key in vm)) {
  49092. defineComputed(vm, key, userDef);
  49093. } else {
  49094. if (key in vm.$data) {
  49095. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  49096. } else if (vm.$options.props && key in vm.$options.props) {
  49097. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  49098. }
  49099. }
  49100. }
  49101. }
  49102. function defineComputed (
  49103. target,
  49104. key,
  49105. userDef
  49106. ) {
  49107. var shouldCache = !isServerRendering();
  49108. if (typeof userDef === 'function') {
  49109. sharedPropertyDefinition.get = shouldCache
  49110. ? createComputedGetter(key)
  49111. : createGetterInvoker(userDef);
  49112. sharedPropertyDefinition.set = noop;
  49113. } else {
  49114. sharedPropertyDefinition.get = userDef.get
  49115. ? shouldCache && userDef.cache !== false
  49116. ? createComputedGetter(key)
  49117. : createGetterInvoker(userDef.get)
  49118. : noop;
  49119. sharedPropertyDefinition.set = userDef.set || noop;
  49120. }
  49121. if (sharedPropertyDefinition.set === noop) {
  49122. sharedPropertyDefinition.set = function () {
  49123. warn(
  49124. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  49125. this
  49126. );
  49127. };
  49128. }
  49129. Object.defineProperty(target, key, sharedPropertyDefinition);
  49130. }
  49131. function createComputedGetter (key) {
  49132. return function computedGetter () {
  49133. var watcher = this._computedWatchers && this._computedWatchers[key];
  49134. if (watcher) {
  49135. if (watcher.dirty) {
  49136. watcher.evaluate();
  49137. }
  49138. if (Dep.target) {
  49139. watcher.depend();
  49140. }
  49141. return watcher.value
  49142. }
  49143. }
  49144. }
  49145. function createGetterInvoker(fn) {
  49146. return function computedGetter () {
  49147. return fn.call(this, this)
  49148. }
  49149. }
  49150. function initMethods (vm, methods) {
  49151. var props = vm.$options.props;
  49152. for (var key in methods) {
  49153. {
  49154. if (typeof methods[key] !== 'function') {
  49155. warn(
  49156. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  49157. "Did you reference the function correctly?",
  49158. vm
  49159. );
  49160. }
  49161. if (props && hasOwn(props, key)) {
  49162. warn(
  49163. ("Method \"" + key + "\" has already been defined as a prop."),
  49164. vm
  49165. );
  49166. }
  49167. if ((key in vm) && isReserved(key)) {
  49168. warn(
  49169. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  49170. "Avoid defining component methods that start with _ or $."
  49171. );
  49172. }
  49173. }
  49174. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  49175. }
  49176. }
  49177. function initWatch (vm, watch) {
  49178. for (var key in watch) {
  49179. var handler = watch[key];
  49180. if (Array.isArray(handler)) {
  49181. for (var i = 0; i < handler.length; i++) {
  49182. createWatcher(vm, key, handler[i]);
  49183. }
  49184. } else {
  49185. createWatcher(vm, key, handler);
  49186. }
  49187. }
  49188. }
  49189. function createWatcher (
  49190. vm,
  49191. expOrFn,
  49192. handler,
  49193. options
  49194. ) {
  49195. if (isPlainObject(handler)) {
  49196. options = handler;
  49197. handler = handler.handler;
  49198. }
  49199. if (typeof handler === 'string') {
  49200. handler = vm[handler];
  49201. }
  49202. return vm.$watch(expOrFn, handler, options)
  49203. }
  49204. function stateMixin (Vue) {
  49205. // flow somehow has problems with directly declared definition object
  49206. // when using Object.defineProperty, so we have to procedurally build up
  49207. // the object here.
  49208. var dataDef = {};
  49209. dataDef.get = function () { return this._data };
  49210. var propsDef = {};
  49211. propsDef.get = function () { return this._props };
  49212. {
  49213. dataDef.set = function () {
  49214. warn(
  49215. 'Avoid replacing instance root $data. ' +
  49216. 'Use nested data properties instead.',
  49217. this
  49218. );
  49219. };
  49220. propsDef.set = function () {
  49221. warn("$props is readonly.", this);
  49222. };
  49223. }
  49224. Object.defineProperty(Vue.prototype, '$data', dataDef);
  49225. Object.defineProperty(Vue.prototype, '$props', propsDef);
  49226. Vue.prototype.$set = set;
  49227. Vue.prototype.$delete = del;
  49228. Vue.prototype.$watch = function (
  49229. expOrFn,
  49230. cb,
  49231. options
  49232. ) {
  49233. var vm = this;
  49234. if (isPlainObject(cb)) {
  49235. return createWatcher(vm, expOrFn, cb, options)
  49236. }
  49237. options = options || {};
  49238. options.user = true;
  49239. var watcher = new Watcher(vm, expOrFn, cb, options);
  49240. if (options.immediate) {
  49241. try {
  49242. cb.call(vm, watcher.value);
  49243. } catch (error) {
  49244. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  49245. }
  49246. }
  49247. return function unwatchFn () {
  49248. watcher.teardown();
  49249. }
  49250. };
  49251. }
  49252. /* */
  49253. var uid$3 = 0;
  49254. function initMixin (Vue) {
  49255. Vue.prototype._init = function (options) {
  49256. var vm = this;
  49257. // a uid
  49258. vm._uid = uid$3++;
  49259. var startTag, endTag;
  49260. /* istanbul ignore if */
  49261. if (config.performance && mark) {
  49262. startTag = "vue-perf-start:" + (vm._uid);
  49263. endTag = "vue-perf-end:" + (vm._uid);
  49264. mark(startTag);
  49265. }
  49266. // a flag to avoid this being observed
  49267. vm._isVue = true;
  49268. // merge options
  49269. if (options && options._isComponent) {
  49270. // optimize internal component instantiation
  49271. // since dynamic options merging is pretty slow, and none of the
  49272. // internal component options needs special treatment.
  49273. initInternalComponent(vm, options);
  49274. } else {
  49275. vm.$options = mergeOptions(
  49276. resolveConstructorOptions(vm.constructor),
  49277. options || {},
  49278. vm
  49279. );
  49280. }
  49281. /* istanbul ignore else */
  49282. {
  49283. initProxy(vm);
  49284. }
  49285. // expose real self
  49286. vm._self = vm;
  49287. initLifecycle(vm);
  49288. initEvents(vm);
  49289. initRender(vm);
  49290. callHook(vm, 'beforeCreate');
  49291. initInjections(vm); // resolve injections before data/props
  49292. initState(vm);
  49293. initProvide(vm); // resolve provide after data/props
  49294. callHook(vm, 'created');
  49295. /* istanbul ignore if */
  49296. if (config.performance && mark) {
  49297. vm._name = formatComponentName(vm, false);
  49298. mark(endTag);
  49299. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  49300. }
  49301. if (vm.$options.el) {
  49302. vm.$mount(vm.$options.el);
  49303. }
  49304. };
  49305. }
  49306. function initInternalComponent (vm, options) {
  49307. var opts = vm.$options = Object.create(vm.constructor.options);
  49308. // doing this because it's faster than dynamic enumeration.
  49309. var parentVnode = options._parentVnode;
  49310. opts.parent = options.parent;
  49311. opts._parentVnode = parentVnode;
  49312. var vnodeComponentOptions = parentVnode.componentOptions;
  49313. opts.propsData = vnodeComponentOptions.propsData;
  49314. opts._parentListeners = vnodeComponentOptions.listeners;
  49315. opts._renderChildren = vnodeComponentOptions.children;
  49316. opts._componentTag = vnodeComponentOptions.tag;
  49317. if (options.render) {
  49318. opts.render = options.render;
  49319. opts.staticRenderFns = options.staticRenderFns;
  49320. }
  49321. }
  49322. function resolveConstructorOptions (Ctor) {
  49323. var options = Ctor.options;
  49324. if (Ctor.super) {
  49325. var superOptions = resolveConstructorOptions(Ctor.super);
  49326. var cachedSuperOptions = Ctor.superOptions;
  49327. if (superOptions !== cachedSuperOptions) {
  49328. // super option changed,
  49329. // need to resolve new options.
  49330. Ctor.superOptions = superOptions;
  49331. // check if there are any late-modified/attached options (#4976)
  49332. var modifiedOptions = resolveModifiedOptions(Ctor);
  49333. // update base extend options
  49334. if (modifiedOptions) {
  49335. extend(Ctor.extendOptions, modifiedOptions);
  49336. }
  49337. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  49338. if (options.name) {
  49339. options.components[options.name] = Ctor;
  49340. }
  49341. }
  49342. }
  49343. return options
  49344. }
  49345. function resolveModifiedOptions (Ctor) {
  49346. var modified;
  49347. var latest = Ctor.options;
  49348. var sealed = Ctor.sealedOptions;
  49349. for (var key in latest) {
  49350. if (latest[key] !== sealed[key]) {
  49351. if (!modified) { modified = {}; }
  49352. modified[key] = latest[key];
  49353. }
  49354. }
  49355. return modified
  49356. }
  49357. function Vue (options) {
  49358. if (!(this instanceof Vue)
  49359. ) {
  49360. warn('Vue is a constructor and should be called with the `new` keyword');
  49361. }
  49362. this._init(options);
  49363. }
  49364. initMixin(Vue);
  49365. stateMixin(Vue);
  49366. eventsMixin(Vue);
  49367. lifecycleMixin(Vue);
  49368. renderMixin(Vue);
  49369. /* */
  49370. function initUse (Vue) {
  49371. Vue.use = function (plugin) {
  49372. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  49373. if (installedPlugins.indexOf(plugin) > -1) {
  49374. return this
  49375. }
  49376. // additional parameters
  49377. var args = toArray(arguments, 1);
  49378. args.unshift(this);
  49379. if (typeof plugin.install === 'function') {
  49380. plugin.install.apply(plugin, args);
  49381. } else if (typeof plugin === 'function') {
  49382. plugin.apply(null, args);
  49383. }
  49384. installedPlugins.push(plugin);
  49385. return this
  49386. };
  49387. }
  49388. /* */
  49389. function initMixin$1 (Vue) {
  49390. Vue.mixin = function (mixin) {
  49391. this.options = mergeOptions(this.options, mixin);
  49392. return this
  49393. };
  49394. }
  49395. /* */
  49396. function initExtend (Vue) {
  49397. /**
  49398. * Each instance constructor, including Vue, has a unique
  49399. * cid. This enables us to create wrapped "child
  49400. * constructors" for prototypal inheritance and cache them.
  49401. */
  49402. Vue.cid = 0;
  49403. var cid = 1;
  49404. /**
  49405. * Class inheritance
  49406. */
  49407. Vue.extend = function (extendOptions) {
  49408. extendOptions = extendOptions || {};
  49409. var Super = this;
  49410. var SuperId = Super.cid;
  49411. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  49412. if (cachedCtors[SuperId]) {
  49413. return cachedCtors[SuperId]
  49414. }
  49415. var name = extendOptions.name || Super.options.name;
  49416. if (name) {
  49417. validateComponentName(name);
  49418. }
  49419. var Sub = function VueComponent (options) {
  49420. this._init(options);
  49421. };
  49422. Sub.prototype = Object.create(Super.prototype);
  49423. Sub.prototype.constructor = Sub;
  49424. Sub.cid = cid++;
  49425. Sub.options = mergeOptions(
  49426. Super.options,
  49427. extendOptions
  49428. );
  49429. Sub['super'] = Super;
  49430. // For props and computed properties, we define the proxy getters on
  49431. // the Vue instances at extension time, on the extended prototype. This
  49432. // avoids Object.defineProperty calls for each instance created.
  49433. if (Sub.options.props) {
  49434. initProps$1(Sub);
  49435. }
  49436. if (Sub.options.computed) {
  49437. initComputed$1(Sub);
  49438. }
  49439. // allow further extension/mixin/plugin usage
  49440. Sub.extend = Super.extend;
  49441. Sub.mixin = Super.mixin;
  49442. Sub.use = Super.use;
  49443. // create asset registers, so extended classes
  49444. // can have their private assets too.
  49445. ASSET_TYPES.forEach(function (type) {
  49446. Sub[type] = Super[type];
  49447. });
  49448. // enable recursive self-lookup
  49449. if (name) {
  49450. Sub.options.components[name] = Sub;
  49451. }
  49452. // keep a reference to the super options at extension time.
  49453. // later at instantiation we can check if Super's options have
  49454. // been updated.
  49455. Sub.superOptions = Super.options;
  49456. Sub.extendOptions = extendOptions;
  49457. Sub.sealedOptions = extend({}, Sub.options);
  49458. // cache constructor
  49459. cachedCtors[SuperId] = Sub;
  49460. return Sub
  49461. };
  49462. }
  49463. function initProps$1 (Comp) {
  49464. var props = Comp.options.props;
  49465. for (var key in props) {
  49466. proxy(Comp.prototype, "_props", key);
  49467. }
  49468. }
  49469. function initComputed$1 (Comp) {
  49470. var computed = Comp.options.computed;
  49471. for (var key in computed) {
  49472. defineComputed(Comp.prototype, key, computed[key]);
  49473. }
  49474. }
  49475. /* */
  49476. function initAssetRegisters (Vue) {
  49477. /**
  49478. * Create asset registration methods.
  49479. */
  49480. ASSET_TYPES.forEach(function (type) {
  49481. Vue[type] = function (
  49482. id,
  49483. definition
  49484. ) {
  49485. if (!definition) {
  49486. return this.options[type + 's'][id]
  49487. } else {
  49488. /* istanbul ignore if */
  49489. if (type === 'component') {
  49490. validateComponentName(id);
  49491. }
  49492. if (type === 'component' && isPlainObject(definition)) {
  49493. definition.name = definition.name || id;
  49494. definition = this.options._base.extend(definition);
  49495. }
  49496. if (type === 'directive' && typeof definition === 'function') {
  49497. definition = { bind: definition, update: definition };
  49498. }
  49499. this.options[type + 's'][id] = definition;
  49500. return definition
  49501. }
  49502. };
  49503. });
  49504. }
  49505. /* */
  49506. function getComponentName (opts) {
  49507. return opts && (opts.Ctor.options.name || opts.tag)
  49508. }
  49509. function matches (pattern, name) {
  49510. if (Array.isArray(pattern)) {
  49511. return pattern.indexOf(name) > -1
  49512. } else if (typeof pattern === 'string') {
  49513. return pattern.split(',').indexOf(name) > -1
  49514. } else if (isRegExp(pattern)) {
  49515. return pattern.test(name)
  49516. }
  49517. /* istanbul ignore next */
  49518. return false
  49519. }
  49520. function pruneCache (keepAliveInstance, filter) {
  49521. var cache = keepAliveInstance.cache;
  49522. var keys = keepAliveInstance.keys;
  49523. var _vnode = keepAliveInstance._vnode;
  49524. for (var key in cache) {
  49525. var cachedNode = cache[key];
  49526. if (cachedNode) {
  49527. var name = getComponentName(cachedNode.componentOptions);
  49528. if (name && !filter(name)) {
  49529. pruneCacheEntry(cache, key, keys, _vnode);
  49530. }
  49531. }
  49532. }
  49533. }
  49534. function pruneCacheEntry (
  49535. cache,
  49536. key,
  49537. keys,
  49538. current
  49539. ) {
  49540. var cached$$1 = cache[key];
  49541. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  49542. cached$$1.componentInstance.$destroy();
  49543. }
  49544. cache[key] = null;
  49545. remove(keys, key);
  49546. }
  49547. var patternTypes = [String, RegExp, Array];
  49548. var KeepAlive = {
  49549. name: 'keep-alive',
  49550. abstract: true,
  49551. props: {
  49552. include: patternTypes,
  49553. exclude: patternTypes,
  49554. max: [String, Number]
  49555. },
  49556. created: function created () {
  49557. this.cache = Object.create(null);
  49558. this.keys = [];
  49559. },
  49560. destroyed: function destroyed () {
  49561. for (var key in this.cache) {
  49562. pruneCacheEntry(this.cache, key, this.keys);
  49563. }
  49564. },
  49565. mounted: function mounted () {
  49566. var this$1 = this;
  49567. this.$watch('include', function (val) {
  49568. pruneCache(this$1, function (name) { return matches(val, name); });
  49569. });
  49570. this.$watch('exclude', function (val) {
  49571. pruneCache(this$1, function (name) { return !matches(val, name); });
  49572. });
  49573. },
  49574. render: function render () {
  49575. var slot = this.$slots.default;
  49576. var vnode = getFirstComponentChild(slot);
  49577. var componentOptions = vnode && vnode.componentOptions;
  49578. if (componentOptions) {
  49579. // check pattern
  49580. var name = getComponentName(componentOptions);
  49581. var ref = this;
  49582. var include = ref.include;
  49583. var exclude = ref.exclude;
  49584. if (
  49585. // not included
  49586. (include && (!name || !matches(include, name))) ||
  49587. // excluded
  49588. (exclude && name && matches(exclude, name))
  49589. ) {
  49590. return vnode
  49591. }
  49592. var ref$1 = this;
  49593. var cache = ref$1.cache;
  49594. var keys = ref$1.keys;
  49595. var key = vnode.key == null
  49596. // same constructor may get registered as different local components
  49597. // so cid alone is not enough (#3269)
  49598. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  49599. : vnode.key;
  49600. if (cache[key]) {
  49601. vnode.componentInstance = cache[key].componentInstance;
  49602. // make current key freshest
  49603. remove(keys, key);
  49604. keys.push(key);
  49605. } else {
  49606. cache[key] = vnode;
  49607. keys.push(key);
  49608. // prune oldest entry
  49609. if (this.max && keys.length > parseInt(this.max)) {
  49610. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  49611. }
  49612. }
  49613. vnode.data.keepAlive = true;
  49614. }
  49615. return vnode || (slot && slot[0])
  49616. }
  49617. };
  49618. var builtInComponents = {
  49619. KeepAlive: KeepAlive
  49620. };
  49621. /* */
  49622. function initGlobalAPI (Vue) {
  49623. // config
  49624. var configDef = {};
  49625. configDef.get = function () { return config; };
  49626. {
  49627. configDef.set = function () {
  49628. warn(
  49629. 'Do not replace the Vue.config object, set individual fields instead.'
  49630. );
  49631. };
  49632. }
  49633. Object.defineProperty(Vue, 'config', configDef);
  49634. // exposed util methods.
  49635. // NOTE: these are not considered part of the public API - avoid relying on
  49636. // them unless you are aware of the risk.
  49637. Vue.util = {
  49638. warn: warn,
  49639. extend: extend,
  49640. mergeOptions: mergeOptions,
  49641. defineReactive: defineReactive$$1
  49642. };
  49643. Vue.set = set;
  49644. Vue.delete = del;
  49645. Vue.nextTick = nextTick;
  49646. // 2.6 explicit observable API
  49647. Vue.observable = function (obj) {
  49648. observe(obj);
  49649. return obj
  49650. };
  49651. Vue.options = Object.create(null);
  49652. ASSET_TYPES.forEach(function (type) {
  49653. Vue.options[type + 's'] = Object.create(null);
  49654. });
  49655. // this is used to identify the "base" constructor to extend all plain-object
  49656. // components with in Weex's multi-instance scenarios.
  49657. Vue.options._base = Vue;
  49658. extend(Vue.options.components, builtInComponents);
  49659. initUse(Vue);
  49660. initMixin$1(Vue);
  49661. initExtend(Vue);
  49662. initAssetRegisters(Vue);
  49663. }
  49664. initGlobalAPI(Vue);
  49665. Object.defineProperty(Vue.prototype, '$isServer', {
  49666. get: isServerRendering
  49667. });
  49668. Object.defineProperty(Vue.prototype, '$ssrContext', {
  49669. get: function get () {
  49670. /* istanbul ignore next */
  49671. return this.$vnode && this.$vnode.ssrContext
  49672. }
  49673. });
  49674. // expose FunctionalRenderContext for ssr runtime helper installation
  49675. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  49676. value: FunctionalRenderContext
  49677. });
  49678. Vue.version = '2.6.11';
  49679. /* */
  49680. // these are reserved for web because they are directly compiled away
  49681. // during template compilation
  49682. var isReservedAttr = makeMap('style,class');
  49683. // attributes that should be using props for binding
  49684. var acceptValue = makeMap('input,textarea,option,select,progress');
  49685. var mustUseProp = function (tag, type, attr) {
  49686. return (
  49687. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  49688. (attr === 'selected' && tag === 'option') ||
  49689. (attr === 'checked' && tag === 'input') ||
  49690. (attr === 'muted' && tag === 'video')
  49691. )
  49692. };
  49693. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  49694. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  49695. var convertEnumeratedValue = function (key, value) {
  49696. return isFalsyAttrValue(value) || value === 'false'
  49697. ? 'false'
  49698. // allow arbitrary string value for contenteditable
  49699. : key === 'contenteditable' && isValidContentEditableValue(value)
  49700. ? value
  49701. : 'true'
  49702. };
  49703. var isBooleanAttr = makeMap(
  49704. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  49705. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  49706. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  49707. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  49708. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  49709. 'truespeed,typemustmatch,visible'
  49710. );
  49711. var xlinkNS = 'http://www.w3.org/1999/xlink';
  49712. var isXlink = function (name) {
  49713. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  49714. };
  49715. var getXlinkProp = function (name) {
  49716. return isXlink(name) ? name.slice(6, name.length) : ''
  49717. };
  49718. var isFalsyAttrValue = function (val) {
  49719. return val == null || val === false
  49720. };
  49721. /* */
  49722. function genClassForVnode (vnode) {
  49723. var data = vnode.data;
  49724. var parentNode = vnode;
  49725. var childNode = vnode;
  49726. while (isDef(childNode.componentInstance)) {
  49727. childNode = childNode.componentInstance._vnode;
  49728. if (childNode && childNode.data) {
  49729. data = mergeClassData(childNode.data, data);
  49730. }
  49731. }
  49732. while (isDef(parentNode = parentNode.parent)) {
  49733. if (parentNode && parentNode.data) {
  49734. data = mergeClassData(data, parentNode.data);
  49735. }
  49736. }
  49737. return renderClass(data.staticClass, data.class)
  49738. }
  49739. function mergeClassData (child, parent) {
  49740. return {
  49741. staticClass: concat(child.staticClass, parent.staticClass),
  49742. class: isDef(child.class)
  49743. ? [child.class, parent.class]
  49744. : parent.class
  49745. }
  49746. }
  49747. function renderClass (
  49748. staticClass,
  49749. dynamicClass
  49750. ) {
  49751. if (isDef(staticClass) || isDef(dynamicClass)) {
  49752. return concat(staticClass, stringifyClass(dynamicClass))
  49753. }
  49754. /* istanbul ignore next */
  49755. return ''
  49756. }
  49757. function concat (a, b) {
  49758. return a ? b ? (a + ' ' + b) : a : (b || '')
  49759. }
  49760. function stringifyClass (value) {
  49761. if (Array.isArray(value)) {
  49762. return stringifyArray(value)
  49763. }
  49764. if (isObject(value)) {
  49765. return stringifyObject(value)
  49766. }
  49767. if (typeof value === 'string') {
  49768. return value
  49769. }
  49770. /* istanbul ignore next */
  49771. return ''
  49772. }
  49773. function stringifyArray (value) {
  49774. var res = '';
  49775. var stringified;
  49776. for (var i = 0, l = value.length; i < l; i++) {
  49777. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  49778. if (res) { res += ' '; }
  49779. res += stringified;
  49780. }
  49781. }
  49782. return res
  49783. }
  49784. function stringifyObject (value) {
  49785. var res = '';
  49786. for (var key in value) {
  49787. if (value[key]) {
  49788. if (res) { res += ' '; }
  49789. res += key;
  49790. }
  49791. }
  49792. return res
  49793. }
  49794. /* */
  49795. var namespaceMap = {
  49796. svg: 'http://www.w3.org/2000/svg',
  49797. math: 'http://www.w3.org/1998/Math/MathML'
  49798. };
  49799. var isHTMLTag = makeMap(
  49800. 'html,body,base,head,link,meta,style,title,' +
  49801. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  49802. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  49803. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  49804. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  49805. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  49806. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  49807. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  49808. 'output,progress,select,textarea,' +
  49809. 'details,dialog,menu,menuitem,summary,' +
  49810. 'content,element,shadow,template,blockquote,iframe,tfoot'
  49811. );
  49812. // this map is intentionally selective, only covering SVG elements that may
  49813. // contain child elements.
  49814. var isSVG = makeMap(
  49815. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  49816. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  49817. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  49818. true
  49819. );
  49820. var isPreTag = function (tag) { return tag === 'pre'; };
  49821. var isReservedTag = function (tag) {
  49822. return isHTMLTag(tag) || isSVG(tag)
  49823. };
  49824. function getTagNamespace (tag) {
  49825. if (isSVG(tag)) {
  49826. return 'svg'
  49827. }
  49828. // basic support for MathML
  49829. // note it doesn't support other MathML elements being component roots
  49830. if (tag === 'math') {
  49831. return 'math'
  49832. }
  49833. }
  49834. var unknownElementCache = Object.create(null);
  49835. function isUnknownElement (tag) {
  49836. /* istanbul ignore if */
  49837. if (!inBrowser) {
  49838. return true
  49839. }
  49840. if (isReservedTag(tag)) {
  49841. return false
  49842. }
  49843. tag = tag.toLowerCase();
  49844. /* istanbul ignore if */
  49845. if (unknownElementCache[tag] != null) {
  49846. return unknownElementCache[tag]
  49847. }
  49848. var el = document.createElement(tag);
  49849. if (tag.indexOf('-') > -1) {
  49850. // http://stackoverflow.com/a/28210364/1070244
  49851. return (unknownElementCache[tag] = (
  49852. el.constructor === window.HTMLUnknownElement ||
  49853. el.constructor === window.HTMLElement
  49854. ))
  49855. } else {
  49856. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  49857. }
  49858. }
  49859. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  49860. /* */
  49861. /**
  49862. * Query an element selector if it's not an element already.
  49863. */
  49864. function query (el) {
  49865. if (typeof el === 'string') {
  49866. var selected = document.querySelector(el);
  49867. if (!selected) {
  49868. warn(
  49869. 'Cannot find element: ' + el
  49870. );
  49871. return document.createElement('div')
  49872. }
  49873. return selected
  49874. } else {
  49875. return el
  49876. }
  49877. }
  49878. /* */
  49879. function createElement$1 (tagName, vnode) {
  49880. var elm = document.createElement(tagName);
  49881. if (tagName !== 'select') {
  49882. return elm
  49883. }
  49884. // false or null will remove the attribute but undefined will not
  49885. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  49886. elm.setAttribute('multiple', 'multiple');
  49887. }
  49888. return elm
  49889. }
  49890. function createElementNS (namespace, tagName) {
  49891. return document.createElementNS(namespaceMap[namespace], tagName)
  49892. }
  49893. function createTextNode (text) {
  49894. return document.createTextNode(text)
  49895. }
  49896. function createComment (text) {
  49897. return document.createComment(text)
  49898. }
  49899. function insertBefore (parentNode, newNode, referenceNode) {
  49900. parentNode.insertBefore(newNode, referenceNode);
  49901. }
  49902. function removeChild (node, child) {
  49903. node.removeChild(child);
  49904. }
  49905. function appendChild (node, child) {
  49906. node.appendChild(child);
  49907. }
  49908. function parentNode (node) {
  49909. return node.parentNode
  49910. }
  49911. function nextSibling (node) {
  49912. return node.nextSibling
  49913. }
  49914. function tagName (node) {
  49915. return node.tagName
  49916. }
  49917. function setTextContent (node, text) {
  49918. node.textContent = text;
  49919. }
  49920. function setStyleScope (node, scopeId) {
  49921. node.setAttribute(scopeId, '');
  49922. }
  49923. var nodeOps = /*#__PURE__*/Object.freeze({
  49924. createElement: createElement$1,
  49925. createElementNS: createElementNS,
  49926. createTextNode: createTextNode,
  49927. createComment: createComment,
  49928. insertBefore: insertBefore,
  49929. removeChild: removeChild,
  49930. appendChild: appendChild,
  49931. parentNode: parentNode,
  49932. nextSibling: nextSibling,
  49933. tagName: tagName,
  49934. setTextContent: setTextContent,
  49935. setStyleScope: setStyleScope
  49936. });
  49937. /* */
  49938. var ref = {
  49939. create: function create (_, vnode) {
  49940. registerRef(vnode);
  49941. },
  49942. update: function update (oldVnode, vnode) {
  49943. if (oldVnode.data.ref !== vnode.data.ref) {
  49944. registerRef(oldVnode, true);
  49945. registerRef(vnode);
  49946. }
  49947. },
  49948. destroy: function destroy (vnode) {
  49949. registerRef(vnode, true);
  49950. }
  49951. };
  49952. function registerRef (vnode, isRemoval) {
  49953. var key = vnode.data.ref;
  49954. if (!isDef(key)) { return }
  49955. var vm = vnode.context;
  49956. var ref = vnode.componentInstance || vnode.elm;
  49957. var refs = vm.$refs;
  49958. if (isRemoval) {
  49959. if (Array.isArray(refs[key])) {
  49960. remove(refs[key], ref);
  49961. } else if (refs[key] === ref) {
  49962. refs[key] = undefined;
  49963. }
  49964. } else {
  49965. if (vnode.data.refInFor) {
  49966. if (!Array.isArray(refs[key])) {
  49967. refs[key] = [ref];
  49968. } else if (refs[key].indexOf(ref) < 0) {
  49969. // $flow-disable-line
  49970. refs[key].push(ref);
  49971. }
  49972. } else {
  49973. refs[key] = ref;
  49974. }
  49975. }
  49976. }
  49977. /**
  49978. * Virtual DOM patching algorithm based on Snabbdom by
  49979. * Simon Friis Vindum (@paldepind)
  49980. * Licensed under the MIT License
  49981. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  49982. *
  49983. * modified by Evan You (@yyx990803)
  49984. *
  49985. * Not type-checking this because this file is perf-critical and the cost
  49986. * of making flow understand it is not worth it.
  49987. */
  49988. var emptyNode = new VNode('', {}, []);
  49989. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  49990. function sameVnode (a, b) {
  49991. return (
  49992. a.key === b.key && (
  49993. (
  49994. a.tag === b.tag &&
  49995. a.isComment === b.isComment &&
  49996. isDef(a.data) === isDef(b.data) &&
  49997. sameInputType(a, b)
  49998. ) || (
  49999. isTrue(a.isAsyncPlaceholder) &&
  50000. a.asyncFactory === b.asyncFactory &&
  50001. isUndef(b.asyncFactory.error)
  50002. )
  50003. )
  50004. )
  50005. }
  50006. function sameInputType (a, b) {
  50007. if (a.tag !== 'input') { return true }
  50008. var i;
  50009. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  50010. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  50011. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  50012. }
  50013. function createKeyToOldIdx (children, beginIdx, endIdx) {
  50014. var i, key;
  50015. var map = {};
  50016. for (i = beginIdx; i <= endIdx; ++i) {
  50017. key = children[i].key;
  50018. if (isDef(key)) { map[key] = i; }
  50019. }
  50020. return map
  50021. }
  50022. function createPatchFunction (backend) {
  50023. var i, j;
  50024. var cbs = {};
  50025. var modules = backend.modules;
  50026. var nodeOps = backend.nodeOps;
  50027. for (i = 0; i < hooks.length; ++i) {
  50028. cbs[hooks[i]] = [];
  50029. for (j = 0; j < modules.length; ++j) {
  50030. if (isDef(modules[j][hooks[i]])) {
  50031. cbs[hooks[i]].push(modules[j][hooks[i]]);
  50032. }
  50033. }
  50034. }
  50035. function emptyNodeAt (elm) {
  50036. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  50037. }
  50038. function createRmCb (childElm, listeners) {
  50039. function remove$$1 () {
  50040. if (--remove$$1.listeners === 0) {
  50041. removeNode(childElm);
  50042. }
  50043. }
  50044. remove$$1.listeners = listeners;
  50045. return remove$$1
  50046. }
  50047. function removeNode (el) {
  50048. var parent = nodeOps.parentNode(el);
  50049. // element may have already been removed due to v-html / v-text
  50050. if (isDef(parent)) {
  50051. nodeOps.removeChild(parent, el);
  50052. }
  50053. }
  50054. function isUnknownElement$$1 (vnode, inVPre) {
  50055. return (
  50056. !inVPre &&
  50057. !vnode.ns &&
  50058. !(
  50059. config.ignoredElements.length &&
  50060. config.ignoredElements.some(function (ignore) {
  50061. return isRegExp(ignore)
  50062. ? ignore.test(vnode.tag)
  50063. : ignore === vnode.tag
  50064. })
  50065. ) &&
  50066. config.isUnknownElement(vnode.tag)
  50067. )
  50068. }
  50069. var creatingElmInVPre = 0;
  50070. function createElm (
  50071. vnode,
  50072. insertedVnodeQueue,
  50073. parentElm,
  50074. refElm,
  50075. nested,
  50076. ownerArray,
  50077. index
  50078. ) {
  50079. if (isDef(vnode.elm) && isDef(ownerArray)) {
  50080. // This vnode was used in a previous render!
  50081. // now it's used as a new node, overwriting its elm would cause
  50082. // potential patch errors down the road when it's used as an insertion
  50083. // reference node. Instead, we clone the node on-demand before creating
  50084. // associated DOM element for it.
  50085. vnode = ownerArray[index] = cloneVNode(vnode);
  50086. }
  50087. vnode.isRootInsert = !nested; // for transition enter check
  50088. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  50089. return
  50090. }
  50091. var data = vnode.data;
  50092. var children = vnode.children;
  50093. var tag = vnode.tag;
  50094. if (isDef(tag)) {
  50095. {
  50096. if (data && data.pre) {
  50097. creatingElmInVPre++;
  50098. }
  50099. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  50100. warn(
  50101. 'Unknown custom element: <' + tag + '> - did you ' +
  50102. 'register the component correctly? For recursive components, ' +
  50103. 'make sure to provide the "name" option.',
  50104. vnode.context
  50105. );
  50106. }
  50107. }
  50108. vnode.elm = vnode.ns
  50109. ? nodeOps.createElementNS(vnode.ns, tag)
  50110. : nodeOps.createElement(tag, vnode);
  50111. setScope(vnode);
  50112. /* istanbul ignore if */
  50113. {
  50114. createChildren(vnode, children, insertedVnodeQueue);
  50115. if (isDef(data)) {
  50116. invokeCreateHooks(vnode, insertedVnodeQueue);
  50117. }
  50118. insert(parentElm, vnode.elm, refElm);
  50119. }
  50120. if (data && data.pre) {
  50121. creatingElmInVPre--;
  50122. }
  50123. } else if (isTrue(vnode.isComment)) {
  50124. vnode.elm = nodeOps.createComment(vnode.text);
  50125. insert(parentElm, vnode.elm, refElm);
  50126. } else {
  50127. vnode.elm = nodeOps.createTextNode(vnode.text);
  50128. insert(parentElm, vnode.elm, refElm);
  50129. }
  50130. }
  50131. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  50132. var i = vnode.data;
  50133. if (isDef(i)) {
  50134. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  50135. if (isDef(i = i.hook) && isDef(i = i.init)) {
  50136. i(vnode, false /* hydrating */);
  50137. }
  50138. // after calling the init hook, if the vnode is a child component
  50139. // it should've created a child instance and mounted it. the child
  50140. // component also has set the placeholder vnode's elm.
  50141. // in that case we can just return the element and be done.
  50142. if (isDef(vnode.componentInstance)) {
  50143. initComponent(vnode, insertedVnodeQueue);
  50144. insert(parentElm, vnode.elm, refElm);
  50145. if (isTrue(isReactivated)) {
  50146. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  50147. }
  50148. return true
  50149. }
  50150. }
  50151. }
  50152. function initComponent (vnode, insertedVnodeQueue) {
  50153. if (isDef(vnode.data.pendingInsert)) {
  50154. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  50155. vnode.data.pendingInsert = null;
  50156. }
  50157. vnode.elm = vnode.componentInstance.$el;
  50158. if (isPatchable(vnode)) {
  50159. invokeCreateHooks(vnode, insertedVnodeQueue);
  50160. setScope(vnode);
  50161. } else {
  50162. // empty component root.
  50163. // skip all element-related modules except for ref (#3455)
  50164. registerRef(vnode);
  50165. // make sure to invoke the insert hook
  50166. insertedVnodeQueue.push(vnode);
  50167. }
  50168. }
  50169. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  50170. var i;
  50171. // hack for #4339: a reactivated component with inner transition
  50172. // does not trigger because the inner node's created hooks are not called
  50173. // again. It's not ideal to involve module-specific logic in here but
  50174. // there doesn't seem to be a better way to do it.
  50175. var innerNode = vnode;
  50176. while (innerNode.componentInstance) {
  50177. innerNode = innerNode.componentInstance._vnode;
  50178. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  50179. for (i = 0; i < cbs.activate.length; ++i) {
  50180. cbs.activate[i](emptyNode, innerNode);
  50181. }
  50182. insertedVnodeQueue.push(innerNode);
  50183. break
  50184. }
  50185. }
  50186. // unlike a newly created component,
  50187. // a reactivated keep-alive component doesn't insert itself
  50188. insert(parentElm, vnode.elm, refElm);
  50189. }
  50190. function insert (parent, elm, ref$$1) {
  50191. if (isDef(parent)) {
  50192. if (isDef(ref$$1)) {
  50193. if (nodeOps.parentNode(ref$$1) === parent) {
  50194. nodeOps.insertBefore(parent, elm, ref$$1);
  50195. }
  50196. } else {
  50197. nodeOps.appendChild(parent, elm);
  50198. }
  50199. }
  50200. }
  50201. function createChildren (vnode, children, insertedVnodeQueue) {
  50202. if (Array.isArray(children)) {
  50203. {
  50204. checkDuplicateKeys(children);
  50205. }
  50206. for (var i = 0; i < children.length; ++i) {
  50207. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  50208. }
  50209. } else if (isPrimitive(vnode.text)) {
  50210. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  50211. }
  50212. }
  50213. function isPatchable (vnode) {
  50214. while (vnode.componentInstance) {
  50215. vnode = vnode.componentInstance._vnode;
  50216. }
  50217. return isDef(vnode.tag)
  50218. }
  50219. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  50220. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  50221. cbs.create[i$1](emptyNode, vnode);
  50222. }
  50223. i = vnode.data.hook; // Reuse variable
  50224. if (isDef(i)) {
  50225. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  50226. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  50227. }
  50228. }
  50229. // set scope id attribute for scoped CSS.
  50230. // this is implemented as a special case to avoid the overhead
  50231. // of going through the normal attribute patching process.
  50232. function setScope (vnode) {
  50233. var i;
  50234. if (isDef(i = vnode.fnScopeId)) {
  50235. nodeOps.setStyleScope(vnode.elm, i);
  50236. } else {
  50237. var ancestor = vnode;
  50238. while (ancestor) {
  50239. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  50240. nodeOps.setStyleScope(vnode.elm, i);
  50241. }
  50242. ancestor = ancestor.parent;
  50243. }
  50244. }
  50245. // for slot content they should also get the scopeId from the host instance.
  50246. if (isDef(i = activeInstance) &&
  50247. i !== vnode.context &&
  50248. i !== vnode.fnContext &&
  50249. isDef(i = i.$options._scopeId)
  50250. ) {
  50251. nodeOps.setStyleScope(vnode.elm, i);
  50252. }
  50253. }
  50254. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  50255. for (; startIdx <= endIdx; ++startIdx) {
  50256. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  50257. }
  50258. }
  50259. function invokeDestroyHook (vnode) {
  50260. var i, j;
  50261. var data = vnode.data;
  50262. if (isDef(data)) {
  50263. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  50264. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  50265. }
  50266. if (isDef(i = vnode.children)) {
  50267. for (j = 0; j < vnode.children.length; ++j) {
  50268. invokeDestroyHook(vnode.children[j]);
  50269. }
  50270. }
  50271. }
  50272. function removeVnodes (vnodes, startIdx, endIdx) {
  50273. for (; startIdx <= endIdx; ++startIdx) {
  50274. var ch = vnodes[startIdx];
  50275. if (isDef(ch)) {
  50276. if (isDef(ch.tag)) {
  50277. removeAndInvokeRemoveHook(ch);
  50278. invokeDestroyHook(ch);
  50279. } else { // Text node
  50280. removeNode(ch.elm);
  50281. }
  50282. }
  50283. }
  50284. }
  50285. function removeAndInvokeRemoveHook (vnode, rm) {
  50286. if (isDef(rm) || isDef(vnode.data)) {
  50287. var i;
  50288. var listeners = cbs.remove.length + 1;
  50289. if (isDef(rm)) {
  50290. // we have a recursively passed down rm callback
  50291. // increase the listeners count
  50292. rm.listeners += listeners;
  50293. } else {
  50294. // directly removing
  50295. rm = createRmCb(vnode.elm, listeners);
  50296. }
  50297. // recursively invoke hooks on child component root node
  50298. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  50299. removeAndInvokeRemoveHook(i, rm);
  50300. }
  50301. for (i = 0; i < cbs.remove.length; ++i) {
  50302. cbs.remove[i](vnode, rm);
  50303. }
  50304. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  50305. i(vnode, rm);
  50306. } else {
  50307. rm();
  50308. }
  50309. } else {
  50310. removeNode(vnode.elm);
  50311. }
  50312. }
  50313. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  50314. var oldStartIdx = 0;
  50315. var newStartIdx = 0;
  50316. var oldEndIdx = oldCh.length - 1;
  50317. var oldStartVnode = oldCh[0];
  50318. var oldEndVnode = oldCh[oldEndIdx];
  50319. var newEndIdx = newCh.length - 1;
  50320. var newStartVnode = newCh[0];
  50321. var newEndVnode = newCh[newEndIdx];
  50322. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  50323. // removeOnly is a special flag used only by <transition-group>
  50324. // to ensure removed elements stay in correct relative positions
  50325. // during leaving transitions
  50326. var canMove = !removeOnly;
  50327. {
  50328. checkDuplicateKeys(newCh);
  50329. }
  50330. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  50331. if (isUndef(oldStartVnode)) {
  50332. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  50333. } else if (isUndef(oldEndVnode)) {
  50334. oldEndVnode = oldCh[--oldEndIdx];
  50335. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  50336. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50337. oldStartVnode = oldCh[++oldStartIdx];
  50338. newStartVnode = newCh[++newStartIdx];
  50339. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  50340. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  50341. oldEndVnode = oldCh[--oldEndIdx];
  50342. newEndVnode = newCh[--newEndIdx];
  50343. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  50344. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  50345. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  50346. oldStartVnode = oldCh[++oldStartIdx];
  50347. newEndVnode = newCh[--newEndIdx];
  50348. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  50349. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50350. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  50351. oldEndVnode = oldCh[--oldEndIdx];
  50352. newStartVnode = newCh[++newStartIdx];
  50353. } else {
  50354. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  50355. idxInOld = isDef(newStartVnode.key)
  50356. ? oldKeyToIdx[newStartVnode.key]
  50357. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  50358. if (isUndef(idxInOld)) { // New element
  50359. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  50360. } else {
  50361. vnodeToMove = oldCh[idxInOld];
  50362. if (sameVnode(vnodeToMove, newStartVnode)) {
  50363. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50364. oldCh[idxInOld] = undefined;
  50365. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  50366. } else {
  50367. // same key but different element. treat as new element
  50368. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  50369. }
  50370. }
  50371. newStartVnode = newCh[++newStartIdx];
  50372. }
  50373. }
  50374. if (oldStartIdx > oldEndIdx) {
  50375. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  50376. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  50377. } else if (newStartIdx > newEndIdx) {
  50378. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  50379. }
  50380. }
  50381. function checkDuplicateKeys (children) {
  50382. var seenKeys = {};
  50383. for (var i = 0; i < children.length; i++) {
  50384. var vnode = children[i];
  50385. var key = vnode.key;
  50386. if (isDef(key)) {
  50387. if (seenKeys[key]) {
  50388. warn(
  50389. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  50390. vnode.context
  50391. );
  50392. } else {
  50393. seenKeys[key] = true;
  50394. }
  50395. }
  50396. }
  50397. }
  50398. function findIdxInOld (node, oldCh, start, end) {
  50399. for (var i = start; i < end; i++) {
  50400. var c = oldCh[i];
  50401. if (isDef(c) && sameVnode(node, c)) { return i }
  50402. }
  50403. }
  50404. function patchVnode (
  50405. oldVnode,
  50406. vnode,
  50407. insertedVnodeQueue,
  50408. ownerArray,
  50409. index,
  50410. removeOnly
  50411. ) {
  50412. if (oldVnode === vnode) {
  50413. return
  50414. }
  50415. if (isDef(vnode.elm) && isDef(ownerArray)) {
  50416. // clone reused vnode
  50417. vnode = ownerArray[index] = cloneVNode(vnode);
  50418. }
  50419. var elm = vnode.elm = oldVnode.elm;
  50420. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  50421. if (isDef(vnode.asyncFactory.resolved)) {
  50422. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  50423. } else {
  50424. vnode.isAsyncPlaceholder = true;
  50425. }
  50426. return
  50427. }
  50428. // reuse element for static trees.
  50429. // note we only do this if the vnode is cloned -
  50430. // if the new node is not cloned it means the render functions have been
  50431. // reset by the hot-reload-api and we need to do a proper re-render.
  50432. if (isTrue(vnode.isStatic) &&
  50433. isTrue(oldVnode.isStatic) &&
  50434. vnode.key === oldVnode.key &&
  50435. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  50436. ) {
  50437. vnode.componentInstance = oldVnode.componentInstance;
  50438. return
  50439. }
  50440. var i;
  50441. var data = vnode.data;
  50442. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  50443. i(oldVnode, vnode);
  50444. }
  50445. var oldCh = oldVnode.children;
  50446. var ch = vnode.children;
  50447. if (isDef(data) && isPatchable(vnode)) {
  50448. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  50449. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  50450. }
  50451. if (isUndef(vnode.text)) {
  50452. if (isDef(oldCh) && isDef(ch)) {
  50453. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  50454. } else if (isDef(ch)) {
  50455. {
  50456. checkDuplicateKeys(ch);
  50457. }
  50458. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  50459. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  50460. } else if (isDef(oldCh)) {
  50461. removeVnodes(oldCh, 0, oldCh.length - 1);
  50462. } else if (isDef(oldVnode.text)) {
  50463. nodeOps.setTextContent(elm, '');
  50464. }
  50465. } else if (oldVnode.text !== vnode.text) {
  50466. nodeOps.setTextContent(elm, vnode.text);
  50467. }
  50468. if (isDef(data)) {
  50469. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  50470. }
  50471. }
  50472. function invokeInsertHook (vnode, queue, initial) {
  50473. // delay insert hooks for component root nodes, invoke them after the
  50474. // element is really inserted
  50475. if (isTrue(initial) && isDef(vnode.parent)) {
  50476. vnode.parent.data.pendingInsert = queue;
  50477. } else {
  50478. for (var i = 0; i < queue.length; ++i) {
  50479. queue[i].data.hook.insert(queue[i]);
  50480. }
  50481. }
  50482. }
  50483. var hydrationBailed = false;
  50484. // list of modules that can skip create hook during hydration because they
  50485. // are already rendered on the client or has no need for initialization
  50486. // Note: style is excluded because it relies on initial clone for future
  50487. // deep updates (#7063).
  50488. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  50489. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  50490. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  50491. var i;
  50492. var tag = vnode.tag;
  50493. var data = vnode.data;
  50494. var children = vnode.children;
  50495. inVPre = inVPre || (data && data.pre);
  50496. vnode.elm = elm;
  50497. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  50498. vnode.isAsyncPlaceholder = true;
  50499. return true
  50500. }
  50501. // assert node match
  50502. {
  50503. if (!assertNodeMatch(elm, vnode, inVPre)) {
  50504. return false
  50505. }
  50506. }
  50507. if (isDef(data)) {
  50508. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  50509. if (isDef(i = vnode.componentInstance)) {
  50510. // child component. it should have hydrated its own tree.
  50511. initComponent(vnode, insertedVnodeQueue);
  50512. return true
  50513. }
  50514. }
  50515. if (isDef(tag)) {
  50516. if (isDef(children)) {
  50517. // empty element, allow client to pick up and populate children
  50518. if (!elm.hasChildNodes()) {
  50519. createChildren(vnode, children, insertedVnodeQueue);
  50520. } else {
  50521. // v-html and domProps: innerHTML
  50522. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  50523. if (i !== elm.innerHTML) {
  50524. /* istanbul ignore if */
  50525. if (typeof console !== 'undefined' &&
  50526. !hydrationBailed
  50527. ) {
  50528. hydrationBailed = true;
  50529. console.warn('Parent: ', elm);
  50530. console.warn('server innerHTML: ', i);
  50531. console.warn('client innerHTML: ', elm.innerHTML);
  50532. }
  50533. return false
  50534. }
  50535. } else {
  50536. // iterate and compare children lists
  50537. var childrenMatch = true;
  50538. var childNode = elm.firstChild;
  50539. for (var i$1 = 0; i$1 < children.length; i$1++) {
  50540. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  50541. childrenMatch = false;
  50542. break
  50543. }
  50544. childNode = childNode.nextSibling;
  50545. }
  50546. // if childNode is not null, it means the actual childNodes list is
  50547. // longer than the virtual children list.
  50548. if (!childrenMatch || childNode) {
  50549. /* istanbul ignore if */
  50550. if (typeof console !== 'undefined' &&
  50551. !hydrationBailed
  50552. ) {
  50553. hydrationBailed = true;
  50554. console.warn('Parent: ', elm);
  50555. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  50556. }
  50557. return false
  50558. }
  50559. }
  50560. }
  50561. }
  50562. if (isDef(data)) {
  50563. var fullInvoke = false;
  50564. for (var key in data) {
  50565. if (!isRenderedModule(key)) {
  50566. fullInvoke = true;
  50567. invokeCreateHooks(vnode, insertedVnodeQueue);
  50568. break
  50569. }
  50570. }
  50571. if (!fullInvoke && data['class']) {
  50572. // ensure collecting deps for deep class bindings for future updates
  50573. traverse(data['class']);
  50574. }
  50575. }
  50576. } else if (elm.data !== vnode.text) {
  50577. elm.data = vnode.text;
  50578. }
  50579. return true
  50580. }
  50581. function assertNodeMatch (node, vnode, inVPre) {
  50582. if (isDef(vnode.tag)) {
  50583. return vnode.tag.indexOf('vue-component') === 0 || (
  50584. !isUnknownElement$$1(vnode, inVPre) &&
  50585. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  50586. )
  50587. } else {
  50588. return node.nodeType === (vnode.isComment ? 8 : 3)
  50589. }
  50590. }
  50591. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  50592. if (isUndef(vnode)) {
  50593. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  50594. return
  50595. }
  50596. var isInitialPatch = false;
  50597. var insertedVnodeQueue = [];
  50598. if (isUndef(oldVnode)) {
  50599. // empty mount (likely as component), create new root element
  50600. isInitialPatch = true;
  50601. createElm(vnode, insertedVnodeQueue);
  50602. } else {
  50603. var isRealElement = isDef(oldVnode.nodeType);
  50604. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  50605. // patch existing root node
  50606. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  50607. } else {
  50608. if (isRealElement) {
  50609. // mounting to a real element
  50610. // check if this is server-rendered content and if we can perform
  50611. // a successful hydration.
  50612. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  50613. oldVnode.removeAttribute(SSR_ATTR);
  50614. hydrating = true;
  50615. }
  50616. if (isTrue(hydrating)) {
  50617. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  50618. invokeInsertHook(vnode, insertedVnodeQueue, true);
  50619. return oldVnode
  50620. } else {
  50621. warn(
  50622. 'The client-side rendered virtual DOM tree is not matching ' +
  50623. 'server-rendered content. This is likely caused by incorrect ' +
  50624. 'HTML markup, for example nesting block-level elements inside ' +
  50625. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  50626. 'full client-side render.'
  50627. );
  50628. }
  50629. }
  50630. // either not server-rendered, or hydration failed.
  50631. // create an empty node and replace it
  50632. oldVnode = emptyNodeAt(oldVnode);
  50633. }
  50634. // replacing existing element
  50635. var oldElm = oldVnode.elm;
  50636. var parentElm = nodeOps.parentNode(oldElm);
  50637. // create new node
  50638. createElm(
  50639. vnode,
  50640. insertedVnodeQueue,
  50641. // extremely rare edge case: do not insert if old element is in a
  50642. // leaving transition. Only happens when combining transition +
  50643. // keep-alive + HOCs. (#4590)
  50644. oldElm._leaveCb ? null : parentElm,
  50645. nodeOps.nextSibling(oldElm)
  50646. );
  50647. // update parent placeholder node element, recursively
  50648. if (isDef(vnode.parent)) {
  50649. var ancestor = vnode.parent;
  50650. var patchable = isPatchable(vnode);
  50651. while (ancestor) {
  50652. for (var i = 0; i < cbs.destroy.length; ++i) {
  50653. cbs.destroy[i](ancestor);
  50654. }
  50655. ancestor.elm = vnode.elm;
  50656. if (patchable) {
  50657. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  50658. cbs.create[i$1](emptyNode, ancestor);
  50659. }
  50660. // #6513
  50661. // invoke insert hooks that may have been merged by create hooks.
  50662. // e.g. for directives that uses the "inserted" hook.
  50663. var insert = ancestor.data.hook.insert;
  50664. if (insert.merged) {
  50665. // start at index 1 to avoid re-invoking component mounted hook
  50666. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  50667. insert.fns[i$2]();
  50668. }
  50669. }
  50670. } else {
  50671. registerRef(ancestor);
  50672. }
  50673. ancestor = ancestor.parent;
  50674. }
  50675. }
  50676. // destroy old node
  50677. if (isDef(parentElm)) {
  50678. removeVnodes([oldVnode], 0, 0);
  50679. } else if (isDef(oldVnode.tag)) {
  50680. invokeDestroyHook(oldVnode);
  50681. }
  50682. }
  50683. }
  50684. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  50685. return vnode.elm
  50686. }
  50687. }
  50688. /* */
  50689. var directives = {
  50690. create: updateDirectives,
  50691. update: updateDirectives,
  50692. destroy: function unbindDirectives (vnode) {
  50693. updateDirectives(vnode, emptyNode);
  50694. }
  50695. };
  50696. function updateDirectives (oldVnode, vnode) {
  50697. if (oldVnode.data.directives || vnode.data.directives) {
  50698. _update(oldVnode, vnode);
  50699. }
  50700. }
  50701. function _update (oldVnode, vnode) {
  50702. var isCreate = oldVnode === emptyNode;
  50703. var isDestroy = vnode === emptyNode;
  50704. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  50705. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  50706. var dirsWithInsert = [];
  50707. var dirsWithPostpatch = [];
  50708. var key, oldDir, dir;
  50709. for (key in newDirs) {
  50710. oldDir = oldDirs[key];
  50711. dir = newDirs[key];
  50712. if (!oldDir) {
  50713. // new directive, bind
  50714. callHook$1(dir, 'bind', vnode, oldVnode);
  50715. if (dir.def && dir.def.inserted) {
  50716. dirsWithInsert.push(dir);
  50717. }
  50718. } else {
  50719. // existing directive, update
  50720. dir.oldValue = oldDir.value;
  50721. dir.oldArg = oldDir.arg;
  50722. callHook$1(dir, 'update', vnode, oldVnode);
  50723. if (dir.def && dir.def.componentUpdated) {
  50724. dirsWithPostpatch.push(dir);
  50725. }
  50726. }
  50727. }
  50728. if (dirsWithInsert.length) {
  50729. var callInsert = function () {
  50730. for (var i = 0; i < dirsWithInsert.length; i++) {
  50731. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  50732. }
  50733. };
  50734. if (isCreate) {
  50735. mergeVNodeHook(vnode, 'insert', callInsert);
  50736. } else {
  50737. callInsert();
  50738. }
  50739. }
  50740. if (dirsWithPostpatch.length) {
  50741. mergeVNodeHook(vnode, 'postpatch', function () {
  50742. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  50743. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  50744. }
  50745. });
  50746. }
  50747. if (!isCreate) {
  50748. for (key in oldDirs) {
  50749. if (!newDirs[key]) {
  50750. // no longer present, unbind
  50751. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  50752. }
  50753. }
  50754. }
  50755. }
  50756. var emptyModifiers = Object.create(null);
  50757. function normalizeDirectives$1 (
  50758. dirs,
  50759. vm
  50760. ) {
  50761. var res = Object.create(null);
  50762. if (!dirs) {
  50763. // $flow-disable-line
  50764. return res
  50765. }
  50766. var i, dir;
  50767. for (i = 0; i < dirs.length; i++) {
  50768. dir = dirs[i];
  50769. if (!dir.modifiers) {
  50770. // $flow-disable-line
  50771. dir.modifiers = emptyModifiers;
  50772. }
  50773. res[getRawDirName(dir)] = dir;
  50774. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  50775. }
  50776. // $flow-disable-line
  50777. return res
  50778. }
  50779. function getRawDirName (dir) {
  50780. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  50781. }
  50782. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  50783. var fn = dir.def && dir.def[hook];
  50784. if (fn) {
  50785. try {
  50786. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  50787. } catch (e) {
  50788. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  50789. }
  50790. }
  50791. }
  50792. var baseModules = [
  50793. ref,
  50794. directives
  50795. ];
  50796. /* */
  50797. function updateAttrs (oldVnode, vnode) {
  50798. var opts = vnode.componentOptions;
  50799. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  50800. return
  50801. }
  50802. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  50803. return
  50804. }
  50805. var key, cur, old;
  50806. var elm = vnode.elm;
  50807. var oldAttrs = oldVnode.data.attrs || {};
  50808. var attrs = vnode.data.attrs || {};
  50809. // clone observed objects, as the user probably wants to mutate it
  50810. if (isDef(attrs.__ob__)) {
  50811. attrs = vnode.data.attrs = extend({}, attrs);
  50812. }
  50813. for (key in attrs) {
  50814. cur = attrs[key];
  50815. old = oldAttrs[key];
  50816. if (old !== cur) {
  50817. setAttr(elm, key, cur);
  50818. }
  50819. }
  50820. // #4391: in IE9, setting type can reset value for input[type=radio]
  50821. // #6666: IE/Edge forces progress value down to 1 before setting a max
  50822. /* istanbul ignore if */
  50823. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  50824. setAttr(elm, 'value', attrs.value);
  50825. }
  50826. for (key in oldAttrs) {
  50827. if (isUndef(attrs[key])) {
  50828. if (isXlink(key)) {
  50829. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  50830. } else if (!isEnumeratedAttr(key)) {
  50831. elm.removeAttribute(key);
  50832. }
  50833. }
  50834. }
  50835. }
  50836. function setAttr (el, key, value) {
  50837. if (el.tagName.indexOf('-') > -1) {
  50838. baseSetAttr(el, key, value);
  50839. } else if (isBooleanAttr(key)) {
  50840. // set attribute for blank value
  50841. // e.g. <option disabled>Select one</option>
  50842. if (isFalsyAttrValue(value)) {
  50843. el.removeAttribute(key);
  50844. } else {
  50845. // technically allowfullscreen is a boolean attribute for <iframe>,
  50846. // but Flash expects a value of "true" when used on <embed> tag
  50847. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  50848. ? 'true'
  50849. : key;
  50850. el.setAttribute(key, value);
  50851. }
  50852. } else if (isEnumeratedAttr(key)) {
  50853. el.setAttribute(key, convertEnumeratedValue(key, value));
  50854. } else if (isXlink(key)) {
  50855. if (isFalsyAttrValue(value)) {
  50856. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  50857. } else {
  50858. el.setAttributeNS(xlinkNS, key, value);
  50859. }
  50860. } else {
  50861. baseSetAttr(el, key, value);
  50862. }
  50863. }
  50864. function baseSetAttr (el, key, value) {
  50865. if (isFalsyAttrValue(value)) {
  50866. el.removeAttribute(key);
  50867. } else {
  50868. // #7138: IE10 & 11 fires input event when setting placeholder on
  50869. // <textarea>... block the first input event and remove the blocker
  50870. // immediately.
  50871. /* istanbul ignore if */
  50872. if (
  50873. isIE && !isIE9 &&
  50874. el.tagName === 'TEXTAREA' &&
  50875. key === 'placeholder' && value !== '' && !el.__ieph
  50876. ) {
  50877. var blocker = function (e) {
  50878. e.stopImmediatePropagation();
  50879. el.removeEventListener('input', blocker);
  50880. };
  50881. el.addEventListener('input', blocker);
  50882. // $flow-disable-line
  50883. el.__ieph = true; /* IE placeholder patched */
  50884. }
  50885. el.setAttribute(key, value);
  50886. }
  50887. }
  50888. var attrs = {
  50889. create: updateAttrs,
  50890. update: updateAttrs
  50891. };
  50892. /* */
  50893. function updateClass (oldVnode, vnode) {
  50894. var el = vnode.elm;
  50895. var data = vnode.data;
  50896. var oldData = oldVnode.data;
  50897. if (
  50898. isUndef(data.staticClass) &&
  50899. isUndef(data.class) && (
  50900. isUndef(oldData) || (
  50901. isUndef(oldData.staticClass) &&
  50902. isUndef(oldData.class)
  50903. )
  50904. )
  50905. ) {
  50906. return
  50907. }
  50908. var cls = genClassForVnode(vnode);
  50909. // handle transition classes
  50910. var transitionClass = el._transitionClasses;
  50911. if (isDef(transitionClass)) {
  50912. cls = concat(cls, stringifyClass(transitionClass));
  50913. }
  50914. // set the class
  50915. if (cls !== el._prevClass) {
  50916. el.setAttribute('class', cls);
  50917. el._prevClass = cls;
  50918. }
  50919. }
  50920. var klass = {
  50921. create: updateClass,
  50922. update: updateClass
  50923. };
  50924. /* */
  50925. var validDivisionCharRE = /[\w).+\-_$\]]/;
  50926. function parseFilters (exp) {
  50927. var inSingle = false;
  50928. var inDouble = false;
  50929. var inTemplateString = false;
  50930. var inRegex = false;
  50931. var curly = 0;
  50932. var square = 0;
  50933. var paren = 0;
  50934. var lastFilterIndex = 0;
  50935. var c, prev, i, expression, filters;
  50936. for (i = 0; i < exp.length; i++) {
  50937. prev = c;
  50938. c = exp.charCodeAt(i);
  50939. if (inSingle) {
  50940. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  50941. } else if (inDouble) {
  50942. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  50943. } else if (inTemplateString) {
  50944. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  50945. } else if (inRegex) {
  50946. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  50947. } else if (
  50948. c === 0x7C && // pipe
  50949. exp.charCodeAt(i + 1) !== 0x7C &&
  50950. exp.charCodeAt(i - 1) !== 0x7C &&
  50951. !curly && !square && !paren
  50952. ) {
  50953. if (expression === undefined) {
  50954. // first filter, end of expression
  50955. lastFilterIndex = i + 1;
  50956. expression = exp.slice(0, i).trim();
  50957. } else {
  50958. pushFilter();
  50959. }
  50960. } else {
  50961. switch (c) {
  50962. case 0x22: inDouble = true; break // "
  50963. case 0x27: inSingle = true; break // '
  50964. case 0x60: inTemplateString = true; break // `
  50965. case 0x28: paren++; break // (
  50966. case 0x29: paren--; break // )
  50967. case 0x5B: square++; break // [
  50968. case 0x5D: square--; break // ]
  50969. case 0x7B: curly++; break // {
  50970. case 0x7D: curly--; break // }
  50971. }
  50972. if (c === 0x2f) { // /
  50973. var j = i - 1;
  50974. var p = (void 0);
  50975. // find first non-whitespace prev char
  50976. for (; j >= 0; j--) {
  50977. p = exp.charAt(j);
  50978. if (p !== ' ') { break }
  50979. }
  50980. if (!p || !validDivisionCharRE.test(p)) {
  50981. inRegex = true;
  50982. }
  50983. }
  50984. }
  50985. }
  50986. if (expression === undefined) {
  50987. expression = exp.slice(0, i).trim();
  50988. } else if (lastFilterIndex !== 0) {
  50989. pushFilter();
  50990. }
  50991. function pushFilter () {
  50992. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  50993. lastFilterIndex = i + 1;
  50994. }
  50995. if (filters) {
  50996. for (i = 0; i < filters.length; i++) {
  50997. expression = wrapFilter(expression, filters[i]);
  50998. }
  50999. }
  51000. return expression
  51001. }
  51002. function wrapFilter (exp, filter) {
  51003. var i = filter.indexOf('(');
  51004. if (i < 0) {
  51005. // _f: resolveFilter
  51006. return ("_f(\"" + filter + "\")(" + exp + ")")
  51007. } else {
  51008. var name = filter.slice(0, i);
  51009. var args = filter.slice(i + 1);
  51010. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  51011. }
  51012. }
  51013. /* */
  51014. /* eslint-disable no-unused-vars */
  51015. function baseWarn (msg, range) {
  51016. console.error(("[Vue compiler]: " + msg));
  51017. }
  51018. /* eslint-enable no-unused-vars */
  51019. function pluckModuleFunction (
  51020. modules,
  51021. key
  51022. ) {
  51023. return modules
  51024. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  51025. : []
  51026. }
  51027. function addProp (el, name, value, range, dynamic) {
  51028. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  51029. el.plain = false;
  51030. }
  51031. function addAttr (el, name, value, range, dynamic) {
  51032. var attrs = dynamic
  51033. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  51034. : (el.attrs || (el.attrs = []));
  51035. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  51036. el.plain = false;
  51037. }
  51038. // add a raw attr (use this in preTransforms)
  51039. function addRawAttr (el, name, value, range) {
  51040. el.attrsMap[name] = value;
  51041. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  51042. }
  51043. function addDirective (
  51044. el,
  51045. name,
  51046. rawName,
  51047. value,
  51048. arg,
  51049. isDynamicArg,
  51050. modifiers,
  51051. range
  51052. ) {
  51053. (el.directives || (el.directives = [])).push(rangeSetItem({
  51054. name: name,
  51055. rawName: rawName,
  51056. value: value,
  51057. arg: arg,
  51058. isDynamicArg: isDynamicArg,
  51059. modifiers: modifiers
  51060. }, range));
  51061. el.plain = false;
  51062. }
  51063. function prependModifierMarker (symbol, name, dynamic) {
  51064. return dynamic
  51065. ? ("_p(" + name + ",\"" + symbol + "\")")
  51066. : symbol + name // mark the event as captured
  51067. }
  51068. function addHandler (
  51069. el,
  51070. name,
  51071. value,
  51072. modifiers,
  51073. important,
  51074. warn,
  51075. range,
  51076. dynamic
  51077. ) {
  51078. modifiers = modifiers || emptyObject;
  51079. // warn prevent and passive modifier
  51080. /* istanbul ignore if */
  51081. if (
  51082. warn &&
  51083. modifiers.prevent && modifiers.passive
  51084. ) {
  51085. warn(
  51086. 'passive and prevent can\'t be used together. ' +
  51087. 'Passive handler can\'t prevent default event.',
  51088. range
  51089. );
  51090. }
  51091. // normalize click.right and click.middle since they don't actually fire
  51092. // this is technically browser-specific, but at least for now browsers are
  51093. // the only target envs that have right/middle clicks.
  51094. if (modifiers.right) {
  51095. if (dynamic) {
  51096. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  51097. } else if (name === 'click') {
  51098. name = 'contextmenu';
  51099. delete modifiers.right;
  51100. }
  51101. } else if (modifiers.middle) {
  51102. if (dynamic) {
  51103. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  51104. } else if (name === 'click') {
  51105. name = 'mouseup';
  51106. }
  51107. }
  51108. // check capture modifier
  51109. if (modifiers.capture) {
  51110. delete modifiers.capture;
  51111. name = prependModifierMarker('!', name, dynamic);
  51112. }
  51113. if (modifiers.once) {
  51114. delete modifiers.once;
  51115. name = prependModifierMarker('~', name, dynamic);
  51116. }
  51117. /* istanbul ignore if */
  51118. if (modifiers.passive) {
  51119. delete modifiers.passive;
  51120. name = prependModifierMarker('&', name, dynamic);
  51121. }
  51122. var events;
  51123. if (modifiers.native) {
  51124. delete modifiers.native;
  51125. events = el.nativeEvents || (el.nativeEvents = {});
  51126. } else {
  51127. events = el.events || (el.events = {});
  51128. }
  51129. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  51130. if (modifiers !== emptyObject) {
  51131. newHandler.modifiers = modifiers;
  51132. }
  51133. var handlers = events[name];
  51134. /* istanbul ignore if */
  51135. if (Array.isArray(handlers)) {
  51136. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  51137. } else if (handlers) {
  51138. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  51139. } else {
  51140. events[name] = newHandler;
  51141. }
  51142. el.plain = false;
  51143. }
  51144. function getRawBindingAttr (
  51145. el,
  51146. name
  51147. ) {
  51148. return el.rawAttrsMap[':' + name] ||
  51149. el.rawAttrsMap['v-bind:' + name] ||
  51150. el.rawAttrsMap[name]
  51151. }
  51152. function getBindingAttr (
  51153. el,
  51154. name,
  51155. getStatic
  51156. ) {
  51157. var dynamicValue =
  51158. getAndRemoveAttr(el, ':' + name) ||
  51159. getAndRemoveAttr(el, 'v-bind:' + name);
  51160. if (dynamicValue != null) {
  51161. return parseFilters(dynamicValue)
  51162. } else if (getStatic !== false) {
  51163. var staticValue = getAndRemoveAttr(el, name);
  51164. if (staticValue != null) {
  51165. return JSON.stringify(staticValue)
  51166. }
  51167. }
  51168. }
  51169. // note: this only removes the attr from the Array (attrsList) so that it
  51170. // doesn't get processed by processAttrs.
  51171. // By default it does NOT remove it from the map (attrsMap) because the map is
  51172. // needed during codegen.
  51173. function getAndRemoveAttr (
  51174. el,
  51175. name,
  51176. removeFromMap
  51177. ) {
  51178. var val;
  51179. if ((val = el.attrsMap[name]) != null) {
  51180. var list = el.attrsList;
  51181. for (var i = 0, l = list.length; i < l; i++) {
  51182. if (list[i].name === name) {
  51183. list.splice(i, 1);
  51184. break
  51185. }
  51186. }
  51187. }
  51188. if (removeFromMap) {
  51189. delete el.attrsMap[name];
  51190. }
  51191. return val
  51192. }
  51193. function getAndRemoveAttrByRegex (
  51194. el,
  51195. name
  51196. ) {
  51197. var list = el.attrsList;
  51198. for (var i = 0, l = list.length; i < l; i++) {
  51199. var attr = list[i];
  51200. if (name.test(attr.name)) {
  51201. list.splice(i, 1);
  51202. return attr
  51203. }
  51204. }
  51205. }
  51206. function rangeSetItem (
  51207. item,
  51208. range
  51209. ) {
  51210. if (range) {
  51211. if (range.start != null) {
  51212. item.start = range.start;
  51213. }
  51214. if (range.end != null) {
  51215. item.end = range.end;
  51216. }
  51217. }
  51218. return item
  51219. }
  51220. /* */
  51221. /**
  51222. * Cross-platform code generation for component v-model
  51223. */
  51224. function genComponentModel (
  51225. el,
  51226. value,
  51227. modifiers
  51228. ) {
  51229. var ref = modifiers || {};
  51230. var number = ref.number;
  51231. var trim = ref.trim;
  51232. var baseValueExpression = '$$v';
  51233. var valueExpression = baseValueExpression;
  51234. if (trim) {
  51235. valueExpression =
  51236. "(typeof " + baseValueExpression + " === 'string'" +
  51237. "? " + baseValueExpression + ".trim()" +
  51238. ": " + baseValueExpression + ")";
  51239. }
  51240. if (number) {
  51241. valueExpression = "_n(" + valueExpression + ")";
  51242. }
  51243. var assignment = genAssignmentCode(value, valueExpression);
  51244. el.model = {
  51245. value: ("(" + value + ")"),
  51246. expression: JSON.stringify(value),
  51247. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  51248. };
  51249. }
  51250. /**
  51251. * Cross-platform codegen helper for generating v-model value assignment code.
  51252. */
  51253. function genAssignmentCode (
  51254. value,
  51255. assignment
  51256. ) {
  51257. var res = parseModel(value);
  51258. if (res.key === null) {
  51259. return (value + "=" + assignment)
  51260. } else {
  51261. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  51262. }
  51263. }
  51264. /**
  51265. * Parse a v-model expression into a base path and a final key segment.
  51266. * Handles both dot-path and possible square brackets.
  51267. *
  51268. * Possible cases:
  51269. *
  51270. * - test
  51271. * - test[key]
  51272. * - test[test1[key]]
  51273. * - test["a"][key]
  51274. * - xxx.test[a[a].test1[key]]
  51275. * - test.xxx.a["asa"][test1[key]]
  51276. *
  51277. */
  51278. var len, str, chr, index$1, expressionPos, expressionEndPos;
  51279. function parseModel (val) {
  51280. // Fix https://github.com/vuejs/vue/pull/7730
  51281. // allow v-model="obj.val " (trailing whitespace)
  51282. val = val.trim();
  51283. len = val.length;
  51284. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  51285. index$1 = val.lastIndexOf('.');
  51286. if (index$1 > -1) {
  51287. return {
  51288. exp: val.slice(0, index$1),
  51289. key: '"' + val.slice(index$1 + 1) + '"'
  51290. }
  51291. } else {
  51292. return {
  51293. exp: val,
  51294. key: null
  51295. }
  51296. }
  51297. }
  51298. str = val;
  51299. index$1 = expressionPos = expressionEndPos = 0;
  51300. while (!eof()) {
  51301. chr = next();
  51302. /* istanbul ignore if */
  51303. if (isStringStart(chr)) {
  51304. parseString(chr);
  51305. } else if (chr === 0x5B) {
  51306. parseBracket(chr);
  51307. }
  51308. }
  51309. return {
  51310. exp: val.slice(0, expressionPos),
  51311. key: val.slice(expressionPos + 1, expressionEndPos)
  51312. }
  51313. }
  51314. function next () {
  51315. return str.charCodeAt(++index$1)
  51316. }
  51317. function eof () {
  51318. return index$1 >= len
  51319. }
  51320. function isStringStart (chr) {
  51321. return chr === 0x22 || chr === 0x27
  51322. }
  51323. function parseBracket (chr) {
  51324. var inBracket = 1;
  51325. expressionPos = index$1;
  51326. while (!eof()) {
  51327. chr = next();
  51328. if (isStringStart(chr)) {
  51329. parseString(chr);
  51330. continue
  51331. }
  51332. if (chr === 0x5B) { inBracket++; }
  51333. if (chr === 0x5D) { inBracket--; }
  51334. if (inBracket === 0) {
  51335. expressionEndPos = index$1;
  51336. break
  51337. }
  51338. }
  51339. }
  51340. function parseString (chr) {
  51341. var stringQuote = chr;
  51342. while (!eof()) {
  51343. chr = next();
  51344. if (chr === stringQuote) {
  51345. break
  51346. }
  51347. }
  51348. }
  51349. /* */
  51350. var warn$1;
  51351. // in some cases, the event used has to be determined at runtime
  51352. // so we used some reserved tokens during compile.
  51353. var RANGE_TOKEN = '__r';
  51354. var CHECKBOX_RADIO_TOKEN = '__c';
  51355. function model (
  51356. el,
  51357. dir,
  51358. _warn
  51359. ) {
  51360. warn$1 = _warn;
  51361. var value = dir.value;
  51362. var modifiers = dir.modifiers;
  51363. var tag = el.tag;
  51364. var type = el.attrsMap.type;
  51365. {
  51366. // inputs with type="file" are read only and setting the input's
  51367. // value will throw an error.
  51368. if (tag === 'input' && type === 'file') {
  51369. warn$1(
  51370. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  51371. "File inputs are read only. Use a v-on:change listener instead.",
  51372. el.rawAttrsMap['v-model']
  51373. );
  51374. }
  51375. }
  51376. if (el.component) {
  51377. genComponentModel(el, value, modifiers);
  51378. // component v-model doesn't need extra runtime
  51379. return false
  51380. } else if (tag === 'select') {
  51381. genSelect(el, value, modifiers);
  51382. } else if (tag === 'input' && type === 'checkbox') {
  51383. genCheckboxModel(el, value, modifiers);
  51384. } else if (tag === 'input' && type === 'radio') {
  51385. genRadioModel(el, value, modifiers);
  51386. } else if (tag === 'input' || tag === 'textarea') {
  51387. genDefaultModel(el, value, modifiers);
  51388. } else if (!config.isReservedTag(tag)) {
  51389. genComponentModel(el, value, modifiers);
  51390. // component v-model doesn't need extra runtime
  51391. return false
  51392. } else {
  51393. warn$1(
  51394. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  51395. "v-model is not supported on this element type. " +
  51396. 'If you are working with contenteditable, it\'s recommended to ' +
  51397. 'wrap a library dedicated for that purpose inside a custom component.',
  51398. el.rawAttrsMap['v-model']
  51399. );
  51400. }
  51401. // ensure runtime directive metadata
  51402. return true
  51403. }
  51404. function genCheckboxModel (
  51405. el,
  51406. value,
  51407. modifiers
  51408. ) {
  51409. var number = modifiers && modifiers.number;
  51410. var valueBinding = getBindingAttr(el, 'value') || 'null';
  51411. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  51412. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  51413. addProp(el, 'checked',
  51414. "Array.isArray(" + value + ")" +
  51415. "?_i(" + value + "," + valueBinding + ")>-1" + (
  51416. trueValueBinding === 'true'
  51417. ? (":(" + value + ")")
  51418. : (":_q(" + value + "," + trueValueBinding + ")")
  51419. )
  51420. );
  51421. addHandler(el, 'change',
  51422. "var $$a=" + value + "," +
  51423. '$$el=$event.target,' +
  51424. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  51425. 'if(Array.isArray($$a)){' +
  51426. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  51427. '$$i=_i($$a,$$v);' +
  51428. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  51429. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  51430. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  51431. null, true
  51432. );
  51433. }
  51434. function genRadioModel (
  51435. el,
  51436. value,
  51437. modifiers
  51438. ) {
  51439. var number = modifiers && modifiers.number;
  51440. var valueBinding = getBindingAttr(el, 'value') || 'null';
  51441. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  51442. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  51443. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  51444. }
  51445. function genSelect (
  51446. el,
  51447. value,
  51448. modifiers
  51449. ) {
  51450. var number = modifiers && modifiers.number;
  51451. var selectedVal = "Array.prototype.filter" +
  51452. ".call($event.target.options,function(o){return o.selected})" +
  51453. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  51454. "return " + (number ? '_n(val)' : 'val') + "})";
  51455. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  51456. var code = "var $$selectedVal = " + selectedVal + ";";
  51457. code = code + " " + (genAssignmentCode(value, assignment));
  51458. addHandler(el, 'change', code, null, true);
  51459. }
  51460. function genDefaultModel (
  51461. el,
  51462. value,
  51463. modifiers
  51464. ) {
  51465. var type = el.attrsMap.type;
  51466. // warn if v-bind:value conflicts with v-model
  51467. // except for inputs with v-bind:type
  51468. {
  51469. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  51470. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  51471. if (value$1 && !typeBinding) {
  51472. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  51473. warn$1(
  51474. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  51475. 'because the latter already expands to a value binding internally',
  51476. el.rawAttrsMap[binding]
  51477. );
  51478. }
  51479. }
  51480. var ref = modifiers || {};
  51481. var lazy = ref.lazy;
  51482. var number = ref.number;
  51483. var trim = ref.trim;
  51484. var needCompositionGuard = !lazy && type !== 'range';
  51485. var event = lazy
  51486. ? 'change'
  51487. : type === 'range'
  51488. ? RANGE_TOKEN
  51489. : 'input';
  51490. var valueExpression = '$event.target.value';
  51491. if (trim) {
  51492. valueExpression = "$event.target.value.trim()";
  51493. }
  51494. if (number) {
  51495. valueExpression = "_n(" + valueExpression + ")";
  51496. }
  51497. var code = genAssignmentCode(value, valueExpression);
  51498. if (needCompositionGuard) {
  51499. code = "if($event.target.composing)return;" + code;
  51500. }
  51501. addProp(el, 'value', ("(" + value + ")"));
  51502. addHandler(el, event, code, null, true);
  51503. if (trim || number) {
  51504. addHandler(el, 'blur', '$forceUpdate()');
  51505. }
  51506. }
  51507. /* */
  51508. // normalize v-model event tokens that can only be determined at runtime.
  51509. // it's important to place the event as the first in the array because
  51510. // the whole point is ensuring the v-model callback gets called before
  51511. // user-attached handlers.
  51512. function normalizeEvents (on) {
  51513. /* istanbul ignore if */
  51514. if (isDef(on[RANGE_TOKEN])) {
  51515. // IE input[type=range] only supports `change` event
  51516. var event = isIE ? 'change' : 'input';
  51517. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  51518. delete on[RANGE_TOKEN];
  51519. }
  51520. // This was originally intended to fix #4521 but no longer necessary
  51521. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  51522. /* istanbul ignore if */
  51523. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  51524. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  51525. delete on[CHECKBOX_RADIO_TOKEN];
  51526. }
  51527. }
  51528. var target$1;
  51529. function createOnceHandler$1 (event, handler, capture) {
  51530. var _target = target$1; // save current target element in closure
  51531. return function onceHandler () {
  51532. var res = handler.apply(null, arguments);
  51533. if (res !== null) {
  51534. remove$2(event, onceHandler, capture, _target);
  51535. }
  51536. }
  51537. }
  51538. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  51539. // implementation and does not fire microtasks in between event propagation, so
  51540. // safe to exclude.
  51541. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  51542. function add$1 (
  51543. name,
  51544. handler,
  51545. capture,
  51546. passive
  51547. ) {
  51548. // async edge case #6566: inner click event triggers patch, event handler
  51549. // attached to outer element during patch, and triggered again. This
  51550. // happens because browsers fire microtask ticks between event propagation.
  51551. // the solution is simple: we save the timestamp when a handler is attached,
  51552. // and the handler would only fire if the event passed to it was fired
  51553. // AFTER it was attached.
  51554. if (useMicrotaskFix) {
  51555. var attachedTimestamp = currentFlushTimestamp;
  51556. var original = handler;
  51557. handler = original._wrapper = function (e) {
  51558. if (
  51559. // no bubbling, should always fire.
  51560. // this is just a safety net in case event.timeStamp is unreliable in
  51561. // certain weird environments...
  51562. e.target === e.currentTarget ||
  51563. // event is fired after handler attachment
  51564. e.timeStamp >= attachedTimestamp ||
  51565. // bail for environments that have buggy event.timeStamp implementations
  51566. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  51567. // #9681 QtWebEngine event.timeStamp is negative value
  51568. e.timeStamp <= 0 ||
  51569. // #9448 bail if event is fired in another document in a multi-page
  51570. // electron/nw.js app, since event.timeStamp will be using a different
  51571. // starting reference
  51572. e.target.ownerDocument !== document
  51573. ) {
  51574. return original.apply(this, arguments)
  51575. }
  51576. };
  51577. }
  51578. target$1.addEventListener(
  51579. name,
  51580. handler,
  51581. supportsPassive
  51582. ? { capture: capture, passive: passive }
  51583. : capture
  51584. );
  51585. }
  51586. function remove$2 (
  51587. name,
  51588. handler,
  51589. capture,
  51590. _target
  51591. ) {
  51592. (_target || target$1).removeEventListener(
  51593. name,
  51594. handler._wrapper || handler,
  51595. capture
  51596. );
  51597. }
  51598. function updateDOMListeners (oldVnode, vnode) {
  51599. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  51600. return
  51601. }
  51602. var on = vnode.data.on || {};
  51603. var oldOn = oldVnode.data.on || {};
  51604. target$1 = vnode.elm;
  51605. normalizeEvents(on);
  51606. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  51607. target$1 = undefined;
  51608. }
  51609. var events = {
  51610. create: updateDOMListeners,
  51611. update: updateDOMListeners
  51612. };
  51613. /* */
  51614. var svgContainer;
  51615. function updateDOMProps (oldVnode, vnode) {
  51616. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  51617. return
  51618. }
  51619. var key, cur;
  51620. var elm = vnode.elm;
  51621. var oldProps = oldVnode.data.domProps || {};
  51622. var props = vnode.data.domProps || {};
  51623. // clone observed objects, as the user probably wants to mutate it
  51624. if (isDef(props.__ob__)) {
  51625. props = vnode.data.domProps = extend({}, props);
  51626. }
  51627. for (key in oldProps) {
  51628. if (!(key in props)) {
  51629. elm[key] = '';
  51630. }
  51631. }
  51632. for (key in props) {
  51633. cur = props[key];
  51634. // ignore children if the node has textContent or innerHTML,
  51635. // as these will throw away existing DOM nodes and cause removal errors
  51636. // on subsequent patches (#3360)
  51637. if (key === 'textContent' || key === 'innerHTML') {
  51638. if (vnode.children) { vnode.children.length = 0; }
  51639. if (cur === oldProps[key]) { continue }
  51640. // #6601 work around Chrome version <= 55 bug where single textNode
  51641. // replaced by innerHTML/textContent retains its parentNode property
  51642. if (elm.childNodes.length === 1) {
  51643. elm.removeChild(elm.childNodes[0]);
  51644. }
  51645. }
  51646. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  51647. // store value as _value as well since
  51648. // non-string values will be stringified
  51649. elm._value = cur;
  51650. // avoid resetting cursor position when value is the same
  51651. var strCur = isUndef(cur) ? '' : String(cur);
  51652. if (shouldUpdateValue(elm, strCur)) {
  51653. elm.value = strCur;
  51654. }
  51655. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  51656. // IE doesn't support innerHTML for SVG elements
  51657. svgContainer = svgContainer || document.createElement('div');
  51658. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  51659. var svg = svgContainer.firstChild;
  51660. while (elm.firstChild) {
  51661. elm.removeChild(elm.firstChild);
  51662. }
  51663. while (svg.firstChild) {
  51664. elm.appendChild(svg.firstChild);
  51665. }
  51666. } else if (
  51667. // skip the update if old and new VDOM state is the same.
  51668. // `value` is handled separately because the DOM value may be temporarily
  51669. // out of sync with VDOM state due to focus, composition and modifiers.
  51670. // This #4521 by skipping the unnecesarry `checked` update.
  51671. cur !== oldProps[key]
  51672. ) {
  51673. // some property updates can throw
  51674. // e.g. `value` on <progress> w/ non-finite value
  51675. try {
  51676. elm[key] = cur;
  51677. } catch (e) {}
  51678. }
  51679. }
  51680. }
  51681. // check platforms/web/util/attrs.js acceptValue
  51682. function shouldUpdateValue (elm, checkVal) {
  51683. return (!elm.composing && (
  51684. elm.tagName === 'OPTION' ||
  51685. isNotInFocusAndDirty(elm, checkVal) ||
  51686. isDirtyWithModifiers(elm, checkVal)
  51687. ))
  51688. }
  51689. function isNotInFocusAndDirty (elm, checkVal) {
  51690. // return true when textbox (.number and .trim) loses focus and its value is
  51691. // not equal to the updated value
  51692. var notInFocus = true;
  51693. // #6157
  51694. // work around IE bug when accessing document.activeElement in an iframe
  51695. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  51696. return notInFocus && elm.value !== checkVal
  51697. }
  51698. function isDirtyWithModifiers (elm, newVal) {
  51699. var value = elm.value;
  51700. var modifiers = elm._vModifiers; // injected by v-model runtime
  51701. if (isDef(modifiers)) {
  51702. if (modifiers.number) {
  51703. return toNumber(value) !== toNumber(newVal)
  51704. }
  51705. if (modifiers.trim) {
  51706. return value.trim() !== newVal.trim()
  51707. }
  51708. }
  51709. return value !== newVal
  51710. }
  51711. var domProps = {
  51712. create: updateDOMProps,
  51713. update: updateDOMProps
  51714. };
  51715. /* */
  51716. var parseStyleText = cached(function (cssText) {
  51717. var res = {};
  51718. var listDelimiter = /;(?![^(]*\))/g;
  51719. var propertyDelimiter = /:(.+)/;
  51720. cssText.split(listDelimiter).forEach(function (item) {
  51721. if (item) {
  51722. var tmp = item.split(propertyDelimiter);
  51723. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  51724. }
  51725. });
  51726. return res
  51727. });
  51728. // merge static and dynamic style data on the same vnode
  51729. function normalizeStyleData (data) {
  51730. var style = normalizeStyleBinding(data.style);
  51731. // static style is pre-processed into an object during compilation
  51732. // and is always a fresh object, so it's safe to merge into it
  51733. return data.staticStyle
  51734. ? extend(data.staticStyle, style)
  51735. : style
  51736. }
  51737. // normalize possible array / string values into Object
  51738. function normalizeStyleBinding (bindingStyle) {
  51739. if (Array.isArray(bindingStyle)) {
  51740. return toObject(bindingStyle)
  51741. }
  51742. if (typeof bindingStyle === 'string') {
  51743. return parseStyleText(bindingStyle)
  51744. }
  51745. return bindingStyle
  51746. }
  51747. /**
  51748. * parent component style should be after child's
  51749. * so that parent component's style could override it
  51750. */
  51751. function getStyle (vnode, checkChild) {
  51752. var res = {};
  51753. var styleData;
  51754. if (checkChild) {
  51755. var childNode = vnode;
  51756. while (childNode.componentInstance) {
  51757. childNode = childNode.componentInstance._vnode;
  51758. if (
  51759. childNode && childNode.data &&
  51760. (styleData = normalizeStyleData(childNode.data))
  51761. ) {
  51762. extend(res, styleData);
  51763. }
  51764. }
  51765. }
  51766. if ((styleData = normalizeStyleData(vnode.data))) {
  51767. extend(res, styleData);
  51768. }
  51769. var parentNode = vnode;
  51770. while ((parentNode = parentNode.parent)) {
  51771. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  51772. extend(res, styleData);
  51773. }
  51774. }
  51775. return res
  51776. }
  51777. /* */
  51778. var cssVarRE = /^--/;
  51779. var importantRE = /\s*!important$/;
  51780. var setProp = function (el, name, val) {
  51781. /* istanbul ignore if */
  51782. if (cssVarRE.test(name)) {
  51783. el.style.setProperty(name, val);
  51784. } else if (importantRE.test(val)) {
  51785. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  51786. } else {
  51787. var normalizedName = normalize(name);
  51788. if (Array.isArray(val)) {
  51789. // Support values array created by autoprefixer, e.g.
  51790. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  51791. // Set them one by one, and the browser will only set those it can recognize
  51792. for (var i = 0, len = val.length; i < len; i++) {
  51793. el.style[normalizedName] = val[i];
  51794. }
  51795. } else {
  51796. el.style[normalizedName] = val;
  51797. }
  51798. }
  51799. };
  51800. var vendorNames = ['Webkit', 'Moz', 'ms'];
  51801. var emptyStyle;
  51802. var normalize = cached(function (prop) {
  51803. emptyStyle = emptyStyle || document.createElement('div').style;
  51804. prop = camelize(prop);
  51805. if (prop !== 'filter' && (prop in emptyStyle)) {
  51806. return prop
  51807. }
  51808. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  51809. for (var i = 0; i < vendorNames.length; i++) {
  51810. var name = vendorNames[i] + capName;
  51811. if (name in emptyStyle) {
  51812. return name
  51813. }
  51814. }
  51815. });
  51816. function updateStyle (oldVnode, vnode) {
  51817. var data = vnode.data;
  51818. var oldData = oldVnode.data;
  51819. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  51820. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  51821. ) {
  51822. return
  51823. }
  51824. var cur, name;
  51825. var el = vnode.elm;
  51826. var oldStaticStyle = oldData.staticStyle;
  51827. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  51828. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  51829. var oldStyle = oldStaticStyle || oldStyleBinding;
  51830. var style = normalizeStyleBinding(vnode.data.style) || {};
  51831. // store normalized style under a different key for next diff
  51832. // make sure to clone it if it's reactive, since the user likely wants
  51833. // to mutate it.
  51834. vnode.data.normalizedStyle = isDef(style.__ob__)
  51835. ? extend({}, style)
  51836. : style;
  51837. var newStyle = getStyle(vnode, true);
  51838. for (name in oldStyle) {
  51839. if (isUndef(newStyle[name])) {
  51840. setProp(el, name, '');
  51841. }
  51842. }
  51843. for (name in newStyle) {
  51844. cur = newStyle[name];
  51845. if (cur !== oldStyle[name]) {
  51846. // ie9 setting to null has no effect, must use empty string
  51847. setProp(el, name, cur == null ? '' : cur);
  51848. }
  51849. }
  51850. }
  51851. var style = {
  51852. create: updateStyle,
  51853. update: updateStyle
  51854. };
  51855. /* */
  51856. var whitespaceRE = /\s+/;
  51857. /**
  51858. * Add class with compatibility for SVG since classList is not supported on
  51859. * SVG elements in IE
  51860. */
  51861. function addClass (el, cls) {
  51862. /* istanbul ignore if */
  51863. if (!cls || !(cls = cls.trim())) {
  51864. return
  51865. }
  51866. /* istanbul ignore else */
  51867. if (el.classList) {
  51868. if (cls.indexOf(' ') > -1) {
  51869. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  51870. } else {
  51871. el.classList.add(cls);
  51872. }
  51873. } else {
  51874. var cur = " " + (el.getAttribute('class') || '') + " ";
  51875. if (cur.indexOf(' ' + cls + ' ') < 0) {
  51876. el.setAttribute('class', (cur + cls).trim());
  51877. }
  51878. }
  51879. }
  51880. /**
  51881. * Remove class with compatibility for SVG since classList is not supported on
  51882. * SVG elements in IE
  51883. */
  51884. function removeClass (el, cls) {
  51885. /* istanbul ignore if */
  51886. if (!cls || !(cls = cls.trim())) {
  51887. return
  51888. }
  51889. /* istanbul ignore else */
  51890. if (el.classList) {
  51891. if (cls.indexOf(' ') > -1) {
  51892. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  51893. } else {
  51894. el.classList.remove(cls);
  51895. }
  51896. if (!el.classList.length) {
  51897. el.removeAttribute('class');
  51898. }
  51899. } else {
  51900. var cur = " " + (el.getAttribute('class') || '') + " ";
  51901. var tar = ' ' + cls + ' ';
  51902. while (cur.indexOf(tar) >= 0) {
  51903. cur = cur.replace(tar, ' ');
  51904. }
  51905. cur = cur.trim();
  51906. if (cur) {
  51907. el.setAttribute('class', cur);
  51908. } else {
  51909. el.removeAttribute('class');
  51910. }
  51911. }
  51912. }
  51913. /* */
  51914. function resolveTransition (def$$1) {
  51915. if (!def$$1) {
  51916. return
  51917. }
  51918. /* istanbul ignore else */
  51919. if (typeof def$$1 === 'object') {
  51920. var res = {};
  51921. if (def$$1.css !== false) {
  51922. extend(res, autoCssTransition(def$$1.name || 'v'));
  51923. }
  51924. extend(res, def$$1);
  51925. return res
  51926. } else if (typeof def$$1 === 'string') {
  51927. return autoCssTransition(def$$1)
  51928. }
  51929. }
  51930. var autoCssTransition = cached(function (name) {
  51931. return {
  51932. enterClass: (name + "-enter"),
  51933. enterToClass: (name + "-enter-to"),
  51934. enterActiveClass: (name + "-enter-active"),
  51935. leaveClass: (name + "-leave"),
  51936. leaveToClass: (name + "-leave-to"),
  51937. leaveActiveClass: (name + "-leave-active")
  51938. }
  51939. });
  51940. var hasTransition = inBrowser && !isIE9;
  51941. var TRANSITION = 'transition';
  51942. var ANIMATION = 'animation';
  51943. // Transition property/event sniffing
  51944. var transitionProp = 'transition';
  51945. var transitionEndEvent = 'transitionend';
  51946. var animationProp = 'animation';
  51947. var animationEndEvent = 'animationend';
  51948. if (hasTransition) {
  51949. /* istanbul ignore if */
  51950. if (window.ontransitionend === undefined &&
  51951. window.onwebkittransitionend !== undefined
  51952. ) {
  51953. transitionProp = 'WebkitTransition';
  51954. transitionEndEvent = 'webkitTransitionEnd';
  51955. }
  51956. if (window.onanimationend === undefined &&
  51957. window.onwebkitanimationend !== undefined
  51958. ) {
  51959. animationProp = 'WebkitAnimation';
  51960. animationEndEvent = 'webkitAnimationEnd';
  51961. }
  51962. }
  51963. // binding to window is necessary to make hot reload work in IE in strict mode
  51964. var raf = inBrowser
  51965. ? window.requestAnimationFrame
  51966. ? window.requestAnimationFrame.bind(window)
  51967. : setTimeout
  51968. : /* istanbul ignore next */ function (fn) { return fn(); };
  51969. function nextFrame (fn) {
  51970. raf(function () {
  51971. raf(fn);
  51972. });
  51973. }
  51974. function addTransitionClass (el, cls) {
  51975. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  51976. if (transitionClasses.indexOf(cls) < 0) {
  51977. transitionClasses.push(cls);
  51978. addClass(el, cls);
  51979. }
  51980. }
  51981. function removeTransitionClass (el, cls) {
  51982. if (el._transitionClasses) {
  51983. remove(el._transitionClasses, cls);
  51984. }
  51985. removeClass(el, cls);
  51986. }
  51987. function whenTransitionEnds (
  51988. el,
  51989. expectedType,
  51990. cb
  51991. ) {
  51992. var ref = getTransitionInfo(el, expectedType);
  51993. var type = ref.type;
  51994. var timeout = ref.timeout;
  51995. var propCount = ref.propCount;
  51996. if (!type) { return cb() }
  51997. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  51998. var ended = 0;
  51999. var end = function () {
  52000. el.removeEventListener(event, onEnd);
  52001. cb();
  52002. };
  52003. var onEnd = function (e) {
  52004. if (e.target === el) {
  52005. if (++ended >= propCount) {
  52006. end();
  52007. }
  52008. }
  52009. };
  52010. setTimeout(function () {
  52011. if (ended < propCount) {
  52012. end();
  52013. }
  52014. }, timeout + 1);
  52015. el.addEventListener(event, onEnd);
  52016. }
  52017. var transformRE = /\b(transform|all)(,|$)/;
  52018. function getTransitionInfo (el, expectedType) {
  52019. var styles = window.getComputedStyle(el);
  52020. // JSDOM may return undefined for transition properties
  52021. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  52022. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  52023. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  52024. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  52025. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  52026. var animationTimeout = getTimeout(animationDelays, animationDurations);
  52027. var type;
  52028. var timeout = 0;
  52029. var propCount = 0;
  52030. /* istanbul ignore if */
  52031. if (expectedType === TRANSITION) {
  52032. if (transitionTimeout > 0) {
  52033. type = TRANSITION;
  52034. timeout = transitionTimeout;
  52035. propCount = transitionDurations.length;
  52036. }
  52037. } else if (expectedType === ANIMATION) {
  52038. if (animationTimeout > 0) {
  52039. type = ANIMATION;
  52040. timeout = animationTimeout;
  52041. propCount = animationDurations.length;
  52042. }
  52043. } else {
  52044. timeout = Math.max(transitionTimeout, animationTimeout);
  52045. type = timeout > 0
  52046. ? transitionTimeout > animationTimeout
  52047. ? TRANSITION
  52048. : ANIMATION
  52049. : null;
  52050. propCount = type
  52051. ? type === TRANSITION
  52052. ? transitionDurations.length
  52053. : animationDurations.length
  52054. : 0;
  52055. }
  52056. var hasTransform =
  52057. type === TRANSITION &&
  52058. transformRE.test(styles[transitionProp + 'Property']);
  52059. return {
  52060. type: type,
  52061. timeout: timeout,
  52062. propCount: propCount,
  52063. hasTransform: hasTransform
  52064. }
  52065. }
  52066. function getTimeout (delays, durations) {
  52067. /* istanbul ignore next */
  52068. while (delays.length < durations.length) {
  52069. delays = delays.concat(delays);
  52070. }
  52071. return Math.max.apply(null, durations.map(function (d, i) {
  52072. return toMs(d) + toMs(delays[i])
  52073. }))
  52074. }
  52075. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  52076. // in a locale-dependent way, using a comma instead of a dot.
  52077. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  52078. // as a floor function) causing unexpected behaviors
  52079. function toMs (s) {
  52080. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  52081. }
  52082. /* */
  52083. function enter (vnode, toggleDisplay) {
  52084. var el = vnode.elm;
  52085. // call leave callback now
  52086. if (isDef(el._leaveCb)) {
  52087. el._leaveCb.cancelled = true;
  52088. el._leaveCb();
  52089. }
  52090. var data = resolveTransition(vnode.data.transition);
  52091. if (isUndef(data)) {
  52092. return
  52093. }
  52094. /* istanbul ignore if */
  52095. if (isDef(el._enterCb) || el.nodeType !== 1) {
  52096. return
  52097. }
  52098. var css = data.css;
  52099. var type = data.type;
  52100. var enterClass = data.enterClass;
  52101. var enterToClass = data.enterToClass;
  52102. var enterActiveClass = data.enterActiveClass;
  52103. var appearClass = data.appearClass;
  52104. var appearToClass = data.appearToClass;
  52105. var appearActiveClass = data.appearActiveClass;
  52106. var beforeEnter = data.beforeEnter;
  52107. var enter = data.enter;
  52108. var afterEnter = data.afterEnter;
  52109. var enterCancelled = data.enterCancelled;
  52110. var beforeAppear = data.beforeAppear;
  52111. var appear = data.appear;
  52112. var afterAppear = data.afterAppear;
  52113. var appearCancelled = data.appearCancelled;
  52114. var duration = data.duration;
  52115. // activeInstance will always be the <transition> component managing this
  52116. // transition. One edge case to check is when the <transition> is placed
  52117. // as the root node of a child component. In that case we need to check
  52118. // <transition>'s parent for appear check.
  52119. var context = activeInstance;
  52120. var transitionNode = activeInstance.$vnode;
  52121. while (transitionNode && transitionNode.parent) {
  52122. context = transitionNode.context;
  52123. transitionNode = transitionNode.parent;
  52124. }
  52125. var isAppear = !context._isMounted || !vnode.isRootInsert;
  52126. if (isAppear && !appear && appear !== '') {
  52127. return
  52128. }
  52129. var startClass = isAppear && appearClass
  52130. ? appearClass
  52131. : enterClass;
  52132. var activeClass = isAppear && appearActiveClass
  52133. ? appearActiveClass
  52134. : enterActiveClass;
  52135. var toClass = isAppear && appearToClass
  52136. ? appearToClass
  52137. : enterToClass;
  52138. var beforeEnterHook = isAppear
  52139. ? (beforeAppear || beforeEnter)
  52140. : beforeEnter;
  52141. var enterHook = isAppear
  52142. ? (typeof appear === 'function' ? appear : enter)
  52143. : enter;
  52144. var afterEnterHook = isAppear
  52145. ? (afterAppear || afterEnter)
  52146. : afterEnter;
  52147. var enterCancelledHook = isAppear
  52148. ? (appearCancelled || enterCancelled)
  52149. : enterCancelled;
  52150. var explicitEnterDuration = toNumber(
  52151. isObject(duration)
  52152. ? duration.enter
  52153. : duration
  52154. );
  52155. if (explicitEnterDuration != null) {
  52156. checkDuration(explicitEnterDuration, 'enter', vnode);
  52157. }
  52158. var expectsCSS = css !== false && !isIE9;
  52159. var userWantsControl = getHookArgumentsLength(enterHook);
  52160. var cb = el._enterCb = once(function () {
  52161. if (expectsCSS) {
  52162. removeTransitionClass(el, toClass);
  52163. removeTransitionClass(el, activeClass);
  52164. }
  52165. if (cb.cancelled) {
  52166. if (expectsCSS) {
  52167. removeTransitionClass(el, startClass);
  52168. }
  52169. enterCancelledHook && enterCancelledHook(el);
  52170. } else {
  52171. afterEnterHook && afterEnterHook(el);
  52172. }
  52173. el._enterCb = null;
  52174. });
  52175. if (!vnode.data.show) {
  52176. // remove pending leave element on enter by injecting an insert hook
  52177. mergeVNodeHook(vnode, 'insert', function () {
  52178. var parent = el.parentNode;
  52179. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  52180. if (pendingNode &&
  52181. pendingNode.tag === vnode.tag &&
  52182. pendingNode.elm._leaveCb
  52183. ) {
  52184. pendingNode.elm._leaveCb();
  52185. }
  52186. enterHook && enterHook(el, cb);
  52187. });
  52188. }
  52189. // start enter transition
  52190. beforeEnterHook && beforeEnterHook(el);
  52191. if (expectsCSS) {
  52192. addTransitionClass(el, startClass);
  52193. addTransitionClass(el, activeClass);
  52194. nextFrame(function () {
  52195. removeTransitionClass(el, startClass);
  52196. if (!cb.cancelled) {
  52197. addTransitionClass(el, toClass);
  52198. if (!userWantsControl) {
  52199. if (isValidDuration(explicitEnterDuration)) {
  52200. setTimeout(cb, explicitEnterDuration);
  52201. } else {
  52202. whenTransitionEnds(el, type, cb);
  52203. }
  52204. }
  52205. }
  52206. });
  52207. }
  52208. if (vnode.data.show) {
  52209. toggleDisplay && toggleDisplay();
  52210. enterHook && enterHook(el, cb);
  52211. }
  52212. if (!expectsCSS && !userWantsControl) {
  52213. cb();
  52214. }
  52215. }
  52216. function leave (vnode, rm) {
  52217. var el = vnode.elm;
  52218. // call enter callback now
  52219. if (isDef(el._enterCb)) {
  52220. el._enterCb.cancelled = true;
  52221. el._enterCb();
  52222. }
  52223. var data = resolveTransition(vnode.data.transition);
  52224. if (isUndef(data) || el.nodeType !== 1) {
  52225. return rm()
  52226. }
  52227. /* istanbul ignore if */
  52228. if (isDef(el._leaveCb)) {
  52229. return
  52230. }
  52231. var css = data.css;
  52232. var type = data.type;
  52233. var leaveClass = data.leaveClass;
  52234. var leaveToClass = data.leaveToClass;
  52235. var leaveActiveClass = data.leaveActiveClass;
  52236. var beforeLeave = data.beforeLeave;
  52237. var leave = data.leave;
  52238. var afterLeave = data.afterLeave;
  52239. var leaveCancelled = data.leaveCancelled;
  52240. var delayLeave = data.delayLeave;
  52241. var duration = data.duration;
  52242. var expectsCSS = css !== false && !isIE9;
  52243. var userWantsControl = getHookArgumentsLength(leave);
  52244. var explicitLeaveDuration = toNumber(
  52245. isObject(duration)
  52246. ? duration.leave
  52247. : duration
  52248. );
  52249. if (isDef(explicitLeaveDuration)) {
  52250. checkDuration(explicitLeaveDuration, 'leave', vnode);
  52251. }
  52252. var cb = el._leaveCb = once(function () {
  52253. if (el.parentNode && el.parentNode._pending) {
  52254. el.parentNode._pending[vnode.key] = null;
  52255. }
  52256. if (expectsCSS) {
  52257. removeTransitionClass(el, leaveToClass);
  52258. removeTransitionClass(el, leaveActiveClass);
  52259. }
  52260. if (cb.cancelled) {
  52261. if (expectsCSS) {
  52262. removeTransitionClass(el, leaveClass);
  52263. }
  52264. leaveCancelled && leaveCancelled(el);
  52265. } else {
  52266. rm();
  52267. afterLeave && afterLeave(el);
  52268. }
  52269. el._leaveCb = null;
  52270. });
  52271. if (delayLeave) {
  52272. delayLeave(performLeave);
  52273. } else {
  52274. performLeave();
  52275. }
  52276. function performLeave () {
  52277. // the delayed leave may have already been cancelled
  52278. if (cb.cancelled) {
  52279. return
  52280. }
  52281. // record leaving element
  52282. if (!vnode.data.show && el.parentNode) {
  52283. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  52284. }
  52285. beforeLeave && beforeLeave(el);
  52286. if (expectsCSS) {
  52287. addTransitionClass(el, leaveClass);
  52288. addTransitionClass(el, leaveActiveClass);
  52289. nextFrame(function () {
  52290. removeTransitionClass(el, leaveClass);
  52291. if (!cb.cancelled) {
  52292. addTransitionClass(el, leaveToClass);
  52293. if (!userWantsControl) {
  52294. if (isValidDuration(explicitLeaveDuration)) {
  52295. setTimeout(cb, explicitLeaveDuration);
  52296. } else {
  52297. whenTransitionEnds(el, type, cb);
  52298. }
  52299. }
  52300. }
  52301. });
  52302. }
  52303. leave && leave(el, cb);
  52304. if (!expectsCSS && !userWantsControl) {
  52305. cb();
  52306. }
  52307. }
  52308. }
  52309. // only used in dev mode
  52310. function checkDuration (val, name, vnode) {
  52311. if (typeof val !== 'number') {
  52312. warn(
  52313. "<transition> explicit " + name + " duration is not a valid number - " +
  52314. "got " + (JSON.stringify(val)) + ".",
  52315. vnode.context
  52316. );
  52317. } else if (isNaN(val)) {
  52318. warn(
  52319. "<transition> explicit " + name + " duration is NaN - " +
  52320. 'the duration expression might be incorrect.',
  52321. vnode.context
  52322. );
  52323. }
  52324. }
  52325. function isValidDuration (val) {
  52326. return typeof val === 'number' && !isNaN(val)
  52327. }
  52328. /**
  52329. * Normalize a transition hook's argument length. The hook may be:
  52330. * - a merged hook (invoker) with the original in .fns
  52331. * - a wrapped component method (check ._length)
  52332. * - a plain function (.length)
  52333. */
  52334. function getHookArgumentsLength (fn) {
  52335. if (isUndef(fn)) {
  52336. return false
  52337. }
  52338. var invokerFns = fn.fns;
  52339. if (isDef(invokerFns)) {
  52340. // invoker
  52341. return getHookArgumentsLength(
  52342. Array.isArray(invokerFns)
  52343. ? invokerFns[0]
  52344. : invokerFns
  52345. )
  52346. } else {
  52347. return (fn._length || fn.length) > 1
  52348. }
  52349. }
  52350. function _enter (_, vnode) {
  52351. if (vnode.data.show !== true) {
  52352. enter(vnode);
  52353. }
  52354. }
  52355. var transition = inBrowser ? {
  52356. create: _enter,
  52357. activate: _enter,
  52358. remove: function remove$$1 (vnode, rm) {
  52359. /* istanbul ignore else */
  52360. if (vnode.data.show !== true) {
  52361. leave(vnode, rm);
  52362. } else {
  52363. rm();
  52364. }
  52365. }
  52366. } : {};
  52367. var platformModules = [
  52368. attrs,
  52369. klass,
  52370. events,
  52371. domProps,
  52372. style,
  52373. transition
  52374. ];
  52375. /* */
  52376. // the directive module should be applied last, after all
  52377. // built-in modules have been applied.
  52378. var modules = platformModules.concat(baseModules);
  52379. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  52380. /**
  52381. * Not type checking this file because flow doesn't like attaching
  52382. * properties to Elements.
  52383. */
  52384. /* istanbul ignore if */
  52385. if (isIE9) {
  52386. // http://www.matts411.com/post/internet-explorer-9-oninput/
  52387. document.addEventListener('selectionchange', function () {
  52388. var el = document.activeElement;
  52389. if (el && el.vmodel) {
  52390. trigger(el, 'input');
  52391. }
  52392. });
  52393. }
  52394. var directive = {
  52395. inserted: function inserted (el, binding, vnode, oldVnode) {
  52396. if (vnode.tag === 'select') {
  52397. // #6903
  52398. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  52399. mergeVNodeHook(vnode, 'postpatch', function () {
  52400. directive.componentUpdated(el, binding, vnode);
  52401. });
  52402. } else {
  52403. setSelected(el, binding, vnode.context);
  52404. }
  52405. el._vOptions = [].map.call(el.options, getValue);
  52406. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  52407. el._vModifiers = binding.modifiers;
  52408. if (!binding.modifiers.lazy) {
  52409. el.addEventListener('compositionstart', onCompositionStart);
  52410. el.addEventListener('compositionend', onCompositionEnd);
  52411. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  52412. // switching focus before confirming composition choice
  52413. // this also fixes the issue where some browsers e.g. iOS Chrome
  52414. // fires "change" instead of "input" on autocomplete.
  52415. el.addEventListener('change', onCompositionEnd);
  52416. /* istanbul ignore if */
  52417. if (isIE9) {
  52418. el.vmodel = true;
  52419. }
  52420. }
  52421. }
  52422. },
  52423. componentUpdated: function componentUpdated (el, binding, vnode) {
  52424. if (vnode.tag === 'select') {
  52425. setSelected(el, binding, vnode.context);
  52426. // in case the options rendered by v-for have changed,
  52427. // it's possible that the value is out-of-sync with the rendered options.
  52428. // detect such cases and filter out values that no longer has a matching
  52429. // option in the DOM.
  52430. var prevOptions = el._vOptions;
  52431. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  52432. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  52433. // trigger change event if
  52434. // no matching option found for at least one value
  52435. var needReset = el.multiple
  52436. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  52437. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  52438. if (needReset) {
  52439. trigger(el, 'change');
  52440. }
  52441. }
  52442. }
  52443. }
  52444. };
  52445. function setSelected (el, binding, vm) {
  52446. actuallySetSelected(el, binding, vm);
  52447. /* istanbul ignore if */
  52448. if (isIE || isEdge) {
  52449. setTimeout(function () {
  52450. actuallySetSelected(el, binding, vm);
  52451. }, 0);
  52452. }
  52453. }
  52454. function actuallySetSelected (el, binding, vm) {
  52455. var value = binding.value;
  52456. var isMultiple = el.multiple;
  52457. if (isMultiple && !Array.isArray(value)) {
  52458. warn(
  52459. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  52460. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  52461. vm
  52462. );
  52463. return
  52464. }
  52465. var selected, option;
  52466. for (var i = 0, l = el.options.length; i < l; i++) {
  52467. option = el.options[i];
  52468. if (isMultiple) {
  52469. selected = looseIndexOf(value, getValue(option)) > -1;
  52470. if (option.selected !== selected) {
  52471. option.selected = selected;
  52472. }
  52473. } else {
  52474. if (looseEqual(getValue(option), value)) {
  52475. if (el.selectedIndex !== i) {
  52476. el.selectedIndex = i;
  52477. }
  52478. return
  52479. }
  52480. }
  52481. }
  52482. if (!isMultiple) {
  52483. el.selectedIndex = -1;
  52484. }
  52485. }
  52486. function hasNoMatchingOption (value, options) {
  52487. return options.every(function (o) { return !looseEqual(o, value); })
  52488. }
  52489. function getValue (option) {
  52490. return '_value' in option
  52491. ? option._value
  52492. : option.value
  52493. }
  52494. function onCompositionStart (e) {
  52495. e.target.composing = true;
  52496. }
  52497. function onCompositionEnd (e) {
  52498. // prevent triggering an input event for no reason
  52499. if (!e.target.composing) { return }
  52500. e.target.composing = false;
  52501. trigger(e.target, 'input');
  52502. }
  52503. function trigger (el, type) {
  52504. var e = document.createEvent('HTMLEvents');
  52505. e.initEvent(type, true, true);
  52506. el.dispatchEvent(e);
  52507. }
  52508. /* */
  52509. // recursively search for possible transition defined inside the component root
  52510. function locateNode (vnode) {
  52511. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  52512. ? locateNode(vnode.componentInstance._vnode)
  52513. : vnode
  52514. }
  52515. var show = {
  52516. bind: function bind (el, ref, vnode) {
  52517. var value = ref.value;
  52518. vnode = locateNode(vnode);
  52519. var transition$$1 = vnode.data && vnode.data.transition;
  52520. var originalDisplay = el.__vOriginalDisplay =
  52521. el.style.display === 'none' ? '' : el.style.display;
  52522. if (value && transition$$1) {
  52523. vnode.data.show = true;
  52524. enter(vnode, function () {
  52525. el.style.display = originalDisplay;
  52526. });
  52527. } else {
  52528. el.style.display = value ? originalDisplay : 'none';
  52529. }
  52530. },
  52531. update: function update (el, ref, vnode) {
  52532. var value = ref.value;
  52533. var oldValue = ref.oldValue;
  52534. /* istanbul ignore if */
  52535. if (!value === !oldValue) { return }
  52536. vnode = locateNode(vnode);
  52537. var transition$$1 = vnode.data && vnode.data.transition;
  52538. if (transition$$1) {
  52539. vnode.data.show = true;
  52540. if (value) {
  52541. enter(vnode, function () {
  52542. el.style.display = el.__vOriginalDisplay;
  52543. });
  52544. } else {
  52545. leave(vnode, function () {
  52546. el.style.display = 'none';
  52547. });
  52548. }
  52549. } else {
  52550. el.style.display = value ? el.__vOriginalDisplay : 'none';
  52551. }
  52552. },
  52553. unbind: function unbind (
  52554. el,
  52555. binding,
  52556. vnode,
  52557. oldVnode,
  52558. isDestroy
  52559. ) {
  52560. if (!isDestroy) {
  52561. el.style.display = el.__vOriginalDisplay;
  52562. }
  52563. }
  52564. };
  52565. var platformDirectives = {
  52566. model: directive,
  52567. show: show
  52568. };
  52569. /* */
  52570. var transitionProps = {
  52571. name: String,
  52572. appear: Boolean,
  52573. css: Boolean,
  52574. mode: String,
  52575. type: String,
  52576. enterClass: String,
  52577. leaveClass: String,
  52578. enterToClass: String,
  52579. leaveToClass: String,
  52580. enterActiveClass: String,
  52581. leaveActiveClass: String,
  52582. appearClass: String,
  52583. appearActiveClass: String,
  52584. appearToClass: String,
  52585. duration: [Number, String, Object]
  52586. };
  52587. // in case the child is also an abstract component, e.g. <keep-alive>
  52588. // we want to recursively retrieve the real component to be rendered
  52589. function getRealChild (vnode) {
  52590. var compOptions = vnode && vnode.componentOptions;
  52591. if (compOptions && compOptions.Ctor.options.abstract) {
  52592. return getRealChild(getFirstComponentChild(compOptions.children))
  52593. } else {
  52594. return vnode
  52595. }
  52596. }
  52597. function extractTransitionData (comp) {
  52598. var data = {};
  52599. var options = comp.$options;
  52600. // props
  52601. for (var key in options.propsData) {
  52602. data[key] = comp[key];
  52603. }
  52604. // events.
  52605. // extract listeners and pass them directly to the transition methods
  52606. var listeners = options._parentListeners;
  52607. for (var key$1 in listeners) {
  52608. data[camelize(key$1)] = listeners[key$1];
  52609. }
  52610. return data
  52611. }
  52612. function placeholder (h, rawChild) {
  52613. if (/\d-keep-alive$/.test(rawChild.tag)) {
  52614. return h('keep-alive', {
  52615. props: rawChild.componentOptions.propsData
  52616. })
  52617. }
  52618. }
  52619. function hasParentTransition (vnode) {
  52620. while ((vnode = vnode.parent)) {
  52621. if (vnode.data.transition) {
  52622. return true
  52623. }
  52624. }
  52625. }
  52626. function isSameChild (child, oldChild) {
  52627. return oldChild.key === child.key && oldChild.tag === child.tag
  52628. }
  52629. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  52630. var isVShowDirective = function (d) { return d.name === 'show'; };
  52631. var Transition = {
  52632. name: 'transition',
  52633. props: transitionProps,
  52634. abstract: true,
  52635. render: function render (h) {
  52636. var this$1 = this;
  52637. var children = this.$slots.default;
  52638. if (!children) {
  52639. return
  52640. }
  52641. // filter out text nodes (possible whitespaces)
  52642. children = children.filter(isNotTextNode);
  52643. /* istanbul ignore if */
  52644. if (!children.length) {
  52645. return
  52646. }
  52647. // warn multiple elements
  52648. if (children.length > 1) {
  52649. warn(
  52650. '<transition> can only be used on a single element. Use ' +
  52651. '<transition-group> for lists.',
  52652. this.$parent
  52653. );
  52654. }
  52655. var mode = this.mode;
  52656. // warn invalid mode
  52657. if (mode && mode !== 'in-out' && mode !== 'out-in'
  52658. ) {
  52659. warn(
  52660. 'invalid <transition> mode: ' + mode,
  52661. this.$parent
  52662. );
  52663. }
  52664. var rawChild = children[0];
  52665. // if this is a component root node and the component's
  52666. // parent container node also has transition, skip.
  52667. if (hasParentTransition(this.$vnode)) {
  52668. return rawChild
  52669. }
  52670. // apply transition data to child
  52671. // use getRealChild() to ignore abstract components e.g. keep-alive
  52672. var child = getRealChild(rawChild);
  52673. /* istanbul ignore if */
  52674. if (!child) {
  52675. return rawChild
  52676. }
  52677. if (this._leaving) {
  52678. return placeholder(h, rawChild)
  52679. }
  52680. // ensure a key that is unique to the vnode type and to this transition
  52681. // component instance. This key will be used to remove pending leaving nodes
  52682. // during entering.
  52683. var id = "__transition-" + (this._uid) + "-";
  52684. child.key = child.key == null
  52685. ? child.isComment
  52686. ? id + 'comment'
  52687. : id + child.tag
  52688. : isPrimitive(child.key)
  52689. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  52690. : child.key;
  52691. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  52692. var oldRawChild = this._vnode;
  52693. var oldChild = getRealChild(oldRawChild);
  52694. // mark v-show
  52695. // so that the transition module can hand over the control to the directive
  52696. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  52697. child.data.show = true;
  52698. }
  52699. if (
  52700. oldChild &&
  52701. oldChild.data &&
  52702. !isSameChild(child, oldChild) &&
  52703. !isAsyncPlaceholder(oldChild) &&
  52704. // #6687 component root is a comment node
  52705. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  52706. ) {
  52707. // replace old child transition data with fresh one
  52708. // important for dynamic transitions!
  52709. var oldData = oldChild.data.transition = extend({}, data);
  52710. // handle transition mode
  52711. if (mode === 'out-in') {
  52712. // return placeholder node and queue update when leave finishes
  52713. this._leaving = true;
  52714. mergeVNodeHook(oldData, 'afterLeave', function () {
  52715. this$1._leaving = false;
  52716. this$1.$forceUpdate();
  52717. });
  52718. return placeholder(h, rawChild)
  52719. } else if (mode === 'in-out') {
  52720. if (isAsyncPlaceholder(child)) {
  52721. return oldRawChild
  52722. }
  52723. var delayedLeave;
  52724. var performLeave = function () { delayedLeave(); };
  52725. mergeVNodeHook(data, 'afterEnter', performLeave);
  52726. mergeVNodeHook(data, 'enterCancelled', performLeave);
  52727. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  52728. }
  52729. }
  52730. return rawChild
  52731. }
  52732. };
  52733. /* */
  52734. var props = extend({
  52735. tag: String,
  52736. moveClass: String
  52737. }, transitionProps);
  52738. delete props.mode;
  52739. var TransitionGroup = {
  52740. props: props,
  52741. beforeMount: function beforeMount () {
  52742. var this$1 = this;
  52743. var update = this._update;
  52744. this._update = function (vnode, hydrating) {
  52745. var restoreActiveInstance = setActiveInstance(this$1);
  52746. // force removing pass
  52747. this$1.__patch__(
  52748. this$1._vnode,
  52749. this$1.kept,
  52750. false, // hydrating
  52751. true // removeOnly (!important, avoids unnecessary moves)
  52752. );
  52753. this$1._vnode = this$1.kept;
  52754. restoreActiveInstance();
  52755. update.call(this$1, vnode, hydrating);
  52756. };
  52757. },
  52758. render: function render (h) {
  52759. var tag = this.tag || this.$vnode.data.tag || 'span';
  52760. var map = Object.create(null);
  52761. var prevChildren = this.prevChildren = this.children;
  52762. var rawChildren = this.$slots.default || [];
  52763. var children = this.children = [];
  52764. var transitionData = extractTransitionData(this);
  52765. for (var i = 0; i < rawChildren.length; i++) {
  52766. var c = rawChildren[i];
  52767. if (c.tag) {
  52768. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  52769. children.push(c);
  52770. map[c.key] = c
  52771. ;(c.data || (c.data = {})).transition = transitionData;
  52772. } else {
  52773. var opts = c.componentOptions;
  52774. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  52775. warn(("<transition-group> children must be keyed: <" + name + ">"));
  52776. }
  52777. }
  52778. }
  52779. if (prevChildren) {
  52780. var kept = [];
  52781. var removed = [];
  52782. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  52783. var c$1 = prevChildren[i$1];
  52784. c$1.data.transition = transitionData;
  52785. c$1.data.pos = c$1.elm.getBoundingClientRect();
  52786. if (map[c$1.key]) {
  52787. kept.push(c$1);
  52788. } else {
  52789. removed.push(c$1);
  52790. }
  52791. }
  52792. this.kept = h(tag, null, kept);
  52793. this.removed = removed;
  52794. }
  52795. return h(tag, null, children)
  52796. },
  52797. updated: function updated () {
  52798. var children = this.prevChildren;
  52799. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  52800. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  52801. return
  52802. }
  52803. // we divide the work into three loops to avoid mixing DOM reads and writes
  52804. // in each iteration - which helps prevent layout thrashing.
  52805. children.forEach(callPendingCbs);
  52806. children.forEach(recordPosition);
  52807. children.forEach(applyTranslation);
  52808. // force reflow to put everything in position
  52809. // assign to this to avoid being removed in tree-shaking
  52810. // $flow-disable-line
  52811. this._reflow = document.body.offsetHeight;
  52812. children.forEach(function (c) {
  52813. if (c.data.moved) {
  52814. var el = c.elm;
  52815. var s = el.style;
  52816. addTransitionClass(el, moveClass);
  52817. s.transform = s.WebkitTransform = s.transitionDuration = '';
  52818. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  52819. if (e && e.target !== el) {
  52820. return
  52821. }
  52822. if (!e || /transform$/.test(e.propertyName)) {
  52823. el.removeEventListener(transitionEndEvent, cb);
  52824. el._moveCb = null;
  52825. removeTransitionClass(el, moveClass);
  52826. }
  52827. });
  52828. }
  52829. });
  52830. },
  52831. methods: {
  52832. hasMove: function hasMove (el, moveClass) {
  52833. /* istanbul ignore if */
  52834. if (!hasTransition) {
  52835. return false
  52836. }
  52837. /* istanbul ignore if */
  52838. if (this._hasMove) {
  52839. return this._hasMove
  52840. }
  52841. // Detect whether an element with the move class applied has
  52842. // CSS transitions. Since the element may be inside an entering
  52843. // transition at this very moment, we make a clone of it and remove
  52844. // all other transition classes applied to ensure only the move class
  52845. // is applied.
  52846. var clone = el.cloneNode();
  52847. if (el._transitionClasses) {
  52848. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  52849. }
  52850. addClass(clone, moveClass);
  52851. clone.style.display = 'none';
  52852. this.$el.appendChild(clone);
  52853. var info = getTransitionInfo(clone);
  52854. this.$el.removeChild(clone);
  52855. return (this._hasMove = info.hasTransform)
  52856. }
  52857. }
  52858. };
  52859. function callPendingCbs (c) {
  52860. /* istanbul ignore if */
  52861. if (c.elm._moveCb) {
  52862. c.elm._moveCb();
  52863. }
  52864. /* istanbul ignore if */
  52865. if (c.elm._enterCb) {
  52866. c.elm._enterCb();
  52867. }
  52868. }
  52869. function recordPosition (c) {
  52870. c.data.newPos = c.elm.getBoundingClientRect();
  52871. }
  52872. function applyTranslation (c) {
  52873. var oldPos = c.data.pos;
  52874. var newPos = c.data.newPos;
  52875. var dx = oldPos.left - newPos.left;
  52876. var dy = oldPos.top - newPos.top;
  52877. if (dx || dy) {
  52878. c.data.moved = true;
  52879. var s = c.elm.style;
  52880. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  52881. s.transitionDuration = '0s';
  52882. }
  52883. }
  52884. var platformComponents = {
  52885. Transition: Transition,
  52886. TransitionGroup: TransitionGroup
  52887. };
  52888. /* */
  52889. // install platform specific utils
  52890. Vue.config.mustUseProp = mustUseProp;
  52891. Vue.config.isReservedTag = isReservedTag;
  52892. Vue.config.isReservedAttr = isReservedAttr;
  52893. Vue.config.getTagNamespace = getTagNamespace;
  52894. Vue.config.isUnknownElement = isUnknownElement;
  52895. // install platform runtime directives & components
  52896. extend(Vue.options.directives, platformDirectives);
  52897. extend(Vue.options.components, platformComponents);
  52898. // install platform patch function
  52899. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  52900. // public mount method
  52901. Vue.prototype.$mount = function (
  52902. el,
  52903. hydrating
  52904. ) {
  52905. el = el && inBrowser ? query(el) : undefined;
  52906. return mountComponent(this, el, hydrating)
  52907. };
  52908. // devtools global hook
  52909. /* istanbul ignore next */
  52910. if (inBrowser) {
  52911. setTimeout(function () {
  52912. if (config.devtools) {
  52913. if (devtools) {
  52914. devtools.emit('init', Vue);
  52915. } else {
  52916. console[console.info ? 'info' : 'log'](
  52917. 'Download the Vue Devtools extension for a better development experience:\n' +
  52918. 'https://github.com/vuejs/vue-devtools'
  52919. );
  52920. }
  52921. }
  52922. if (config.productionTip !== false &&
  52923. typeof console !== 'undefined'
  52924. ) {
  52925. console[console.info ? 'info' : 'log'](
  52926. "You are running Vue in development mode.\n" +
  52927. "Make sure to turn on production mode when deploying for production.\n" +
  52928. "See more tips at https://vuejs.org/guide/deployment.html"
  52929. );
  52930. }
  52931. }, 0);
  52932. }
  52933. /* */
  52934. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  52935. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  52936. var buildRegex = cached(function (delimiters) {
  52937. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  52938. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  52939. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  52940. });
  52941. function parseText (
  52942. text,
  52943. delimiters
  52944. ) {
  52945. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  52946. if (!tagRE.test(text)) {
  52947. return
  52948. }
  52949. var tokens = [];
  52950. var rawTokens = [];
  52951. var lastIndex = tagRE.lastIndex = 0;
  52952. var match, index, tokenValue;
  52953. while ((match = tagRE.exec(text))) {
  52954. index = match.index;
  52955. // push text token
  52956. if (index > lastIndex) {
  52957. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  52958. tokens.push(JSON.stringify(tokenValue));
  52959. }
  52960. // tag token
  52961. var exp = parseFilters(match[1].trim());
  52962. tokens.push(("_s(" + exp + ")"));
  52963. rawTokens.push({ '@binding': exp });
  52964. lastIndex = index + match[0].length;
  52965. }
  52966. if (lastIndex < text.length) {
  52967. rawTokens.push(tokenValue = text.slice(lastIndex));
  52968. tokens.push(JSON.stringify(tokenValue));
  52969. }
  52970. return {
  52971. expression: tokens.join('+'),
  52972. tokens: rawTokens
  52973. }
  52974. }
  52975. /* */
  52976. function transformNode (el, options) {
  52977. var warn = options.warn || baseWarn;
  52978. var staticClass = getAndRemoveAttr(el, 'class');
  52979. if (staticClass) {
  52980. var res = parseText(staticClass, options.delimiters);
  52981. if (res) {
  52982. warn(
  52983. "class=\"" + staticClass + "\": " +
  52984. 'Interpolation inside attributes has been removed. ' +
  52985. 'Use v-bind or the colon shorthand instead. For example, ' +
  52986. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  52987. el.rawAttrsMap['class']
  52988. );
  52989. }
  52990. }
  52991. if (staticClass) {
  52992. el.staticClass = JSON.stringify(staticClass);
  52993. }
  52994. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  52995. if (classBinding) {
  52996. el.classBinding = classBinding;
  52997. }
  52998. }
  52999. function genData (el) {
  53000. var data = '';
  53001. if (el.staticClass) {
  53002. data += "staticClass:" + (el.staticClass) + ",";
  53003. }
  53004. if (el.classBinding) {
  53005. data += "class:" + (el.classBinding) + ",";
  53006. }
  53007. return data
  53008. }
  53009. var klass$1 = {
  53010. staticKeys: ['staticClass'],
  53011. transformNode: transformNode,
  53012. genData: genData
  53013. };
  53014. /* */
  53015. function transformNode$1 (el, options) {
  53016. var warn = options.warn || baseWarn;
  53017. var staticStyle = getAndRemoveAttr(el, 'style');
  53018. if (staticStyle) {
  53019. /* istanbul ignore if */
  53020. {
  53021. var res = parseText(staticStyle, options.delimiters);
  53022. if (res) {
  53023. warn(
  53024. "style=\"" + staticStyle + "\": " +
  53025. 'Interpolation inside attributes has been removed. ' +
  53026. 'Use v-bind or the colon shorthand instead. For example, ' +
  53027. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  53028. el.rawAttrsMap['style']
  53029. );
  53030. }
  53031. }
  53032. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  53033. }
  53034. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  53035. if (styleBinding) {
  53036. el.styleBinding = styleBinding;
  53037. }
  53038. }
  53039. function genData$1 (el) {
  53040. var data = '';
  53041. if (el.staticStyle) {
  53042. data += "staticStyle:" + (el.staticStyle) + ",";
  53043. }
  53044. if (el.styleBinding) {
  53045. data += "style:(" + (el.styleBinding) + "),";
  53046. }
  53047. return data
  53048. }
  53049. var style$1 = {
  53050. staticKeys: ['staticStyle'],
  53051. transformNode: transformNode$1,
  53052. genData: genData$1
  53053. };
  53054. /* */
  53055. var decoder;
  53056. var he = {
  53057. decode: function decode (html) {
  53058. decoder = decoder || document.createElement('div');
  53059. decoder.innerHTML = html;
  53060. return decoder.textContent
  53061. }
  53062. };
  53063. /* */
  53064. var isUnaryTag = makeMap(
  53065. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  53066. 'link,meta,param,source,track,wbr'
  53067. );
  53068. // Elements that you can, intentionally, leave open
  53069. // (and which close themselves)
  53070. var canBeLeftOpenTag = makeMap(
  53071. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  53072. );
  53073. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  53074. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  53075. var isNonPhrasingTag = makeMap(
  53076. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  53077. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  53078. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  53079. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  53080. 'title,tr,track'
  53081. );
  53082. /**
  53083. * Not type-checking this file because it's mostly vendor code.
  53084. */
  53085. // Regular Expressions for parsing tags and attributes
  53086. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  53087. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  53088. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  53089. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  53090. var startTagOpen = new RegExp(("^<" + qnameCapture));
  53091. var startTagClose = /^\s*(\/?)>/;
  53092. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  53093. var doctype = /^<!DOCTYPE [^>]+>/i;
  53094. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  53095. var comment = /^<!\--/;
  53096. var conditionalComment = /^<!\[/;
  53097. // Special Elements (can contain anything)
  53098. var isPlainTextElement = makeMap('script,style,textarea', true);
  53099. var reCache = {};
  53100. var decodingMap = {
  53101. '&lt;': '<',
  53102. '&gt;': '>',
  53103. '&quot;': '"',
  53104. '&amp;': '&',
  53105. '&#10;': '\n',
  53106. '&#9;': '\t',
  53107. '&#39;': "'"
  53108. };
  53109. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  53110. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  53111. // #5992
  53112. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  53113. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  53114. function decodeAttr (value, shouldDecodeNewlines) {
  53115. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  53116. return value.replace(re, function (match) { return decodingMap[match]; })
  53117. }
  53118. function parseHTML (html, options) {
  53119. var stack = [];
  53120. var expectHTML = options.expectHTML;
  53121. var isUnaryTag$$1 = options.isUnaryTag || no;
  53122. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  53123. var index = 0;
  53124. var last, lastTag;
  53125. while (html) {
  53126. last = html;
  53127. // Make sure we're not in a plaintext content element like script/style
  53128. if (!lastTag || !isPlainTextElement(lastTag)) {
  53129. var textEnd = html.indexOf('<');
  53130. if (textEnd === 0) {
  53131. // Comment:
  53132. if (comment.test(html)) {
  53133. var commentEnd = html.indexOf('-->');
  53134. if (commentEnd >= 0) {
  53135. if (options.shouldKeepComment) {
  53136. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  53137. }
  53138. advance(commentEnd + 3);
  53139. continue
  53140. }
  53141. }
  53142. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  53143. if (conditionalComment.test(html)) {
  53144. var conditionalEnd = html.indexOf(']>');
  53145. if (conditionalEnd >= 0) {
  53146. advance(conditionalEnd + 2);
  53147. continue
  53148. }
  53149. }
  53150. // Doctype:
  53151. var doctypeMatch = html.match(doctype);
  53152. if (doctypeMatch) {
  53153. advance(doctypeMatch[0].length);
  53154. continue
  53155. }
  53156. // End tag:
  53157. var endTagMatch = html.match(endTag);
  53158. if (endTagMatch) {
  53159. var curIndex = index;
  53160. advance(endTagMatch[0].length);
  53161. parseEndTag(endTagMatch[1], curIndex, index);
  53162. continue
  53163. }
  53164. // Start tag:
  53165. var startTagMatch = parseStartTag();
  53166. if (startTagMatch) {
  53167. handleStartTag(startTagMatch);
  53168. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  53169. advance(1);
  53170. }
  53171. continue
  53172. }
  53173. }
  53174. var text = (void 0), rest = (void 0), next = (void 0);
  53175. if (textEnd >= 0) {
  53176. rest = html.slice(textEnd);
  53177. while (
  53178. !endTag.test(rest) &&
  53179. !startTagOpen.test(rest) &&
  53180. !comment.test(rest) &&
  53181. !conditionalComment.test(rest)
  53182. ) {
  53183. // < in plain text, be forgiving and treat it as text
  53184. next = rest.indexOf('<', 1);
  53185. if (next < 0) { break }
  53186. textEnd += next;
  53187. rest = html.slice(textEnd);
  53188. }
  53189. text = html.substring(0, textEnd);
  53190. }
  53191. if (textEnd < 0) {
  53192. text = html;
  53193. }
  53194. if (text) {
  53195. advance(text.length);
  53196. }
  53197. if (options.chars && text) {
  53198. options.chars(text, index - text.length, index);
  53199. }
  53200. } else {
  53201. var endTagLength = 0;
  53202. var stackedTag = lastTag.toLowerCase();
  53203. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  53204. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  53205. endTagLength = endTag.length;
  53206. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  53207. text = text
  53208. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  53209. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  53210. }
  53211. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  53212. text = text.slice(1);
  53213. }
  53214. if (options.chars) {
  53215. options.chars(text);
  53216. }
  53217. return ''
  53218. });
  53219. index += html.length - rest$1.length;
  53220. html = rest$1;
  53221. parseEndTag(stackedTag, index - endTagLength, index);
  53222. }
  53223. if (html === last) {
  53224. options.chars && options.chars(html);
  53225. if (!stack.length && options.warn) {
  53226. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  53227. }
  53228. break
  53229. }
  53230. }
  53231. // Clean up any remaining tags
  53232. parseEndTag();
  53233. function advance (n) {
  53234. index += n;
  53235. html = html.substring(n);
  53236. }
  53237. function parseStartTag () {
  53238. var start = html.match(startTagOpen);
  53239. if (start) {
  53240. var match = {
  53241. tagName: start[1],
  53242. attrs: [],
  53243. start: index
  53244. };
  53245. advance(start[0].length);
  53246. var end, attr;
  53247. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  53248. attr.start = index;
  53249. advance(attr[0].length);
  53250. attr.end = index;
  53251. match.attrs.push(attr);
  53252. }
  53253. if (end) {
  53254. match.unarySlash = end[1];
  53255. advance(end[0].length);
  53256. match.end = index;
  53257. return match
  53258. }
  53259. }
  53260. }
  53261. function handleStartTag (match) {
  53262. var tagName = match.tagName;
  53263. var unarySlash = match.unarySlash;
  53264. if (expectHTML) {
  53265. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  53266. parseEndTag(lastTag);
  53267. }
  53268. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  53269. parseEndTag(tagName);
  53270. }
  53271. }
  53272. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  53273. var l = match.attrs.length;
  53274. var attrs = new Array(l);
  53275. for (var i = 0; i < l; i++) {
  53276. var args = match.attrs[i];
  53277. var value = args[3] || args[4] || args[5] || '';
  53278. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  53279. ? options.shouldDecodeNewlinesForHref
  53280. : options.shouldDecodeNewlines;
  53281. attrs[i] = {
  53282. name: args[1],
  53283. value: decodeAttr(value, shouldDecodeNewlines)
  53284. };
  53285. if (options.outputSourceRange) {
  53286. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  53287. attrs[i].end = args.end;
  53288. }
  53289. }
  53290. if (!unary) {
  53291. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  53292. lastTag = tagName;
  53293. }
  53294. if (options.start) {
  53295. options.start(tagName, attrs, unary, match.start, match.end);
  53296. }
  53297. }
  53298. function parseEndTag (tagName, start, end) {
  53299. var pos, lowerCasedTagName;
  53300. if (start == null) { start = index; }
  53301. if (end == null) { end = index; }
  53302. // Find the closest opened tag of the same type
  53303. if (tagName) {
  53304. lowerCasedTagName = tagName.toLowerCase();
  53305. for (pos = stack.length - 1; pos >= 0; pos--) {
  53306. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  53307. break
  53308. }
  53309. }
  53310. } else {
  53311. // If no tag name is provided, clean shop
  53312. pos = 0;
  53313. }
  53314. if (pos >= 0) {
  53315. // Close all the open elements, up the stack
  53316. for (var i = stack.length - 1; i >= pos; i--) {
  53317. if (i > pos || !tagName &&
  53318. options.warn
  53319. ) {
  53320. options.warn(
  53321. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  53322. { start: stack[i].start, end: stack[i].end }
  53323. );
  53324. }
  53325. if (options.end) {
  53326. options.end(stack[i].tag, start, end);
  53327. }
  53328. }
  53329. // Remove the open elements from the stack
  53330. stack.length = pos;
  53331. lastTag = pos && stack[pos - 1].tag;
  53332. } else if (lowerCasedTagName === 'br') {
  53333. if (options.start) {
  53334. options.start(tagName, [], true, start, end);
  53335. }
  53336. } else if (lowerCasedTagName === 'p') {
  53337. if (options.start) {
  53338. options.start(tagName, [], false, start, end);
  53339. }
  53340. if (options.end) {
  53341. options.end(tagName, start, end);
  53342. }
  53343. }
  53344. }
  53345. }
  53346. /* */
  53347. var onRE = /^@|^v-on:/;
  53348. var dirRE = /^v-|^@|^:|^#/;
  53349. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  53350. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  53351. var stripParensRE = /^\(|\)$/g;
  53352. var dynamicArgRE = /^\[.*\]$/;
  53353. var argRE = /:(.*)$/;
  53354. var bindRE = /^:|^\.|^v-bind:/;
  53355. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  53356. var slotRE = /^v-slot(:|$)|^#/;
  53357. var lineBreakRE = /[\r\n]/;
  53358. var whitespaceRE$1 = /\s+/g;
  53359. var invalidAttributeRE = /[\s"'<>\/=]/;
  53360. var decodeHTMLCached = cached(he.decode);
  53361. var emptySlotScopeToken = "_empty_";
  53362. // configurable state
  53363. var warn$2;
  53364. var delimiters;
  53365. var transforms;
  53366. var preTransforms;
  53367. var postTransforms;
  53368. var platformIsPreTag;
  53369. var platformMustUseProp;
  53370. var platformGetTagNamespace;
  53371. var maybeComponent;
  53372. function createASTElement (
  53373. tag,
  53374. attrs,
  53375. parent
  53376. ) {
  53377. return {
  53378. type: 1,
  53379. tag: tag,
  53380. attrsList: attrs,
  53381. attrsMap: makeAttrsMap(attrs),
  53382. rawAttrsMap: {},
  53383. parent: parent,
  53384. children: []
  53385. }
  53386. }
  53387. /**
  53388. * Convert HTML string to AST.
  53389. */
  53390. function parse (
  53391. template,
  53392. options
  53393. ) {
  53394. warn$2 = options.warn || baseWarn;
  53395. platformIsPreTag = options.isPreTag || no;
  53396. platformMustUseProp = options.mustUseProp || no;
  53397. platformGetTagNamespace = options.getTagNamespace || no;
  53398. var isReservedTag = options.isReservedTag || no;
  53399. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  53400. transforms = pluckModuleFunction(options.modules, 'transformNode');
  53401. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  53402. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  53403. delimiters = options.delimiters;
  53404. var stack = [];
  53405. var preserveWhitespace = options.preserveWhitespace !== false;
  53406. var whitespaceOption = options.whitespace;
  53407. var root;
  53408. var currentParent;
  53409. var inVPre = false;
  53410. var inPre = false;
  53411. var warned = false;
  53412. function warnOnce (msg, range) {
  53413. if (!warned) {
  53414. warned = true;
  53415. warn$2(msg, range);
  53416. }
  53417. }
  53418. function closeElement (element) {
  53419. trimEndingWhitespace(element);
  53420. if (!inVPre && !element.processed) {
  53421. element = processElement(element, options);
  53422. }
  53423. // tree management
  53424. if (!stack.length && element !== root) {
  53425. // allow root elements with v-if, v-else-if and v-else
  53426. if (root.if && (element.elseif || element.else)) {
  53427. {
  53428. checkRootConstraints(element);
  53429. }
  53430. addIfCondition(root, {
  53431. exp: element.elseif,
  53432. block: element
  53433. });
  53434. } else {
  53435. warnOnce(
  53436. "Component template should contain exactly one root element. " +
  53437. "If you are using v-if on multiple elements, " +
  53438. "use v-else-if to chain them instead.",
  53439. { start: element.start }
  53440. );
  53441. }
  53442. }
  53443. if (currentParent && !element.forbidden) {
  53444. if (element.elseif || element.else) {
  53445. processIfConditions(element, currentParent);
  53446. } else {
  53447. if (element.slotScope) {
  53448. // scoped slot
  53449. // keep it in the children list so that v-else(-if) conditions can
  53450. // find it as the prev node.
  53451. var name = element.slotTarget || '"default"'
  53452. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  53453. }
  53454. currentParent.children.push(element);
  53455. element.parent = currentParent;
  53456. }
  53457. }
  53458. // final children cleanup
  53459. // filter out scoped slots
  53460. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  53461. // remove trailing whitespace node again
  53462. trimEndingWhitespace(element);
  53463. // check pre state
  53464. if (element.pre) {
  53465. inVPre = false;
  53466. }
  53467. if (platformIsPreTag(element.tag)) {
  53468. inPre = false;
  53469. }
  53470. // apply post-transforms
  53471. for (var i = 0; i < postTransforms.length; i++) {
  53472. postTransforms[i](element, options);
  53473. }
  53474. }
  53475. function trimEndingWhitespace (el) {
  53476. // remove trailing whitespace node
  53477. if (!inPre) {
  53478. var lastNode;
  53479. while (
  53480. (lastNode = el.children[el.children.length - 1]) &&
  53481. lastNode.type === 3 &&
  53482. lastNode.text === ' '
  53483. ) {
  53484. el.children.pop();
  53485. }
  53486. }
  53487. }
  53488. function checkRootConstraints (el) {
  53489. if (el.tag === 'slot' || el.tag === 'template') {
  53490. warnOnce(
  53491. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  53492. 'contain multiple nodes.',
  53493. { start: el.start }
  53494. );
  53495. }
  53496. if (el.attrsMap.hasOwnProperty('v-for')) {
  53497. warnOnce(
  53498. 'Cannot use v-for on stateful component root element because ' +
  53499. 'it renders multiple elements.',
  53500. el.rawAttrsMap['v-for']
  53501. );
  53502. }
  53503. }
  53504. parseHTML(template, {
  53505. warn: warn$2,
  53506. expectHTML: options.expectHTML,
  53507. isUnaryTag: options.isUnaryTag,
  53508. canBeLeftOpenTag: options.canBeLeftOpenTag,
  53509. shouldDecodeNewlines: options.shouldDecodeNewlines,
  53510. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  53511. shouldKeepComment: options.comments,
  53512. outputSourceRange: options.outputSourceRange,
  53513. start: function start (tag, attrs, unary, start$1, end) {
  53514. // check namespace.
  53515. // inherit parent ns if there is one
  53516. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  53517. // handle IE svg bug
  53518. /* istanbul ignore if */
  53519. if (isIE && ns === 'svg') {
  53520. attrs = guardIESVGBug(attrs);
  53521. }
  53522. var element = createASTElement(tag, attrs, currentParent);
  53523. if (ns) {
  53524. element.ns = ns;
  53525. }
  53526. {
  53527. if (options.outputSourceRange) {
  53528. element.start = start$1;
  53529. element.end = end;
  53530. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  53531. cumulated[attr.name] = attr;
  53532. return cumulated
  53533. }, {});
  53534. }
  53535. attrs.forEach(function (attr) {
  53536. if (invalidAttributeRE.test(attr.name)) {
  53537. warn$2(
  53538. "Invalid dynamic argument expression: attribute names cannot contain " +
  53539. "spaces, quotes, <, >, / or =.",
  53540. {
  53541. start: attr.start + attr.name.indexOf("["),
  53542. end: attr.start + attr.name.length
  53543. }
  53544. );
  53545. }
  53546. });
  53547. }
  53548. if (isForbiddenTag(element) && !isServerRendering()) {
  53549. element.forbidden = true;
  53550. warn$2(
  53551. 'Templates should only be responsible for mapping the state to the ' +
  53552. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  53553. "<" + tag + ">" + ', as they will not be parsed.',
  53554. { start: element.start }
  53555. );
  53556. }
  53557. // apply pre-transforms
  53558. for (var i = 0; i < preTransforms.length; i++) {
  53559. element = preTransforms[i](element, options) || element;
  53560. }
  53561. if (!inVPre) {
  53562. processPre(element);
  53563. if (element.pre) {
  53564. inVPre = true;
  53565. }
  53566. }
  53567. if (platformIsPreTag(element.tag)) {
  53568. inPre = true;
  53569. }
  53570. if (inVPre) {
  53571. processRawAttrs(element);
  53572. } else if (!element.processed) {
  53573. // structural directives
  53574. processFor(element);
  53575. processIf(element);
  53576. processOnce(element);
  53577. }
  53578. if (!root) {
  53579. root = element;
  53580. {
  53581. checkRootConstraints(root);
  53582. }
  53583. }
  53584. if (!unary) {
  53585. currentParent = element;
  53586. stack.push(element);
  53587. } else {
  53588. closeElement(element);
  53589. }
  53590. },
  53591. end: function end (tag, start, end$1) {
  53592. var element = stack[stack.length - 1];
  53593. // pop stack
  53594. stack.length -= 1;
  53595. currentParent = stack[stack.length - 1];
  53596. if (options.outputSourceRange) {
  53597. element.end = end$1;
  53598. }
  53599. closeElement(element);
  53600. },
  53601. chars: function chars (text, start, end) {
  53602. if (!currentParent) {
  53603. {
  53604. if (text === template) {
  53605. warnOnce(
  53606. 'Component template requires a root element, rather than just text.',
  53607. { start: start }
  53608. );
  53609. } else if ((text = text.trim())) {
  53610. warnOnce(
  53611. ("text \"" + text + "\" outside root element will be ignored."),
  53612. { start: start }
  53613. );
  53614. }
  53615. }
  53616. return
  53617. }
  53618. // IE textarea placeholder bug
  53619. /* istanbul ignore if */
  53620. if (isIE &&
  53621. currentParent.tag === 'textarea' &&
  53622. currentParent.attrsMap.placeholder === text
  53623. ) {
  53624. return
  53625. }
  53626. var children = currentParent.children;
  53627. if (inPre || text.trim()) {
  53628. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  53629. } else if (!children.length) {
  53630. // remove the whitespace-only node right after an opening tag
  53631. text = '';
  53632. } else if (whitespaceOption) {
  53633. if (whitespaceOption === 'condense') {
  53634. // in condense mode, remove the whitespace node if it contains
  53635. // line break, otherwise condense to a single space
  53636. text = lineBreakRE.test(text) ? '' : ' ';
  53637. } else {
  53638. text = ' ';
  53639. }
  53640. } else {
  53641. text = preserveWhitespace ? ' ' : '';
  53642. }
  53643. if (text) {
  53644. if (!inPre && whitespaceOption === 'condense') {
  53645. // condense consecutive whitespaces into single space
  53646. text = text.replace(whitespaceRE$1, ' ');
  53647. }
  53648. var res;
  53649. var child;
  53650. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  53651. child = {
  53652. type: 2,
  53653. expression: res.expression,
  53654. tokens: res.tokens,
  53655. text: text
  53656. };
  53657. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  53658. child = {
  53659. type: 3,
  53660. text: text
  53661. };
  53662. }
  53663. if (child) {
  53664. if (options.outputSourceRange) {
  53665. child.start = start;
  53666. child.end = end;
  53667. }
  53668. children.push(child);
  53669. }
  53670. }
  53671. },
  53672. comment: function comment (text, start, end) {
  53673. // adding anyting as a sibling to the root node is forbidden
  53674. // comments should still be allowed, but ignored
  53675. if (currentParent) {
  53676. var child = {
  53677. type: 3,
  53678. text: text,
  53679. isComment: true
  53680. };
  53681. if (options.outputSourceRange) {
  53682. child.start = start;
  53683. child.end = end;
  53684. }
  53685. currentParent.children.push(child);
  53686. }
  53687. }
  53688. });
  53689. return root
  53690. }
  53691. function processPre (el) {
  53692. if (getAndRemoveAttr(el, 'v-pre') != null) {
  53693. el.pre = true;
  53694. }
  53695. }
  53696. function processRawAttrs (el) {
  53697. var list = el.attrsList;
  53698. var len = list.length;
  53699. if (len) {
  53700. var attrs = el.attrs = new Array(len);
  53701. for (var i = 0; i < len; i++) {
  53702. attrs[i] = {
  53703. name: list[i].name,
  53704. value: JSON.stringify(list[i].value)
  53705. };
  53706. if (list[i].start != null) {
  53707. attrs[i].start = list[i].start;
  53708. attrs[i].end = list[i].end;
  53709. }
  53710. }
  53711. } else if (!el.pre) {
  53712. // non root node in pre blocks with no attributes
  53713. el.plain = true;
  53714. }
  53715. }
  53716. function processElement (
  53717. element,
  53718. options
  53719. ) {
  53720. processKey(element);
  53721. // determine whether this is a plain element after
  53722. // removing structural attributes
  53723. element.plain = (
  53724. !element.key &&
  53725. !element.scopedSlots &&
  53726. !element.attrsList.length
  53727. );
  53728. processRef(element);
  53729. processSlotContent(element);
  53730. processSlotOutlet(element);
  53731. processComponent(element);
  53732. for (var i = 0; i < transforms.length; i++) {
  53733. element = transforms[i](element, options) || element;
  53734. }
  53735. processAttrs(element);
  53736. return element
  53737. }
  53738. function processKey (el) {
  53739. var exp = getBindingAttr(el, 'key');
  53740. if (exp) {
  53741. {
  53742. if (el.tag === 'template') {
  53743. warn$2(
  53744. "<template> cannot be keyed. Place the key on real elements instead.",
  53745. getRawBindingAttr(el, 'key')
  53746. );
  53747. }
  53748. if (el.for) {
  53749. var iterator = el.iterator2 || el.iterator1;
  53750. var parent = el.parent;
  53751. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  53752. warn$2(
  53753. "Do not use v-for index as key on <transition-group> children, " +
  53754. "this is the same as not using keys.",
  53755. getRawBindingAttr(el, 'key'),
  53756. true /* tip */
  53757. );
  53758. }
  53759. }
  53760. }
  53761. el.key = exp;
  53762. }
  53763. }
  53764. function processRef (el) {
  53765. var ref = getBindingAttr(el, 'ref');
  53766. if (ref) {
  53767. el.ref = ref;
  53768. el.refInFor = checkInFor(el);
  53769. }
  53770. }
  53771. function processFor (el) {
  53772. var exp;
  53773. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  53774. var res = parseFor(exp);
  53775. if (res) {
  53776. extend(el, res);
  53777. } else {
  53778. warn$2(
  53779. ("Invalid v-for expression: " + exp),
  53780. el.rawAttrsMap['v-for']
  53781. );
  53782. }
  53783. }
  53784. }
  53785. function parseFor (exp) {
  53786. var inMatch = exp.match(forAliasRE);
  53787. if (!inMatch) { return }
  53788. var res = {};
  53789. res.for = inMatch[2].trim();
  53790. var alias = inMatch[1].trim().replace(stripParensRE, '');
  53791. var iteratorMatch = alias.match(forIteratorRE);
  53792. if (iteratorMatch) {
  53793. res.alias = alias.replace(forIteratorRE, '').trim();
  53794. res.iterator1 = iteratorMatch[1].trim();
  53795. if (iteratorMatch[2]) {
  53796. res.iterator2 = iteratorMatch[2].trim();
  53797. }
  53798. } else {
  53799. res.alias = alias;
  53800. }
  53801. return res
  53802. }
  53803. function processIf (el) {
  53804. var exp = getAndRemoveAttr(el, 'v-if');
  53805. if (exp) {
  53806. el.if = exp;
  53807. addIfCondition(el, {
  53808. exp: exp,
  53809. block: el
  53810. });
  53811. } else {
  53812. if (getAndRemoveAttr(el, 'v-else') != null) {
  53813. el.else = true;
  53814. }
  53815. var elseif = getAndRemoveAttr(el, 'v-else-if');
  53816. if (elseif) {
  53817. el.elseif = elseif;
  53818. }
  53819. }
  53820. }
  53821. function processIfConditions (el, parent) {
  53822. var prev = findPrevElement(parent.children);
  53823. if (prev && prev.if) {
  53824. addIfCondition(prev, {
  53825. exp: el.elseif,
  53826. block: el
  53827. });
  53828. } else {
  53829. warn$2(
  53830. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  53831. "used on element <" + (el.tag) + "> without corresponding v-if.",
  53832. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  53833. );
  53834. }
  53835. }
  53836. function findPrevElement (children) {
  53837. var i = children.length;
  53838. while (i--) {
  53839. if (children[i].type === 1) {
  53840. return children[i]
  53841. } else {
  53842. if (children[i].text !== ' ') {
  53843. warn$2(
  53844. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  53845. "will be ignored.",
  53846. children[i]
  53847. );
  53848. }
  53849. children.pop();
  53850. }
  53851. }
  53852. }
  53853. function addIfCondition (el, condition) {
  53854. if (!el.ifConditions) {
  53855. el.ifConditions = [];
  53856. }
  53857. el.ifConditions.push(condition);
  53858. }
  53859. function processOnce (el) {
  53860. var once$$1 = getAndRemoveAttr(el, 'v-once');
  53861. if (once$$1 != null) {
  53862. el.once = true;
  53863. }
  53864. }
  53865. // handle content being passed to a component as slot,
  53866. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  53867. function processSlotContent (el) {
  53868. var slotScope;
  53869. if (el.tag === 'template') {
  53870. slotScope = getAndRemoveAttr(el, 'scope');
  53871. /* istanbul ignore if */
  53872. if (slotScope) {
  53873. warn$2(
  53874. "the \"scope\" attribute for scoped slots have been deprecated and " +
  53875. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  53876. "can also be used on plain elements in addition to <template> to " +
  53877. "denote scoped slots.",
  53878. el.rawAttrsMap['scope'],
  53879. true
  53880. );
  53881. }
  53882. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  53883. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  53884. /* istanbul ignore if */
  53885. if (el.attrsMap['v-for']) {
  53886. warn$2(
  53887. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  53888. "(v-for takes higher priority). Use a wrapper <template> for the " +
  53889. "scoped slot to make it clearer.",
  53890. el.rawAttrsMap['slot-scope'],
  53891. true
  53892. );
  53893. }
  53894. el.slotScope = slotScope;
  53895. }
  53896. // slot="xxx"
  53897. var slotTarget = getBindingAttr(el, 'slot');
  53898. if (slotTarget) {
  53899. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  53900. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  53901. // preserve slot as an attribute for native shadow DOM compat
  53902. // only for non-scoped slots.
  53903. if (el.tag !== 'template' && !el.slotScope) {
  53904. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  53905. }
  53906. }
  53907. // 2.6 v-slot syntax
  53908. {
  53909. if (el.tag === 'template') {
  53910. // v-slot on <template>
  53911. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  53912. if (slotBinding) {
  53913. {
  53914. if (el.slotTarget || el.slotScope) {
  53915. warn$2(
  53916. "Unexpected mixed usage of different slot syntaxes.",
  53917. el
  53918. );
  53919. }
  53920. if (el.parent && !maybeComponent(el.parent)) {
  53921. warn$2(
  53922. "<template v-slot> can only appear at the root level inside " +
  53923. "the receiving component",
  53924. el
  53925. );
  53926. }
  53927. }
  53928. var ref = getSlotName(slotBinding);
  53929. var name = ref.name;
  53930. var dynamic = ref.dynamic;
  53931. el.slotTarget = name;
  53932. el.slotTargetDynamic = dynamic;
  53933. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  53934. }
  53935. } else {
  53936. // v-slot on component, denotes default slot
  53937. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  53938. if (slotBinding$1) {
  53939. {
  53940. if (!maybeComponent(el)) {
  53941. warn$2(
  53942. "v-slot can only be used on components or <template>.",
  53943. slotBinding$1
  53944. );
  53945. }
  53946. if (el.slotScope || el.slotTarget) {
  53947. warn$2(
  53948. "Unexpected mixed usage of different slot syntaxes.",
  53949. el
  53950. );
  53951. }
  53952. if (el.scopedSlots) {
  53953. warn$2(
  53954. "To avoid scope ambiguity, the default slot should also use " +
  53955. "<template> syntax when there are other named slots.",
  53956. slotBinding$1
  53957. );
  53958. }
  53959. }
  53960. // add the component's children to its default slot
  53961. var slots = el.scopedSlots || (el.scopedSlots = {});
  53962. var ref$1 = getSlotName(slotBinding$1);
  53963. var name$1 = ref$1.name;
  53964. var dynamic$1 = ref$1.dynamic;
  53965. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  53966. slotContainer.slotTarget = name$1;
  53967. slotContainer.slotTargetDynamic = dynamic$1;
  53968. slotContainer.children = el.children.filter(function (c) {
  53969. if (!c.slotScope) {
  53970. c.parent = slotContainer;
  53971. return true
  53972. }
  53973. });
  53974. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  53975. // remove children as they are returned from scopedSlots now
  53976. el.children = [];
  53977. // mark el non-plain so data gets generated
  53978. el.plain = false;
  53979. }
  53980. }
  53981. }
  53982. }
  53983. function getSlotName (binding) {
  53984. var name = binding.name.replace(slotRE, '');
  53985. if (!name) {
  53986. if (binding.name[0] !== '#') {
  53987. name = 'default';
  53988. } else {
  53989. warn$2(
  53990. "v-slot shorthand syntax requires a slot name.",
  53991. binding
  53992. );
  53993. }
  53994. }
  53995. return dynamicArgRE.test(name)
  53996. // dynamic [name]
  53997. ? { name: name.slice(1, -1), dynamic: true }
  53998. // static name
  53999. : { name: ("\"" + name + "\""), dynamic: false }
  54000. }
  54001. // handle <slot/> outlets
  54002. function processSlotOutlet (el) {
  54003. if (el.tag === 'slot') {
  54004. el.slotName = getBindingAttr(el, 'name');
  54005. if (el.key) {
  54006. warn$2(
  54007. "`key` does not work on <slot> because slots are abstract outlets " +
  54008. "and can possibly expand into multiple elements. " +
  54009. "Use the key on a wrapping element instead.",
  54010. getRawBindingAttr(el, 'key')
  54011. );
  54012. }
  54013. }
  54014. }
  54015. function processComponent (el) {
  54016. var binding;
  54017. if ((binding = getBindingAttr(el, 'is'))) {
  54018. el.component = binding;
  54019. }
  54020. if (getAndRemoveAttr(el, 'inline-template') != null) {
  54021. el.inlineTemplate = true;
  54022. }
  54023. }
  54024. function processAttrs (el) {
  54025. var list = el.attrsList;
  54026. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  54027. for (i = 0, l = list.length; i < l; i++) {
  54028. name = rawName = list[i].name;
  54029. value = list[i].value;
  54030. if (dirRE.test(name)) {
  54031. // mark element as dynamic
  54032. el.hasBindings = true;
  54033. // modifiers
  54034. modifiers = parseModifiers(name.replace(dirRE, ''));
  54035. // support .foo shorthand syntax for the .prop modifier
  54036. if (modifiers) {
  54037. name = name.replace(modifierRE, '');
  54038. }
  54039. if (bindRE.test(name)) { // v-bind
  54040. name = name.replace(bindRE, '');
  54041. value = parseFilters(value);
  54042. isDynamic = dynamicArgRE.test(name);
  54043. if (isDynamic) {
  54044. name = name.slice(1, -1);
  54045. }
  54046. if (
  54047. value.trim().length === 0
  54048. ) {
  54049. warn$2(
  54050. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  54051. );
  54052. }
  54053. if (modifiers) {
  54054. if (modifiers.prop && !isDynamic) {
  54055. name = camelize(name);
  54056. if (name === 'innerHtml') { name = 'innerHTML'; }
  54057. }
  54058. if (modifiers.camel && !isDynamic) {
  54059. name = camelize(name);
  54060. }
  54061. if (modifiers.sync) {
  54062. syncGen = genAssignmentCode(value, "$event");
  54063. if (!isDynamic) {
  54064. addHandler(
  54065. el,
  54066. ("update:" + (camelize(name))),
  54067. syncGen,
  54068. null,
  54069. false,
  54070. warn$2,
  54071. list[i]
  54072. );
  54073. if (hyphenate(name) !== camelize(name)) {
  54074. addHandler(
  54075. el,
  54076. ("update:" + (hyphenate(name))),
  54077. syncGen,
  54078. null,
  54079. false,
  54080. warn$2,
  54081. list[i]
  54082. );
  54083. }
  54084. } else {
  54085. // handler w/ dynamic event name
  54086. addHandler(
  54087. el,
  54088. ("\"update:\"+(" + name + ")"),
  54089. syncGen,
  54090. null,
  54091. false,
  54092. warn$2,
  54093. list[i],
  54094. true // dynamic
  54095. );
  54096. }
  54097. }
  54098. }
  54099. if ((modifiers && modifiers.prop) || (
  54100. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  54101. )) {
  54102. addProp(el, name, value, list[i], isDynamic);
  54103. } else {
  54104. addAttr(el, name, value, list[i], isDynamic);
  54105. }
  54106. } else if (onRE.test(name)) { // v-on
  54107. name = name.replace(onRE, '');
  54108. isDynamic = dynamicArgRE.test(name);
  54109. if (isDynamic) {
  54110. name = name.slice(1, -1);
  54111. }
  54112. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  54113. } else { // normal directives
  54114. name = name.replace(dirRE, '');
  54115. // parse arg
  54116. var argMatch = name.match(argRE);
  54117. var arg = argMatch && argMatch[1];
  54118. isDynamic = false;
  54119. if (arg) {
  54120. name = name.slice(0, -(arg.length + 1));
  54121. if (dynamicArgRE.test(arg)) {
  54122. arg = arg.slice(1, -1);
  54123. isDynamic = true;
  54124. }
  54125. }
  54126. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  54127. if (name === 'model') {
  54128. checkForAliasModel(el, value);
  54129. }
  54130. }
  54131. } else {
  54132. // literal attribute
  54133. {
  54134. var res = parseText(value, delimiters);
  54135. if (res) {
  54136. warn$2(
  54137. name + "=\"" + value + "\": " +
  54138. 'Interpolation inside attributes has been removed. ' +
  54139. 'Use v-bind or the colon shorthand instead. For example, ' +
  54140. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  54141. list[i]
  54142. );
  54143. }
  54144. }
  54145. addAttr(el, name, JSON.stringify(value), list[i]);
  54146. // #6887 firefox doesn't update muted state if set via attribute
  54147. // even immediately after element creation
  54148. if (!el.component &&
  54149. name === 'muted' &&
  54150. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  54151. addProp(el, name, 'true', list[i]);
  54152. }
  54153. }
  54154. }
  54155. }
  54156. function checkInFor (el) {
  54157. var parent = el;
  54158. while (parent) {
  54159. if (parent.for !== undefined) {
  54160. return true
  54161. }
  54162. parent = parent.parent;
  54163. }
  54164. return false
  54165. }
  54166. function parseModifiers (name) {
  54167. var match = name.match(modifierRE);
  54168. if (match) {
  54169. var ret = {};
  54170. match.forEach(function (m) { ret[m.slice(1)] = true; });
  54171. return ret
  54172. }
  54173. }
  54174. function makeAttrsMap (attrs) {
  54175. var map = {};
  54176. for (var i = 0, l = attrs.length; i < l; i++) {
  54177. if (
  54178. map[attrs[i].name] && !isIE && !isEdge
  54179. ) {
  54180. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  54181. }
  54182. map[attrs[i].name] = attrs[i].value;
  54183. }
  54184. return map
  54185. }
  54186. // for script (e.g. type="x/template") or style, do not decode content
  54187. function isTextTag (el) {
  54188. return el.tag === 'script' || el.tag === 'style'
  54189. }
  54190. function isForbiddenTag (el) {
  54191. return (
  54192. el.tag === 'style' ||
  54193. (el.tag === 'script' && (
  54194. !el.attrsMap.type ||
  54195. el.attrsMap.type === 'text/javascript'
  54196. ))
  54197. )
  54198. }
  54199. var ieNSBug = /^xmlns:NS\d+/;
  54200. var ieNSPrefix = /^NS\d+:/;
  54201. /* istanbul ignore next */
  54202. function guardIESVGBug (attrs) {
  54203. var res = [];
  54204. for (var i = 0; i < attrs.length; i++) {
  54205. var attr = attrs[i];
  54206. if (!ieNSBug.test(attr.name)) {
  54207. attr.name = attr.name.replace(ieNSPrefix, '');
  54208. res.push(attr);
  54209. }
  54210. }
  54211. return res
  54212. }
  54213. function checkForAliasModel (el, value) {
  54214. var _el = el;
  54215. while (_el) {
  54216. if (_el.for && _el.alias === value) {
  54217. warn$2(
  54218. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  54219. "You are binding v-model directly to a v-for iteration alias. " +
  54220. "This will not be able to modify the v-for source array because " +
  54221. "writing to the alias is like modifying a function local variable. " +
  54222. "Consider using an array of objects and use v-model on an object property instead.",
  54223. el.rawAttrsMap['v-model']
  54224. );
  54225. }
  54226. _el = _el.parent;
  54227. }
  54228. }
  54229. /* */
  54230. function preTransformNode (el, options) {
  54231. if (el.tag === 'input') {
  54232. var map = el.attrsMap;
  54233. if (!map['v-model']) {
  54234. return
  54235. }
  54236. var typeBinding;
  54237. if (map[':type'] || map['v-bind:type']) {
  54238. typeBinding = getBindingAttr(el, 'type');
  54239. }
  54240. if (!map.type && !typeBinding && map['v-bind']) {
  54241. typeBinding = "(" + (map['v-bind']) + ").type";
  54242. }
  54243. if (typeBinding) {
  54244. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  54245. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  54246. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  54247. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  54248. // 1. checkbox
  54249. var branch0 = cloneASTElement(el);
  54250. // process for on the main node
  54251. processFor(branch0);
  54252. addRawAttr(branch0, 'type', 'checkbox');
  54253. processElement(branch0, options);
  54254. branch0.processed = true; // prevent it from double-processed
  54255. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  54256. addIfCondition(branch0, {
  54257. exp: branch0.if,
  54258. block: branch0
  54259. });
  54260. // 2. add radio else-if condition
  54261. var branch1 = cloneASTElement(el);
  54262. getAndRemoveAttr(branch1, 'v-for', true);
  54263. addRawAttr(branch1, 'type', 'radio');
  54264. processElement(branch1, options);
  54265. addIfCondition(branch0, {
  54266. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  54267. block: branch1
  54268. });
  54269. // 3. other
  54270. var branch2 = cloneASTElement(el);
  54271. getAndRemoveAttr(branch2, 'v-for', true);
  54272. addRawAttr(branch2, ':type', typeBinding);
  54273. processElement(branch2, options);
  54274. addIfCondition(branch0, {
  54275. exp: ifCondition,
  54276. block: branch2
  54277. });
  54278. if (hasElse) {
  54279. branch0.else = true;
  54280. } else if (elseIfCondition) {
  54281. branch0.elseif = elseIfCondition;
  54282. }
  54283. return branch0
  54284. }
  54285. }
  54286. }
  54287. function cloneASTElement (el) {
  54288. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  54289. }
  54290. var model$1 = {
  54291. preTransformNode: preTransformNode
  54292. };
  54293. var modules$1 = [
  54294. klass$1,
  54295. style$1,
  54296. model$1
  54297. ];
  54298. /* */
  54299. function text (el, dir) {
  54300. if (dir.value) {
  54301. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  54302. }
  54303. }
  54304. /* */
  54305. function html (el, dir) {
  54306. if (dir.value) {
  54307. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  54308. }
  54309. }
  54310. var directives$1 = {
  54311. model: model,
  54312. text: text,
  54313. html: html
  54314. };
  54315. /* */
  54316. var baseOptions = {
  54317. expectHTML: true,
  54318. modules: modules$1,
  54319. directives: directives$1,
  54320. isPreTag: isPreTag,
  54321. isUnaryTag: isUnaryTag,
  54322. mustUseProp: mustUseProp,
  54323. canBeLeftOpenTag: canBeLeftOpenTag,
  54324. isReservedTag: isReservedTag,
  54325. getTagNamespace: getTagNamespace,
  54326. staticKeys: genStaticKeys(modules$1)
  54327. };
  54328. /* */
  54329. var isStaticKey;
  54330. var isPlatformReservedTag;
  54331. var genStaticKeysCached = cached(genStaticKeys$1);
  54332. /**
  54333. * Goal of the optimizer: walk the generated template AST tree
  54334. * and detect sub-trees that are purely static, i.e. parts of
  54335. * the DOM that never needs to change.
  54336. *
  54337. * Once we detect these sub-trees, we can:
  54338. *
  54339. * 1. Hoist them into constants, so that we no longer need to
  54340. * create fresh nodes for them on each re-render;
  54341. * 2. Completely skip them in the patching process.
  54342. */
  54343. function optimize (root, options) {
  54344. if (!root) { return }
  54345. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  54346. isPlatformReservedTag = options.isReservedTag || no;
  54347. // first pass: mark all non-static nodes.
  54348. markStatic$1(root);
  54349. // second pass: mark static roots.
  54350. markStaticRoots(root, false);
  54351. }
  54352. function genStaticKeys$1 (keys) {
  54353. return makeMap(
  54354. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  54355. (keys ? ',' + keys : '')
  54356. )
  54357. }
  54358. function markStatic$1 (node) {
  54359. node.static = isStatic(node);
  54360. if (node.type === 1) {
  54361. // do not make component slot content static. this avoids
  54362. // 1. components not able to mutate slot nodes
  54363. // 2. static slot content fails for hot-reloading
  54364. if (
  54365. !isPlatformReservedTag(node.tag) &&
  54366. node.tag !== 'slot' &&
  54367. node.attrsMap['inline-template'] == null
  54368. ) {
  54369. return
  54370. }
  54371. for (var i = 0, l = node.children.length; i < l; i++) {
  54372. var child = node.children[i];
  54373. markStatic$1(child);
  54374. if (!child.static) {
  54375. node.static = false;
  54376. }
  54377. }
  54378. if (node.ifConditions) {
  54379. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  54380. var block = node.ifConditions[i$1].block;
  54381. markStatic$1(block);
  54382. if (!block.static) {
  54383. node.static = false;
  54384. }
  54385. }
  54386. }
  54387. }
  54388. }
  54389. function markStaticRoots (node, isInFor) {
  54390. if (node.type === 1) {
  54391. if (node.static || node.once) {
  54392. node.staticInFor = isInFor;
  54393. }
  54394. // For a node to qualify as a static root, it should have children that
  54395. // are not just static text. Otherwise the cost of hoisting out will
  54396. // outweigh the benefits and it's better off to just always render it fresh.
  54397. if (node.static && node.children.length && !(
  54398. node.children.length === 1 &&
  54399. node.children[0].type === 3
  54400. )) {
  54401. node.staticRoot = true;
  54402. return
  54403. } else {
  54404. node.staticRoot = false;
  54405. }
  54406. if (node.children) {
  54407. for (var i = 0, l = node.children.length; i < l; i++) {
  54408. markStaticRoots(node.children[i], isInFor || !!node.for);
  54409. }
  54410. }
  54411. if (node.ifConditions) {
  54412. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  54413. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  54414. }
  54415. }
  54416. }
  54417. }
  54418. function isStatic (node) {
  54419. if (node.type === 2) { // expression
  54420. return false
  54421. }
  54422. if (node.type === 3) { // text
  54423. return true
  54424. }
  54425. return !!(node.pre || (
  54426. !node.hasBindings && // no dynamic bindings
  54427. !node.if && !node.for && // not v-if or v-for or v-else
  54428. !isBuiltInTag(node.tag) && // not a built-in
  54429. isPlatformReservedTag(node.tag) && // not a component
  54430. !isDirectChildOfTemplateFor(node) &&
  54431. Object.keys(node).every(isStaticKey)
  54432. ))
  54433. }
  54434. function isDirectChildOfTemplateFor (node) {
  54435. while (node.parent) {
  54436. node = node.parent;
  54437. if (node.tag !== 'template') {
  54438. return false
  54439. }
  54440. if (node.for) {
  54441. return true
  54442. }
  54443. }
  54444. return false
  54445. }
  54446. /* */
  54447. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  54448. var fnInvokeRE = /\([^)]*?\);*$/;
  54449. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  54450. // KeyboardEvent.keyCode aliases
  54451. var keyCodes = {
  54452. esc: 27,
  54453. tab: 9,
  54454. enter: 13,
  54455. space: 32,
  54456. up: 38,
  54457. left: 37,
  54458. right: 39,
  54459. down: 40,
  54460. 'delete': [8, 46]
  54461. };
  54462. // KeyboardEvent.key aliases
  54463. var keyNames = {
  54464. // #7880: IE11 and Edge use `Esc` for Escape key name.
  54465. esc: ['Esc', 'Escape'],
  54466. tab: 'Tab',
  54467. enter: 'Enter',
  54468. // #9112: IE11 uses `Spacebar` for Space key name.
  54469. space: [' ', 'Spacebar'],
  54470. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  54471. up: ['Up', 'ArrowUp'],
  54472. left: ['Left', 'ArrowLeft'],
  54473. right: ['Right', 'ArrowRight'],
  54474. down: ['Down', 'ArrowDown'],
  54475. // #9112: IE11 uses `Del` for Delete key name.
  54476. 'delete': ['Backspace', 'Delete', 'Del']
  54477. };
  54478. // #4868: modifiers that prevent the execution of the listener
  54479. // need to explicitly return null so that we can determine whether to remove
  54480. // the listener for .once
  54481. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  54482. var modifierCode = {
  54483. stop: '$event.stopPropagation();',
  54484. prevent: '$event.preventDefault();',
  54485. self: genGuard("$event.target !== $event.currentTarget"),
  54486. ctrl: genGuard("!$event.ctrlKey"),
  54487. shift: genGuard("!$event.shiftKey"),
  54488. alt: genGuard("!$event.altKey"),
  54489. meta: genGuard("!$event.metaKey"),
  54490. left: genGuard("'button' in $event && $event.button !== 0"),
  54491. middle: genGuard("'button' in $event && $event.button !== 1"),
  54492. right: genGuard("'button' in $event && $event.button !== 2")
  54493. };
  54494. function genHandlers (
  54495. events,
  54496. isNative
  54497. ) {
  54498. var prefix = isNative ? 'nativeOn:' : 'on:';
  54499. var staticHandlers = "";
  54500. var dynamicHandlers = "";
  54501. for (var name in events) {
  54502. var handlerCode = genHandler(events[name]);
  54503. if (events[name] && events[name].dynamic) {
  54504. dynamicHandlers += name + "," + handlerCode + ",";
  54505. } else {
  54506. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  54507. }
  54508. }
  54509. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  54510. if (dynamicHandlers) {
  54511. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  54512. } else {
  54513. return prefix + staticHandlers
  54514. }
  54515. }
  54516. function genHandler (handler) {
  54517. if (!handler) {
  54518. return 'function(){}'
  54519. }
  54520. if (Array.isArray(handler)) {
  54521. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  54522. }
  54523. var isMethodPath = simplePathRE.test(handler.value);
  54524. var isFunctionExpression = fnExpRE.test(handler.value);
  54525. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  54526. if (!handler.modifiers) {
  54527. if (isMethodPath || isFunctionExpression) {
  54528. return handler.value
  54529. }
  54530. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  54531. } else {
  54532. var code = '';
  54533. var genModifierCode = '';
  54534. var keys = [];
  54535. for (var key in handler.modifiers) {
  54536. if (modifierCode[key]) {
  54537. genModifierCode += modifierCode[key];
  54538. // left/right
  54539. if (keyCodes[key]) {
  54540. keys.push(key);
  54541. }
  54542. } else if (key === 'exact') {
  54543. var modifiers = (handler.modifiers);
  54544. genModifierCode += genGuard(
  54545. ['ctrl', 'shift', 'alt', 'meta']
  54546. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  54547. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  54548. .join('||')
  54549. );
  54550. } else {
  54551. keys.push(key);
  54552. }
  54553. }
  54554. if (keys.length) {
  54555. code += genKeyFilter(keys);
  54556. }
  54557. // Make sure modifiers like prevent and stop get executed after key filtering
  54558. if (genModifierCode) {
  54559. code += genModifierCode;
  54560. }
  54561. var handlerCode = isMethodPath
  54562. ? ("return " + (handler.value) + "($event)")
  54563. : isFunctionExpression
  54564. ? ("return (" + (handler.value) + ")($event)")
  54565. : isFunctionInvocation
  54566. ? ("return " + (handler.value))
  54567. : handler.value;
  54568. return ("function($event){" + code + handlerCode + "}")
  54569. }
  54570. }
  54571. function genKeyFilter (keys) {
  54572. return (
  54573. // make sure the key filters only apply to KeyboardEvents
  54574. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  54575. // key events that do not have keyCode property...
  54576. "if(!$event.type.indexOf('key')&&" +
  54577. (keys.map(genFilterCode).join('&&')) + ")return null;"
  54578. )
  54579. }
  54580. function genFilterCode (key) {
  54581. var keyVal = parseInt(key, 10);
  54582. if (keyVal) {
  54583. return ("$event.keyCode!==" + keyVal)
  54584. }
  54585. var keyCode = keyCodes[key];
  54586. var keyName = keyNames[key];
  54587. return (
  54588. "_k($event.keyCode," +
  54589. (JSON.stringify(key)) + "," +
  54590. (JSON.stringify(keyCode)) + "," +
  54591. "$event.key," +
  54592. "" + (JSON.stringify(keyName)) +
  54593. ")"
  54594. )
  54595. }
  54596. /* */
  54597. function on (el, dir) {
  54598. if (dir.modifiers) {
  54599. warn("v-on without argument does not support modifiers.");
  54600. }
  54601. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  54602. }
  54603. /* */
  54604. function bind$1 (el, dir) {
  54605. el.wrapData = function (code) {
  54606. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  54607. };
  54608. }
  54609. /* */
  54610. var baseDirectives = {
  54611. on: on,
  54612. bind: bind$1,
  54613. cloak: noop
  54614. };
  54615. /* */
  54616. var CodegenState = function CodegenState (options) {
  54617. this.options = options;
  54618. this.warn = options.warn || baseWarn;
  54619. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  54620. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  54621. this.directives = extend(extend({}, baseDirectives), options.directives);
  54622. var isReservedTag = options.isReservedTag || no;
  54623. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  54624. this.onceId = 0;
  54625. this.staticRenderFns = [];
  54626. this.pre = false;
  54627. };
  54628. function generate (
  54629. ast,
  54630. options
  54631. ) {
  54632. var state = new CodegenState(options);
  54633. var code = ast ? genElement(ast, state) : '_c("div")';
  54634. return {
  54635. render: ("with(this){return " + code + "}"),
  54636. staticRenderFns: state.staticRenderFns
  54637. }
  54638. }
  54639. function genElement (el, state) {
  54640. if (el.parent) {
  54641. el.pre = el.pre || el.parent.pre;
  54642. }
  54643. if (el.staticRoot && !el.staticProcessed) {
  54644. return genStatic(el, state)
  54645. } else if (el.once && !el.onceProcessed) {
  54646. return genOnce(el, state)
  54647. } else if (el.for && !el.forProcessed) {
  54648. return genFor(el, state)
  54649. } else if (el.if && !el.ifProcessed) {
  54650. return genIf(el, state)
  54651. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  54652. return genChildren(el, state) || 'void 0'
  54653. } else if (el.tag === 'slot') {
  54654. return genSlot(el, state)
  54655. } else {
  54656. // component or element
  54657. var code;
  54658. if (el.component) {
  54659. code = genComponent(el.component, el, state);
  54660. } else {
  54661. var data;
  54662. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  54663. data = genData$2(el, state);
  54664. }
  54665. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  54666. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  54667. }
  54668. // module transforms
  54669. for (var i = 0; i < state.transforms.length; i++) {
  54670. code = state.transforms[i](el, code);
  54671. }
  54672. return code
  54673. }
  54674. }
  54675. // hoist static sub-trees out
  54676. function genStatic (el, state) {
  54677. el.staticProcessed = true;
  54678. // Some elements (templates) need to behave differently inside of a v-pre
  54679. // node. All pre nodes are static roots, so we can use this as a location to
  54680. // wrap a state change and reset it upon exiting the pre node.
  54681. var originalPreState = state.pre;
  54682. if (el.pre) {
  54683. state.pre = el.pre;
  54684. }
  54685. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  54686. state.pre = originalPreState;
  54687. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  54688. }
  54689. // v-once
  54690. function genOnce (el, state) {
  54691. el.onceProcessed = true;
  54692. if (el.if && !el.ifProcessed) {
  54693. return genIf(el, state)
  54694. } else if (el.staticInFor) {
  54695. var key = '';
  54696. var parent = el.parent;
  54697. while (parent) {
  54698. if (parent.for) {
  54699. key = parent.key;
  54700. break
  54701. }
  54702. parent = parent.parent;
  54703. }
  54704. if (!key) {
  54705. state.warn(
  54706. "v-once can only be used inside v-for that is keyed. ",
  54707. el.rawAttrsMap['v-once']
  54708. );
  54709. return genElement(el, state)
  54710. }
  54711. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  54712. } else {
  54713. return genStatic(el, state)
  54714. }
  54715. }
  54716. function genIf (
  54717. el,
  54718. state,
  54719. altGen,
  54720. altEmpty
  54721. ) {
  54722. el.ifProcessed = true; // avoid recursion
  54723. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  54724. }
  54725. function genIfConditions (
  54726. conditions,
  54727. state,
  54728. altGen,
  54729. altEmpty
  54730. ) {
  54731. if (!conditions.length) {
  54732. return altEmpty || '_e()'
  54733. }
  54734. var condition = conditions.shift();
  54735. if (condition.exp) {
  54736. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  54737. } else {
  54738. return ("" + (genTernaryExp(condition.block)))
  54739. }
  54740. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  54741. function genTernaryExp (el) {
  54742. return altGen
  54743. ? altGen(el, state)
  54744. : el.once
  54745. ? genOnce(el, state)
  54746. : genElement(el, state)
  54747. }
  54748. }
  54749. function genFor (
  54750. el,
  54751. state,
  54752. altGen,
  54753. altHelper
  54754. ) {
  54755. var exp = el.for;
  54756. var alias = el.alias;
  54757. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  54758. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  54759. if (state.maybeComponent(el) &&
  54760. el.tag !== 'slot' &&
  54761. el.tag !== 'template' &&
  54762. !el.key
  54763. ) {
  54764. state.warn(
  54765. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  54766. "v-for should have explicit keys. " +
  54767. "See https://vuejs.org/guide/list.html#key for more info.",
  54768. el.rawAttrsMap['v-for'],
  54769. true /* tip */
  54770. );
  54771. }
  54772. el.forProcessed = true; // avoid recursion
  54773. return (altHelper || '_l') + "((" + exp + ")," +
  54774. "function(" + alias + iterator1 + iterator2 + "){" +
  54775. "return " + ((altGen || genElement)(el, state)) +
  54776. '})'
  54777. }
  54778. function genData$2 (el, state) {
  54779. var data = '{';
  54780. // directives first.
  54781. // directives may mutate the el's other properties before they are generated.
  54782. var dirs = genDirectives(el, state);
  54783. if (dirs) { data += dirs + ','; }
  54784. // key
  54785. if (el.key) {
  54786. data += "key:" + (el.key) + ",";
  54787. }
  54788. // ref
  54789. if (el.ref) {
  54790. data += "ref:" + (el.ref) + ",";
  54791. }
  54792. if (el.refInFor) {
  54793. data += "refInFor:true,";
  54794. }
  54795. // pre
  54796. if (el.pre) {
  54797. data += "pre:true,";
  54798. }
  54799. // record original tag name for components using "is" attribute
  54800. if (el.component) {
  54801. data += "tag:\"" + (el.tag) + "\",";
  54802. }
  54803. // module data generation functions
  54804. for (var i = 0; i < state.dataGenFns.length; i++) {
  54805. data += state.dataGenFns[i](el);
  54806. }
  54807. // attributes
  54808. if (el.attrs) {
  54809. data += "attrs:" + (genProps(el.attrs)) + ",";
  54810. }
  54811. // DOM props
  54812. if (el.props) {
  54813. data += "domProps:" + (genProps(el.props)) + ",";
  54814. }
  54815. // event handlers
  54816. if (el.events) {
  54817. data += (genHandlers(el.events, false)) + ",";
  54818. }
  54819. if (el.nativeEvents) {
  54820. data += (genHandlers(el.nativeEvents, true)) + ",";
  54821. }
  54822. // slot target
  54823. // only for non-scoped slots
  54824. if (el.slotTarget && !el.slotScope) {
  54825. data += "slot:" + (el.slotTarget) + ",";
  54826. }
  54827. // scoped slots
  54828. if (el.scopedSlots) {
  54829. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  54830. }
  54831. // component v-model
  54832. if (el.model) {
  54833. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  54834. }
  54835. // inline-template
  54836. if (el.inlineTemplate) {
  54837. var inlineTemplate = genInlineTemplate(el, state);
  54838. if (inlineTemplate) {
  54839. data += inlineTemplate + ",";
  54840. }
  54841. }
  54842. data = data.replace(/,$/, '') + '}';
  54843. // v-bind dynamic argument wrap
  54844. // v-bind with dynamic arguments must be applied using the same v-bind object
  54845. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  54846. if (el.dynamicAttrs) {
  54847. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  54848. }
  54849. // v-bind data wrap
  54850. if (el.wrapData) {
  54851. data = el.wrapData(data);
  54852. }
  54853. // v-on data wrap
  54854. if (el.wrapListeners) {
  54855. data = el.wrapListeners(data);
  54856. }
  54857. return data
  54858. }
  54859. function genDirectives (el, state) {
  54860. var dirs = el.directives;
  54861. if (!dirs) { return }
  54862. var res = 'directives:[';
  54863. var hasRuntime = false;
  54864. var i, l, dir, needRuntime;
  54865. for (i = 0, l = dirs.length; i < l; i++) {
  54866. dir = dirs[i];
  54867. needRuntime = true;
  54868. var gen = state.directives[dir.name];
  54869. if (gen) {
  54870. // compile-time directive that manipulates AST.
  54871. // returns true if it also needs a runtime counterpart.
  54872. needRuntime = !!gen(el, dir, state.warn);
  54873. }
  54874. if (needRuntime) {
  54875. hasRuntime = true;
  54876. 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))) : '') + "},";
  54877. }
  54878. }
  54879. if (hasRuntime) {
  54880. return res.slice(0, -1) + ']'
  54881. }
  54882. }
  54883. function genInlineTemplate (el, state) {
  54884. var ast = el.children[0];
  54885. if (el.children.length !== 1 || ast.type !== 1) {
  54886. state.warn(
  54887. 'Inline-template components must have exactly one child element.',
  54888. { start: el.start }
  54889. );
  54890. }
  54891. if (ast && ast.type === 1) {
  54892. var inlineRenderFns = generate(ast, state.options);
  54893. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  54894. }
  54895. }
  54896. function genScopedSlots (
  54897. el,
  54898. slots,
  54899. state
  54900. ) {
  54901. // by default scoped slots are considered "stable", this allows child
  54902. // components with only scoped slots to skip forced updates from parent.
  54903. // but in some cases we have to bail-out of this optimization
  54904. // for example if the slot contains dynamic names, has v-if or v-for on them...
  54905. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  54906. var slot = slots[key];
  54907. return (
  54908. slot.slotTargetDynamic ||
  54909. slot.if ||
  54910. slot.for ||
  54911. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  54912. )
  54913. });
  54914. // #9534: if a component with scoped slots is inside a conditional branch,
  54915. // it's possible for the same component to be reused but with different
  54916. // compiled slot content. To avoid that, we generate a unique key based on
  54917. // the generated code of all the slot contents.
  54918. var needsKey = !!el.if;
  54919. // OR when it is inside another scoped slot or v-for (the reactivity may be
  54920. // disconnected due to the intermediate scope variable)
  54921. // #9438, #9506
  54922. // TODO: this can be further optimized by properly analyzing in-scope bindings
  54923. // and skip force updating ones that do not actually use scope variables.
  54924. if (!needsForceUpdate) {
  54925. var parent = el.parent;
  54926. while (parent) {
  54927. if (
  54928. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  54929. parent.for
  54930. ) {
  54931. needsForceUpdate = true;
  54932. break
  54933. }
  54934. if (parent.if) {
  54935. needsKey = true;
  54936. }
  54937. parent = parent.parent;
  54938. }
  54939. }
  54940. var generatedSlots = Object.keys(slots)
  54941. .map(function (key) { return genScopedSlot(slots[key], state); })
  54942. .join(',');
  54943. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  54944. }
  54945. function hash(str) {
  54946. var hash = 5381;
  54947. var i = str.length;
  54948. while(i) {
  54949. hash = (hash * 33) ^ str.charCodeAt(--i);
  54950. }
  54951. return hash >>> 0
  54952. }
  54953. function containsSlotChild (el) {
  54954. if (el.type === 1) {
  54955. if (el.tag === 'slot') {
  54956. return true
  54957. }
  54958. return el.children.some(containsSlotChild)
  54959. }
  54960. return false
  54961. }
  54962. function genScopedSlot (
  54963. el,
  54964. state
  54965. ) {
  54966. var isLegacySyntax = el.attrsMap['slot-scope'];
  54967. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  54968. return genIf(el, state, genScopedSlot, "null")
  54969. }
  54970. if (el.for && !el.forProcessed) {
  54971. return genFor(el, state, genScopedSlot)
  54972. }
  54973. var slotScope = el.slotScope === emptySlotScopeToken
  54974. ? ""
  54975. : String(el.slotScope);
  54976. var fn = "function(" + slotScope + "){" +
  54977. "return " + (el.tag === 'template'
  54978. ? el.if && isLegacySyntax
  54979. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  54980. : genChildren(el, state) || 'undefined'
  54981. : genElement(el, state)) + "}";
  54982. // reverse proxy v-slot without scope on this.$slots
  54983. var reverseProxy = slotScope ? "" : ",proxy:true";
  54984. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  54985. }
  54986. function genChildren (
  54987. el,
  54988. state,
  54989. checkSkip,
  54990. altGenElement,
  54991. altGenNode
  54992. ) {
  54993. var children = el.children;
  54994. if (children.length) {
  54995. var el$1 = children[0];
  54996. // optimize single v-for
  54997. if (children.length === 1 &&
  54998. el$1.for &&
  54999. el$1.tag !== 'template' &&
  55000. el$1.tag !== 'slot'
  55001. ) {
  55002. var normalizationType = checkSkip
  55003. ? state.maybeComponent(el$1) ? ",1" : ",0"
  55004. : "";
  55005. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  55006. }
  55007. var normalizationType$1 = checkSkip
  55008. ? getNormalizationType(children, state.maybeComponent)
  55009. : 0;
  55010. var gen = altGenNode || genNode;
  55011. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  55012. }
  55013. }
  55014. // determine the normalization needed for the children array.
  55015. // 0: no normalization needed
  55016. // 1: simple normalization needed (possible 1-level deep nested array)
  55017. // 2: full normalization needed
  55018. function getNormalizationType (
  55019. children,
  55020. maybeComponent
  55021. ) {
  55022. var res = 0;
  55023. for (var i = 0; i < children.length; i++) {
  55024. var el = children[i];
  55025. if (el.type !== 1) {
  55026. continue
  55027. }
  55028. if (needsNormalization(el) ||
  55029. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  55030. res = 2;
  55031. break
  55032. }
  55033. if (maybeComponent(el) ||
  55034. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  55035. res = 1;
  55036. }
  55037. }
  55038. return res
  55039. }
  55040. function needsNormalization (el) {
  55041. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  55042. }
  55043. function genNode (node, state) {
  55044. if (node.type === 1) {
  55045. return genElement(node, state)
  55046. } else if (node.type === 3 && node.isComment) {
  55047. return genComment(node)
  55048. } else {
  55049. return genText(node)
  55050. }
  55051. }
  55052. function genText (text) {
  55053. return ("_v(" + (text.type === 2
  55054. ? text.expression // no need for () because already wrapped in _s()
  55055. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  55056. }
  55057. function genComment (comment) {
  55058. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  55059. }
  55060. function genSlot (el, state) {
  55061. var slotName = el.slotName || '"default"';
  55062. var children = genChildren(el, state);
  55063. var res = "_t(" + slotName + (children ? ("," + children) : '');
  55064. var attrs = el.attrs || el.dynamicAttrs
  55065. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  55066. // slot props are camelized
  55067. name: camelize(attr.name),
  55068. value: attr.value,
  55069. dynamic: attr.dynamic
  55070. }); }))
  55071. : null;
  55072. var bind$$1 = el.attrsMap['v-bind'];
  55073. if ((attrs || bind$$1) && !children) {
  55074. res += ",null";
  55075. }
  55076. if (attrs) {
  55077. res += "," + attrs;
  55078. }
  55079. if (bind$$1) {
  55080. res += (attrs ? '' : ',null') + "," + bind$$1;
  55081. }
  55082. return res + ')'
  55083. }
  55084. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  55085. function genComponent (
  55086. componentName,
  55087. el,
  55088. state
  55089. ) {
  55090. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  55091. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  55092. }
  55093. function genProps (props) {
  55094. var staticProps = "";
  55095. var dynamicProps = "";
  55096. for (var i = 0; i < props.length; i++) {
  55097. var prop = props[i];
  55098. var value = transformSpecialNewlines(prop.value);
  55099. if (prop.dynamic) {
  55100. dynamicProps += (prop.name) + "," + value + ",";
  55101. } else {
  55102. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  55103. }
  55104. }
  55105. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  55106. if (dynamicProps) {
  55107. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  55108. } else {
  55109. return staticProps
  55110. }
  55111. }
  55112. // #3895, #4268
  55113. function transformSpecialNewlines (text) {
  55114. return text
  55115. .replace(/\u2028/g, '\\u2028')
  55116. .replace(/\u2029/g, '\\u2029')
  55117. }
  55118. /* */
  55119. // these keywords should not appear inside expressions, but operators like
  55120. // typeof, instanceof and in are allowed
  55121. var prohibitedKeywordRE = new RegExp('\\b' + (
  55122. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  55123. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  55124. 'extends,finally,continue,debugger,function,arguments'
  55125. ).split(',').join('\\b|\\b') + '\\b');
  55126. // these unary operators should not be used as property/method names
  55127. var unaryOperatorsRE = new RegExp('\\b' + (
  55128. 'delete,typeof,void'
  55129. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  55130. // strip strings in expressions
  55131. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  55132. // detect problematic expressions in a template
  55133. function detectErrors (ast, warn) {
  55134. if (ast) {
  55135. checkNode(ast, warn);
  55136. }
  55137. }
  55138. function checkNode (node, warn) {
  55139. if (node.type === 1) {
  55140. for (var name in node.attrsMap) {
  55141. if (dirRE.test(name)) {
  55142. var value = node.attrsMap[name];
  55143. if (value) {
  55144. var range = node.rawAttrsMap[name];
  55145. if (name === 'v-for') {
  55146. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  55147. } else if (name === 'v-slot' || name[0] === '#') {
  55148. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  55149. } else if (onRE.test(name)) {
  55150. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  55151. } else {
  55152. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  55153. }
  55154. }
  55155. }
  55156. }
  55157. if (node.children) {
  55158. for (var i = 0; i < node.children.length; i++) {
  55159. checkNode(node.children[i], warn);
  55160. }
  55161. }
  55162. } else if (node.type === 2) {
  55163. checkExpression(node.expression, node.text, warn, node);
  55164. }
  55165. }
  55166. function checkEvent (exp, text, warn, range) {
  55167. var stripped = exp.replace(stripStringRE, '');
  55168. var keywordMatch = stripped.match(unaryOperatorsRE);
  55169. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  55170. warn(
  55171. "avoid using JavaScript unary operator as property name: " +
  55172. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  55173. range
  55174. );
  55175. }
  55176. checkExpression(exp, text, warn, range);
  55177. }
  55178. function checkFor (node, text, warn, range) {
  55179. checkExpression(node.for || '', text, warn, range);
  55180. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  55181. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  55182. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  55183. }
  55184. function checkIdentifier (
  55185. ident,
  55186. type,
  55187. text,
  55188. warn,
  55189. range
  55190. ) {
  55191. if (typeof ident === 'string') {
  55192. try {
  55193. new Function(("var " + ident + "=_"));
  55194. } catch (e) {
  55195. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  55196. }
  55197. }
  55198. }
  55199. function checkExpression (exp, text, warn, range) {
  55200. try {
  55201. new Function(("return " + exp));
  55202. } catch (e) {
  55203. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  55204. if (keywordMatch) {
  55205. warn(
  55206. "avoid using JavaScript keyword as property name: " +
  55207. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  55208. range
  55209. );
  55210. } else {
  55211. warn(
  55212. "invalid expression: " + (e.message) + " in\n\n" +
  55213. " " + exp + "\n\n" +
  55214. " Raw expression: " + (text.trim()) + "\n",
  55215. range
  55216. );
  55217. }
  55218. }
  55219. }
  55220. function checkFunctionParameterExpression (exp, text, warn, range) {
  55221. try {
  55222. new Function(exp, '');
  55223. } catch (e) {
  55224. warn(
  55225. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  55226. " " + exp + "\n\n" +
  55227. " Raw expression: " + (text.trim()) + "\n",
  55228. range
  55229. );
  55230. }
  55231. }
  55232. /* */
  55233. var range = 2;
  55234. function generateCodeFrame (
  55235. source,
  55236. start,
  55237. end
  55238. ) {
  55239. if ( start === void 0 ) start = 0;
  55240. if ( end === void 0 ) end = source.length;
  55241. var lines = source.split(/\r?\n/);
  55242. var count = 0;
  55243. var res = [];
  55244. for (var i = 0; i < lines.length; i++) {
  55245. count += lines[i].length + 1;
  55246. if (count >= start) {
  55247. for (var j = i - range; j <= i + range || end > count; j++) {
  55248. if (j < 0 || j >= lines.length) { continue }
  55249. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  55250. var lineLength = lines[j].length;
  55251. if (j === i) {
  55252. // push underline
  55253. var pad = start - (count - lineLength) + 1;
  55254. var length = end > count ? lineLength - pad : end - start;
  55255. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  55256. } else if (j > i) {
  55257. if (end > count) {
  55258. var length$1 = Math.min(end - count, lineLength);
  55259. res.push(" | " + repeat$1("^", length$1));
  55260. }
  55261. count += lineLength + 1;
  55262. }
  55263. }
  55264. break
  55265. }
  55266. }
  55267. return res.join('\n')
  55268. }
  55269. function repeat$1 (str, n) {
  55270. var result = '';
  55271. if (n > 0) {
  55272. while (true) { // eslint-disable-line
  55273. if (n & 1) { result += str; }
  55274. n >>>= 1;
  55275. if (n <= 0) { break }
  55276. str += str;
  55277. }
  55278. }
  55279. return result
  55280. }
  55281. /* */
  55282. function createFunction (code, errors) {
  55283. try {
  55284. return new Function(code)
  55285. } catch (err) {
  55286. errors.push({ err: err, code: code });
  55287. return noop
  55288. }
  55289. }
  55290. function createCompileToFunctionFn (compile) {
  55291. var cache = Object.create(null);
  55292. return function compileToFunctions (
  55293. template,
  55294. options,
  55295. vm
  55296. ) {
  55297. options = extend({}, options);
  55298. var warn$$1 = options.warn || warn;
  55299. delete options.warn;
  55300. /* istanbul ignore if */
  55301. {
  55302. // detect possible CSP restriction
  55303. try {
  55304. new Function('return 1');
  55305. } catch (e) {
  55306. if (e.toString().match(/unsafe-eval|CSP/)) {
  55307. warn$$1(
  55308. 'It seems you are using the standalone build of Vue.js in an ' +
  55309. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  55310. 'The template compiler cannot work in this environment. Consider ' +
  55311. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  55312. 'templates into render functions.'
  55313. );
  55314. }
  55315. }
  55316. }
  55317. // check cache
  55318. var key = options.delimiters
  55319. ? String(options.delimiters) + template
  55320. : template;
  55321. if (cache[key]) {
  55322. return cache[key]
  55323. }
  55324. // compile
  55325. var compiled = compile(template, options);
  55326. // check compilation errors/tips
  55327. {
  55328. if (compiled.errors && compiled.errors.length) {
  55329. if (options.outputSourceRange) {
  55330. compiled.errors.forEach(function (e) {
  55331. warn$$1(
  55332. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  55333. generateCodeFrame(template, e.start, e.end),
  55334. vm
  55335. );
  55336. });
  55337. } else {
  55338. warn$$1(
  55339. "Error compiling template:\n\n" + template + "\n\n" +
  55340. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  55341. vm
  55342. );
  55343. }
  55344. }
  55345. if (compiled.tips && compiled.tips.length) {
  55346. if (options.outputSourceRange) {
  55347. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  55348. } else {
  55349. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  55350. }
  55351. }
  55352. }
  55353. // turn code into functions
  55354. var res = {};
  55355. var fnGenErrors = [];
  55356. res.render = createFunction(compiled.render, fnGenErrors);
  55357. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  55358. return createFunction(code, fnGenErrors)
  55359. });
  55360. // check function generation errors.
  55361. // this should only happen if there is a bug in the compiler itself.
  55362. // mostly for codegen development use
  55363. /* istanbul ignore if */
  55364. {
  55365. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  55366. warn$$1(
  55367. "Failed to generate render function:\n\n" +
  55368. fnGenErrors.map(function (ref) {
  55369. var err = ref.err;
  55370. var code = ref.code;
  55371. return ((err.toString()) + " in\n\n" + code + "\n");
  55372. }).join('\n'),
  55373. vm
  55374. );
  55375. }
  55376. }
  55377. return (cache[key] = res)
  55378. }
  55379. }
  55380. /* */
  55381. function createCompilerCreator (baseCompile) {
  55382. return function createCompiler (baseOptions) {
  55383. function compile (
  55384. template,
  55385. options
  55386. ) {
  55387. var finalOptions = Object.create(baseOptions);
  55388. var errors = [];
  55389. var tips = [];
  55390. var warn = function (msg, range, tip) {
  55391. (tip ? tips : errors).push(msg);
  55392. };
  55393. if (options) {
  55394. if (options.outputSourceRange) {
  55395. // $flow-disable-line
  55396. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  55397. warn = function (msg, range, tip) {
  55398. var data = { msg: msg };
  55399. if (range) {
  55400. if (range.start != null) {
  55401. data.start = range.start + leadingSpaceLength;
  55402. }
  55403. if (range.end != null) {
  55404. data.end = range.end + leadingSpaceLength;
  55405. }
  55406. }
  55407. (tip ? tips : errors).push(data);
  55408. };
  55409. }
  55410. // merge custom modules
  55411. if (options.modules) {
  55412. finalOptions.modules =
  55413. (baseOptions.modules || []).concat(options.modules);
  55414. }
  55415. // merge custom directives
  55416. if (options.directives) {
  55417. finalOptions.directives = extend(
  55418. Object.create(baseOptions.directives || null),
  55419. options.directives
  55420. );
  55421. }
  55422. // copy other options
  55423. for (var key in options) {
  55424. if (key !== 'modules' && key !== 'directives') {
  55425. finalOptions[key] = options[key];
  55426. }
  55427. }
  55428. }
  55429. finalOptions.warn = warn;
  55430. var compiled = baseCompile(template.trim(), finalOptions);
  55431. {
  55432. detectErrors(compiled.ast, warn);
  55433. }
  55434. compiled.errors = errors;
  55435. compiled.tips = tips;
  55436. return compiled
  55437. }
  55438. return {
  55439. compile: compile,
  55440. compileToFunctions: createCompileToFunctionFn(compile)
  55441. }
  55442. }
  55443. }
  55444. /* */
  55445. // `createCompilerCreator` allows creating compilers that use alternative
  55446. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  55447. // Here we just export a default compiler using the default parts.
  55448. var createCompiler = createCompilerCreator(function baseCompile (
  55449. template,
  55450. options
  55451. ) {
  55452. var ast = parse(template.trim(), options);
  55453. if (options.optimize !== false) {
  55454. optimize(ast, options);
  55455. }
  55456. var code = generate(ast, options);
  55457. return {
  55458. ast: ast,
  55459. render: code.render,
  55460. staticRenderFns: code.staticRenderFns
  55461. }
  55462. });
  55463. /* */
  55464. var ref$1 = createCompiler(baseOptions);
  55465. var compile = ref$1.compile;
  55466. var compileToFunctions = ref$1.compileToFunctions;
  55467. /* */
  55468. // check whether current browser encodes a char inside attribute values
  55469. var div;
  55470. function getShouldDecode (href) {
  55471. div = div || document.createElement('div');
  55472. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  55473. return div.innerHTML.indexOf('&#10;') > 0
  55474. }
  55475. // #3663: IE encodes newlines inside attribute values while other browsers don't
  55476. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  55477. // #6828: chrome encodes content in a[href]
  55478. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  55479. /* */
  55480. var idToTemplate = cached(function (id) {
  55481. var el = query(id);
  55482. return el && el.innerHTML
  55483. });
  55484. var mount = Vue.prototype.$mount;
  55485. Vue.prototype.$mount = function (
  55486. el,
  55487. hydrating
  55488. ) {
  55489. el = el && query(el);
  55490. /* istanbul ignore if */
  55491. if (el === document.body || el === document.documentElement) {
  55492. warn(
  55493. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  55494. );
  55495. return this
  55496. }
  55497. var options = this.$options;
  55498. // resolve template/el and convert to render function
  55499. if (!options.render) {
  55500. var template = options.template;
  55501. if (template) {
  55502. if (typeof template === 'string') {
  55503. if (template.charAt(0) === '#') {
  55504. template = idToTemplate(template);
  55505. /* istanbul ignore if */
  55506. if (!template) {
  55507. warn(
  55508. ("Template element not found or is empty: " + (options.template)),
  55509. this
  55510. );
  55511. }
  55512. }
  55513. } else if (template.nodeType) {
  55514. template = template.innerHTML;
  55515. } else {
  55516. {
  55517. warn('invalid template option:' + template, this);
  55518. }
  55519. return this
  55520. }
  55521. } else if (el) {
  55522. template = getOuterHTML(el);
  55523. }
  55524. if (template) {
  55525. /* istanbul ignore if */
  55526. if (config.performance && mark) {
  55527. mark('compile');
  55528. }
  55529. var ref = compileToFunctions(template, {
  55530. outputSourceRange: "development" !== 'production',
  55531. shouldDecodeNewlines: shouldDecodeNewlines,
  55532. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  55533. delimiters: options.delimiters,
  55534. comments: options.comments
  55535. }, this);
  55536. var render = ref.render;
  55537. var staticRenderFns = ref.staticRenderFns;
  55538. options.render = render;
  55539. options.staticRenderFns = staticRenderFns;
  55540. /* istanbul ignore if */
  55541. if (config.performance && mark) {
  55542. mark('compile end');
  55543. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  55544. }
  55545. }
  55546. }
  55547. return mount.call(this, el, hydrating)
  55548. };
  55549. /**
  55550. * Get outerHTML of elements, taking care
  55551. * of SVG elements in IE as well.
  55552. */
  55553. function getOuterHTML (el) {
  55554. if (el.outerHTML) {
  55555. return el.outerHTML
  55556. } else {
  55557. var container = document.createElement('div');
  55558. container.appendChild(el.cloneNode(true));
  55559. return container.innerHTML
  55560. }
  55561. }
  55562. Vue.compile = compileToFunctions;
  55563. module.exports = Vue;
  55564. /* 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))
  55565. /***/ }),
  55566. /***/ "./node_modules/vue/dist/vue.common.js":
  55567. /*!*********************************************!*\
  55568. !*** ./node_modules/vue/dist/vue.common.js ***!
  55569. \*********************************************/
  55570. /*! no static exports found */
  55571. /***/ (function(module, exports, __webpack_require__) {
  55572. if (false) {} else {
  55573. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  55574. }
  55575. /***/ }),
  55576. /***/ "./node_modules/webpack/buildin/global.js":
  55577. /*!***********************************!*\
  55578. !*** (webpack)/buildin/global.js ***!
  55579. \***********************************/
  55580. /*! no static exports found */
  55581. /***/ (function(module, exports) {
  55582. var g;
  55583. // This works in non-strict mode
  55584. g = (function() {
  55585. return this;
  55586. })();
  55587. try {
  55588. // This works if eval is allowed (see CSP)
  55589. g = g || new Function("return this")();
  55590. } catch (e) {
  55591. // This works if the window reference is available
  55592. if (typeof window === "object") g = window;
  55593. }
  55594. // g can still be undefined, but nothing to do about it...
  55595. // We return undefined, instead of nothing here, so it's
  55596. // easier to handle this case. if(!global) { ...}
  55597. module.exports = g;
  55598. /***/ }),
  55599. /***/ "./node_modules/webpack/buildin/module.js":
  55600. /*!***********************************!*\
  55601. !*** (webpack)/buildin/module.js ***!
  55602. \***********************************/
  55603. /*! no static exports found */
  55604. /***/ (function(module, exports) {
  55605. module.exports = function(module) {
  55606. if (!module.webpackPolyfill) {
  55607. module.deprecate = function() {};
  55608. module.paths = [];
  55609. // module.parent = undefined by default
  55610. if (!module.children) module.children = [];
  55611. Object.defineProperty(module, "loaded", {
  55612. enumerable: true,
  55613. get: function() {
  55614. return module.l;
  55615. }
  55616. });
  55617. Object.defineProperty(module, "id", {
  55618. enumerable: true,
  55619. get: function() {
  55620. return module.i;
  55621. }
  55622. });
  55623. module.webpackPolyfill = 1;
  55624. }
  55625. return module;
  55626. };
  55627. /***/ }),
  55628. /***/ "./resources/js/app.js":
  55629. /*!*****************************!*\
  55630. !*** ./resources/js/app.js ***!
  55631. \*****************************/
  55632. /*! no static exports found */
  55633. /***/ (function(module, exports, __webpack_require__) {
  55634. /**
  55635. * First we will load all of this project's JavaScript dependencies which
  55636. * includes Vue and other libraries. It is a great starting point when
  55637. * building robust, powerful web applications using Vue and Laravel.
  55638. */
  55639. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  55640. window.Clipboard = __webpack_require__(/*! clipboard */ "./node_modules/clipboard/dist/clipboard.js");
  55641. __webpack_require__(/*! ./notify.min.js */ "./resources/js/notify.min.js");
  55642. window.Vue = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  55643. /**
  55644. * The following block of code may be used to automatically register your
  55645. * Vue components. It will recursively scan this directory for the Vue
  55646. * components and automatically register them with their "basename".
  55647. *
  55648. * Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
  55649. */
  55650. // const files = require.context('./', true, /\.vue$/i)
  55651. // files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))
  55652. Vue.component('example-component', __webpack_require__(/*! ./components/ExampleComponent.vue */ "./resources/js/components/ExampleComponent.vue")["default"]);
  55653. Vue.component('woinfo', __webpack_require__(/*! ./components/woinfo.vue */ "./resources/js/components/woinfo.vue")["default"]);
  55654. Vue.component('assetinfo', __webpack_require__(/*! ./components/assetinfo.vue */ "./resources/js/components/assetinfo.vue")["default"]);
  55655. Vue.component('credential', __webpack_require__(/*! ./components/credential.vue */ "./resources/js/components/credential.vue")["default"]);
  55656. Vue.component('notes', __webpack_require__(/*! ./components/notes.vue */ "./resources/js/components/notes.vue")["default"]);
  55657. Vue.component('modal', __webpack_require__(/*! ./components/modal.vue */ "./resources/js/components/modal.vue")["default"]);
  55658. Vue.component('woinfo-edit-modal', __webpack_require__(/*! ./components/woinfo-edit-modal.vue */ "./resources/js/components/woinfo-edit-modal.vue")["default"]);
  55659. Vue.component('errorlist', __webpack_require__(/*! ./components/errorlist.vue */ "./resources/js/components/errorlist.vue")["default"]);
  55660. Vue.component('credential-form-modal', __webpack_require__(/*! ./components/credential-form-modal.vue */ "./resources/js/components/credential-form-modal.vue")["default"]);
  55661. Vue.component('autocomplete-custom-dropdown', __webpack_require__(/*! ./components/autocomplete-custom-dropdown.vue */ "./resources/js/components/autocomplete-custom-dropdown.vue")["default"]);
  55662. Vue.component('credential-list', __webpack_require__(/*! ./components/credential-list.vue */ "./resources/js/components/credential-list.vue")["default"]);
  55663. Vue.component('note-form-modal', __webpack_require__(/*! ./components/note-form-modal.vue */ "./resources/js/components/note-form-modal.vue")["default"]);
  55664. /**
  55665. * Next, we will create a fresh Vue application instance and attach it to
  55666. * the page. Then, you may begin adding components to this application
  55667. * or customize the JavaScript scaffolding to fit your unique needs.
  55668. */
  55669. var app = new Vue({
  55670. el: '#app'
  55671. });
  55672. $(function () {
  55673. $('[data-toggle="tooltip"]').tooltip();
  55674. });
  55675. var clipboard = new Clipboard('.btn-clip');
  55676. clipboard.on('success', function (e) {
  55677. $('#' + e.trigger.getAttribute('id')).notify('Copied to Clipboard', {
  55678. position: "right",
  55679. className: 'success'
  55680. });
  55681. e.clearSelection();
  55682. });
  55683. /***/ }),
  55684. /***/ "./resources/js/bootstrap.js":
  55685. /*!***********************************!*\
  55686. !*** ./resources/js/bootstrap.js ***!
  55687. \***********************************/
  55688. /*! no exports provided */
  55689. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55690. "use strict";
  55691. __webpack_require__.r(__webpack_exports__);
  55692. /* harmony import */ var laravel_echo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! laravel-echo */ "./node_modules/laravel-echo/dist/echo.js");
  55693. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  55694. /**
  55695. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  55696. * for JavaScript based Bootstrap features such as modals and tabs. This
  55697. * code may be modified to fit the specific needs of your application.
  55698. */
  55699. try {
  55700. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  55701. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  55702. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  55703. } catch (e) {}
  55704. /**
  55705. * We'll load the axios HTTP library which allows us to easily issue requests
  55706. * to our Laravel back-end. This library automatically handles sending the
  55707. * CSRF token as a header based on the value of the "XSRF" token cookie.
  55708. */
  55709. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  55710. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  55711. /**
  55712. * Echo exposes an expressive API for subscribing to channels and listening
  55713. * for events that are broadcast by Laravel. Echo and event broadcasting
  55714. * allows your team to easily build robust real-time web applications.
  55715. */
  55716. window.Pusher = __webpack_require__(/*! pusher-js */ "./node_modules/pusher-js/dist/web/pusher.js");
  55717. window.Echo = new laravel_echo__WEBPACK_IMPORTED_MODULE_0__["default"]({
  55718. broadcaster: 'pusher',
  55719. key: "upccrt",
  55720. authEndpoint: '/broadcasting/auth',
  55721. wsHost: window.location.hostname,
  55722. wsPort: 6001,
  55723. disableStats: true
  55724. });
  55725. /***/ }),
  55726. /***/ "./resources/js/components/ExampleComponent.vue":
  55727. /*!******************************************************!*\
  55728. !*** ./resources/js/components/ExampleComponent.vue ***!
  55729. \******************************************************/
  55730. /*! exports provided: default */
  55731. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55732. "use strict";
  55733. __webpack_require__.r(__webpack_exports__);
  55734. /* 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&");
  55735. /* 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&");
  55736. /* 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");
  55737. /* normalize component */
  55738. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55739. _ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55740. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["render"],
  55741. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55742. false,
  55743. null,
  55744. null,
  55745. null
  55746. )
  55747. /* hot reload */
  55748. if (false) { var api; }
  55749. component.options.__file = "resources/js/components/ExampleComponent.vue"
  55750. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55751. /***/ }),
  55752. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&":
  55753. /*!*******************************************************************************!*\
  55754. !*** ./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js& ***!
  55755. \*******************************************************************************/
  55756. /*! exports provided: default */
  55757. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55758. "use strict";
  55759. __webpack_require__.r(__webpack_exports__);
  55760. /* 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&");
  55761. /* 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"]);
  55762. /***/ }),
  55763. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&":
  55764. /*!*************************************************************************************!*\
  55765. !*** ./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e& ***!
  55766. \*************************************************************************************/
  55767. /*! exports provided: render, staticRenderFns */
  55768. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55769. "use strict";
  55770. __webpack_require__.r(__webpack_exports__);
  55771. /* 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&");
  55772. /* 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"]; });
  55773. /* 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"]; });
  55774. /***/ }),
  55775. /***/ "./resources/js/components/assetinfo.vue":
  55776. /*!***********************************************!*\
  55777. !*** ./resources/js/components/assetinfo.vue ***!
  55778. \***********************************************/
  55779. /*! exports provided: default */
  55780. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55781. "use strict";
  55782. __webpack_require__.r(__webpack_exports__);
  55783. /* 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&");
  55784. /* 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&");
  55785. /* 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");
  55786. /* normalize component */
  55787. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55788. _assetinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55789. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["render"],
  55790. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55791. false,
  55792. null,
  55793. null,
  55794. null
  55795. )
  55796. /* hot reload */
  55797. if (false) { var api; }
  55798. component.options.__file = "resources/js/components/assetinfo.vue"
  55799. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55800. /***/ }),
  55801. /***/ "./resources/js/components/assetinfo.vue?vue&type=script&lang=js&":
  55802. /*!************************************************************************!*\
  55803. !*** ./resources/js/components/assetinfo.vue?vue&type=script&lang=js& ***!
  55804. \************************************************************************/
  55805. /*! exports provided: default */
  55806. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55807. "use strict";
  55808. __webpack_require__.r(__webpack_exports__);
  55809. /* 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&");
  55810. /* 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"]);
  55811. /***/ }),
  55812. /***/ "./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3&":
  55813. /*!******************************************************************************!*\
  55814. !*** ./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3& ***!
  55815. \******************************************************************************/
  55816. /*! exports provided: render, staticRenderFns */
  55817. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55818. "use strict";
  55819. __webpack_require__.r(__webpack_exports__);
  55820. /* 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&");
  55821. /* 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"]; });
  55822. /* 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"]; });
  55823. /***/ }),
  55824. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue":
  55825. /*!******************************************************************!*\
  55826. !*** ./resources/js/components/autocomplete-custom-dropdown.vue ***!
  55827. \******************************************************************/
  55828. /*! exports provided: default */
  55829. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55830. "use strict";
  55831. __webpack_require__.r(__webpack_exports__);
  55832. /* 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&");
  55833. /* 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&");
  55834. /* 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");
  55835. /* normalize component */
  55836. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55837. _autocomplete_custom_dropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55838. _autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["render"],
  55839. _autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55840. false,
  55841. null,
  55842. null,
  55843. null
  55844. )
  55845. /* hot reload */
  55846. if (false) { var api; }
  55847. component.options.__file = "resources/js/components/autocomplete-custom-dropdown.vue"
  55848. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55849. /***/ }),
  55850. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js&":
  55851. /*!*******************************************************************************************!*\
  55852. !*** ./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js& ***!
  55853. \*******************************************************************************************/
  55854. /*! exports provided: default */
  55855. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55856. "use strict";
  55857. __webpack_require__.r(__webpack_exports__);
  55858. /* 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&");
  55859. /* 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"]);
  55860. /***/ }),
  55861. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a&":
  55862. /*!*************************************************************************************************!*\
  55863. !*** ./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a& ***!
  55864. \*************************************************************************************************/
  55865. /*! exports provided: render, staticRenderFns */
  55866. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55867. "use strict";
  55868. __webpack_require__.r(__webpack_exports__);
  55869. /* 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&");
  55870. /* 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"]; });
  55871. /* 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"]; });
  55872. /***/ }),
  55873. /***/ "./resources/js/components/credential-form-modal.vue":
  55874. /*!***********************************************************!*\
  55875. !*** ./resources/js/components/credential-form-modal.vue ***!
  55876. \***********************************************************/
  55877. /*! exports provided: default */
  55878. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55879. "use strict";
  55880. __webpack_require__.r(__webpack_exports__);
  55881. /* 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&");
  55882. /* 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&");
  55883. /* 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");
  55884. /* normalize component */
  55885. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55886. _credential_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55887. _credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["render"],
  55888. _credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55889. false,
  55890. null,
  55891. null,
  55892. null
  55893. )
  55894. /* hot reload */
  55895. if (false) { var api; }
  55896. component.options.__file = "resources/js/components/credential-form-modal.vue"
  55897. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55898. /***/ }),
  55899. /***/ "./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js&":
  55900. /*!************************************************************************************!*\
  55901. !*** ./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js& ***!
  55902. \************************************************************************************/
  55903. /*! exports provided: default */
  55904. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55905. "use strict";
  55906. __webpack_require__.r(__webpack_exports__);
  55907. /* 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&");
  55908. /* 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"]);
  55909. /***/ }),
  55910. /***/ "./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42&":
  55911. /*!******************************************************************************************!*\
  55912. !*** ./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42& ***!
  55913. \******************************************************************************************/
  55914. /*! exports provided: render, staticRenderFns */
  55915. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55916. "use strict";
  55917. __webpack_require__.r(__webpack_exports__);
  55918. /* 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&");
  55919. /* 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"]; });
  55920. /* 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"]; });
  55921. /***/ }),
  55922. /***/ "./resources/js/components/credential-list.vue":
  55923. /*!*****************************************************!*\
  55924. !*** ./resources/js/components/credential-list.vue ***!
  55925. \*****************************************************/
  55926. /*! exports provided: default */
  55927. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55928. "use strict";
  55929. __webpack_require__.r(__webpack_exports__);
  55930. /* 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&");
  55931. /* 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&");
  55932. /* 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");
  55933. /* normalize component */
  55934. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55935. _credential_list_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55936. _credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["render"],
  55937. _credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55938. false,
  55939. null,
  55940. null,
  55941. null
  55942. )
  55943. /* hot reload */
  55944. if (false) { var api; }
  55945. component.options.__file = "resources/js/components/credential-list.vue"
  55946. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55947. /***/ }),
  55948. /***/ "./resources/js/components/credential-list.vue?vue&type=script&lang=js&":
  55949. /*!******************************************************************************!*\
  55950. !*** ./resources/js/components/credential-list.vue?vue&type=script&lang=js& ***!
  55951. \******************************************************************************/
  55952. /*! exports provided: default */
  55953. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55954. "use strict";
  55955. __webpack_require__.r(__webpack_exports__);
  55956. /* 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&");
  55957. /* 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"]);
  55958. /***/ }),
  55959. /***/ "./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e&":
  55960. /*!************************************************************************************!*\
  55961. !*** ./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e& ***!
  55962. \************************************************************************************/
  55963. /*! exports provided: render, staticRenderFns */
  55964. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55965. "use strict";
  55966. __webpack_require__.r(__webpack_exports__);
  55967. /* 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&");
  55968. /* 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"]; });
  55969. /* 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"]; });
  55970. /***/ }),
  55971. /***/ "./resources/js/components/credential.vue":
  55972. /*!************************************************!*\
  55973. !*** ./resources/js/components/credential.vue ***!
  55974. \************************************************/
  55975. /*! exports provided: default */
  55976. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55977. "use strict";
  55978. __webpack_require__.r(__webpack_exports__);
  55979. /* 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&");
  55980. /* 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&");
  55981. /* 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");
  55982. /* normalize component */
  55983. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55984. _credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55985. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["render"],
  55986. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55987. false,
  55988. null,
  55989. null,
  55990. null
  55991. )
  55992. /* hot reload */
  55993. if (false) { var api; }
  55994. component.options.__file = "resources/js/components/credential.vue"
  55995. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55996. /***/ }),
  55997. /***/ "./resources/js/components/credential.vue?vue&type=script&lang=js&":
  55998. /*!*************************************************************************!*\
  55999. !*** ./resources/js/components/credential.vue?vue&type=script&lang=js& ***!
  56000. \*************************************************************************/
  56001. /*! exports provided: default */
  56002. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56003. "use strict";
  56004. __webpack_require__.r(__webpack_exports__);
  56005. /* 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&");
  56006. /* 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"]);
  56007. /***/ }),
  56008. /***/ "./resources/js/components/credential.vue?vue&type=template&id=0f5cc562&":
  56009. /*!*******************************************************************************!*\
  56010. !*** ./resources/js/components/credential.vue?vue&type=template&id=0f5cc562& ***!
  56011. \*******************************************************************************/
  56012. /*! exports provided: render, staticRenderFns */
  56013. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56014. "use strict";
  56015. __webpack_require__.r(__webpack_exports__);
  56016. /* 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&");
  56017. /* 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"]; });
  56018. /* 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"]; });
  56019. /***/ }),
  56020. /***/ "./resources/js/components/errorlist.vue":
  56021. /*!***********************************************!*\
  56022. !*** ./resources/js/components/errorlist.vue ***!
  56023. \***********************************************/
  56024. /*! exports provided: default */
  56025. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56026. "use strict";
  56027. __webpack_require__.r(__webpack_exports__);
  56028. /* 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&");
  56029. /* 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&");
  56030. /* 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");
  56031. /* normalize component */
  56032. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  56033. _errorlist_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  56034. _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["render"],
  56035. _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  56036. false,
  56037. null,
  56038. null,
  56039. null
  56040. )
  56041. /* hot reload */
  56042. if (false) { var api; }
  56043. component.options.__file = "resources/js/components/errorlist.vue"
  56044. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56045. /***/ }),
  56046. /***/ "./resources/js/components/errorlist.vue?vue&type=script&lang=js&":
  56047. /*!************************************************************************!*\
  56048. !*** ./resources/js/components/errorlist.vue?vue&type=script&lang=js& ***!
  56049. \************************************************************************/
  56050. /*! exports provided: default */
  56051. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56052. "use strict";
  56053. __webpack_require__.r(__webpack_exports__);
  56054. /* 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&");
  56055. /* 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"]);
  56056. /***/ }),
  56057. /***/ "./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb&":
  56058. /*!******************************************************************************!*\
  56059. !*** ./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb& ***!
  56060. \******************************************************************************/
  56061. /*! exports provided: render, staticRenderFns */
  56062. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56063. "use strict";
  56064. __webpack_require__.r(__webpack_exports__);
  56065. /* 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&");
  56066. /* 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"]; });
  56067. /* 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"]; });
  56068. /***/ }),
  56069. /***/ "./resources/js/components/modal.vue":
  56070. /*!*******************************************!*\
  56071. !*** ./resources/js/components/modal.vue ***!
  56072. \*******************************************/
  56073. /*! exports provided: default */
  56074. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56075. "use strict";
  56076. __webpack_require__.r(__webpack_exports__);
  56077. /* 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&");
  56078. /* 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");
  56079. var script = {}
  56080. /* normalize component */
  56081. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(
  56082. script,
  56083. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["render"],
  56084. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  56085. false,
  56086. null,
  56087. null,
  56088. null
  56089. )
  56090. /* hot reload */
  56091. if (false) { var api; }
  56092. component.options.__file = "resources/js/components/modal.vue"
  56093. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56094. /***/ }),
  56095. /***/ "./resources/js/components/modal.vue?vue&type=template&id=478d961c&":
  56096. /*!**************************************************************************!*\
  56097. !*** ./resources/js/components/modal.vue?vue&type=template&id=478d961c& ***!
  56098. \**************************************************************************/
  56099. /*! exports provided: render, staticRenderFns */
  56100. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56101. "use strict";
  56102. __webpack_require__.r(__webpack_exports__);
  56103. /* 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&");
  56104. /* 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"]; });
  56105. /* 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"]; });
  56106. /***/ }),
  56107. /***/ "./resources/js/components/note-form-modal.vue":
  56108. /*!*****************************************************!*\
  56109. !*** ./resources/js/components/note-form-modal.vue ***!
  56110. \*****************************************************/
  56111. /*! exports provided: default */
  56112. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56113. "use strict";
  56114. __webpack_require__.r(__webpack_exports__);
  56115. /* harmony import */ var _note_form_modal_vue_vue_type_template_id_0435c624___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./note-form-modal.vue?vue&type=template&id=0435c624& */ "./resources/js/components/note-form-modal.vue?vue&type=template&id=0435c624&");
  56116. /* harmony import */ var _note_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./note-form-modal.vue?vue&type=script&lang=js& */ "./resources/js/components/note-form-modal.vue?vue&type=script&lang=js&");
  56117. /* 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");
  56118. /* normalize component */
  56119. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  56120. _note_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  56121. _note_form_modal_vue_vue_type_template_id_0435c624___WEBPACK_IMPORTED_MODULE_0__["render"],
  56122. _note_form_modal_vue_vue_type_template_id_0435c624___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  56123. false,
  56124. null,
  56125. null,
  56126. null
  56127. )
  56128. /* hot reload */
  56129. if (false) { var api; }
  56130. component.options.__file = "resources/js/components/note-form-modal.vue"
  56131. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56132. /***/ }),
  56133. /***/ "./resources/js/components/note-form-modal.vue?vue&type=script&lang=js&":
  56134. /*!******************************************************************************!*\
  56135. !*** ./resources/js/components/note-form-modal.vue?vue&type=script&lang=js& ***!
  56136. \******************************************************************************/
  56137. /*! exports provided: default */
  56138. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56139. "use strict";
  56140. __webpack_require__.r(__webpack_exports__);
  56141. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_note_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./note-form-modal.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/note-form-modal.vue?vue&type=script&lang=js&");
  56142. /* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_note_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  56143. /***/ }),
  56144. /***/ "./resources/js/components/note-form-modal.vue?vue&type=template&id=0435c624&":
  56145. /*!************************************************************************************!*\
  56146. !*** ./resources/js/components/note-form-modal.vue?vue&type=template&id=0435c624& ***!
  56147. \************************************************************************************/
  56148. /*! exports provided: render, staticRenderFns */
  56149. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56150. "use strict";
  56151. __webpack_require__.r(__webpack_exports__);
  56152. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_note_form_modal_vue_vue_type_template_id_0435c624___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./note-form-modal.vue?vue&type=template&id=0435c624& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/note-form-modal.vue?vue&type=template&id=0435c624&");
  56153. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_note_form_modal_vue_vue_type_template_id_0435c624___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  56154. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_note_form_modal_vue_vue_type_template_id_0435c624___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  56155. /***/ }),
  56156. /***/ "./resources/js/components/notes.vue":
  56157. /*!*******************************************!*\
  56158. !*** ./resources/js/components/notes.vue ***!
  56159. \*******************************************/
  56160. /*! exports provided: default */
  56161. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56162. "use strict";
  56163. __webpack_require__.r(__webpack_exports__);
  56164. /* 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&");
  56165. /* 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&");
  56166. /* 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");
  56167. /* normalize component */
  56168. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  56169. _notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  56170. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["render"],
  56171. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  56172. false,
  56173. null,
  56174. null,
  56175. null
  56176. )
  56177. /* hot reload */
  56178. if (false) { var api; }
  56179. component.options.__file = "resources/js/components/notes.vue"
  56180. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56181. /***/ }),
  56182. /***/ "./resources/js/components/notes.vue?vue&type=script&lang=js&":
  56183. /*!********************************************************************!*\
  56184. !*** ./resources/js/components/notes.vue?vue&type=script&lang=js& ***!
  56185. \********************************************************************/
  56186. /*! exports provided: default */
  56187. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56188. "use strict";
  56189. __webpack_require__.r(__webpack_exports__);
  56190. /* 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&");
  56191. /* 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"]);
  56192. /***/ }),
  56193. /***/ "./resources/js/components/notes.vue?vue&type=template&id=73d141f4&":
  56194. /*!**************************************************************************!*\
  56195. !*** ./resources/js/components/notes.vue?vue&type=template&id=73d141f4& ***!
  56196. \**************************************************************************/
  56197. /*! exports provided: render, staticRenderFns */
  56198. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56199. "use strict";
  56200. __webpack_require__.r(__webpack_exports__);
  56201. /* 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&");
  56202. /* 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"]; });
  56203. /* 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"]; });
  56204. /***/ }),
  56205. /***/ "./resources/js/components/woinfo-edit-modal.vue":
  56206. /*!*******************************************************!*\
  56207. !*** ./resources/js/components/woinfo-edit-modal.vue ***!
  56208. \*******************************************************/
  56209. /*! exports provided: default */
  56210. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56211. "use strict";
  56212. __webpack_require__.r(__webpack_exports__);
  56213. /* 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&");
  56214. /* 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&");
  56215. /* 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");
  56216. /* normalize component */
  56217. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  56218. _woinfo_edit_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  56219. _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["render"],
  56220. _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  56221. false,
  56222. null,
  56223. null,
  56224. null
  56225. )
  56226. /* hot reload */
  56227. if (false) { var api; }
  56228. component.options.__file = "resources/js/components/woinfo-edit-modal.vue"
  56229. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56230. /***/ }),
  56231. /***/ "./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js&":
  56232. /*!********************************************************************************!*\
  56233. !*** ./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js& ***!
  56234. \********************************************************************************/
  56235. /*! exports provided: default */
  56236. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56237. "use strict";
  56238. __webpack_require__.r(__webpack_exports__);
  56239. /* 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&");
  56240. /* 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"]);
  56241. /***/ }),
  56242. /***/ "./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4&":
  56243. /*!**************************************************************************************!*\
  56244. !*** ./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4& ***!
  56245. \**************************************************************************************/
  56246. /*! exports provided: render, staticRenderFns */
  56247. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56248. "use strict";
  56249. __webpack_require__.r(__webpack_exports__);
  56250. /* 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&");
  56251. /* 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"]; });
  56252. /* 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"]; });
  56253. /***/ }),
  56254. /***/ "./resources/js/components/woinfo.vue":
  56255. /*!********************************************!*\
  56256. !*** ./resources/js/components/woinfo.vue ***!
  56257. \********************************************/
  56258. /*! exports provided: default */
  56259. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56260. "use strict";
  56261. __webpack_require__.r(__webpack_exports__);
  56262. /* 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&");
  56263. /* 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&");
  56264. /* 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");
  56265. /* normalize component */
  56266. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  56267. _woinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  56268. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["render"],
  56269. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  56270. false,
  56271. null,
  56272. null,
  56273. null
  56274. )
  56275. /* hot reload */
  56276. if (false) { var api; }
  56277. component.options.__file = "resources/js/components/woinfo.vue"
  56278. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56279. /***/ }),
  56280. /***/ "./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  56281. /*!*********************************************************************!*\
  56282. !*** ./resources/js/components/woinfo.vue?vue&type=script&lang=js& ***!
  56283. \*********************************************************************/
  56284. /*! exports provided: default */
  56285. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56286. "use strict";
  56287. __webpack_require__.r(__webpack_exports__);
  56288. /* 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&");
  56289. /* 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"]);
  56290. /***/ }),
  56291. /***/ "./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de&":
  56292. /*!***************************************************************************!*\
  56293. !*** ./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de& ***!
  56294. \***************************************************************************/
  56295. /*! exports provided: render, staticRenderFns */
  56296. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56297. "use strict";
  56298. __webpack_require__.r(__webpack_exports__);
  56299. /* 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&");
  56300. /* 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"]; });
  56301. /* 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"]; });
  56302. /***/ }),
  56303. /***/ "./resources/js/mixins/dateMixin.js":
  56304. /*!******************************************!*\
  56305. !*** ./resources/js/mixins/dateMixin.js ***!
  56306. \******************************************/
  56307. /*! exports provided: default */
  56308. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56309. "use strict";
  56310. __webpack_require__.r(__webpack_exports__);
  56311. /* harmony default export */ __webpack_exports__["default"] = ({
  56312. methods: {
  56313. treatAsUTC: function treatAsUTC(date) {
  56314. var result = new Date(date);
  56315. result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
  56316. return result;
  56317. },
  56318. daysSinceToday: function daysSinceToday(date) {
  56319. var currentDate = new Date();
  56320. var millisecondsPerDay = 24 * 60 * 60 * 1000;
  56321. return (this.treatAsUTC(currentDate) - this.treatAsUTC(date)) / millisecondsPerDay;
  56322. },
  56323. getHRDate: function getHRDate(dateString) {
  56324. var date = new Date(dateString);
  56325. return date.toLocaleString('default', {
  56326. month: 'short',
  56327. day: 'numeric',
  56328. year: 'numeric',
  56329. hour: 'numeric',
  56330. minute: 'numeric'
  56331. });
  56332. },
  56333. isZero: function isZero(dateString) {
  56334. return dateString === '0000-00-00 00:00:00';
  56335. }
  56336. }
  56337. });
  56338. /***/ }),
  56339. /***/ "./resources/js/notify.min.js":
  56340. /*!************************************!*\
  56341. !*** ./resources/js/notify.min.js ***!
  56342. \************************************/
  56343. /*! no static exports found */
  56344. /***/ (function(module, exports, __webpack_require__) {
  56345. 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); }
  56346. (function (e) {
  56347. true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (e),
  56348. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  56349. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  56350. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
  56351. })(function (e) {
  56352. function A(t, n, i) {
  56353. typeof i == "string" && (i = {
  56354. className: i
  56355. }), 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);
  56356. }
  56357. var t = [].indexOf || function (e) {
  56358. for (var t = 0, n = this.length; t < n; t++) {
  56359. if (t in this && this[t] === e) return t;
  56360. }
  56361. return -1;
  56362. },
  56363. n = "notify",
  56364. r = n + "js",
  56365. i = n + "!blank",
  56366. s = {
  56367. t: "top",
  56368. m: "middle",
  56369. b: "bottom",
  56370. l: "left",
  56371. c: "center",
  56372. r: "right"
  56373. },
  56374. o = ["l", "c", "r"],
  56375. u = ["t", "m", "b"],
  56376. a = ["t", "b", "l", "r"],
  56377. f = {
  56378. t: "b",
  56379. m: null,
  56380. b: "t",
  56381. l: "r",
  56382. c: null,
  56383. r: "l"
  56384. },
  56385. l = function l(t) {
  56386. var n;
  56387. return n = [], e.each(t.split(/\W+/), function (e, t) {
  56388. var r;
  56389. r = t.toLowerCase().charAt(0);
  56390. if (s[r]) return n.push(r);
  56391. }), n;
  56392. },
  56393. c = {},
  56394. h = {
  56395. name: "core",
  56396. html: '<div class="' + r + '-wrapper">\n <div class="' + r + '-arrow"></div>\n <div class="' + r + '-container"></div>\n</div>',
  56397. 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}"
  56398. },
  56399. p = {
  56400. "border-radius": ["-webkit-", "-moz-"]
  56401. },
  56402. d = function d(e) {
  56403. return c[e];
  56404. },
  56405. v = function v(e) {
  56406. if (!e) throw "Missing Style name";
  56407. c[e] && delete c[e];
  56408. },
  56409. m = function m(t, i) {
  56410. if (!t) throw "Missing Style name";
  56411. if (!i) throw "Missing Style definition";
  56412. if (!i.html) throw "Missing Style HTML";
  56413. var s = c[t];
  56414. s && s.cssElem && (window.console && console.warn(n + ": overwriting style '" + t + "'"), c[t].cssElem.remove()), i.name = t, c[t] = i;
  56415. var o = "";
  56416. i.classes && e.each(i.classes, function (t, n) {
  56417. return o += "." + r + "-" + i.name + "-" + t + " {\n", e.each(n, function (t, n) {
  56418. return p[t] && e.each(p[t], function (e, r) {
  56419. return o += " " + r + t + ": " + n + ";\n";
  56420. }), o += " " + t + ": " + n + ";\n";
  56421. }), o += "}\n";
  56422. }), i.css && (o += "/* styles for " + i.name + " */\n" + i.css), o && (i.cssElem = g(o), i.cssElem.attr("id", "notify-" + i.name));
  56423. var u = {},
  56424. a = e(i.html);
  56425. y("html", a, u), y("text", a, u), i.fields = u;
  56426. },
  56427. g = function g(t) {
  56428. var n, r, i;
  56429. r = x("style"), r.attr("type", "text/css"), e("head").append(r);
  56430. try {
  56431. r.html(t);
  56432. } catch (s) {
  56433. r[0].styleSheet.cssText = t;
  56434. }
  56435. return r;
  56436. },
  56437. y = function y(t, n, r) {
  56438. var s;
  56439. return t !== "html" && (t = "text"), s = "data-notify-" + t, b(n, "[" + s + "]").each(function () {
  56440. var n;
  56441. n = e(this).attr(s), n || (n = i), r[n] = t;
  56442. });
  56443. },
  56444. b = function b(e, t) {
  56445. return e.is(t) ? e : e.find(t);
  56446. },
  56447. w = {
  56448. clickToHide: !0,
  56449. autoHide: !0,
  56450. autoHideDelay: 5e3,
  56451. arrowShow: !0,
  56452. arrowSize: 5,
  56453. breakNewLines: !0,
  56454. elementPosition: "bottom",
  56455. globalPosition: "top right",
  56456. style: "bootstrap",
  56457. className: "error",
  56458. showAnimation: "slideDown",
  56459. showDuration: 400,
  56460. hideAnimation: "slideUp",
  56461. hideDuration: 200,
  56462. gap: 5
  56463. },
  56464. E = function E(t, n) {
  56465. var r;
  56466. return r = function r() {}, r.prototype = t, e.extend(!0, new r(), n);
  56467. },
  56468. S = function S(t) {
  56469. return e.extend(w, t);
  56470. },
  56471. x = function x(t) {
  56472. return e("<" + t + "></" + t + ">");
  56473. },
  56474. T = {},
  56475. N = function N(t) {
  56476. var n;
  56477. return t.is("[type=radio]") && (n = t.parents("form:first").find("[type=radio]").filter(function (n, r) {
  56478. return e(r).attr("name") === t.attr("name");
  56479. }), t = n.first()), t;
  56480. },
  56481. C = function C(e, t, n) {
  56482. var r, i;
  56483. if (typeof n == "string") n = parseInt(n, 10);else if (typeof n != "number") return;
  56484. if (isNaN(n)) return;
  56485. 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;
  56486. },
  56487. k = function k(e, t, n) {
  56488. if (e === "l" || e === "t") return 0;
  56489. if (e === "c" || e === "m") return n / 2 - t / 2;
  56490. if (e === "r" || e === "b") return n - t;
  56491. throw "Invalid alignment";
  56492. },
  56493. L = function L(e) {
  56494. return L.e = L.e || x("div"), L.e.text(e).html();
  56495. };
  56496. A.prototype.loadHTML = function () {
  56497. var t;
  56498. t = this.getStyle(), this.userContainer = e(t.html), this.userFields = t.fields;
  56499. }, A.prototype.show = function (e, t) {
  56500. var n, r, i, s, o;
  56501. r = function (n) {
  56502. return function () {
  56503. !e && !n.elem && n.destroy();
  56504. if (t) return t();
  56505. };
  56506. }(this), o = this.container.parent().parents(":hidden").length > 0, i = this.container.add(this.arrow), n = [];
  56507. 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 {
  56508. if (!!o || !!e) return r();
  56509. s = this.options.hideAnimation, n.push(this.options.hideDuration);
  56510. }
  56511. return n.push(r), i[s].apply(i, n);
  56512. }, A.prototype.setGlobalPosition = function () {
  56513. var t = this.getPosition(),
  56514. n = t[0],
  56515. i = t[1],
  56516. o = s[n],
  56517. u = s[i],
  56518. a = n + "|" + i,
  56519. f = T[a];
  56520. if (!f || !document.body.contains(f[0])) {
  56521. f = T[a] = x("div");
  56522. var l = {};
  56523. 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);
  56524. }
  56525. return f.prepend(this.wrapper);
  56526. }, A.prototype.setElementPosition = function () {
  56527. 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;
  56528. 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"];
  56529. for (w = 0, S = B.length; w < S; w++) {
  56530. D = B[w], N = parseInt(this.elem.css("margin-" + D), 10), N && C(p, D, N);
  56531. }
  56532. b = Math.max(0, this.options.gap - (this.options.arrowShow ? i : 0)), C(p, A, b);
  56533. if (!this.options.arrowShow) this.arrow.hide();else {
  56534. 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";
  56535. for (E = 0, x = a.length; E < x; E++) {
  56536. D = a[E], P = s[D];
  56537. if (D === L) continue;
  56538. l = P === T ? n : "transparent", r["border-" + P] = i + "px solid " + l;
  56539. }
  56540. C(p, s[L], i), t.call(a, O) >= 0 && C(r, s[O], i * 2);
  56541. }
  56542. 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);
  56543. if (r) return this.arrow.removeAttr("style").css(r);
  56544. }, A.prototype.getPosition = function () {
  56545. var e, n, r, i, s, f, c, h;
  56546. h = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition), e = l(h), e.length === 0 && (e[0] = "b");
  56547. if (n = e[0], t.call(a, n) < 0) throw "Must be one of [" + a + "]";
  56548. 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";
  56549. return e.length === 2 && (e[2] = e[1]), e;
  56550. }, A.prototype.getStyle = function (e) {
  56551. var t;
  56552. e || (e = this.options.style), e || (e = "default"), t = c[e];
  56553. if (!t) throw "Missing style: " + e;
  56554. return t;
  56555. }, A.prototype.updateClasses = function () {
  56556. var t, n;
  56557. 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) {
  56558. return r + "-" + n.name + "-" + e;
  56559. }).join(" "), this.userContainer.attr("class", t);
  56560. }, A.prototype.run = function (t, n) {
  56561. var r, s, o, u, a;
  56562. e.isPlainObject(n) ? e.extend(this.options, n) : e.type(n) === "string" && (this.options.className = n);
  56563. if (this.container && !t) {
  56564. this.show(!1);
  56565. return;
  56566. }
  56567. if (!this.container && !t) return;
  56568. s = {}, e.isPlainObject(t) ? s = t : s[i] = t;
  56569. for (o in s) {
  56570. r = s[o], u = this.userFields[o];
  56571. if (!u) continue;
  56572. 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);
  56573. }
  56574. 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));
  56575. }, A.prototype.destroy = function () {
  56576. this.wrapper.data(r, null), this.wrapper.remove();
  56577. }, e[n] = function (t, r, i) {
  56578. return t && t.nodeName || t.jquery ? e(t)[n](r, i) : (i = r, r = t, new A(null, r, i)), t;
  56579. }, e.fn[n] = function (t, n) {
  56580. return e(this).each(function () {
  56581. var i = N(e(this)).data(r);
  56582. i && i.destroy();
  56583. var s = new A(e(this), t, n);
  56584. }), this;
  56585. }, e.extend(e[n], {
  56586. defaults: S,
  56587. addStyle: m,
  56588. removeStyle: v,
  56589. pluginOptions: w,
  56590. getStyle: d,
  56591. insertCSS: g
  56592. }), m("bootstrap", {
  56593. html: "<div>\n<span data-notify-text></span>\n</div>",
  56594. classes: {
  56595. base: {
  56596. "font-weight": "bold",
  56597. padding: "8px 15px 8px 14px",
  56598. "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
  56599. "background-color": "#fcf8e3",
  56600. border: "1px solid #fbeed5",
  56601. "border-radius": "4px",
  56602. "white-space": "nowrap",
  56603. "padding-left": "25px",
  56604. "background-repeat": "no-repeat",
  56605. "background-position": "3px 7px"
  56606. },
  56607. error: {
  56608. color: "#B94A48",
  56609. "background-color": "#F2DEDE",
  56610. "border-color": "#EED3D7",
  56611. "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=)"
  56612. },
  56613. success: {
  56614. color: "#468847",
  56615. "background-color": "#DFF0D8",
  56616. "border-color": "#D6E9C6",
  56617. "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==)"
  56618. },
  56619. info: {
  56620. color: "#3A87AD",
  56621. "background-color": "#D9EDF7",
  56622. "border-color": "#BCE8F1",
  56623. "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=)"
  56624. },
  56625. warn: {
  56626. color: "#C09853",
  56627. "background-color": "#FCF8E3",
  56628. "border-color": "#FBEED5",
  56629. "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)"
  56630. }
  56631. }
  56632. }), e(function () {
  56633. g(h.css).attr("id", "core-notify"), e(document).on("click", "." + r + "-hidable", function (t) {
  56634. e(this).trigger("notify-hide");
  56635. }), e(document).on("notify-hide", "." + r + "-wrapper", function (t) {
  56636. var n = e(this).data(r);
  56637. n && n.show(!1);
  56638. });
  56639. });
  56640. });
  56641. /***/ }),
  56642. /***/ "./resources/sass/app.scss":
  56643. /*!*********************************!*\
  56644. !*** ./resources/sass/app.scss ***!
  56645. \*********************************/
  56646. /*! no static exports found */
  56647. /***/ (function(module, exports) {
  56648. // removed by extract-text-webpack-plugin
  56649. /***/ }),
  56650. /***/ 0:
  56651. /*!*************************************************************!*\
  56652. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  56653. \*************************************************************/
  56654. /*! no static exports found */
  56655. /***/ (function(module, exports, __webpack_require__) {
  56656. __webpack_require__(/*! /home/vagrant/upccrt/resources/js/app.js */"./resources/js/app.js");
  56657. module.exports = __webpack_require__(/*! /home/vagrant/upccrt/resources/sass/app.scss */"./resources/sass/app.scss");
  56658. /***/ })
  56659. /******/ });