app.js 2.0 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227602286022960230602316023260233602346023560236602376023860239602406024160242602436024460245602466024760248602496025060251602526025360254602556025660257602586025960260602616026260263602646026560266602676026860269602706027160272602736027460275602766027760278602796028060281602826028360284602856028660287602886028960290602916029260293602946029560296602976029860299603006030160302603036030460305603066030760308603096031060311603126031360314603156031660317603186031960320603216032260323603246032560326603276032860329603306033160332603336033460335603366033760338603396034060341603426034360344603456034660347603486034960350603516035260353603546035560356603576035860359603606036160362603636036460365603666036760368603696037060371603726037360374603756037660377603786037960380603816038260383603846038560386603876038860389603906039160392603936039460395603966039760398603996040060401604026040360404604056040660407604086040960410604116041260413604146041560416604176041860419604206042160422604236042460425604266042760428604296043060431604326043360434604356043660437604386043960440604416044260443604446044560446604476044860449604506045160452604536045460455604566045760458604596046060461604626046360464604656046660467604686046960470604716047260473604746047560476604776047860479604806048160482604836048460485604866048760488604896049060491604926049360494604956049660497604986049960500605016050260503605046050560506605076050860509605106051160512605136051460515605166051760518605196052060521605226052360524605256052660527605286052960530605316053260533605346053560536605376053860539605406054160542605436054460545605466054760548605496055060551605526055360554605556055660557605586055960560605616056260563605646056560566605676056860569605706057160572605736057460575605766057760578605796058060581605826058360584605856058660587605886058960590605916059260593605946059560596605976059860599606006060160602606036060460605606066060760608606096061060611606126061360614606156061660617606186061960620606216062260623606246062560626606276062860629606306063160632606336063460635606366063760638606396064060641606426064360644606456064660647606486064960650606516065260653606546065560656606576065860659606606066160662606636066460665606666066760668606696067060671606726067360674606756067660677606786067960680606816068260683606846068560686606876068860689606906069160692606936069460695606966069760698606996070060701607026070360704607056070660707607086070960710607116071260713607146071560716607176071860719607206072160722607236072460725607266072760728607296073060731607326073360734607356073660737607386073960740607416074260743607446074560746607476074860749607506075160752607536075460755607566075760758607596076060761607626076360764607656076660767607686076960770607716077260773607746077560776607776077860779607806078160782607836078460785607866078760788607896079060791607926079360794607956079660797607986079960800608016080260803608046080560806608076080860809608106081160812608136081460815608166081760818608196082060821608226082360824608256082660827608286082960830608316083260833608346083560836608376083860839608406084160842608436084460845608466084760848608496085060851608526085360854608556085660857608586085960860608616086260863608646086560866608676086860869608706087160872608736087460875608766087760878608796088060881608826088360884608856088660887608886088960890608916089260893608946089560896608976089860899609006090160902609036090460905609066090760908609096091060911609126091360914609156091660917609186091960920609216092260923609246092560926609276092860929609306093160932609336093460935609366093760938609396094060941609426094360944609456094660947609486094960950609516095260953609546095560956609576095860959609606096160962609636096460965609666096760968609696097060971609726097360974609756097660977609786097960980609816098260983609846098560986609876098860989609906099160992609936099460995609966099760998609996100061001610026100361004610056100661007610086100961010610116101261013610146101561016610176101861019610206102161022610236102461025610266102761028610296103061031610326103361034610356103661037610386103961040610416104261043610446104561046610476104861049610506105161052610536105461055610566105761058610596106061061610626106361064610656106661067610686106961070610716107261073610746107561076610776107861079610806108161082610836108461085610866108761088610896109061091610926109361094610956109661097610986109961100611016110261103611046110561106611076110861109611106111161112611136111461115611166111761118611196112061121611226112361124611256112661127611286112961130611316113261133611346113561136611376113861139611406114161142611436114461145611466114761148611496115061151611526115361154611556115661157611586115961160611616116261163611646116561166611676116861169611706117161172611736117461175611766117761178611796118061181611826118361184611856118661187611886118961190611916119261193611946119561196611976119861199612006120161202612036120461205612066120761208612096121061211612126121361214612156121661217612186121961220612216122261223612246122561226612276122861229612306123161232612336123461235612366123761238612396124061241612426124361244612456124661247612486124961250612516125261253612546125561256612576125861259612606126161262612636126461265612666126761268612696127061271612726127361274612756127661277612786127961280612816128261283612846128561286612876128861289612906129161292612936129461295612966129761298612996130061301613026130361304613056130661307613086130961310613116131261313613146131561316613176131861319613206132161322613236132461325613266132761328613296133061331613326133361334613356133661337613386133961340613416134261343613446134561346613476134861349613506135161352613536135461355613566135761358613596136061361613626136361364613656136661367613686136961370613716137261373613746137561376613776137861379613806138161382613836138461385613866138761388613896139061391613926139361394613956139661397613986139961400614016140261403614046140561406614076140861409614106141161412614136141461415614166141761418614196142061421614226142361424614256142661427614286142961430614316143261433614346143561436614376143861439614406144161442614436144461445614466144761448614496145061451614526145361454614556145661457614586145961460614616146261463614646146561466614676146861469614706147161472614736147461475614766147761478614796148061481614826148361484614856148661487614886148961490614916149261493614946149561496614976149861499615006150161502615036150461505615066150761508615096151061511615126151361514615156151661517615186151961520615216152261523615246152561526615276152861529615306153161532615336153461535615366153761538615396154061541615426154361544615456154661547615486154961550615516155261553615546155561556615576155861559615606156161562615636156461565615666156761568615696157061571615726157361574615756157661577615786157961580615816158261583615846158561586615876158861589615906159161592615936159461595615966159761598615996160061601616026160361604616056160661607616086160961610616116161261613616146161561616616176161861619616206162161622616236162461625616266162761628616296163061631616326163361634616356163661637616386163961640616416164261643616446164561646616476164861649616506165161652616536165461655616566165761658616596166061661616626166361664616656166661667616686166961670616716167261673616746167561676616776167861679616806168161682616836168461685616866168761688616896169061691616926169361694616956169661697616986169961700617016170261703617046170561706617076170861709617106171161712617136171461715617166171761718617196172061721617226172361724617256172661727617286172961730617316173261733617346173561736617376173861739617406174161742617436174461745617466174761748617496175061751617526175361754617556175661757617586175961760617616176261763617646176561766617676176861769617706177161772617736177461775617766177761778617796178061781617826178361784617856178661787617886178961790617916179261793617946179561796617976179861799618006180161802618036180461805618066180761808618096181061811618126181361814618156181661817618186181961820618216182261823618246182561826618276182861829618306183161832618336183461835618366183761838618396184061841618426184361844618456184661847618486184961850618516185261853618546185561856618576185861859618606186161862618636186461865618666186761868618696187061871618726187361874618756187661877618786187961880618816188261883618846188561886618876188861889618906189161892618936189461895618966189761898618996190061901619026190361904619056190661907619086190961910619116191261913619146191561916619176191861919619206192161922619236192461925619266192761928619296193061931619326193361934619356193661937619386193961940619416194261943619446194561946619476194861949619506195161952619536195461955619566195761958619596196061961619626196361964619656196661967619686196961970619716197261973619746197561976619776197861979619806198161982619836198461985619866198761988619896199061991619926199361994619956199661997619986199962000620016200262003620046200562006620076200862009620106201162012620136201462015620166201762018620196202062021620226202362024620256202662027620286202962030620316203262033620346203562036620376203862039620406204162042620436204462045620466204762048620496205062051620526205362054620556205662057620586205962060620616206262063620646206562066620676206862069620706207162072620736207462075620766207762078620796208062081620826208362084620856208662087620886208962090620916209262093620946209562096620976209862099621006210162102621036210462105621066210762108621096211062111621126211362114621156211662117621186211962120621216212262123621246212562126621276212862129621306213162132621336213462135621366213762138621396214062141621426214362144621456214662147621486214962150621516215262153621546215562156621576215862159621606216162162621636216462165621666216762168621696217062171621726217362174621756217662177621786217962180621816218262183621846218562186621876218862189621906219162192621936219462195621966219762198621996220062201622026220362204622056220662207622086220962210622116221262213622146221562216622176221862219622206222162222622236222462225622266222762228622296223062231622326223362234622356223662237622386223962240622416224262243622446224562246622476224862249622506225162252622536225462255622566225762258622596226062261622626226362264622656226662267622686226962270622716227262273622746227562276622776227862279622806228162282622836228462285622866228762288622896229062291622926229362294622956229662297622986229962300623016230262303623046230562306623076230862309623106231162312623136231462315623166231762318623196232062321623226232362324623256232662327623286232962330623316233262333623346233562336623376233862339623406234162342623436234462345623466234762348623496235062351623526235362354623556235662357623586235962360623616236262363623646236562366623676236862369623706237162372623736237462375623766237762378623796238062381623826238362384623856238662387623886238962390623916239262393623946239562396623976239862399624006240162402624036240462405624066240762408624096241062411624126241362414624156241662417624186241962420624216242262423624246242562426624276242862429624306243162432624336243462435624366243762438624396244062441624426244362444624456244662447624486244962450624516245262453624546245562456624576245862459624606246162462624636246462465624666246762468624696247062471624726247362474624756247662477624786247962480624816248262483624846248562486624876248862489624906249162492624936249462495624966249762498624996250062501625026250362504625056250662507625086250962510625116251262513625146251562516625176251862519625206252162522625236252462525625266252762528625296253062531625326253362534625356253662537625386253962540625416254262543625446254562546625476254862549625506255162552625536255462555625566255762558625596256062561625626256362564625656256662567625686256962570625716257262573625746257562576625776257862579625806258162582625836258462585625866258762588625896259062591625926259362594625956259662597625986259962600626016260262603626046260562606626076260862609626106261162612626136261462615626166261762618626196262062621626226262362624626256262662627626286262962630626316263262633626346263562636626376263862639626406264162642626436264462645626466264762648626496265062651626526265362654626556265662657626586265962660626616266262663626646266562666626676266862669626706267162672626736267462675626766267762678626796268062681626826268362684626856268662687626886268962690626916269262693626946269562696626976269862699627006270162702627036270462705627066270762708627096271062711627126271362714627156271662717627186271962720627216272262723627246272562726627276272862729627306273162732627336273462735627366273762738627396274062741627426274362744627456274662747627486274962750627516275262753627546275562756627576275862759627606276162762627636276462765627666276762768627696277062771627726277362774627756277662777627786277962780627816278262783627846278562786627876278862789627906279162792627936279462795627966279762798627996280062801628026280362804628056280662807628086280962810628116281262813628146281562816628176281862819628206282162822628236282462825628266282762828628296283062831628326283362834628356283662837628386283962840628416284262843628446284562846628476284862849628506285162852628536285462855628566285762858628596286062861628626286362864628656286662867628686286962870628716287262873628746287562876628776287862879628806288162882628836288462885628866288762888628896289062891628926289362894628956289662897628986289962900629016290262903629046290562906629076290862909629106291162912629136291462915629166291762918629196292062921629226292362924629256292662927629286292962930629316293262933629346293562936629376293862939629406294162942629436294462945629466294762948629496295062951629526295362954629556295662957629586295962960629616296262963629646296562966629676296862969629706297162972629736297462975629766297762978629796298062981629826298362984629856298662987629886298962990629916299262993629946299562996629976299862999630006300163002630036300463005630066300763008630096301063011630126301363014630156301663017630186301963020630216302263023630246302563026630276302863029630306303163032630336303463035630366303763038630396304063041630426304363044630456304663047630486304963050630516305263053630546305563056630576305863059630606306163062630636306463065630666306763068630696307063071630726307363074630756307663077630786307963080630816308263083630846308563086630876308863089630906309163092630936309463095630966309763098630996310063101631026310363104631056310663107631086310963110631116311263113631146311563116631176311863119631206312163122631236312463125631266312763128631296313063131631326313363134631356313663137631386313963140631416314263143631446314563146631476314863149631506315163152631536315463155631566315763158631596316063161631626316363164631656316663167631686316963170631716317263173631746317563176631776317863179631806318163182631836318463185631866318763188631896319063191631926319363194631956319663197631986319963200632016320263203632046320563206632076320863209632106321163212632136321463215632166321763218632196322063221632226322363224632256322663227632286322963230632316323263233632346323563236632376323863239632406324163242632436324463245632466324763248632496325063251632526325363254632556325663257632586325963260632616326263263632646326563266632676326863269632706327163272632736327463275632766327763278632796328063281632826328363284632856328663287632886328963290632916329263293632946329563296632976329863299633006330163302633036330463305633066330763308633096331063311633126331363314633156331663317633186331963320633216332263323633246332563326633276332863329633306333163332633336333463335633366333763338633396334063341633426334363344633456334663347633486334963350633516335263353633546335563356633576335863359633606336163362633636336463365633666336763368633696337063371633726337363374633756337663377633786337963380633816338263383633846338563386633876338863389633906339163392633936339463395633966339763398633996340063401634026340363404634056340663407634086340963410634116341263413634146341563416634176341863419634206342163422634236342463425634266342763428634296343063431634326343363434634356343663437634386343963440634416344263443634446344563446634476344863449634506345163452634536345463455634566345763458634596346063461634626346363464634656346663467634686346963470634716347263473634746347563476634776347863479634806348163482634836348463485634866348763488634896349063491634926349363494634956349663497634986349963500635016350263503635046350563506635076350863509635106351163512635136351463515635166351763518635196352063521635226352363524635256352663527635286352963530635316353263533635346353563536635376353863539635406354163542635436354463545635466354763548635496355063551635526355363554635556355663557635586355963560635616356263563635646356563566635676356863569635706357163572635736357463575635766357763578635796358063581635826358363584635856358663587635886358963590635916359263593635946359563596635976359863599636006360163602636036360463605636066360763608636096361063611636126361363614636156361663617636186361963620636216362263623636246362563626636276362863629636306363163632636336363463635636366363763638636396364063641636426364363644636456364663647636486364963650636516365263653636546365563656636576365863659636606366163662636636366463665636666366763668636696367063671636726367363674636756367663677636786367963680636816368263683636846368563686636876368863689636906369163692636936369463695636966369763698636996370063701637026370363704637056370663707637086370963710637116371263713637146371563716637176371863719637206372163722637236372463725637266372763728637296373063731637326373363734637356373663737637386373963740637416374263743637446374563746637476374863749637506375163752637536375463755637566375763758637596376063761637626376363764637656376663767637686376963770637716377263773637746377563776637776377863779637806378163782637836378463785637866378763788637896379063791637926379363794637956379663797637986379963800638016380263803638046380563806638076380863809638106381163812638136381463815638166381763818638196382063821638226382363824638256382663827638286382963830638316383263833638346383563836638376383863839638406384163842638436384463845638466384763848638496385063851638526385363854638556385663857638586385963860638616386263863638646386563866638676386863869638706387163872638736387463875638766387763878638796388063881638826388363884638856388663887638886388963890638916389263893638946389563896638976389863899639006390163902639036390463905639066390763908639096391063911639126391363914639156391663917639186391963920639216392263923639246392563926639276392863929639306393163932639336393463935639366393763938639396394063941639426394363944639456394663947639486394963950639516395263953639546395563956639576395863959639606396163962639636396463965639666396763968639696397063971639726397363974639756397663977639786397963980639816398263983639846398563986639876398863989639906399163992639936399463995639966399763998639996400064001640026400364004640056400664007640086400964010640116401264013640146401564016640176401864019640206402164022640236402464025640266402764028640296403064031640326403364034640356403664037640386403964040640416404264043640446404564046640476404864049640506405164052640536405464055640566405764058640596406064061640626406364064640656406664067640686406964070640716407264073640746407564076640776407864079640806408164082640836408464085640866408764088640896409064091640926409364094640956409664097640986409964100641016410264103641046410564106641076410864109641106411164112641136411464115641166411764118641196412064121641226412364124641256412664127641286412964130641316413264133641346413564136641376413864139641406414164142641436414464145641466414764148641496415064151641526415364154641556415664157641586415964160641616416264163641646416564166641676416864169641706417164172641736417464175641766417764178641796418064181641826418364184641856418664187641886418964190641916419264193641946419564196641976419864199642006420164202642036420464205642066420764208642096421064211642126421364214642156421664217642186421964220642216422264223642246422564226642276422864229642306423164232642336423464235642366423764238642396424064241642426424364244642456424664247642486424964250642516425264253642546425564256642576425864259642606426164262642636426464265642666426764268642696427064271642726427364274642756427664277642786427964280642816428264283642846428564286642876428864289642906429164292642936429464295642966429764298642996430064301643026430364304643056430664307643086430964310643116431264313643146431564316643176431864319643206432164322643236432464325643266432764328643296433064331643326433364334643356433664337643386433964340643416434264343643446434564346643476434864349643506435164352643536435464355643566435764358643596436064361643626436364364643656436664367643686436964370643716437264373643746437564376643776437864379643806438164382643836438464385643866438764388643896439064391643926439364394643956439664397643986439964400644016440264403644046440564406644076440864409644106441164412644136441464415644166441764418644196442064421644226442364424644256442664427644286442964430644316443264433644346443564436644376443864439644406444164442644436444464445644466444764448644496445064451644526445364454644556445664457644586445964460644616446264463644646446564466644676446864469644706447164472644736447464475644766447764478644796448064481644826448364484644856448664487644886448964490644916449264493644946449564496644976449864499645006450164502645036450464505645066450764508645096451064511645126451364514645156451664517645186451964520645216452264523645246452564526645276452864529645306453164532645336453464535645366453764538645396454064541645426454364544645456454664547645486454964550645516455264553645546455564556645576455864559645606456164562645636456464565645666456764568645696457064571645726457364574645756457664577645786457964580645816458264583645846458564586645876458864589645906459164592645936459464595645966459764598645996460064601646026460364604646056460664607646086460964610646116461264613646146461564616646176461864619646206462164622646236462464625646266462764628646296463064631646326463364634646356463664637646386463964640646416464264643646446464564646646476464864649646506465164652646536465464655646566465764658646596466064661646626466364664646656466664667646686466964670646716467264673646746467564676646776467864679646806468164682646836468464685646866468764688646896469064691646926469364694646956469664697646986469964700647016470264703647046470564706647076470864709647106471164712647136471464715647166471764718647196472064721647226472364724647256472664727647286472964730647316473264733647346473564736647376473864739647406474164742647436474464745647466474764748647496475064751647526475364754647556475664757647586475964760647616476264763647646476564766647676476864769647706477164772647736477464775647766477764778647796478064781647826478364784647856478664787647886478964790647916479264793647946479564796647976479864799648006480164802648036480464805648066480764808648096481064811648126481364814648156481664817648186481964820648216482264823648246482564826648276482864829648306483164832648336483464835648366483764838648396484064841648426484364844648456484664847648486484964850648516485264853648546485564856648576485864859648606486164862648636486464865648666486764868648696487064871648726487364874648756487664877648786487964880648816488264883648846488564886648876488864889648906489164892648936489464895648966489764898648996490064901649026490364904649056490664907649086490964910649116491264913649146491564916649176491864919649206492164922649236492464925649266492764928649296493064931649326493364934649356493664937649386493964940649416494264943649446494564946649476494864949649506495164952649536495464955649566495764958649596496064961649626496364964649656496664967649686496964970649716497264973649746497564976649776497864979649806498164982649836498464985649866498764988649896499064991649926499364994649956499664997649986499965000650016500265003650046500565006650076500865009650106501165012650136501465015650166501765018650196502065021650226502365024650256502665027650286502965030650316503265033650346503565036650376503865039650406504165042650436504465045650466504765048650496505065051650526505365054650556505665057650586505965060650616506265063650646506565066650676506865069650706507165072650736507465075650766507765078650796508065081650826508365084650856508665087650886508965090650916509265093650946509565096650976509865099651006510165102651036510465105651066510765108651096511065111651126511365114651156511665117651186511965120651216512265123651246512565126651276512865129651306513165132651336513465135651366513765138651396514065141651426514365144651456514665147651486514965150651516515265153651546515565156651576515865159651606516165162651636516465165651666516765168651696517065171651726517365174651756517665177651786517965180651816518265183651846518565186651876518865189651906519165192651936519465195651966519765198651996520065201652026520365204652056520665207652086520965210652116521265213652146521565216652176521865219652206522165222652236522465225652266522765228652296523065231652326523365234652356523665237652386523965240652416524265243652446524565246652476524865249652506525165252652536525465255652566525765258652596526065261652626526365264652656526665267652686526965270652716527265273652746527565276652776527865279652806528165282652836528465285652866528765288652896529065291652926529365294652956529665297652986529965300653016530265303653046530565306653076530865309653106531165312653136531465315653166531765318653196532065321653226532365324653256532665327653286532965330653316533265333653346533565336653376533865339653406534165342653436534465345653466534765348653496535065351653526535365354653556535665357653586535965360653616536265363653646536565366653676536865369653706537165372653736537465375653766537765378653796538065381653826538365384653856538665387653886538965390653916539265393653946539565396653976539865399654006540165402654036540465405654066540765408654096541065411654126541365414654156541665417654186541965420654216542265423654246542565426654276542865429654306543165432654336543465435654366543765438654396544065441654426544365444654456544665447654486544965450654516545265453654546545565456654576545865459654606546165462654636546465465654666546765468654696547065471654726547365474654756547665477654786547965480654816548265483654846548565486654876548865489654906549165492654936549465495654966549765498654996550065501655026550365504655056550665507655086550965510655116551265513655146551565516655176551865519655206552165522655236552465525655266552765528655296553065531655326553365534655356553665537655386553965540655416554265543655446554565546655476554865549655506555165552655536555465555655566555765558655596556065561655626556365564655656556665567655686556965570655716557265573655746557565576655776557865579655806558165582655836558465585655866558765588655896559065591655926559365594655956559665597655986559965600656016560265603656046560565606656076560865609656106561165612656136561465615656166561765618656196562065621656226562365624656256562665627656286562965630656316563265633656346563565636656376563865639656406564165642656436564465645656466564765648656496565065651656526565365654656556565665657656586565965660656616566265663656646566565666656676566865669656706567165672656736567465675656766567765678656796568065681656826568365684656856568665687656886568965690656916569265693656946569565696656976569865699657006570165702657036570465705657066570765708657096571065711657126571365714657156571665717657186571965720657216572265723657246572565726657276572865729657306573165732657336573465735657366573765738657396574065741657426574365744657456574665747657486574965750657516575265753657546575565756657576575865759657606576165762657636576465765657666576765768657696577065771657726577365774657756577665777657786577965780657816578265783657846578565786657876578865789657906579165792657936579465795657966579765798657996580065801658026580365804658056580665807658086580965810658116581265813658146581565816658176581865819658206582165822658236582465825658266582765828658296583065831658326583365834658356583665837658386583965840658416584265843658446584565846658476584865849658506585165852658536585465855658566585765858658596586065861658626586365864658656586665867658686586965870658716587265873658746587565876658776587865879658806588165882658836588465885658866588765888658896589065891658926589365894658956589665897658986589965900659016590265903659046590565906659076590865909659106591165912659136591465915659166591765918659196592065921659226592365924659256592665927659286592965930659316593265933659346593565936659376593865939659406594165942659436594465945659466594765948659496595065951659526595365954659556595665957659586595965960659616596265963659646596565966659676596865969659706597165972659736597465975659766597765978659796598065981659826598365984659856598665987659886598965990659916599265993659946599565996659976599865999660006600166002660036600466005660066600766008660096601066011660126601366014660156601666017660186601966020660216602266023660246602566026660276602866029660306603166032660336603466035660366603766038660396604066041660426604366044660456604666047660486604966050660516605266053660546605566056660576605866059660606606166062660636606466065660666606766068660696607066071660726607366074660756607666077660786607966080660816608266083660846608566086660876608866089660906609166092660936609466095660966609766098660996610066101661026610366104661056610666107661086610966110661116611266113661146611566116661176611866119661206612166122661236612466125661266612766128661296613066131661326613366134661356613666137661386613966140661416614266143661446614566146661476614866149661506615166152661536615466155661566615766158661596616066161661626616366164661656616666167661686616966170661716617266173661746617566176661776617866179661806618166182661836618466185661866618766188661896619066191661926619366194661956619666197661986619966200662016620266203662046620566206662076620866209662106621166212662136621466215662166621766218662196622066221662226622366224662256622666227662286622966230662316623266233662346623566236662376623866239662406624166242662436624466245662466624766248662496625066251662526625366254662556625666257662586625966260662616626266263662646626566266662676626866269662706627166272662736627466275662766627766278662796628066281662826628366284662856628666287662886628966290662916629266293662946629566296662976629866299663006630166302663036630466305663066630766308663096631066311663126631366314663156631666317663186631966320663216632266323663246632566326663276632866329663306633166332663336633466335663366633766338663396634066341663426634366344663456634666347663486634966350663516635266353663546635566356663576635866359663606636166362663636636466365663666636766368663696637066371663726637366374663756637666377663786637966380663816638266383663846638566386663876638866389663906639166392663936639466395663966639766398663996640066401664026640366404664056640666407664086640966410664116641266413664146641566416664176641866419664206642166422664236642466425664266642766428664296643066431664326643366434664356643666437664386643966440664416644266443664446644566446664476644866449664506645166452664536645466455664566645766458664596646066461664626646366464664656646666467664686646966470664716647266473664746647566476664776647866479664806648166482664836648466485664866648766488664896649066491664926649366494664956649666497664986649966500665016650266503665046650566506665076650866509665106651166512665136651466515665166651766518665196652066521665226652366524665256652666527665286652966530665316653266533665346653566536665376653866539665406654166542665436654466545665466654766548665496655066551665526655366554665556655666557665586655966560665616656266563665646656566566665676656866569665706657166572665736657466575665766657766578665796658066581665826658366584665856658666587665886658966590665916659266593665946659566596665976659866599666006660166602666036660466605666066660766608666096661066611666126661366614666156661666617666186661966620666216662266623666246662566626666276662866629666306663166632666336663466635666366663766638666396664066641666426664366644666456664666647666486664966650666516665266653666546665566656666576665866659666606666166662666636666466665666666666766668666696667066671666726667366674666756667666677666786667966680666816668266683666846668566686666876668866689666906669166692666936669466695666966669766698666996670066701667026670366704667056670666707667086670966710667116671266713667146671566716667176671866719667206672166722667236672466725667266672766728667296673066731667326673366734667356673666737667386673966740667416674266743667446674566746667476674866749667506675166752667536675466755667566675766758667596676066761667626676366764667656676666767667686676966770667716677266773667746677566776667776677866779667806678166782667836678466785667866678766788667896679066791667926679366794667956679666797667986679966800668016680266803668046680566806668076680866809668106681166812668136681466815668166681766818668196682066821668226682366824668256682666827668286682966830668316683266833668346683566836668376683866839668406684166842668436684466845668466684766848668496685066851668526685366854668556685666857668586685966860668616686266863668646686566866668676686866869668706687166872668736687466875668766687766878668796688066881668826688366884668856688666887668886688966890668916689266893668946689566896668976689866899669006690166902669036690466905669066690766908669096691066911669126691366914669156691666917669186691966920669216692266923669246692566926669276692866929669306693166932669336693466935669366693766938669396694066941669426694366944669456694666947669486694966950669516695266953669546695566956669576695866959669606696166962669636696466965669666696766968669696697066971669726697366974669756697666977669786697966980669816698266983669846698566986669876698866989669906699166992669936699466995669966699766998669996700067001670026700367004670056700667007670086700967010670116701267013670146701567016670176701867019670206702167022670236702467025670266702767028670296703067031670326703367034670356703667037670386703967040670416704267043670446704567046670476704867049670506705167052670536705467055670566705767058670596706067061670626706367064670656706667067670686706967070670716707267073670746707567076670776707867079670806708167082670836708467085670866708767088670896709067091670926709367094670956709667097670986709967100671016710267103671046710567106671076710867109671106711167112671136711467115671166711767118671196712067121671226712367124671256712667127671286712967130671316713267133671346713567136671376713867139671406714167142671436714467145671466714767148671496715067151671526715367154671556715667157671586715967160671616716267163671646716567166671676716867169671706717167172671736717467175671766717767178671796718067181671826718367184671856718667187671886718967190671916719267193671946719567196671976719867199672006720167202672036720467205672066720767208672096721067211672126721367214672156721667217672186721967220672216722267223672246722567226672276722867229672306723167232672336723467235672366723767238672396724067241672426724367244672456724667247672486724967250672516725267253672546725567256672576725867259672606726167262672636726467265672666726767268672696727067271672726727367274672756727667277672786727967280672816728267283672846728567286672876728867289672906729167292672936729467295672966729767298672996730067301673026730367304673056730667307673086730967310673116731267313673146731567316673176731867319673206732167322673236732467325673266732767328673296733067331673326733367334673356733667337673386733967340673416734267343673446734567346673476734867349673506735167352673536735467355673566735767358673596736067361673626736367364673656736667367673686736967370673716737267373673746737567376673776737867379673806738167382673836738467385673866738767388673896739067391673926739367394673956739667397673986739967400674016740267403674046740567406674076740867409674106741167412674136741467415674166741767418674196742067421674226742367424674256742667427674286742967430674316743267433674346743567436674376743867439674406744167442674436744467445674466744767448674496745067451674526745367454674556745667457674586745967460674616746267463674646746567466674676746867469674706747167472674736747467475674766747767478674796748067481674826748367484674856748667487674886748967490674916749267493674946749567496674976749867499675006750167502675036750467505675066750767508675096751067511675126751367514675156751667517675186751967520675216752267523675246752567526675276752867529675306753167532675336753467535675366753767538675396754067541675426754367544675456754667547675486754967550675516755267553675546755567556675576755867559675606756167562675636756467565675666756767568675696757067571675726757367574675756757667577675786757967580675816758267583675846758567586675876758867589675906759167592675936759467595675966759767598675996760067601676026760367604676056760667607676086760967610676116761267613676146761567616676176761867619676206762167622676236762467625676266762767628676296763067631676326763367634676356763667637676386763967640676416764267643676446764567646676476764867649676506765167652676536765467655676566765767658676596766067661676626766367664676656766667667676686766967670676716767267673676746767567676676776767867679676806768167682676836768467685676866768767688676896769067691676926769367694676956769667697676986769967700677016770267703677046770567706677076770867709677106771167712677136771467715677166771767718677196772067721677226772367724677256772667727677286772967730677316773267733677346773567736677376773867739677406774167742677436774467745677466774767748677496775067751677526775367754677556775667757677586775967760677616776267763677646776567766677676776867769677706777167772677736777467775677766777767778677796778067781677826778367784677856778667787677886778967790677916779267793677946779567796677976779867799678006780167802678036780467805678066780767808678096781067811678126781367814678156781667817678186781967820678216782267823678246782567826678276782867829678306783167832678336783467835678366783767838678396784067841678426784367844678456784667847678486784967850678516785267853678546785567856678576785867859678606786167862678636786467865678666786767868678696787067871678726787367874678756787667877678786787967880678816788267883678846788567886678876788867889678906789167892678936789467895678966789767898678996790067901679026790367904679056790667907679086790967910679116791267913679146791567916679176791867919679206792167922679236792467925679266792767928679296793067931679326793367934679356793667937679386793967940679416794267943679446794567946679476794867949679506795167952679536795467955679566795767958679596796067961679626796367964679656796667967679686796967970679716797267973679746797567976679776797867979679806798167982679836798467985679866798767988679896799067991679926799367994679956799667997679986799968000680016800268003680046800568006680076800868009680106801168012680136801468015680166801768018680196802068021680226802368024680256802668027680286802968030680316803268033680346803568036680376803868039680406804168042680436804468045680466804768048680496805068051680526805368054680556805668057680586805968060680616806268063680646806568066680676806868069680706807168072680736807468075680766807768078680796808068081680826808368084680856808668087680886808968090680916809268093680946809568096680976809868099681006810168102681036810468105681066810768108681096811068111681126811368114681156811668117681186811968120681216812268123681246812568126681276812868129681306813168132681336813468135681366813768138681396814068141681426814368144681456814668147681486814968150681516815268153681546815568156681576815868159681606816168162681636816468165681666816768168681696817068171681726817368174681756817668177681786817968180681816818268183681846818568186681876818868189681906819168192681936819468195681966819768198681996820068201682026820368204682056820668207682086820968210682116821268213682146821568216682176821868219682206822168222682236822468225682266822768228682296823068231682326823368234682356823668237682386823968240682416824268243682446824568246682476824868249682506825168252682536825468255682566825768258682596826068261682626826368264682656826668267682686826968270682716827268273682746827568276682776827868279682806828168282682836828468285682866828768288682896829068291682926829368294682956829668297682986829968300683016830268303683046830568306683076830868309683106831168312683136831468315683166831768318683196832068321683226832368324683256832668327683286832968330683316833268333683346833568336683376833868339683406834168342683436834468345683466834768348683496835068351683526835368354683556835668357683586835968360683616836268363683646836568366683676836868369683706837168372683736837468375683766837768378683796838068381683826838368384683856838668387683886838968390683916839268393683946839568396683976839868399684006840168402684036840468405684066840768408684096841068411684126841368414684156841668417684186841968420684216842268423684246842568426684276842868429684306843168432684336843468435684366843768438684396844068441684426844368444684456844668447684486844968450684516845268453684546845568456684576845868459684606846168462684636846468465684666846768468684696847068471684726847368474684756847668477684786847968480684816848268483684846848568486684876848868489684906849168492684936849468495684966849768498684996850068501685026850368504685056850668507685086850968510685116851268513685146851568516685176851868519685206852168522685236852468525685266852768528685296853068531685326853368534685356853668537685386853968540685416854268543685446854568546685476854868549685506855168552685536855468555685566855768558685596856068561685626856368564685656856668567685686856968570685716857268573685746857568576685776857868579685806858168582685836858468585685866858768588685896859068591685926859368594685956859668597685986859968600686016860268603686046860568606686076860868609686106861168612686136861468615686166861768618686196862068621686226862368624686256862668627686286862968630686316863268633686346863568636686376863868639686406864168642686436864468645686466864768648686496865068651686526865368654686556865668657686586865968660686616866268663686646866568666686676866868669686706867168672686736867468675686766867768678686796868068681686826868368684686856868668687686886868968690686916869268693686946869568696686976869868699687006870168702687036870468705687066870768708687096871068711687126871368714687156871668717687186871968720687216872268723687246872568726687276872868729687306873168732687336873468735687366873768738687396874068741687426874368744687456874668747687486874968750687516875268753687546875568756687576875868759687606876168762687636876468765687666876768768687696877068771687726877368774687756877668777687786877968780687816878268783687846878568786687876878868789687906879168792687936879468795687966879768798687996880068801688026880368804688056880668807688086880968810688116881268813688146881568816688176881868819688206882168822688236882468825688266882768828688296883068831688326883368834688356883668837688386883968840688416884268843688446884568846688476884868849688506885168852688536885468855688566885768858688596886068861688626886368864688656886668867688686886968870688716887268873688746887568876688776887868879688806888168882688836888468885688866888768888688896889068891688926889368894688956889668897688986889968900689016890268903689046890568906689076890868909689106891168912689136891468915689166891768918689196892068921689226892368924689256892668927689286892968930689316893268933689346893568936689376893868939689406894168942689436894468945689466894768948689496895068951689526895368954689556895668957689586895968960689616896268963689646896568966689676896868969689706897168972689736897468975689766897768978689796898068981689826898368984689856898668987689886898968990689916899268993689946899568996689976899868999690006900169002690036900469005690066900769008690096901069011690126901369014690156901669017690186901969020690216902269023690246902569026690276902869029690306903169032690336903469035690366903769038690396904069041690426904369044690456904669047690486904969050690516905269053690546905569056690576905869059690606906169062690636906469065690666906769068690696907069071690726907369074690756907669077690786907969080690816908269083690846908569086690876908869089690906909169092690936909469095690966909769098690996910069101691026910369104691056910669107691086910969110691116911269113691146911569116691176911869119691206912169122691236912469125691266912769128691296913069131691326913369134691356913669137691386913969140691416914269143691446914569146691476914869149691506915169152691536915469155691566915769158691596916069161691626916369164691656916669167691686916969170691716917269173691746917569176691776917869179691806918169182691836918469185691866918769188691896919069191691926919369194691956919669197691986919969200692016920269203692046920569206692076920869209692106921169212692136921469215692166921769218692196922069221692226922369224692256922669227692286922969230692316923269233692346923569236692376923869239692406924169242692436924469245692466924769248692496925069251692526925369254692556925669257692586925969260692616926269263692646926569266692676926869269692706927169272692736927469275692766927769278692796928069281692826928369284692856928669287692886928969290692916929269293692946929569296692976929869299693006930169302693036930469305693066930769308693096931069311693126931369314693156931669317693186931969320693216932269323693246932569326693276932869329693306933169332693336933469335693366933769338693396934069341693426934369344693456934669347693486934969350693516935269353693546935569356693576935869359693606936169362693636936469365693666936769368693696937069371693726937369374693756937669377693786937969380693816938269383693846938569386693876938869389693906939169392693936939469395693966939769398693996940069401694026940369404694056940669407694086940969410694116941269413694146941569416694176941869419694206942169422694236942469425694266942769428694296943069431694326943369434694356943669437694386943969440694416944269443694446944569446694476944869449694506945169452694536945469455694566945769458694596946069461694626946369464694656946669467694686946969470694716947269473694746947569476694776947869479694806948169482694836948469485694866948769488694896949069491694926949369494694956949669497694986949969500695016950269503695046950569506695076950869509695106951169512695136951469515695166951769518695196952069521695226952369524695256952669527695286952969530695316953269533695346953569536695376953869539695406954169542695436954469545695466954769548695496955069551695526955369554695556955669557695586955969560695616956269563695646956569566695676956869569695706957169572695736957469575695766957769578695796958069581695826958369584695856958669587695886958969590695916959269593695946959569596695976959869599696006960169602696036960469605696066960769608696096961069611696126961369614696156961669617696186961969620696216962269623696246962569626696276962869629696306963169632696336963469635696366963769638696396964069641696426964369644696456964669647696486964969650696516965269653696546965569656696576965869659696606966169662696636966469665696666966769668696696967069671696726967369674696756967669677696786967969680696816968269683696846968569686696876968869689696906969169692696936969469695696966969769698696996970069701697026970369704697056970669707697086970969710697116971269713697146971569716697176971869719697206972169722697236972469725697266972769728
  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/AssetInfo.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/AssetInfo.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. /* harmony import */ var _components_AssetInfoEditModal_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/AssetInfoEditModal.vue */ "./resources/js/components/AssetInfoEditModal.vue");
  1582. //
  1583. //
  1584. //
  1585. //
  1586. //
  1587. //
  1588. //
  1589. //
  1590. //
  1591. //
  1592. //
  1593. //
  1594. //
  1595. /* harmony default export */ __webpack_exports__["default"] = ({
  1596. components: {
  1597. AssetInfoEditModal: _components_AssetInfoEditModal_vue__WEBPACK_IMPORTED_MODULE_0__["default"]
  1598. },
  1599. props: {
  1600. asset: {
  1601. type: Object,
  1602. required: true
  1603. }
  1604. }
  1605. });
  1606. /***/ }),
  1607. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AssetInfoEditModal.vue?vue&type=script&lang=js&":
  1608. /*!*****************************************************************************************************************************************************************************!*\
  1609. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/AssetInfoEditModal.vue?vue&type=script&lang=js& ***!
  1610. \*****************************************************************************************************************************************************************************/
  1611. /*! exports provided: default */
  1612. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1613. "use strict";
  1614. __webpack_require__.r(__webpack_exports__);
  1615. /* harmony import */ var _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Modal.vue */ "./resources/js/components/Modal.vue");
  1616. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  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. /* harmony default export */ __webpack_exports__["default"] = ({
  1667. components: {
  1668. Modal: _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  1669. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_1__["default"]
  1670. },
  1671. props: {
  1672. populateWith: {
  1673. type: Object,
  1674. required: true
  1675. },
  1676. modalId: {
  1677. type: String,
  1678. required: true
  1679. }
  1680. },
  1681. data: function data() {
  1682. return {
  1683. // Essentially makes a copy of the object. Otherwise
  1684. // We would have a reference to the exising object causing
  1685. // unwanted mutations in the parent component.
  1686. asset: JSON.parse(JSON.stringify(this.populateWith)),
  1687. assetSaving: false
  1688. };
  1689. },
  1690. methods: {
  1691. updateAsset: function updateAsset() {
  1692. var _this = this;
  1693. this.assetSaving = true;
  1694. axios.put("/api/assets/".concat(this.asset.pcid), this.asset).then(function (response) {
  1695. _this.assetSaving = false;
  1696. $("#".concat(_this.modalId)).modal('hide');
  1697. })["catch"](function (error) {
  1698. _this.assetSaving = false;
  1699. });
  1700. }
  1701. }
  1702. });
  1703. /***/ }),
  1704. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js&":
  1705. /*!*************************************************************************************************************************************************************************************!*\
  1706. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js& ***!
  1707. \*************************************************************************************************************************************************************************************/
  1708. /*! exports provided: default */
  1709. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1710. "use strict";
  1711. __webpack_require__.r(__webpack_exports__);
  1712. //
  1713. //
  1714. //
  1715. //
  1716. //
  1717. //
  1718. //
  1719. //
  1720. //
  1721. //
  1722. //
  1723. //
  1724. //
  1725. //
  1726. //
  1727. //
  1728. //
  1729. //
  1730. //
  1731. //
  1732. //
  1733. /* harmony default export */ __webpack_exports__["default"] = ({
  1734. props: {
  1735. value: null,
  1736. // An object with the following format
  1737. // {
  1738. // key: value,
  1739. // key: value,
  1740. // }
  1741. options: {
  1742. type: Object,
  1743. required: true
  1744. },
  1745. allowCustom: {
  1746. type: Boolean,
  1747. "default": false
  1748. }
  1749. },
  1750. data: function data() {
  1751. return {
  1752. searchText: '',
  1753. selectedOption: null,
  1754. open: false,
  1755. // allows for checking whether button was clicked or text was typed.
  1756. // If button was clicked, we show all options without having to clear
  1757. // out any searchText that was autofilled when page loaded.
  1758. isSearching: false
  1759. };
  1760. },
  1761. computed: {
  1762. matches: function matches() {
  1763. var _this = this;
  1764. // If button was clicked, show all options, if typing, filter
  1765. // options based on searchText
  1766. return Object.entries(this.options).filter(function (option) {
  1767. var optionText = option[1].toUpperCase();
  1768. if (_this.isSearching) {
  1769. return optionText.match(_this.searchText.toUpperCase());
  1770. } else {
  1771. return optionText.match('');
  1772. }
  1773. });
  1774. }
  1775. },
  1776. methods: {
  1777. // if button is clicked, show all options
  1778. setOpen: function setOpen(isOpen) {
  1779. this.open = isOpen;
  1780. this.isSearching = false;
  1781. },
  1782. // if typing in the box, start filtering options
  1783. searchChanged: function searchChanged() {
  1784. if (!this.open) {
  1785. this.open = true;
  1786. }
  1787. if (!this.isSearching) {
  1788. this.isSearching = true;
  1789. } // If custom values are allowed, emits {id: 'custom', name: searchtext}
  1790. if (this.allowCustom) {
  1791. this.$emit('input', {
  1792. 'id': 'custom',
  1793. 'name': this.searchText
  1794. });
  1795. }
  1796. },
  1797. // emits { id: suggestion_id, name: suggestion_name} to v-model when
  1798. // a suggestion is selected
  1799. suggestionSelected: function suggestionSelected(suggestion) {
  1800. this.open = false;
  1801. this.searchText = suggestion[1];
  1802. this.$emit('input', {
  1803. 'id': suggestion[0],
  1804. 'name': suggestion[1]
  1805. });
  1806. },
  1807. updateComponentWithValue: function updateComponentWithValue(newValue) {
  1808. if (this.allowCustom) {
  1809. this.searchText = this.value.name;
  1810. } else {
  1811. if (newValue.id > -1) {
  1812. // Find the matching text for the supplied option value
  1813. for (var id in this.options) {
  1814. if (this.options.hasOwnProperty(id)) {
  1815. if (this.options[id] === this.options[newValue.id]) {
  1816. this.searchText = this.options[id];
  1817. }
  1818. }
  1819. }
  1820. }
  1821. }
  1822. }
  1823. },
  1824. mounted: function mounted() {
  1825. this.updateComponentWithValue(this.value);
  1826. },
  1827. watch: {
  1828. value: function value(newValue) {
  1829. this.updateComponentWithValue(newValue);
  1830. }
  1831. }
  1832. });
  1833. /***/ }),
  1834. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js&":
  1835. /*!************************************************************************************************************************************************************************!*\
  1836. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js& ***!
  1837. \************************************************************************************************************************************************************************/
  1838. /*! exports provided: default */
  1839. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1840. "use strict";
  1841. __webpack_require__.r(__webpack_exports__);
  1842. //
  1843. //
  1844. //
  1845. //
  1846. /* harmony default export */ __webpack_exports__["default"] = ({
  1847. name: 'IntersectingCirclesSpinner',
  1848. props: {
  1849. color: {
  1850. type: String,
  1851. "default": '#fff'
  1852. },
  1853. size: {
  1854. type: Number,
  1855. "default": 10
  1856. }
  1857. }
  1858. });
  1859. /***/ }),
  1860. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/Credential.vue?vue&type=script&lang=js&":
  1861. /*!*********************************************************************************************************************************************************************!*\
  1862. !*** ./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& ***!
  1863. \*********************************************************************************************************************************************************************/
  1864. /*! exports provided: default */
  1865. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1866. "use strict";
  1867. __webpack_require__.r(__webpack_exports__);
  1868. /* harmony import */ var _components_CredentialFormModal_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/CredentialFormModal.vue */ "./resources/js/components/CredentialFormModal.vue");
  1869. /* harmony import */ var _components_Modal_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/Modal.vue */ "./resources/js/components/Modal.vue");
  1870. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  1871. //
  1872. //
  1873. //
  1874. //
  1875. //
  1876. //
  1877. //
  1878. //
  1879. //
  1880. //
  1881. //
  1882. //
  1883. //
  1884. //
  1885. //
  1886. //
  1887. //
  1888. //
  1889. //
  1890. //
  1891. //
  1892. //
  1893. //
  1894. //
  1895. //
  1896. //
  1897. //
  1898. //
  1899. //
  1900. //
  1901. //
  1902. //
  1903. //
  1904. //
  1905. //
  1906. //
  1907. //
  1908. //
  1909. //
  1910. //
  1911. //
  1912. //
  1913. //
  1914. //
  1915. //
  1916. //
  1917. /* harmony default export */ __webpack_exports__["default"] = ({
  1918. components: {
  1919. CredentialFormModal: _components_CredentialFormModal_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  1920. Modal: _components_Modal_vue__WEBPACK_IMPORTED_MODULE_1__["default"],
  1921. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_2__["default"]
  1922. },
  1923. props: {
  1924. credential: {
  1925. type: Object,
  1926. required: true
  1927. },
  1928. descriptions: {
  1929. type: Object,
  1930. required: true
  1931. }
  1932. },
  1933. data: function data() {
  1934. return {
  1935. data: this.credential,
  1936. creddescList: this.descriptions,
  1937. credentialDeleting: false
  1938. };
  1939. },
  1940. mounted: function mounted() {
  1941. var _this = this;
  1942. Echo.channel('credential.' + this.data.credid).listen('CredentialUpdated', function (e) {
  1943. _this.data = e.credential;
  1944. });
  1945. },
  1946. methods: {
  1947. deleteCredential: function deleteCredential() {
  1948. var _this2 = this;
  1949. this.credentialDeleting = true;
  1950. axios["delete"]('/api/credentials/' + this.data.credid, this.data).then(function (response) {
  1951. _this2.credentialDeleting = false;
  1952. $('#credential' + _this2.data.credid + 'deleteModal').modal('hide');
  1953. })["catch"](function (error) {
  1954. _this2.credentialDeleting = false;
  1955. console.error(error);
  1956. });
  1957. }
  1958. }
  1959. });
  1960. /***/ }),
  1961. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CredentialFormModal.vue?vue&type=script&lang=js&":
  1962. /*!******************************************************************************************************************************************************************************!*\
  1963. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/CredentialFormModal.vue?vue&type=script&lang=js& ***!
  1964. \******************************************************************************************************************************************************************************/
  1965. /*! exports provided: default */
  1966. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1967. "use strict";
  1968. __webpack_require__.r(__webpack_exports__);
  1969. /* harmony import */ var _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Modal.vue */ "./resources/js/components/Modal.vue");
  1970. /* harmony import */ var _components_AutocompleteCustomDropdown_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/AutocompleteCustomDropdown.vue */ "./resources/js/components/AutocompleteCustomDropdown.vue");
  1971. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  1972. //
  1973. //
  1974. //
  1975. //
  1976. //
  1977. //
  1978. //
  1979. //
  1980. //
  1981. //
  1982. //
  1983. //
  1984. //
  1985. //
  1986. //
  1987. //
  1988. //
  1989. //
  1990. //
  1991. //
  1992. //
  1993. //
  1994. //
  1995. //
  1996. //
  1997. //
  1998. //
  1999. //
  2000. //
  2001. /* harmony default export */ __webpack_exports__["default"] = ({
  2002. components: {
  2003. AutocompleteCustomDropdown: _components_AutocompleteCustomDropdown_vue__WEBPACK_IMPORTED_MODULE_1__["default"],
  2004. Modal: _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  2005. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_2__["default"]
  2006. },
  2007. props: {
  2008. populateWith: {
  2009. type: Object,
  2010. "default": function _default() {
  2011. return {
  2012. creddesc: null,
  2013. creduser: null,
  2014. credpass: null,
  2015. groupid: null,
  2016. pcid: null,
  2017. credtype: null
  2018. };
  2019. }
  2020. },
  2021. modalId: {
  2022. type: String,
  2023. required: true
  2024. },
  2025. descriptions: {
  2026. type: Object,
  2027. required: true
  2028. },
  2029. create: {
  2030. type: Boolean
  2031. },
  2032. pcid: {
  2033. type: Number
  2034. },
  2035. groupid: {
  2036. type: Number
  2037. }
  2038. },
  2039. data: function data() {
  2040. return {
  2041. data: JSON.parse(JSON.stringify(this.populateWith)),
  2042. creddesc: {},
  2043. id: this.modalId,
  2044. errors: [],
  2045. credentialSaving: false
  2046. };
  2047. },
  2048. mounted: function mounted() {
  2049. this.creddesc = {
  2050. 'id': this.data.credtype,
  2051. 'name': this.data.creddesc
  2052. };
  2053. },
  2054. methods: {
  2055. rndStr: function rndStr(len) {
  2056. var text = "";
  2057. var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%";
  2058. for (var i = 0; i < len; i++) {
  2059. text += chars.charAt(Math.floor(Math.random() * chars.length));
  2060. }
  2061. return text;
  2062. },
  2063. getRandomPassword: function getRandomPassword(id) {
  2064. this.data.credpass = this.rndStr(16);
  2065. },
  2066. updateCredential: function updateCredential() {
  2067. var _this = this;
  2068. this.credentialSaving = true;
  2069. if (this.creddesc.id === "custom") {
  2070. this.data.credtype = 1;
  2071. this.data.creddesc = this.creddesc.name;
  2072. } else {
  2073. this.data.credtype = this.creddesc.id;
  2074. this.data.creddesc = this.creddesc.name;
  2075. }
  2076. if (this.create) {
  2077. if (this.pcid) {
  2078. this.data.pcid = this.pcid;
  2079. }
  2080. if (this.groupid) {
  2081. this.data.groupid = this.groupid;
  2082. }
  2083. axios.post('/api/credentials/', this.data).then(function (response) {
  2084. _this.credentialSaving = false;
  2085. $('#' + _this.id).modal('hide');
  2086. })["catch"](function (error) {
  2087. _this.credentialSaving = false;
  2088. console.error(error);
  2089. });
  2090. } else {
  2091. axios.put('/api/credentials/' + this.data.credid, this.data).then(function (response) {
  2092. _this.credentialSaving = false;
  2093. $('#' + _this.id).modal('hide');
  2094. })["catch"](function (error) {
  2095. _this.credentialSaving = false;
  2096. console.error(error);
  2097. });
  2098. }
  2099. }
  2100. }
  2101. });
  2102. /***/ }),
  2103. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CredentialList.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/CredentialList.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. /* harmony import */ var _components_Credential_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Credential.vue */ "./resources/js/components/Credential.vue");
  2112. /* harmony import */ var _components_CredentialFormModal_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/CredentialFormModal.vue */ "./resources/js/components/CredentialFormModal.vue");
  2113. //
  2114. //
  2115. //
  2116. //
  2117. //
  2118. //
  2119. //
  2120. //
  2121. //
  2122. /* harmony default export */ __webpack_exports__["default"] = ({
  2123. components: {
  2124. Credential: _components_Credential_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  2125. CredentialFormModal: _components_CredentialFormModal_vue__WEBPACK_IMPORTED_MODULE_1__["default"]
  2126. },
  2127. props: {
  2128. credentials: {
  2129. type: Array,
  2130. required: true
  2131. },
  2132. descriptions: {
  2133. type: Array,
  2134. required: true
  2135. },
  2136. pcid: {
  2137. type: Number
  2138. },
  2139. groupid: {
  2140. type: Number
  2141. }
  2142. },
  2143. computed: {
  2144. creddescList: function creddescList() {
  2145. var list = {};
  2146. this.descriptions.map(function (val) {
  2147. list[val.creddescid] = val.credtitle;
  2148. });
  2149. return list;
  2150. }
  2151. },
  2152. methods: {
  2153. deleteCred: function deleteCred(index) {
  2154. this.credentials.splice(index, 1);
  2155. }
  2156. },
  2157. mounted: function mounted() {
  2158. var _this = this;
  2159. if (this.pcid) {
  2160. Echo.channel('credlist.pcid.' + this.pcid).listen('CredentialDeleted', function (e) {
  2161. var deletedCred = e.credential;
  2162. var index = _this.credentials.findIndex(function (credential) {
  2163. return credential.credid === deletedCred['credid'];
  2164. });
  2165. $('#credential' + deletedCred['credid'] + 'deleteModal').modal('hide');
  2166. _this.deleteCred(index);
  2167. }).listen('CredentialAdded', function (e) {
  2168. _this.credentials.unshift(e.credential);
  2169. });
  2170. }
  2171. if (this.groupid) {
  2172. Echo.channel('credlist.groupid.' + this.groupid).listen('CredentialDeleted', function (e) {
  2173. var deletedCred = e.credential;
  2174. var index = _this.credentials.findIndex(function (credential) {
  2175. return credential.groupid === deletedCred['groupid'];
  2176. });
  2177. $('#credential' + deletedCred['credid'] + 'deleteModal').modal('hide');
  2178. _this.deleteCred(index);
  2179. }).listen('CredentialAdded', function (e) {
  2180. _this.credentials.unshift(e.credential);
  2181. });
  2182. }
  2183. }
  2184. });
  2185. /***/ }),
  2186. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ErrorList.vue?vue&type=script&lang=js&":
  2187. /*!********************************************************************************************************************************************************************!*\
  2188. !*** ./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& ***!
  2189. \********************************************************************************************************************************************************************/
  2190. /*! exports provided: default */
  2191. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2192. "use strict";
  2193. __webpack_require__.r(__webpack_exports__);
  2194. //
  2195. //
  2196. //
  2197. //
  2198. //
  2199. /* harmony default export */ __webpack_exports__["default"] = ({
  2200. props: ['errors'],
  2201. data: function data() {
  2202. return {
  2203. errorList: this.errors
  2204. };
  2205. },
  2206. watch: {
  2207. errors: function errors(newErrors) {
  2208. this.errorList = newErrors;
  2209. }
  2210. }
  2211. });
  2212. /***/ }),
  2213. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/NoteFormModal.vue?vue&type=script&lang=js&":
  2214. /*!************************************************************************************************************************************************************************!*\
  2215. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/NoteFormModal.vue?vue&type=script&lang=js& ***!
  2216. \************************************************************************************************************************************************************************/
  2217. /*! exports provided: default */
  2218. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2219. "use strict";
  2220. __webpack_require__.r(__webpack_exports__);
  2221. /* harmony import */ var _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Modal.vue */ "./resources/js/components/Modal.vue");
  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. components: {
  2241. Modal: _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__["default"]
  2242. },
  2243. props: {
  2244. populateWith: {
  2245. type: Object,
  2246. require: true
  2247. },
  2248. modalId: {
  2249. type: String,
  2250. require: true
  2251. },
  2252. noteType: {
  2253. type: Number
  2254. },
  2255. noteUser: {
  2256. type: String
  2257. },
  2258. woid: {
  2259. type: Number
  2260. }
  2261. },
  2262. data: function data() {
  2263. return {
  2264. note: JSON.parse(JSON.stringify(this.populateWith))
  2265. };
  2266. },
  2267. methods: {
  2268. updateNote: function updateNote(note) {
  2269. var _this = this;
  2270. axios.put('/api/workorders/notes/' + note.noteid, note).then(function (response) {
  2271. _this.hideModal();
  2272. });
  2273. },
  2274. hideModal: function hideModal() {
  2275. $('#' + this.modalId).modal('hide');
  2276. }
  2277. }
  2278. });
  2279. /***/ }),
  2280. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/Notes.vue?vue&type=script&lang=js&":
  2281. /*!****************************************************************************************************************************************************************!*\
  2282. !*** ./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& ***!
  2283. \****************************************************************************************************************************************************************/
  2284. /*! exports provided: default */
  2285. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2286. "use strict";
  2287. __webpack_require__.r(__webpack_exports__);
  2288. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2289. /* harmony import */ var _components_NoteFormModal_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/NoteFormModal.vue */ "./resources/js/components/NoteFormModal.vue");
  2290. //
  2291. //
  2292. //
  2293. //
  2294. //
  2295. //
  2296. //
  2297. //
  2298. //
  2299. //
  2300. //
  2301. //
  2302. //
  2303. //
  2304. //
  2305. //
  2306. //
  2307. //
  2308. //
  2309. //
  2310. //
  2311. //
  2312. //
  2313. //
  2314. //
  2315. //
  2316. //
  2317. //
  2318. //
  2319. //
  2320. //
  2321. //
  2322. //
  2323. //
  2324. //
  2325. //
  2326. //
  2327. //
  2328. /* harmony default export */ __webpack_exports__["default"] = ({
  2329. components: {
  2330. NoteFormModal: _components_NoteFormModal_vue__WEBPACK_IMPORTED_MODULE_1__["default"]
  2331. },
  2332. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2333. props: {
  2334. notes: {
  2335. type: Array,
  2336. "default": []
  2337. },
  2338. authusername: {
  2339. type: String,
  2340. required: true
  2341. },
  2342. noteType: {
  2343. type: Number,
  2344. required: true
  2345. },
  2346. woid: {
  2347. type: String,
  2348. required: true
  2349. }
  2350. },
  2351. data: function data() {
  2352. return {
  2353. newNote: {
  2354. notetype: this.noteType,
  2355. thenote: '',
  2356. noteuser: this.authusername,
  2357. woid: this.woid
  2358. }
  2359. };
  2360. },
  2361. computed: {
  2362. noteOrders: function noteOrders() {
  2363. return this.getNoteOrders(this.notes);
  2364. }
  2365. },
  2366. methods: {
  2367. createNote: function createNote() {
  2368. var _this = this;
  2369. axios.post('/api/workorders/notes', this.newNote).then(function (response) {
  2370. $('#note' + _this.noteType + 'add').collapse('hide');
  2371. _this.newNote.thenote = '';
  2372. });
  2373. },
  2374. getNoteOrders: function getNoteOrders(notes) {
  2375. var noteOrders = [];
  2376. notes.forEach(function (note, index) {
  2377. if (index === 0) {
  2378. noteOrders[index] = 'order-first';
  2379. } else if (note.noteuser !== notes[index - 1].noteuser) {
  2380. if (noteOrders[index - 1] === 'order-first') {
  2381. noteOrders[index] = 'order-last';
  2382. } else {
  2383. noteOrders[index] = 'order-first';
  2384. }
  2385. } else {
  2386. noteOrders[index] = noteOrders[index - 1];
  2387. }
  2388. });
  2389. return noteOrders;
  2390. }
  2391. }
  2392. });
  2393. /***/ }),
  2394. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js&":
  2395. /*!**************************************************************************************************************************************************************************!*\
  2396. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js& ***!
  2397. \**************************************************************************************************************************************************************************/
  2398. /*! exports provided: default */
  2399. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2400. "use strict";
  2401. __webpack_require__.r(__webpack_exports__);
  2402. /* harmony import */ var _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Modal.vue */ "./resources/js/components/Modal.vue");
  2403. /* harmony import */ var _components_AutocompleteCustomDropdown_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/AutocompleteCustomDropdown.vue */ "./resources/js/components/AutocompleteCustomDropdown.vue");
  2404. /* harmony import */ var _components_ErrorList_vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../components/ErrorList.vue */ "./resources/js/components/ErrorList.vue");
  2405. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  2406. //
  2407. //
  2408. //
  2409. //
  2410. //
  2411. //
  2412. //
  2413. //
  2414. //
  2415. //
  2416. //
  2417. //
  2418. //
  2419. //
  2420. //
  2421. //
  2422. //
  2423. //
  2424. //
  2425. //
  2426. //
  2427. //
  2428. //
  2429. //
  2430. //
  2431. //
  2432. //
  2433. //
  2434. //
  2435. //
  2436. //
  2437. //
  2438. //
  2439. //
  2440. //
  2441. //
  2442. /* harmony default export */ __webpack_exports__["default"] = ({
  2443. components: {
  2444. Modal: _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  2445. AutocompleteCustomDropdown: _components_AutocompleteCustomDropdown_vue__WEBPACK_IMPORTED_MODULE_1__["default"],
  2446. ErrorList: _components_ErrorList_vue__WEBPACK_IMPORTED_MODULE_2__["default"],
  2447. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_3__["default"]
  2448. },
  2449. props: {
  2450. populateWith: {
  2451. type: Object,
  2452. required: true
  2453. },
  2454. storeList: {
  2455. type: Object,
  2456. required: true
  2457. },
  2458. modalId: {
  2459. type: String,
  2460. required: true
  2461. }
  2462. },
  2463. data: function data() {
  2464. return {
  2465. // Copies object from prop, so it doesn't mutate the object
  2466. // from the parent component. Parent component will be updated via
  2467. // Websocket if updateWorkOrder is successful.
  2468. data: JSON.parse(JSON.stringify(this.populateWith)),
  2469. id: this.modalId,
  2470. store: {},
  2471. errors: [],
  2472. woInfoSaving: false
  2473. };
  2474. },
  2475. methods: {
  2476. updateWorkOrder: function updateWorkOrder() {
  2477. var _this = this;
  2478. this.woInfoSaving = true;
  2479. this.data.storeid = this.store.id;
  2480. axios.put('/api/workorders/' + this.data.woid, this.data).then(function (response) {
  2481. _this.woInfoSaving = false;
  2482. $('#workordereditModal').modal('hide');
  2483. })["catch"](function (error) {
  2484. _this.woInfoSaving = false;
  2485. _this.errors = JSON.parse(error.response.request.response).errors;
  2486. });
  2487. }
  2488. },
  2489. mounted: function mounted() {
  2490. this.store = {
  2491. 'id': this.data.storeid,
  2492. 'name': this.storeList[this.data.storeid]
  2493. };
  2494. },
  2495. // This was originally here because the populateWith info would originally
  2496. // not necessarily be loaded when this component was mounted. That is no
  2497. // longer the case as I now don't render the parent component until the
  2498. // ajax request is finised. The watch statements are still here to cover
  2499. // the case where someone else updates the populateWith values while
  2500. // someone is editing, although it probably should be edited so it doesn't
  2501. // immediately overwrite the unsaved edits of the current user.
  2502. watch: {
  2503. populateWith: function populateWith(value) {
  2504. this.data = JSON.parse(JSON.stringify(this.populateWith));
  2505. this.store = {
  2506. 'id': this.data.storeid,
  2507. 'name': this.storeList[this.data.storeid]
  2508. };
  2509. },
  2510. storeList: function storeList(value) {
  2511. this.store = {
  2512. 'id': this.data.storeid,
  2513. 'name': this.storeList[this.data.storeid]
  2514. };
  2515. }
  2516. }
  2517. });
  2518. /***/ }),
  2519. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js&":
  2520. /*!************************************************************************************************************************************************************************!*\
  2521. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js& ***!
  2522. \************************************************************************************************************************************************************************/
  2523. /*! exports provided: default */
  2524. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2525. "use strict";
  2526. __webpack_require__.r(__webpack_exports__);
  2527. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2528. /* harmony import */ var _components_WoInfoEditModal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/WoInfoEditModal */ "./resources/js/components/WoInfoEditModal.vue");
  2529. //
  2530. //
  2531. //
  2532. //
  2533. //
  2534. //
  2535. //
  2536. //
  2537. //
  2538. //
  2539. //
  2540. //
  2541. //
  2542. //
  2543. //
  2544. //
  2545. //
  2546. //
  2547. //
  2548. //
  2549. /* harmony default export */ __webpack_exports__["default"] = ({
  2550. components: {
  2551. WoInfoEditModal: _components_WoInfoEditModal__WEBPACK_IMPORTED_MODULE_1__["default"]
  2552. },
  2553. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2554. props: ['workOrder', 'stores'],
  2555. computed: {
  2556. storeList: function storeList() {
  2557. var list = {};
  2558. Object.values(this.stores).map(function (val) {
  2559. list[val.storeid] = val.storesname;
  2560. });
  2561. return list;
  2562. }
  2563. }
  2564. });
  2565. /***/ }),
  2566. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/App.vue?vue&type=script&lang=js&":
  2567. /*!*********************************************************************************************************************************************************!*\
  2568. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/App.vue?vue&type=script&lang=js& ***!
  2569. \*********************************************************************************************************************************************************/
  2570. /*! exports provided: default */
  2571. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2572. "use strict";
  2573. __webpack_require__.r(__webpack_exports__);
  2574. //
  2575. //
  2576. //
  2577. //
  2578. //
  2579. //
  2580. //
  2581. //
  2582. //
  2583. //
  2584. //
  2585. //
  2586. //
  2587. //
  2588. //
  2589. //
  2590. //
  2591. //
  2592. //
  2593. //
  2594. //
  2595. //
  2596. //
  2597. //
  2598. //
  2599. //
  2600. //
  2601. //
  2602. //
  2603. //
  2604. //
  2605. //
  2606. //
  2607. //
  2608. //
  2609. //
  2610. //
  2611. //
  2612. //
  2613. //
  2614. //
  2615. //
  2616. //
  2617. //
  2618. //
  2619. //
  2620. //
  2621. //
  2622. //
  2623. //
  2624. //
  2625. //
  2626. //
  2627. //
  2628. //
  2629. //
  2630. //
  2631. //
  2632. //
  2633. //
  2634. //
  2635. //
  2636. //
  2637. //
  2638. //
  2639. //
  2640. //
  2641. //
  2642. //
  2643. //
  2644. //
  2645. /* harmony default export */ __webpack_exports__["default"] = ({
  2646. data: function data() {
  2647. return {
  2648. isLoggedIn: null,
  2649. username: null
  2650. };
  2651. },
  2652. mounted: function mounted() {
  2653. this.isLoggedIn = localStorage.getItem('jwt');
  2654. this.username = localStorage.getItem('user');
  2655. }
  2656. });
  2657. /***/ }),
  2658. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Dashboard.vue?vue&type=script&lang=js&":
  2659. /*!***************************************************************************************************************************************************************!*\
  2660. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/Dashboard.vue?vue&type=script&lang=js& ***!
  2661. \***************************************************************************************************************************************************************/
  2662. /*! exports provided: default */
  2663. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2664. "use strict";
  2665. __webpack_require__.r(__webpack_exports__);
  2666. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  2667. //
  2668. //
  2669. //
  2670. //
  2671. //
  2672. //
  2673. //
  2674. //
  2675. //
  2676. //
  2677. //
  2678. //
  2679. //
  2680. //
  2681. //
  2682. //
  2683. //
  2684. //
  2685. //
  2686. //
  2687. //
  2688. //
  2689. //
  2690. //
  2691. //
  2692. //
  2693. /* harmony default export */ __webpack_exports__["default"] = ({
  2694. components: {
  2695. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_0__["default"]
  2696. },
  2697. data: function data() {
  2698. return {
  2699. workOrders: [],
  2700. isLoading: true
  2701. };
  2702. },
  2703. mounted: function mounted() {
  2704. var _this = this;
  2705. var token = localStorage.getItem('jwt');
  2706. var user = localStorage.getItem('user');
  2707. axios.defaults.headers.common['Content-Type'] = 'application/json';
  2708. axios.defaults.headers.common['Authorization'] = 'Bearer ' + token;
  2709. axios.get('api/users/' + user + '/workorders').then(function (response) {
  2710. _this.workOrders = response.data;
  2711. _this.isLoading = false;
  2712. })["catch"](function (error) {
  2713. console.log(error);
  2714. });
  2715. },
  2716. beforeRouteEnter: function beforeRouteEnter(to, from, next) {
  2717. if (!localStorage.getItem('jwt')) {
  2718. return next('login');
  2719. }
  2720. next();
  2721. }
  2722. });
  2723. /***/ }),
  2724. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Login.vue?vue&type=script&lang=js&":
  2725. /*!***********************************************************************************************************************************************************!*\
  2726. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/Login.vue?vue&type=script&lang=js& ***!
  2727. \***********************************************************************************************************************************************************/
  2728. /*! exports provided: default */
  2729. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2730. "use strict";
  2731. __webpack_require__.r(__webpack_exports__);
  2732. //
  2733. //
  2734. //
  2735. //
  2736. //
  2737. //
  2738. //
  2739. //
  2740. //
  2741. //
  2742. //
  2743. //
  2744. //
  2745. //
  2746. //
  2747. //
  2748. //
  2749. //
  2750. //
  2751. //
  2752. //
  2753. //
  2754. //
  2755. //
  2756. //
  2757. //
  2758. //
  2759. //
  2760. //
  2761. //
  2762. //
  2763. //
  2764. //
  2765. //
  2766. //
  2767. //
  2768. //
  2769. //
  2770. //
  2771. /* harmony default export */ __webpack_exports__["default"] = ({
  2772. data: function data() {
  2773. return {
  2774. username: "",
  2775. password: ""
  2776. };
  2777. },
  2778. methods: {
  2779. handleSubmit: function handleSubmit(e) {
  2780. var _this = this;
  2781. e.preventDefault();
  2782. if (this.password.length > 0) {
  2783. axios.post('api/login', {
  2784. username: this.username,
  2785. password: this.password
  2786. }).then(function (response) {
  2787. localStorage.setItem('user', response.data.success.username);
  2788. localStorage.setItem('jwt', response.data.success.token);
  2789. if (localStorage.getItem('jwt') != null) {
  2790. _this.$router.go('/dashboard');
  2791. }
  2792. })["catch"](function (error) {
  2793. console.error(error);
  2794. });
  2795. }
  2796. }
  2797. },
  2798. beforeRouteEnter: function beforeRouteEnter(to, from, next) {
  2799. if (localStorage.getItem('jwt')) {
  2800. return next('dashboard');
  2801. }
  2802. next();
  2803. }
  2804. });
  2805. /***/ }),
  2806. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.vue?vue&type=script&lang=js&":
  2807. /*!*************************************************************************************************************************************************************!*\
  2808. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/Welcome.vue?vue&type=script&lang=js& ***!
  2809. \*************************************************************************************************************************************************************/
  2810. /*! exports provided: default */
  2811. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2812. "use strict";
  2813. __webpack_require__.r(__webpack_exports__);
  2814. //
  2815. //
  2816. //
  2817. //
  2818. //
  2819. //
  2820. //
  2821. //
  2822. //
  2823. //
  2824. //
  2825. //
  2826. //
  2827. //
  2828. //
  2829. //
  2830. //
  2831. //
  2832. //
  2833. //
  2834. //
  2835. //
  2836. //
  2837. //
  2838. //
  2839. //
  2840. //
  2841. //
  2842. //
  2843. //
  2844. //
  2845. //
  2846. //
  2847. //
  2848. //
  2849. //
  2850. //
  2851. //
  2852. //
  2853. //
  2854. //
  2855. //
  2856. //
  2857. //
  2858. //
  2859. //
  2860. //
  2861. //
  2862. //
  2863. //
  2864. //
  2865. /* harmony default export */ __webpack_exports__["default"] = ({});
  2866. /***/ }),
  2867. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/WorkOrder.vue?vue&type=script&lang=js&":
  2868. /*!***************************************************************************************************************************************************************!*\
  2869. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/WorkOrder.vue?vue&type=script&lang=js& ***!
  2870. \***************************************************************************************************************************************************************/
  2871. /*! exports provided: default */
  2872. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2873. "use strict";
  2874. __webpack_require__.r(__webpack_exports__);
  2875. /* harmony import */ var _components_WorkOrderInfo_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/WorkOrderInfo.vue */ "./resources/js/components/WorkOrderInfo.vue");
  2876. /* harmony import */ var _components_AssetInfo_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/AssetInfo.vue */ "./resources/js/components/AssetInfo.vue");
  2877. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  2878. /* harmony import */ var _components_CredentialList_vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../components/CredentialList.vue */ "./resources/js/components/CredentialList.vue");
  2879. /* harmony import */ var _components_Notes_vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../components/Notes.vue */ "./resources/js/components/Notes.vue");
  2880. //
  2881. //
  2882. //
  2883. //
  2884. //
  2885. //
  2886. //
  2887. //
  2888. //
  2889. //
  2890. //
  2891. //
  2892. //
  2893. //
  2894. //
  2895. //
  2896. //
  2897. //
  2898. //
  2899. //
  2900. //
  2901. //
  2902. //
  2903. //
  2904. //
  2905. //
  2906. //
  2907. //
  2908. //
  2909. //
  2910. //
  2911. //
  2912. //
  2913. //
  2914. //
  2915. //
  2916. //
  2917. //
  2918. //
  2919. //
  2920. //
  2921. //
  2922. //
  2923. //
  2924. //
  2925. //
  2926. //
  2927. //
  2928. //
  2929. //
  2930. //
  2931. //
  2932. //
  2933. //
  2934. //
  2935. //
  2936. //
  2937. //
  2938. //
  2939. //
  2940. //
  2941. //
  2942. //
  2943. //
  2944. //
  2945. //
  2946. //
  2947. //
  2948. //
  2949. //
  2950. //
  2951. //
  2952. //
  2953. //
  2954. //
  2955. //
  2956. //
  2957. //
  2958. //
  2959. //
  2960. //
  2961. //
  2962. //
  2963. //
  2964. //
  2965. //
  2966. //
  2967. //
  2968. //
  2969. //
  2970. //
  2971. //
  2972. //
  2973. //
  2974. //
  2975. //
  2976. //
  2977. //
  2978. //
  2979. //
  2980. //
  2981. /* harmony default export */ __webpack_exports__["default"] = ({
  2982. components: {
  2983. WorkOrderInfo: _components_WorkOrderInfo_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  2984. AssetInfo: _components_AssetInfo_vue__WEBPACK_IMPORTED_MODULE_1__["default"],
  2985. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_2__["default"],
  2986. CredentialList: _components_CredentialList_vue__WEBPACK_IMPORTED_MODULE_3__["default"],
  2987. Notes: _components_Notes_vue__WEBPACK_IMPORTED_MODULE_4__["default"]
  2988. },
  2989. props: {
  2990. id: {
  2991. type: String,
  2992. required: true
  2993. }
  2994. },
  2995. data: function data() {
  2996. return {
  2997. workOrder: {},
  2998. asset: {},
  2999. stores: {},
  3000. credentials: {},
  3001. credentialDescriptions: {},
  3002. workOrderNotes: [],
  3003. woLoading: true,
  3004. assetLoading: true,
  3005. storesLoading: true,
  3006. credentialsLoading: true,
  3007. credentialDescriptionsLoading: true,
  3008. workOrderNotesLoading: true,
  3009. authUser: localStorage.getItem('user')
  3010. };
  3011. },
  3012. computed: {
  3013. publicNotes: function publicNotes() {
  3014. var notes = [];
  3015. notes = this.workOrderNotes.filter(function (note) {
  3016. return note.notetype === 0;
  3017. });
  3018. return notes;
  3019. },
  3020. privateNotes: function privateNotes() {
  3021. var notes = [];
  3022. notes = this.workOrderNotes.filter(function (note) {
  3023. return note.notetype === 1;
  3024. });
  3025. return notes;
  3026. }
  3027. },
  3028. mounted: function mounted() {
  3029. var _this = this;
  3030. // Get authentication info from current user from local storage
  3031. var token = localStorage.getItem('jwt');
  3032. var user = localStorage.getItem('user'); // Set some axios config options for Content-Type and Authentication.
  3033. axios.defaults.headers.common['Content-Type'] = 'application/json';
  3034. axios.defaults.headers.common['Authorization'] = 'Bearer ' + token; // Get WorkOrder from API
  3035. axios.get('/api/workorders/' + this.id).then(function (response) {
  3036. _this.workOrder = response.data;
  3037. _this.woLoading = false;
  3038. })["catch"](function (error) {
  3039. console.log(error);
  3040. }); // Get list of stores from API
  3041. axios.get('/api/stores/').then(function (response) {
  3042. _this.stores = response.data;
  3043. _this.storesLoading = false;
  3044. })["catch"](function (error) {
  3045. console.log(error);
  3046. }); // Get Asset from API (will most likely be replaced with list of assets
  3047. // in the future. Current each WO can only have one but that is likely
  3048. // to change)
  3049. axios.get("/api/workorders/".concat(this.id, "/asset")).then(function (response) {
  3050. _this.asset = response.data;
  3051. _this.assetLoading = false; // Establish listener for liveupdate broadcasts.
  3052. // Must be done here or we can't guarantee this.asset
  3053. // exists by the time we execute this code.
  3054. Echo.channel('asset.' + _this.asset.pcid).listen('AssetUpdated', function (e) {
  3055. _this.asset = e.data;
  3056. }); // Get Credentials for this asset. May be relocated to be part of asset
  3057. // Component when WOs can have more than one asset.
  3058. axios.get("/api/assets/".concat(_this.asset.pcid, "/credentials")).then(function (response) {
  3059. _this.credentials = response.data;
  3060. _this.credentialsLoading = false;
  3061. })["catch"](function (error) {
  3062. console.log(error);
  3063. }); // Get default list of Credential Descriptions. May be relocated along with
  3064. // the above.
  3065. axios.get('/api/credentials/descriptions').then(function (response) {
  3066. _this.credentialDescriptions = response.data;
  3067. _this.credentialDescriptionsLoading = false;
  3068. })["catch"](function (error) {
  3069. console.log(error);
  3070. });
  3071. })["catch"](function (error) {
  3072. console.log(error);
  3073. });
  3074. axios.get("/api/workorders/".concat(this.id, "/notes")).then(function (response) {
  3075. _this.workOrderNotes = response.data;
  3076. _this.workOrderNotesLoading = false;
  3077. })["catch"](function (error) {
  3078. console.log(error);
  3079. });
  3080. Echo.channel('work-order.' + this.id).listen('WorkOrderUpdated', function (e) {
  3081. _this.workOrder = e.data;
  3082. });
  3083. Echo.channel('wonotes.' + this.id).listen('WorkOrderNoteAdded', function (e) {
  3084. _this.workOrderNotes.push(e.note);
  3085. }).listen('WorkOrderNoteUpdated', function (e) {
  3086. var index = _this.workOrderNotes.findIndex(function (note) {
  3087. return note.noteid === e.note.noteid;
  3088. }); // Note has to be edited this way, or else Vue cannot
  3089. // see it to recompute the computed values.
  3090. _this.workOrderNotes.splice(index, 1, e.note);
  3091. }).listen('WorkOrderNoteDeleted', function (e) {
  3092. var index = _this.notes.findIndex(function (note) {
  3093. return note.noteid === e.noteid;
  3094. });
  3095. _this.notes.splice(index, 1);
  3096. });
  3097. }
  3098. });
  3099. /***/ }),
  3100. /***/ "./node_modules/base64-js/index.js":
  3101. /*!*****************************************!*\
  3102. !*** ./node_modules/base64-js/index.js ***!
  3103. \*****************************************/
  3104. /*! no static exports found */
  3105. /***/ (function(module, exports, __webpack_require__) {
  3106. "use strict";
  3107. exports.byteLength = byteLength
  3108. exports.toByteArray = toByteArray
  3109. exports.fromByteArray = fromByteArray
  3110. var lookup = []
  3111. var revLookup = []
  3112. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  3113. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  3114. for (var i = 0, len = code.length; i < len; ++i) {
  3115. lookup[i] = code[i]
  3116. revLookup[code.charCodeAt(i)] = i
  3117. }
  3118. // Support decoding URL-safe base64 strings, as Node.js does.
  3119. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  3120. revLookup['-'.charCodeAt(0)] = 62
  3121. revLookup['_'.charCodeAt(0)] = 63
  3122. function getLens (b64) {
  3123. var len = b64.length
  3124. if (len % 4 > 0) {
  3125. throw new Error('Invalid string. Length must be a multiple of 4')
  3126. }
  3127. // Trim off extra bytes after placeholder bytes are found
  3128. // See: https://github.com/beatgammit/base64-js/issues/42
  3129. var validLen = b64.indexOf('=')
  3130. if (validLen === -1) validLen = len
  3131. var placeHoldersLen = validLen === len
  3132. ? 0
  3133. : 4 - (validLen % 4)
  3134. return [validLen, placeHoldersLen]
  3135. }
  3136. // base64 is 4/3 + up to two characters of the original data
  3137. function byteLength (b64) {
  3138. var lens = getLens(b64)
  3139. var validLen = lens[0]
  3140. var placeHoldersLen = lens[1]
  3141. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  3142. }
  3143. function _byteLength (b64, validLen, placeHoldersLen) {
  3144. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  3145. }
  3146. function toByteArray (b64) {
  3147. var tmp
  3148. var lens = getLens(b64)
  3149. var validLen = lens[0]
  3150. var placeHoldersLen = lens[1]
  3151. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  3152. var curByte = 0
  3153. // if there are placeholders, only get up to the last complete 4 chars
  3154. var len = placeHoldersLen > 0
  3155. ? validLen - 4
  3156. : validLen
  3157. var i
  3158. for (i = 0; i < len; i += 4) {
  3159. tmp =
  3160. (revLookup[b64.charCodeAt(i)] << 18) |
  3161. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  3162. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  3163. revLookup[b64.charCodeAt(i + 3)]
  3164. arr[curByte++] = (tmp >> 16) & 0xFF
  3165. arr[curByte++] = (tmp >> 8) & 0xFF
  3166. arr[curByte++] = tmp & 0xFF
  3167. }
  3168. if (placeHoldersLen === 2) {
  3169. tmp =
  3170. (revLookup[b64.charCodeAt(i)] << 2) |
  3171. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  3172. arr[curByte++] = tmp & 0xFF
  3173. }
  3174. if (placeHoldersLen === 1) {
  3175. tmp =
  3176. (revLookup[b64.charCodeAt(i)] << 10) |
  3177. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  3178. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  3179. arr[curByte++] = (tmp >> 8) & 0xFF
  3180. arr[curByte++] = tmp & 0xFF
  3181. }
  3182. return arr
  3183. }
  3184. function tripletToBase64 (num) {
  3185. return lookup[num >> 18 & 0x3F] +
  3186. lookup[num >> 12 & 0x3F] +
  3187. lookup[num >> 6 & 0x3F] +
  3188. lookup[num & 0x3F]
  3189. }
  3190. function encodeChunk (uint8, start, end) {
  3191. var tmp
  3192. var output = []
  3193. for (var i = start; i < end; i += 3) {
  3194. tmp =
  3195. ((uint8[i] << 16) & 0xFF0000) +
  3196. ((uint8[i + 1] << 8) & 0xFF00) +
  3197. (uint8[i + 2] & 0xFF)
  3198. output.push(tripletToBase64(tmp))
  3199. }
  3200. return output.join('')
  3201. }
  3202. function fromByteArray (uint8) {
  3203. var tmp
  3204. var len = uint8.length
  3205. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  3206. var parts = []
  3207. var maxChunkLength = 16383 // must be multiple of 3
  3208. // go through the array every three bytes, we'll deal with trailing stuff later
  3209. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  3210. parts.push(encodeChunk(
  3211. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  3212. ))
  3213. }
  3214. // pad the end with zeros, but make sure to not forget the extra bytes
  3215. if (extraBytes === 1) {
  3216. tmp = uint8[len - 1]
  3217. parts.push(
  3218. lookup[tmp >> 2] +
  3219. lookup[(tmp << 4) & 0x3F] +
  3220. '=='
  3221. )
  3222. } else if (extraBytes === 2) {
  3223. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  3224. parts.push(
  3225. lookup[tmp >> 10] +
  3226. lookup[(tmp >> 4) & 0x3F] +
  3227. lookup[(tmp << 2) & 0x3F] +
  3228. '='
  3229. )
  3230. }
  3231. return parts.join('')
  3232. }
  3233. /***/ }),
  3234. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  3235. /*!*****************************************************!*\
  3236. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  3237. \*****************************************************/
  3238. /*! no static exports found */
  3239. /***/ (function(module, exports, __webpack_require__) {
  3240. /*!
  3241. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  3242. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  3243. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  3244. */
  3245. (function (global, factory) {
  3246. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  3247. undefined;
  3248. }(this, (function (exports, $, Popper) { 'use strict';
  3249. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  3250. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  3251. function _defineProperties(target, props) {
  3252. for (var i = 0; i < props.length; i++) {
  3253. var descriptor = props[i];
  3254. descriptor.enumerable = descriptor.enumerable || false;
  3255. descriptor.configurable = true;
  3256. if ("value" in descriptor) descriptor.writable = true;
  3257. Object.defineProperty(target, descriptor.key, descriptor);
  3258. }
  3259. }
  3260. function _createClass(Constructor, protoProps, staticProps) {
  3261. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  3262. if (staticProps) _defineProperties(Constructor, staticProps);
  3263. return Constructor;
  3264. }
  3265. function _defineProperty(obj, key, value) {
  3266. if (key in obj) {
  3267. Object.defineProperty(obj, key, {
  3268. value: value,
  3269. enumerable: true,
  3270. configurable: true,
  3271. writable: true
  3272. });
  3273. } else {
  3274. obj[key] = value;
  3275. }
  3276. return obj;
  3277. }
  3278. function ownKeys(object, enumerableOnly) {
  3279. var keys = Object.keys(object);
  3280. if (Object.getOwnPropertySymbols) {
  3281. var symbols = Object.getOwnPropertySymbols(object);
  3282. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  3283. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  3284. });
  3285. keys.push.apply(keys, symbols);
  3286. }
  3287. return keys;
  3288. }
  3289. function _objectSpread2(target) {
  3290. for (var i = 1; i < arguments.length; i++) {
  3291. var source = arguments[i] != null ? arguments[i] : {};
  3292. if (i % 2) {
  3293. ownKeys(Object(source), true).forEach(function (key) {
  3294. _defineProperty(target, key, source[key]);
  3295. });
  3296. } else if (Object.getOwnPropertyDescriptors) {
  3297. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  3298. } else {
  3299. ownKeys(Object(source)).forEach(function (key) {
  3300. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  3301. });
  3302. }
  3303. }
  3304. return target;
  3305. }
  3306. function _inheritsLoose(subClass, superClass) {
  3307. subClass.prototype = Object.create(superClass.prototype);
  3308. subClass.prototype.constructor = subClass;
  3309. subClass.__proto__ = superClass;
  3310. }
  3311. /**
  3312. * --------------------------------------------------------------------------
  3313. * Bootstrap (v4.4.1): util.js
  3314. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  3315. * --------------------------------------------------------------------------
  3316. */
  3317. /**
  3318. * ------------------------------------------------------------------------
  3319. * Private TransitionEnd Helpers
  3320. * ------------------------------------------------------------------------
  3321. */
  3322. var TRANSITION_END = 'transitionend';
  3323. var MAX_UID = 1000000;
  3324. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  3325. function toType(obj) {
  3326. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  3327. }
  3328. function getSpecialTransitionEndEvent() {
  3329. return {
  3330. bindType: TRANSITION_END,
  3331. delegateType: TRANSITION_END,
  3332. handle: function handle(event) {
  3333. if ($(event.target).is(this)) {
  3334. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  3335. }
  3336. return undefined; // eslint-disable-line no-undefined
  3337. }
  3338. };
  3339. }
  3340. function transitionEndEmulator(duration) {
  3341. var _this = this;
  3342. var called = false;
  3343. $(this).one(Util.TRANSITION_END, function () {
  3344. called = true;
  3345. });
  3346. setTimeout(function () {
  3347. if (!called) {
  3348. Util.triggerTransitionEnd(_this);
  3349. }
  3350. }, duration);
  3351. return this;
  3352. }
  3353. function setTransitionEndSupport() {
  3354. $.fn.emulateTransitionEnd = transitionEndEmulator;
  3355. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  3356. }
  3357. /**
  3358. * --------------------------------------------------------------------------
  3359. * Public Util Api
  3360. * --------------------------------------------------------------------------
  3361. */
  3362. var Util = {
  3363. TRANSITION_END: 'bsTransitionEnd',
  3364. getUID: function getUID(prefix) {
  3365. do {
  3366. // eslint-disable-next-line no-bitwise
  3367. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  3368. } while (document.getElementById(prefix));
  3369. return prefix;
  3370. },
  3371. getSelectorFromElement: function getSelectorFromElement(element) {
  3372. var selector = element.getAttribute('data-target');
  3373. if (!selector || selector === '#') {
  3374. var hrefAttr = element.getAttribute('href');
  3375. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  3376. }
  3377. try {
  3378. return document.querySelector(selector) ? selector : null;
  3379. } catch (err) {
  3380. return null;
  3381. }
  3382. },
  3383. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  3384. if (!element) {
  3385. return 0;
  3386. } // Get transition-duration of the element
  3387. var transitionDuration = $(element).css('transition-duration');
  3388. var transitionDelay = $(element).css('transition-delay');
  3389. var floatTransitionDuration = parseFloat(transitionDuration);
  3390. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  3391. if (!floatTransitionDuration && !floatTransitionDelay) {
  3392. return 0;
  3393. } // If multiple durations are defined, take the first
  3394. transitionDuration = transitionDuration.split(',')[0];
  3395. transitionDelay = transitionDelay.split(',')[0];
  3396. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  3397. },
  3398. reflow: function reflow(element) {
  3399. return element.offsetHeight;
  3400. },
  3401. triggerTransitionEnd: function triggerTransitionEnd(element) {
  3402. $(element).trigger(TRANSITION_END);
  3403. },
  3404. // TODO: Remove in v5
  3405. supportsTransitionEnd: function supportsTransitionEnd() {
  3406. return Boolean(TRANSITION_END);
  3407. },
  3408. isElement: function isElement(obj) {
  3409. return (obj[0] || obj).nodeType;
  3410. },
  3411. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  3412. for (var property in configTypes) {
  3413. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  3414. var expectedTypes = configTypes[property];
  3415. var value = config[property];
  3416. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  3417. if (!new RegExp(expectedTypes).test(valueType)) {
  3418. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  3419. }
  3420. }
  3421. }
  3422. },
  3423. findShadowRoot: function findShadowRoot(element) {
  3424. if (!document.documentElement.attachShadow) {
  3425. return null;
  3426. } // Can find the shadow root otherwise it'll return the document
  3427. if (typeof element.getRootNode === 'function') {
  3428. var root = element.getRootNode();
  3429. return root instanceof ShadowRoot ? root : null;
  3430. }
  3431. if (element instanceof ShadowRoot) {
  3432. return element;
  3433. } // when we don't find a shadow root
  3434. if (!element.parentNode) {
  3435. return null;
  3436. }
  3437. return Util.findShadowRoot(element.parentNode);
  3438. },
  3439. jQueryDetection: function jQueryDetection() {
  3440. if (typeof $ === 'undefined') {
  3441. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  3442. }
  3443. var version = $.fn.jquery.split(' ')[0].split('.');
  3444. var minMajor = 1;
  3445. var ltMajor = 2;
  3446. var minMinor = 9;
  3447. var minPatch = 1;
  3448. var maxMajor = 4;
  3449. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  3450. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  3451. }
  3452. }
  3453. };
  3454. Util.jQueryDetection();
  3455. setTransitionEndSupport();
  3456. /**
  3457. * ------------------------------------------------------------------------
  3458. * Constants
  3459. * ------------------------------------------------------------------------
  3460. */
  3461. var NAME = 'alert';
  3462. var VERSION = '4.4.1';
  3463. var DATA_KEY = 'bs.alert';
  3464. var EVENT_KEY = "." + DATA_KEY;
  3465. var DATA_API_KEY = '.data-api';
  3466. var JQUERY_NO_CONFLICT = $.fn[NAME];
  3467. var Selector = {
  3468. DISMISS: '[data-dismiss="alert"]'
  3469. };
  3470. var Event = {
  3471. CLOSE: "close" + EVENT_KEY,
  3472. CLOSED: "closed" + EVENT_KEY,
  3473. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  3474. };
  3475. var ClassName = {
  3476. ALERT: 'alert',
  3477. FADE: 'fade',
  3478. SHOW: 'show'
  3479. };
  3480. /**
  3481. * ------------------------------------------------------------------------
  3482. * Class Definition
  3483. * ------------------------------------------------------------------------
  3484. */
  3485. var Alert =
  3486. /*#__PURE__*/
  3487. function () {
  3488. function Alert(element) {
  3489. this._element = element;
  3490. } // Getters
  3491. var _proto = Alert.prototype;
  3492. // Public
  3493. _proto.close = function close(element) {
  3494. var rootElement = this._element;
  3495. if (element) {
  3496. rootElement = this._getRootElement(element);
  3497. }
  3498. var customEvent = this._triggerCloseEvent(rootElement);
  3499. if (customEvent.isDefaultPrevented()) {
  3500. return;
  3501. }
  3502. this._removeElement(rootElement);
  3503. };
  3504. _proto.dispose = function dispose() {
  3505. $.removeData(this._element, DATA_KEY);
  3506. this._element = null;
  3507. } // Private
  3508. ;
  3509. _proto._getRootElement = function _getRootElement(element) {
  3510. var selector = Util.getSelectorFromElement(element);
  3511. var parent = false;
  3512. if (selector) {
  3513. parent = document.querySelector(selector);
  3514. }
  3515. if (!parent) {
  3516. parent = $(element).closest("." + ClassName.ALERT)[0];
  3517. }
  3518. return parent;
  3519. };
  3520. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  3521. var closeEvent = $.Event(Event.CLOSE);
  3522. $(element).trigger(closeEvent);
  3523. return closeEvent;
  3524. };
  3525. _proto._removeElement = function _removeElement(element) {
  3526. var _this = this;
  3527. $(element).removeClass(ClassName.SHOW);
  3528. if (!$(element).hasClass(ClassName.FADE)) {
  3529. this._destroyElement(element);
  3530. return;
  3531. }
  3532. var transitionDuration = Util.getTransitionDurationFromElement(element);
  3533. $(element).one(Util.TRANSITION_END, function (event) {
  3534. return _this._destroyElement(element, event);
  3535. }).emulateTransitionEnd(transitionDuration);
  3536. };
  3537. _proto._destroyElement = function _destroyElement(element) {
  3538. $(element).detach().trigger(Event.CLOSED).remove();
  3539. } // Static
  3540. ;
  3541. Alert._jQueryInterface = function _jQueryInterface(config) {
  3542. return this.each(function () {
  3543. var $element = $(this);
  3544. var data = $element.data(DATA_KEY);
  3545. if (!data) {
  3546. data = new Alert(this);
  3547. $element.data(DATA_KEY, data);
  3548. }
  3549. if (config === 'close') {
  3550. data[config](this);
  3551. }
  3552. });
  3553. };
  3554. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  3555. return function (event) {
  3556. if (event) {
  3557. event.preventDefault();
  3558. }
  3559. alertInstance.close(this);
  3560. };
  3561. };
  3562. _createClass(Alert, null, [{
  3563. key: "VERSION",
  3564. get: function get() {
  3565. return VERSION;
  3566. }
  3567. }]);
  3568. return Alert;
  3569. }();
  3570. /**
  3571. * ------------------------------------------------------------------------
  3572. * Data Api implementation
  3573. * ------------------------------------------------------------------------
  3574. */
  3575. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  3576. /**
  3577. * ------------------------------------------------------------------------
  3578. * jQuery
  3579. * ------------------------------------------------------------------------
  3580. */
  3581. $.fn[NAME] = Alert._jQueryInterface;
  3582. $.fn[NAME].Constructor = Alert;
  3583. $.fn[NAME].noConflict = function () {
  3584. $.fn[NAME] = JQUERY_NO_CONFLICT;
  3585. return Alert._jQueryInterface;
  3586. };
  3587. /**
  3588. * ------------------------------------------------------------------------
  3589. * Constants
  3590. * ------------------------------------------------------------------------
  3591. */
  3592. var NAME$1 = 'button';
  3593. var VERSION$1 = '4.4.1';
  3594. var DATA_KEY$1 = 'bs.button';
  3595. var EVENT_KEY$1 = "." + DATA_KEY$1;
  3596. var DATA_API_KEY$1 = '.data-api';
  3597. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  3598. var ClassName$1 = {
  3599. ACTIVE: 'active',
  3600. BUTTON: 'btn',
  3601. FOCUS: 'focus'
  3602. };
  3603. var Selector$1 = {
  3604. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  3605. DATA_TOGGLES: '[data-toggle="buttons"]',
  3606. DATA_TOGGLE: '[data-toggle="button"]',
  3607. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  3608. INPUT: 'input:not([type="hidden"])',
  3609. ACTIVE: '.active',
  3610. BUTTON: '.btn'
  3611. };
  3612. var Event$1 = {
  3613. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  3614. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  3615. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  3616. };
  3617. /**
  3618. * ------------------------------------------------------------------------
  3619. * Class Definition
  3620. * ------------------------------------------------------------------------
  3621. */
  3622. var Button =
  3623. /*#__PURE__*/
  3624. function () {
  3625. function Button(element) {
  3626. this._element = element;
  3627. } // Getters
  3628. var _proto = Button.prototype;
  3629. // Public
  3630. _proto.toggle = function toggle() {
  3631. var triggerChangeEvent = true;
  3632. var addAriaPressed = true;
  3633. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  3634. if (rootElement) {
  3635. var input = this._element.querySelector(Selector$1.INPUT);
  3636. if (input) {
  3637. if (input.type === 'radio') {
  3638. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  3639. triggerChangeEvent = false;
  3640. } else {
  3641. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  3642. if (activeElement) {
  3643. $(activeElement).removeClass(ClassName$1.ACTIVE);
  3644. }
  3645. }
  3646. } else if (input.type === 'checkbox') {
  3647. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  3648. triggerChangeEvent = false;
  3649. }
  3650. } else {
  3651. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  3652. triggerChangeEvent = false;
  3653. }
  3654. if (triggerChangeEvent) {
  3655. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  3656. $(input).trigger('change');
  3657. }
  3658. input.focus();
  3659. addAriaPressed = false;
  3660. }
  3661. }
  3662. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  3663. if (addAriaPressed) {
  3664. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  3665. }
  3666. if (triggerChangeEvent) {
  3667. $(this._element).toggleClass(ClassName$1.ACTIVE);
  3668. }
  3669. }
  3670. };
  3671. _proto.dispose = function dispose() {
  3672. $.removeData(this._element, DATA_KEY$1);
  3673. this._element = null;
  3674. } // Static
  3675. ;
  3676. Button._jQueryInterface = function _jQueryInterface(config) {
  3677. return this.each(function () {
  3678. var data = $(this).data(DATA_KEY$1);
  3679. if (!data) {
  3680. data = new Button(this);
  3681. $(this).data(DATA_KEY$1, data);
  3682. }
  3683. if (config === 'toggle') {
  3684. data[config]();
  3685. }
  3686. });
  3687. };
  3688. _createClass(Button, null, [{
  3689. key: "VERSION",
  3690. get: function get() {
  3691. return VERSION$1;
  3692. }
  3693. }]);
  3694. return Button;
  3695. }();
  3696. /**
  3697. * ------------------------------------------------------------------------
  3698. * Data Api implementation
  3699. * ------------------------------------------------------------------------
  3700. */
  3701. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  3702. var button = event.target;
  3703. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  3704. button = $(button).closest(Selector$1.BUTTON)[0];
  3705. }
  3706. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  3707. event.preventDefault(); // work around Firefox bug #1540995
  3708. } else {
  3709. var inputBtn = button.querySelector(Selector$1.INPUT);
  3710. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  3711. event.preventDefault(); // work around Firefox bug #1540995
  3712. return;
  3713. }
  3714. Button._jQueryInterface.call($(button), 'toggle');
  3715. }
  3716. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  3717. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  3718. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  3719. });
  3720. $(window).on(Event$1.LOAD_DATA_API, function () {
  3721. // ensure correct active class is set to match the controls' actual values/states
  3722. // find all checkboxes/readio buttons inside data-toggle groups
  3723. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  3724. for (var i = 0, len = buttons.length; i < len; i++) {
  3725. var button = buttons[i];
  3726. var input = button.querySelector(Selector$1.INPUT);
  3727. if (input.checked || input.hasAttribute('checked')) {
  3728. button.classList.add(ClassName$1.ACTIVE);
  3729. } else {
  3730. button.classList.remove(ClassName$1.ACTIVE);
  3731. }
  3732. } // find all button toggles
  3733. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  3734. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  3735. var _button = buttons[_i];
  3736. if (_button.getAttribute('aria-pressed') === 'true') {
  3737. _button.classList.add(ClassName$1.ACTIVE);
  3738. } else {
  3739. _button.classList.remove(ClassName$1.ACTIVE);
  3740. }
  3741. }
  3742. });
  3743. /**
  3744. * ------------------------------------------------------------------------
  3745. * jQuery
  3746. * ------------------------------------------------------------------------
  3747. */
  3748. $.fn[NAME$1] = Button._jQueryInterface;
  3749. $.fn[NAME$1].Constructor = Button;
  3750. $.fn[NAME$1].noConflict = function () {
  3751. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  3752. return Button._jQueryInterface;
  3753. };
  3754. /**
  3755. * ------------------------------------------------------------------------
  3756. * Constants
  3757. * ------------------------------------------------------------------------
  3758. */
  3759. var NAME$2 = 'carousel';
  3760. var VERSION$2 = '4.4.1';
  3761. var DATA_KEY$2 = 'bs.carousel';
  3762. var EVENT_KEY$2 = "." + DATA_KEY$2;
  3763. var DATA_API_KEY$2 = '.data-api';
  3764. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  3765. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  3766. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  3767. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  3768. var SWIPE_THRESHOLD = 40;
  3769. var Default = {
  3770. interval: 5000,
  3771. keyboard: true,
  3772. slide: false,
  3773. pause: 'hover',
  3774. wrap: true,
  3775. touch: true
  3776. };
  3777. var DefaultType = {
  3778. interval: '(number|boolean)',
  3779. keyboard: 'boolean',
  3780. slide: '(boolean|string)',
  3781. pause: '(string|boolean)',
  3782. wrap: 'boolean',
  3783. touch: 'boolean'
  3784. };
  3785. var Direction = {
  3786. NEXT: 'next',
  3787. PREV: 'prev',
  3788. LEFT: 'left',
  3789. RIGHT: 'right'
  3790. };
  3791. var Event$2 = {
  3792. SLIDE: "slide" + EVENT_KEY$2,
  3793. SLID: "slid" + EVENT_KEY$2,
  3794. KEYDOWN: "keydown" + EVENT_KEY$2,
  3795. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  3796. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  3797. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  3798. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  3799. TOUCHEND: "touchend" + EVENT_KEY$2,
  3800. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  3801. POINTERUP: "pointerup" + EVENT_KEY$2,
  3802. DRAG_START: "dragstart" + EVENT_KEY$2,
  3803. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  3804. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  3805. };
  3806. var ClassName$2 = {
  3807. CAROUSEL: 'carousel',
  3808. ACTIVE: 'active',
  3809. SLIDE: 'slide',
  3810. RIGHT: 'carousel-item-right',
  3811. LEFT: 'carousel-item-left',
  3812. NEXT: 'carousel-item-next',
  3813. PREV: 'carousel-item-prev',
  3814. ITEM: 'carousel-item',
  3815. POINTER_EVENT: 'pointer-event'
  3816. };
  3817. var Selector$2 = {
  3818. ACTIVE: '.active',
  3819. ACTIVE_ITEM: '.active.carousel-item',
  3820. ITEM: '.carousel-item',
  3821. ITEM_IMG: '.carousel-item img',
  3822. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  3823. INDICATORS: '.carousel-indicators',
  3824. DATA_SLIDE: '[data-slide], [data-slide-to]',
  3825. DATA_RIDE: '[data-ride="carousel"]'
  3826. };
  3827. var PointerType = {
  3828. TOUCH: 'touch',
  3829. PEN: 'pen'
  3830. };
  3831. /**
  3832. * ------------------------------------------------------------------------
  3833. * Class Definition
  3834. * ------------------------------------------------------------------------
  3835. */
  3836. var Carousel =
  3837. /*#__PURE__*/
  3838. function () {
  3839. function Carousel(element, config) {
  3840. this._items = null;
  3841. this._interval = null;
  3842. this._activeElement = null;
  3843. this._isPaused = false;
  3844. this._isSliding = false;
  3845. this.touchTimeout = null;
  3846. this.touchStartX = 0;
  3847. this.touchDeltaX = 0;
  3848. this._config = this._getConfig(config);
  3849. this._element = element;
  3850. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  3851. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  3852. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  3853. this._addEventListeners();
  3854. } // Getters
  3855. var _proto = Carousel.prototype;
  3856. // Public
  3857. _proto.next = function next() {
  3858. if (!this._isSliding) {
  3859. this._slide(Direction.NEXT);
  3860. }
  3861. };
  3862. _proto.nextWhenVisible = function nextWhenVisible() {
  3863. // Don't call next when the page isn't visible
  3864. // or the carousel or its parent isn't visible
  3865. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  3866. this.next();
  3867. }
  3868. };
  3869. _proto.prev = function prev() {
  3870. if (!this._isSliding) {
  3871. this._slide(Direction.PREV);
  3872. }
  3873. };
  3874. _proto.pause = function pause(event) {
  3875. if (!event) {
  3876. this._isPaused = true;
  3877. }
  3878. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  3879. Util.triggerTransitionEnd(this._element);
  3880. this.cycle(true);
  3881. }
  3882. clearInterval(this._interval);
  3883. this._interval = null;
  3884. };
  3885. _proto.cycle = function cycle(event) {
  3886. if (!event) {
  3887. this._isPaused = false;
  3888. }
  3889. if (this._interval) {
  3890. clearInterval(this._interval);
  3891. this._interval = null;
  3892. }
  3893. if (this._config.interval && !this._isPaused) {
  3894. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  3895. }
  3896. };
  3897. _proto.to = function to(index) {
  3898. var _this = this;
  3899. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3900. var activeIndex = this._getItemIndex(this._activeElement);
  3901. if (index > this._items.length - 1 || index < 0) {
  3902. return;
  3903. }
  3904. if (this._isSliding) {
  3905. $(this._element).one(Event$2.SLID, function () {
  3906. return _this.to(index);
  3907. });
  3908. return;
  3909. }
  3910. if (activeIndex === index) {
  3911. this.pause();
  3912. this.cycle();
  3913. return;
  3914. }
  3915. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  3916. this._slide(direction, this._items[index]);
  3917. };
  3918. _proto.dispose = function dispose() {
  3919. $(this._element).off(EVENT_KEY$2);
  3920. $.removeData(this._element, DATA_KEY$2);
  3921. this._items = null;
  3922. this._config = null;
  3923. this._element = null;
  3924. this._interval = null;
  3925. this._isPaused = null;
  3926. this._isSliding = null;
  3927. this._activeElement = null;
  3928. this._indicatorsElement = null;
  3929. } // Private
  3930. ;
  3931. _proto._getConfig = function _getConfig(config) {
  3932. config = _objectSpread2({}, Default, {}, config);
  3933. Util.typeCheckConfig(NAME$2, config, DefaultType);
  3934. return config;
  3935. };
  3936. _proto._handleSwipe = function _handleSwipe() {
  3937. var absDeltax = Math.abs(this.touchDeltaX);
  3938. if (absDeltax <= SWIPE_THRESHOLD) {
  3939. return;
  3940. }
  3941. var direction = absDeltax / this.touchDeltaX;
  3942. this.touchDeltaX = 0; // swipe left
  3943. if (direction > 0) {
  3944. this.prev();
  3945. } // swipe right
  3946. if (direction < 0) {
  3947. this.next();
  3948. }
  3949. };
  3950. _proto._addEventListeners = function _addEventListeners() {
  3951. var _this2 = this;
  3952. if (this._config.keyboard) {
  3953. $(this._element).on(Event$2.KEYDOWN, function (event) {
  3954. return _this2._keydown(event);
  3955. });
  3956. }
  3957. if (this._config.pause === 'hover') {
  3958. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  3959. return _this2.pause(event);
  3960. }).on(Event$2.MOUSELEAVE, function (event) {
  3961. return _this2.cycle(event);
  3962. });
  3963. }
  3964. if (this._config.touch) {
  3965. this._addTouchEventListeners();
  3966. }
  3967. };
  3968. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  3969. var _this3 = this;
  3970. if (!this._touchSupported) {
  3971. return;
  3972. }
  3973. var start = function start(event) {
  3974. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3975. _this3.touchStartX = event.originalEvent.clientX;
  3976. } else if (!_this3._pointerEvent) {
  3977. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  3978. }
  3979. };
  3980. var move = function move(event) {
  3981. // ensure swiping with one touch and not pinching
  3982. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  3983. _this3.touchDeltaX = 0;
  3984. } else {
  3985. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  3986. }
  3987. };
  3988. var end = function end(event) {
  3989. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3990. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  3991. }
  3992. _this3._handleSwipe();
  3993. if (_this3._config.pause === 'hover') {
  3994. // If it's a touch-enabled device, mouseenter/leave are fired as
  3995. // part of the mouse compatibility events on first tap - the carousel
  3996. // would stop cycling until user tapped out of it;
  3997. // here, we listen for touchend, explicitly pause the carousel
  3998. // (as if it's the second time we tap on it, mouseenter compat event
  3999. // is NOT fired) and after a timeout (to allow for mouse compatibility
  4000. // events to fire) we explicitly restart cycling
  4001. _this3.pause();
  4002. if (_this3.touchTimeout) {
  4003. clearTimeout(_this3.touchTimeout);
  4004. }
  4005. _this3.touchTimeout = setTimeout(function (event) {
  4006. return _this3.cycle(event);
  4007. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  4008. }
  4009. };
  4010. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  4011. return e.preventDefault();
  4012. });
  4013. if (this._pointerEvent) {
  4014. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  4015. return start(event);
  4016. });
  4017. $(this._element).on(Event$2.POINTERUP, function (event) {
  4018. return end(event);
  4019. });
  4020. this._element.classList.add(ClassName$2.POINTER_EVENT);
  4021. } else {
  4022. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  4023. return start(event);
  4024. });
  4025. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  4026. return move(event);
  4027. });
  4028. $(this._element).on(Event$2.TOUCHEND, function (event) {
  4029. return end(event);
  4030. });
  4031. }
  4032. };
  4033. _proto._keydown = function _keydown(event) {
  4034. if (/input|textarea/i.test(event.target.tagName)) {
  4035. return;
  4036. }
  4037. switch (event.which) {
  4038. case ARROW_LEFT_KEYCODE:
  4039. event.preventDefault();
  4040. this.prev();
  4041. break;
  4042. case ARROW_RIGHT_KEYCODE:
  4043. event.preventDefault();
  4044. this.next();
  4045. break;
  4046. }
  4047. };
  4048. _proto._getItemIndex = function _getItemIndex(element) {
  4049. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  4050. return this._items.indexOf(element);
  4051. };
  4052. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  4053. var isNextDirection = direction === Direction.NEXT;
  4054. var isPrevDirection = direction === Direction.PREV;
  4055. var activeIndex = this._getItemIndex(activeElement);
  4056. var lastItemIndex = this._items.length - 1;
  4057. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  4058. if (isGoingToWrap && !this._config.wrap) {
  4059. return activeElement;
  4060. }
  4061. var delta = direction === Direction.PREV ? -1 : 1;
  4062. var itemIndex = (activeIndex + delta) % this._items.length;
  4063. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  4064. };
  4065. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  4066. var targetIndex = this._getItemIndex(relatedTarget);
  4067. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  4068. var slideEvent = $.Event(Event$2.SLIDE, {
  4069. relatedTarget: relatedTarget,
  4070. direction: eventDirectionName,
  4071. from: fromIndex,
  4072. to: targetIndex
  4073. });
  4074. $(this._element).trigger(slideEvent);
  4075. return slideEvent;
  4076. };
  4077. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  4078. if (this._indicatorsElement) {
  4079. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  4080. $(indicators).removeClass(ClassName$2.ACTIVE);
  4081. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  4082. if (nextIndicator) {
  4083. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  4084. }
  4085. }
  4086. };
  4087. _proto._slide = function _slide(direction, element) {
  4088. var _this4 = this;
  4089. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  4090. var activeElementIndex = this._getItemIndex(activeElement);
  4091. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  4092. var nextElementIndex = this._getItemIndex(nextElement);
  4093. var isCycling = Boolean(this._interval);
  4094. var directionalClassName;
  4095. var orderClassName;
  4096. var eventDirectionName;
  4097. if (direction === Direction.NEXT) {
  4098. directionalClassName = ClassName$2.LEFT;
  4099. orderClassName = ClassName$2.NEXT;
  4100. eventDirectionName = Direction.LEFT;
  4101. } else {
  4102. directionalClassName = ClassName$2.RIGHT;
  4103. orderClassName = ClassName$2.PREV;
  4104. eventDirectionName = Direction.RIGHT;
  4105. }
  4106. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  4107. this._isSliding = false;
  4108. return;
  4109. }
  4110. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  4111. if (slideEvent.isDefaultPrevented()) {
  4112. return;
  4113. }
  4114. if (!activeElement || !nextElement) {
  4115. // Some weirdness is happening, so we bail
  4116. return;
  4117. }
  4118. this._isSliding = true;
  4119. if (isCycling) {
  4120. this.pause();
  4121. }
  4122. this._setActiveIndicatorElement(nextElement);
  4123. var slidEvent = $.Event(Event$2.SLID, {
  4124. relatedTarget: nextElement,
  4125. direction: eventDirectionName,
  4126. from: activeElementIndex,
  4127. to: nextElementIndex
  4128. });
  4129. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  4130. $(nextElement).addClass(orderClassName);
  4131. Util.reflow(nextElement);
  4132. $(activeElement).addClass(directionalClassName);
  4133. $(nextElement).addClass(directionalClassName);
  4134. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  4135. if (nextElementInterval) {
  4136. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  4137. this._config.interval = nextElementInterval;
  4138. } else {
  4139. this._config.interval = this._config.defaultInterval || this._config.interval;
  4140. }
  4141. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  4142. $(activeElement).one(Util.TRANSITION_END, function () {
  4143. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  4144. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  4145. _this4._isSliding = false;
  4146. setTimeout(function () {
  4147. return $(_this4._element).trigger(slidEvent);
  4148. }, 0);
  4149. }).emulateTransitionEnd(transitionDuration);
  4150. } else {
  4151. $(activeElement).removeClass(ClassName$2.ACTIVE);
  4152. $(nextElement).addClass(ClassName$2.ACTIVE);
  4153. this._isSliding = false;
  4154. $(this._element).trigger(slidEvent);
  4155. }
  4156. if (isCycling) {
  4157. this.cycle();
  4158. }
  4159. } // Static
  4160. ;
  4161. Carousel._jQueryInterface = function _jQueryInterface(config) {
  4162. return this.each(function () {
  4163. var data = $(this).data(DATA_KEY$2);
  4164. var _config = _objectSpread2({}, Default, {}, $(this).data());
  4165. if (typeof config === 'object') {
  4166. _config = _objectSpread2({}, _config, {}, config);
  4167. }
  4168. var action = typeof config === 'string' ? config : _config.slide;
  4169. if (!data) {
  4170. data = new Carousel(this, _config);
  4171. $(this).data(DATA_KEY$2, data);
  4172. }
  4173. if (typeof config === 'number') {
  4174. data.to(config);
  4175. } else if (typeof action === 'string') {
  4176. if (typeof data[action] === 'undefined') {
  4177. throw new TypeError("No method named \"" + action + "\"");
  4178. }
  4179. data[action]();
  4180. } else if (_config.interval && _config.ride) {
  4181. data.pause();
  4182. data.cycle();
  4183. }
  4184. });
  4185. };
  4186. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  4187. var selector = Util.getSelectorFromElement(this);
  4188. if (!selector) {
  4189. return;
  4190. }
  4191. var target = $(selector)[0];
  4192. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  4193. return;
  4194. }
  4195. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  4196. var slideIndex = this.getAttribute('data-slide-to');
  4197. if (slideIndex) {
  4198. config.interval = false;
  4199. }
  4200. Carousel._jQueryInterface.call($(target), config);
  4201. if (slideIndex) {
  4202. $(target).data(DATA_KEY$2).to(slideIndex);
  4203. }
  4204. event.preventDefault();
  4205. };
  4206. _createClass(Carousel, null, [{
  4207. key: "VERSION",
  4208. get: function get() {
  4209. return VERSION$2;
  4210. }
  4211. }, {
  4212. key: "Default",
  4213. get: function get() {
  4214. return Default;
  4215. }
  4216. }]);
  4217. return Carousel;
  4218. }();
  4219. /**
  4220. * ------------------------------------------------------------------------
  4221. * Data Api implementation
  4222. * ------------------------------------------------------------------------
  4223. */
  4224. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  4225. $(window).on(Event$2.LOAD_DATA_API, function () {
  4226. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  4227. for (var i = 0, len = carousels.length; i < len; i++) {
  4228. var $carousel = $(carousels[i]);
  4229. Carousel._jQueryInterface.call($carousel, $carousel.data());
  4230. }
  4231. });
  4232. /**
  4233. * ------------------------------------------------------------------------
  4234. * jQuery
  4235. * ------------------------------------------------------------------------
  4236. */
  4237. $.fn[NAME$2] = Carousel._jQueryInterface;
  4238. $.fn[NAME$2].Constructor = Carousel;
  4239. $.fn[NAME$2].noConflict = function () {
  4240. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  4241. return Carousel._jQueryInterface;
  4242. };
  4243. /**
  4244. * ------------------------------------------------------------------------
  4245. * Constants
  4246. * ------------------------------------------------------------------------
  4247. */
  4248. var NAME$3 = 'collapse';
  4249. var VERSION$3 = '4.4.1';
  4250. var DATA_KEY$3 = 'bs.collapse';
  4251. var EVENT_KEY$3 = "." + DATA_KEY$3;
  4252. var DATA_API_KEY$3 = '.data-api';
  4253. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  4254. var Default$1 = {
  4255. toggle: true,
  4256. parent: ''
  4257. };
  4258. var DefaultType$1 = {
  4259. toggle: 'boolean',
  4260. parent: '(string|element)'
  4261. };
  4262. var Event$3 = {
  4263. SHOW: "show" + EVENT_KEY$3,
  4264. SHOWN: "shown" + EVENT_KEY$3,
  4265. HIDE: "hide" + EVENT_KEY$3,
  4266. HIDDEN: "hidden" + EVENT_KEY$3,
  4267. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  4268. };
  4269. var ClassName$3 = {
  4270. SHOW: 'show',
  4271. COLLAPSE: 'collapse',
  4272. COLLAPSING: 'collapsing',
  4273. COLLAPSED: 'collapsed'
  4274. };
  4275. var Dimension = {
  4276. WIDTH: 'width',
  4277. HEIGHT: 'height'
  4278. };
  4279. var Selector$3 = {
  4280. ACTIVES: '.show, .collapsing',
  4281. DATA_TOGGLE: '[data-toggle="collapse"]'
  4282. };
  4283. /**
  4284. * ------------------------------------------------------------------------
  4285. * Class Definition
  4286. * ------------------------------------------------------------------------
  4287. */
  4288. var Collapse =
  4289. /*#__PURE__*/
  4290. function () {
  4291. function Collapse(element, config) {
  4292. this._isTransitioning = false;
  4293. this._element = element;
  4294. this._config = this._getConfig(config);
  4295. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  4296. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  4297. for (var i = 0, len = toggleList.length; i < len; i++) {
  4298. var elem = toggleList[i];
  4299. var selector = Util.getSelectorFromElement(elem);
  4300. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  4301. return foundElem === element;
  4302. });
  4303. if (selector !== null && filterElement.length > 0) {
  4304. this._selector = selector;
  4305. this._triggerArray.push(elem);
  4306. }
  4307. }
  4308. this._parent = this._config.parent ? this._getParent() : null;
  4309. if (!this._config.parent) {
  4310. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  4311. }
  4312. if (this._config.toggle) {
  4313. this.toggle();
  4314. }
  4315. } // Getters
  4316. var _proto = Collapse.prototype;
  4317. // Public
  4318. _proto.toggle = function toggle() {
  4319. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  4320. this.hide();
  4321. } else {
  4322. this.show();
  4323. }
  4324. };
  4325. _proto.show = function show() {
  4326. var _this = this;
  4327. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  4328. return;
  4329. }
  4330. var actives;
  4331. var activesData;
  4332. if (this._parent) {
  4333. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  4334. if (typeof _this._config.parent === 'string') {
  4335. return elem.getAttribute('data-parent') === _this._config.parent;
  4336. }
  4337. return elem.classList.contains(ClassName$3.COLLAPSE);
  4338. });
  4339. if (actives.length === 0) {
  4340. actives = null;
  4341. }
  4342. }
  4343. if (actives) {
  4344. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  4345. if (activesData && activesData._isTransitioning) {
  4346. return;
  4347. }
  4348. }
  4349. var startEvent = $.Event(Event$3.SHOW);
  4350. $(this._element).trigger(startEvent);
  4351. if (startEvent.isDefaultPrevented()) {
  4352. return;
  4353. }
  4354. if (actives) {
  4355. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  4356. if (!activesData) {
  4357. $(actives).data(DATA_KEY$3, null);
  4358. }
  4359. }
  4360. var dimension = this._getDimension();
  4361. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  4362. this._element.style[dimension] = 0;
  4363. if (this._triggerArray.length) {
  4364. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  4365. }
  4366. this.setTransitioning(true);
  4367. var complete = function complete() {
  4368. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  4369. _this._element.style[dimension] = '';
  4370. _this.setTransitioning(false);
  4371. $(_this._element).trigger(Event$3.SHOWN);
  4372. };
  4373. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  4374. var scrollSize = "scroll" + capitalizedDimension;
  4375. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4376. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4377. this._element.style[dimension] = this._element[scrollSize] + "px";
  4378. };
  4379. _proto.hide = function hide() {
  4380. var _this2 = this;
  4381. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  4382. return;
  4383. }
  4384. var startEvent = $.Event(Event$3.HIDE);
  4385. $(this._element).trigger(startEvent);
  4386. if (startEvent.isDefaultPrevented()) {
  4387. return;
  4388. }
  4389. var dimension = this._getDimension();
  4390. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  4391. Util.reflow(this._element);
  4392. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  4393. var triggerArrayLength = this._triggerArray.length;
  4394. if (triggerArrayLength > 0) {
  4395. for (var i = 0; i < triggerArrayLength; i++) {
  4396. var trigger = this._triggerArray[i];
  4397. var selector = Util.getSelectorFromElement(trigger);
  4398. if (selector !== null) {
  4399. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  4400. if (!$elem.hasClass(ClassName$3.SHOW)) {
  4401. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  4402. }
  4403. }
  4404. }
  4405. }
  4406. this.setTransitioning(true);
  4407. var complete = function complete() {
  4408. _this2.setTransitioning(false);
  4409. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  4410. };
  4411. this._element.style[dimension] = '';
  4412. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4413. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4414. };
  4415. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  4416. this._isTransitioning = isTransitioning;
  4417. };
  4418. _proto.dispose = function dispose() {
  4419. $.removeData(this._element, DATA_KEY$3);
  4420. this._config = null;
  4421. this._parent = null;
  4422. this._element = null;
  4423. this._triggerArray = null;
  4424. this._isTransitioning = null;
  4425. } // Private
  4426. ;
  4427. _proto._getConfig = function _getConfig(config) {
  4428. config = _objectSpread2({}, Default$1, {}, config);
  4429. config.toggle = Boolean(config.toggle); // Coerce string values
  4430. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  4431. return config;
  4432. };
  4433. _proto._getDimension = function _getDimension() {
  4434. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  4435. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  4436. };
  4437. _proto._getParent = function _getParent() {
  4438. var _this3 = this;
  4439. var parent;
  4440. if (Util.isElement(this._config.parent)) {
  4441. parent = this._config.parent; // It's a jQuery object
  4442. if (typeof this._config.parent.jquery !== 'undefined') {
  4443. parent = this._config.parent[0];
  4444. }
  4445. } else {
  4446. parent = document.querySelector(this._config.parent);
  4447. }
  4448. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  4449. var children = [].slice.call(parent.querySelectorAll(selector));
  4450. $(children).each(function (i, element) {
  4451. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  4452. });
  4453. return parent;
  4454. };
  4455. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  4456. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  4457. if (triggerArray.length) {
  4458. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  4459. }
  4460. } // Static
  4461. ;
  4462. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  4463. var selector = Util.getSelectorFromElement(element);
  4464. return selector ? document.querySelector(selector) : null;
  4465. };
  4466. Collapse._jQueryInterface = function _jQueryInterface(config) {
  4467. return this.each(function () {
  4468. var $this = $(this);
  4469. var data = $this.data(DATA_KEY$3);
  4470. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  4471. if (!data && _config.toggle && /show|hide/.test(config)) {
  4472. _config.toggle = false;
  4473. }
  4474. if (!data) {
  4475. data = new Collapse(this, _config);
  4476. $this.data(DATA_KEY$3, data);
  4477. }
  4478. if (typeof config === 'string') {
  4479. if (typeof data[config] === 'undefined') {
  4480. throw new TypeError("No method named \"" + config + "\"");
  4481. }
  4482. data[config]();
  4483. }
  4484. });
  4485. };
  4486. _createClass(Collapse, null, [{
  4487. key: "VERSION",
  4488. get: function get() {
  4489. return VERSION$3;
  4490. }
  4491. }, {
  4492. key: "Default",
  4493. get: function get() {
  4494. return Default$1;
  4495. }
  4496. }]);
  4497. return Collapse;
  4498. }();
  4499. /**
  4500. * ------------------------------------------------------------------------
  4501. * Data Api implementation
  4502. * ------------------------------------------------------------------------
  4503. */
  4504. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  4505. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  4506. if (event.currentTarget.tagName === 'A') {
  4507. event.preventDefault();
  4508. }
  4509. var $trigger = $(this);
  4510. var selector = Util.getSelectorFromElement(this);
  4511. var selectors = [].slice.call(document.querySelectorAll(selector));
  4512. $(selectors).each(function () {
  4513. var $target = $(this);
  4514. var data = $target.data(DATA_KEY$3);
  4515. var config = data ? 'toggle' : $trigger.data();
  4516. Collapse._jQueryInterface.call($target, config);
  4517. });
  4518. });
  4519. /**
  4520. * ------------------------------------------------------------------------
  4521. * jQuery
  4522. * ------------------------------------------------------------------------
  4523. */
  4524. $.fn[NAME$3] = Collapse._jQueryInterface;
  4525. $.fn[NAME$3].Constructor = Collapse;
  4526. $.fn[NAME$3].noConflict = function () {
  4527. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  4528. return Collapse._jQueryInterface;
  4529. };
  4530. /**
  4531. * ------------------------------------------------------------------------
  4532. * Constants
  4533. * ------------------------------------------------------------------------
  4534. */
  4535. var NAME$4 = 'dropdown';
  4536. var VERSION$4 = '4.4.1';
  4537. var DATA_KEY$4 = 'bs.dropdown';
  4538. var EVENT_KEY$4 = "." + DATA_KEY$4;
  4539. var DATA_API_KEY$4 = '.data-api';
  4540. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  4541. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  4542. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  4543. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  4544. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  4545. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  4546. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  4547. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  4548. var Event$4 = {
  4549. HIDE: "hide" + EVENT_KEY$4,
  4550. HIDDEN: "hidden" + EVENT_KEY$4,
  4551. SHOW: "show" + EVENT_KEY$4,
  4552. SHOWN: "shown" + EVENT_KEY$4,
  4553. CLICK: "click" + EVENT_KEY$4,
  4554. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  4555. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  4556. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  4557. };
  4558. var ClassName$4 = {
  4559. DISABLED: 'disabled',
  4560. SHOW: 'show',
  4561. DROPUP: 'dropup',
  4562. DROPRIGHT: 'dropright',
  4563. DROPLEFT: 'dropleft',
  4564. MENURIGHT: 'dropdown-menu-right',
  4565. MENULEFT: 'dropdown-menu-left',
  4566. POSITION_STATIC: 'position-static'
  4567. };
  4568. var Selector$4 = {
  4569. DATA_TOGGLE: '[data-toggle="dropdown"]',
  4570. FORM_CHILD: '.dropdown form',
  4571. MENU: '.dropdown-menu',
  4572. NAVBAR_NAV: '.navbar-nav',
  4573. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  4574. };
  4575. var AttachmentMap = {
  4576. TOP: 'top-start',
  4577. TOPEND: 'top-end',
  4578. BOTTOM: 'bottom-start',
  4579. BOTTOMEND: 'bottom-end',
  4580. RIGHT: 'right-start',
  4581. RIGHTEND: 'right-end',
  4582. LEFT: 'left-start',
  4583. LEFTEND: 'left-end'
  4584. };
  4585. var Default$2 = {
  4586. offset: 0,
  4587. flip: true,
  4588. boundary: 'scrollParent',
  4589. reference: 'toggle',
  4590. display: 'dynamic',
  4591. popperConfig: null
  4592. };
  4593. var DefaultType$2 = {
  4594. offset: '(number|string|function)',
  4595. flip: 'boolean',
  4596. boundary: '(string|element)',
  4597. reference: '(string|element)',
  4598. display: 'string',
  4599. popperConfig: '(null|object)'
  4600. };
  4601. /**
  4602. * ------------------------------------------------------------------------
  4603. * Class Definition
  4604. * ------------------------------------------------------------------------
  4605. */
  4606. var Dropdown =
  4607. /*#__PURE__*/
  4608. function () {
  4609. function Dropdown(element, config) {
  4610. this._element = element;
  4611. this._popper = null;
  4612. this._config = this._getConfig(config);
  4613. this._menu = this._getMenuElement();
  4614. this._inNavbar = this._detectNavbar();
  4615. this._addEventListeners();
  4616. } // Getters
  4617. var _proto = Dropdown.prototype;
  4618. // Public
  4619. _proto.toggle = function toggle() {
  4620. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  4621. return;
  4622. }
  4623. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  4624. Dropdown._clearMenus();
  4625. if (isActive) {
  4626. return;
  4627. }
  4628. this.show(true);
  4629. };
  4630. _proto.show = function show(usePopper) {
  4631. if (usePopper === void 0) {
  4632. usePopper = false;
  4633. }
  4634. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  4635. return;
  4636. }
  4637. var relatedTarget = {
  4638. relatedTarget: this._element
  4639. };
  4640. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  4641. var parent = Dropdown._getParentFromElement(this._element);
  4642. $(parent).trigger(showEvent);
  4643. if (showEvent.isDefaultPrevented()) {
  4644. return;
  4645. } // Disable totally Popper.js for Dropdown in Navbar
  4646. if (!this._inNavbar && usePopper) {
  4647. /**
  4648. * Check for Popper dependency
  4649. * Popper - https://popper.js.org
  4650. */
  4651. if (typeof Popper === 'undefined') {
  4652. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  4653. }
  4654. var referenceElement = this._element;
  4655. if (this._config.reference === 'parent') {
  4656. referenceElement = parent;
  4657. } else if (Util.isElement(this._config.reference)) {
  4658. referenceElement = this._config.reference; // Check if it's jQuery element
  4659. if (typeof this._config.reference.jquery !== 'undefined') {
  4660. referenceElement = this._config.reference[0];
  4661. }
  4662. } // If boundary is not `scrollParent`, then set position to `static`
  4663. // to allow the menu to "escape" the scroll parent's boundaries
  4664. // https://github.com/twbs/bootstrap/issues/24251
  4665. if (this._config.boundary !== 'scrollParent') {
  4666. $(parent).addClass(ClassName$4.POSITION_STATIC);
  4667. }
  4668. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  4669. } // If this is a touch-enabled device we add extra
  4670. // empty mouseover listeners to the body's immediate children;
  4671. // only needed because of broken event delegation on iOS
  4672. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4673. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  4674. $(document.body).children().on('mouseover', null, $.noop);
  4675. }
  4676. this._element.focus();
  4677. this._element.setAttribute('aria-expanded', true);
  4678. $(this._menu).toggleClass(ClassName$4.SHOW);
  4679. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  4680. };
  4681. _proto.hide = function hide() {
  4682. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  4683. return;
  4684. }
  4685. var relatedTarget = {
  4686. relatedTarget: this._element
  4687. };
  4688. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4689. var parent = Dropdown._getParentFromElement(this._element);
  4690. $(parent).trigger(hideEvent);
  4691. if (hideEvent.isDefaultPrevented()) {
  4692. return;
  4693. }
  4694. if (this._popper) {
  4695. this._popper.destroy();
  4696. }
  4697. $(this._menu).toggleClass(ClassName$4.SHOW);
  4698. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4699. };
  4700. _proto.dispose = function dispose() {
  4701. $.removeData(this._element, DATA_KEY$4);
  4702. $(this._element).off(EVENT_KEY$4);
  4703. this._element = null;
  4704. this._menu = null;
  4705. if (this._popper !== null) {
  4706. this._popper.destroy();
  4707. this._popper = null;
  4708. }
  4709. };
  4710. _proto.update = function update() {
  4711. this._inNavbar = this._detectNavbar();
  4712. if (this._popper !== null) {
  4713. this._popper.scheduleUpdate();
  4714. }
  4715. } // Private
  4716. ;
  4717. _proto._addEventListeners = function _addEventListeners() {
  4718. var _this = this;
  4719. $(this._element).on(Event$4.CLICK, function (event) {
  4720. event.preventDefault();
  4721. event.stopPropagation();
  4722. _this.toggle();
  4723. });
  4724. };
  4725. _proto._getConfig = function _getConfig(config) {
  4726. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  4727. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  4728. return config;
  4729. };
  4730. _proto._getMenuElement = function _getMenuElement() {
  4731. if (!this._menu) {
  4732. var parent = Dropdown._getParentFromElement(this._element);
  4733. if (parent) {
  4734. this._menu = parent.querySelector(Selector$4.MENU);
  4735. }
  4736. }
  4737. return this._menu;
  4738. };
  4739. _proto._getPlacement = function _getPlacement() {
  4740. var $parentDropdown = $(this._element.parentNode);
  4741. var placement = AttachmentMap.BOTTOM; // Handle dropup
  4742. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  4743. placement = AttachmentMap.TOP;
  4744. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  4745. placement = AttachmentMap.TOPEND;
  4746. }
  4747. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  4748. placement = AttachmentMap.RIGHT;
  4749. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  4750. placement = AttachmentMap.LEFT;
  4751. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  4752. placement = AttachmentMap.BOTTOMEND;
  4753. }
  4754. return placement;
  4755. };
  4756. _proto._detectNavbar = function _detectNavbar() {
  4757. return $(this._element).closest('.navbar').length > 0;
  4758. };
  4759. _proto._getOffset = function _getOffset() {
  4760. var _this2 = this;
  4761. var offset = {};
  4762. if (typeof this._config.offset === 'function') {
  4763. offset.fn = function (data) {
  4764. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  4765. return data;
  4766. };
  4767. } else {
  4768. offset.offset = this._config.offset;
  4769. }
  4770. return offset;
  4771. };
  4772. _proto._getPopperConfig = function _getPopperConfig() {
  4773. var popperConfig = {
  4774. placement: this._getPlacement(),
  4775. modifiers: {
  4776. offset: this._getOffset(),
  4777. flip: {
  4778. enabled: this._config.flip
  4779. },
  4780. preventOverflow: {
  4781. boundariesElement: this._config.boundary
  4782. }
  4783. }
  4784. }; // Disable Popper.js if we have a static display
  4785. if (this._config.display === 'static') {
  4786. popperConfig.modifiers.applyStyle = {
  4787. enabled: false
  4788. };
  4789. }
  4790. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  4791. } // Static
  4792. ;
  4793. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  4794. return this.each(function () {
  4795. var data = $(this).data(DATA_KEY$4);
  4796. var _config = typeof config === 'object' ? config : null;
  4797. if (!data) {
  4798. data = new Dropdown(this, _config);
  4799. $(this).data(DATA_KEY$4, data);
  4800. }
  4801. if (typeof config === 'string') {
  4802. if (typeof data[config] === 'undefined') {
  4803. throw new TypeError("No method named \"" + config + "\"");
  4804. }
  4805. data[config]();
  4806. }
  4807. });
  4808. };
  4809. Dropdown._clearMenus = function _clearMenus(event) {
  4810. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  4811. return;
  4812. }
  4813. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  4814. for (var i = 0, len = toggles.length; i < len; i++) {
  4815. var parent = Dropdown._getParentFromElement(toggles[i]);
  4816. var context = $(toggles[i]).data(DATA_KEY$4);
  4817. var relatedTarget = {
  4818. relatedTarget: toggles[i]
  4819. };
  4820. if (event && event.type === 'click') {
  4821. relatedTarget.clickEvent = event;
  4822. }
  4823. if (!context) {
  4824. continue;
  4825. }
  4826. var dropdownMenu = context._menu;
  4827. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  4828. continue;
  4829. }
  4830. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  4831. continue;
  4832. }
  4833. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4834. $(parent).trigger(hideEvent);
  4835. if (hideEvent.isDefaultPrevented()) {
  4836. continue;
  4837. } // If this is a touch-enabled device we remove the extra
  4838. // empty mouseover listeners we added for iOS support
  4839. if ('ontouchstart' in document.documentElement) {
  4840. $(document.body).children().off('mouseover', null, $.noop);
  4841. }
  4842. toggles[i].setAttribute('aria-expanded', 'false');
  4843. if (context._popper) {
  4844. context._popper.destroy();
  4845. }
  4846. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  4847. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4848. }
  4849. };
  4850. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  4851. var parent;
  4852. var selector = Util.getSelectorFromElement(element);
  4853. if (selector) {
  4854. parent = document.querySelector(selector);
  4855. }
  4856. return parent || element.parentNode;
  4857. } // eslint-disable-next-line complexity
  4858. ;
  4859. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  4860. // If not input/textarea:
  4861. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  4862. // If input/textarea:
  4863. // - If space key => not a dropdown command
  4864. // - If key is other than escape
  4865. // - If key is not up or down => not a dropdown command
  4866. // - If trigger inside the menu => not a dropdown command
  4867. 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)) {
  4868. return;
  4869. }
  4870. event.preventDefault();
  4871. event.stopPropagation();
  4872. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  4873. return;
  4874. }
  4875. var parent = Dropdown._getParentFromElement(this);
  4876. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  4877. if (!isActive && event.which === ESCAPE_KEYCODE) {
  4878. return;
  4879. }
  4880. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  4881. if (event.which === ESCAPE_KEYCODE) {
  4882. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  4883. $(toggle).trigger('focus');
  4884. }
  4885. $(this).trigger('click');
  4886. return;
  4887. }
  4888. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  4889. return $(item).is(':visible');
  4890. });
  4891. if (items.length === 0) {
  4892. return;
  4893. }
  4894. var index = items.indexOf(event.target);
  4895. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  4896. // Up
  4897. index--;
  4898. }
  4899. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  4900. // Down
  4901. index++;
  4902. }
  4903. if (index < 0) {
  4904. index = 0;
  4905. }
  4906. items[index].focus();
  4907. };
  4908. _createClass(Dropdown, null, [{
  4909. key: "VERSION",
  4910. get: function get() {
  4911. return VERSION$4;
  4912. }
  4913. }, {
  4914. key: "Default",
  4915. get: function get() {
  4916. return Default$2;
  4917. }
  4918. }, {
  4919. key: "DefaultType",
  4920. get: function get() {
  4921. return DefaultType$2;
  4922. }
  4923. }]);
  4924. return Dropdown;
  4925. }();
  4926. /**
  4927. * ------------------------------------------------------------------------
  4928. * Data Api implementation
  4929. * ------------------------------------------------------------------------
  4930. */
  4931. $(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) {
  4932. event.preventDefault();
  4933. event.stopPropagation();
  4934. Dropdown._jQueryInterface.call($(this), 'toggle');
  4935. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  4936. e.stopPropagation();
  4937. });
  4938. /**
  4939. * ------------------------------------------------------------------------
  4940. * jQuery
  4941. * ------------------------------------------------------------------------
  4942. */
  4943. $.fn[NAME$4] = Dropdown._jQueryInterface;
  4944. $.fn[NAME$4].Constructor = Dropdown;
  4945. $.fn[NAME$4].noConflict = function () {
  4946. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  4947. return Dropdown._jQueryInterface;
  4948. };
  4949. /**
  4950. * ------------------------------------------------------------------------
  4951. * Constants
  4952. * ------------------------------------------------------------------------
  4953. */
  4954. var NAME$5 = 'modal';
  4955. var VERSION$5 = '4.4.1';
  4956. var DATA_KEY$5 = 'bs.modal';
  4957. var EVENT_KEY$5 = "." + DATA_KEY$5;
  4958. var DATA_API_KEY$5 = '.data-api';
  4959. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  4960. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  4961. var Default$3 = {
  4962. backdrop: true,
  4963. keyboard: true,
  4964. focus: true,
  4965. show: true
  4966. };
  4967. var DefaultType$3 = {
  4968. backdrop: '(boolean|string)',
  4969. keyboard: 'boolean',
  4970. focus: 'boolean',
  4971. show: 'boolean'
  4972. };
  4973. var Event$5 = {
  4974. HIDE: "hide" + EVENT_KEY$5,
  4975. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  4976. HIDDEN: "hidden" + EVENT_KEY$5,
  4977. SHOW: "show" + EVENT_KEY$5,
  4978. SHOWN: "shown" + EVENT_KEY$5,
  4979. FOCUSIN: "focusin" + EVENT_KEY$5,
  4980. RESIZE: "resize" + EVENT_KEY$5,
  4981. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  4982. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  4983. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  4984. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  4985. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  4986. };
  4987. var ClassName$5 = {
  4988. SCROLLABLE: 'modal-dialog-scrollable',
  4989. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  4990. BACKDROP: 'modal-backdrop',
  4991. OPEN: 'modal-open',
  4992. FADE: 'fade',
  4993. SHOW: 'show',
  4994. STATIC: 'modal-static'
  4995. };
  4996. var Selector$5 = {
  4997. DIALOG: '.modal-dialog',
  4998. MODAL_BODY: '.modal-body',
  4999. DATA_TOGGLE: '[data-toggle="modal"]',
  5000. DATA_DISMISS: '[data-dismiss="modal"]',
  5001. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  5002. STICKY_CONTENT: '.sticky-top'
  5003. };
  5004. /**
  5005. * ------------------------------------------------------------------------
  5006. * Class Definition
  5007. * ------------------------------------------------------------------------
  5008. */
  5009. var Modal =
  5010. /*#__PURE__*/
  5011. function () {
  5012. function Modal(element, config) {
  5013. this._config = this._getConfig(config);
  5014. this._element = element;
  5015. this._dialog = element.querySelector(Selector$5.DIALOG);
  5016. this._backdrop = null;
  5017. this._isShown = false;
  5018. this._isBodyOverflowing = false;
  5019. this._ignoreBackdropClick = false;
  5020. this._isTransitioning = false;
  5021. this._scrollbarWidth = 0;
  5022. } // Getters
  5023. var _proto = Modal.prototype;
  5024. // Public
  5025. _proto.toggle = function toggle(relatedTarget) {
  5026. return this._isShown ? this.hide() : this.show(relatedTarget);
  5027. };
  5028. _proto.show = function show(relatedTarget) {
  5029. var _this = this;
  5030. if (this._isShown || this._isTransitioning) {
  5031. return;
  5032. }
  5033. if ($(this._element).hasClass(ClassName$5.FADE)) {
  5034. this._isTransitioning = true;
  5035. }
  5036. var showEvent = $.Event(Event$5.SHOW, {
  5037. relatedTarget: relatedTarget
  5038. });
  5039. $(this._element).trigger(showEvent);
  5040. if (this._isShown || showEvent.isDefaultPrevented()) {
  5041. return;
  5042. }
  5043. this._isShown = true;
  5044. this._checkScrollbar();
  5045. this._setScrollbar();
  5046. this._adjustDialog();
  5047. this._setEscapeEvent();
  5048. this._setResizeEvent();
  5049. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  5050. return _this.hide(event);
  5051. });
  5052. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  5053. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  5054. if ($(event.target).is(_this._element)) {
  5055. _this._ignoreBackdropClick = true;
  5056. }
  5057. });
  5058. });
  5059. this._showBackdrop(function () {
  5060. return _this._showElement(relatedTarget);
  5061. });
  5062. };
  5063. _proto.hide = function hide(event) {
  5064. var _this2 = this;
  5065. if (event) {
  5066. event.preventDefault();
  5067. }
  5068. if (!this._isShown || this._isTransitioning) {
  5069. return;
  5070. }
  5071. var hideEvent = $.Event(Event$5.HIDE);
  5072. $(this._element).trigger(hideEvent);
  5073. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  5074. return;
  5075. }
  5076. this._isShown = false;
  5077. var transition = $(this._element).hasClass(ClassName$5.FADE);
  5078. if (transition) {
  5079. this._isTransitioning = true;
  5080. }
  5081. this._setEscapeEvent();
  5082. this._setResizeEvent();
  5083. $(document).off(Event$5.FOCUSIN);
  5084. $(this._element).removeClass(ClassName$5.SHOW);
  5085. $(this._element).off(Event$5.CLICK_DISMISS);
  5086. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  5087. if (transition) {
  5088. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5089. $(this._element).one(Util.TRANSITION_END, function (event) {
  5090. return _this2._hideModal(event);
  5091. }).emulateTransitionEnd(transitionDuration);
  5092. } else {
  5093. this._hideModal();
  5094. }
  5095. };
  5096. _proto.dispose = function dispose() {
  5097. [window, this._element, this._dialog].forEach(function (htmlElement) {
  5098. return $(htmlElement).off(EVENT_KEY$5);
  5099. });
  5100. /**
  5101. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  5102. * Do not move `document` in `htmlElements` array
  5103. * It will remove `Event.CLICK_DATA_API` event that should remain
  5104. */
  5105. $(document).off(Event$5.FOCUSIN);
  5106. $.removeData(this._element, DATA_KEY$5);
  5107. this._config = null;
  5108. this._element = null;
  5109. this._dialog = null;
  5110. this._backdrop = null;
  5111. this._isShown = null;
  5112. this._isBodyOverflowing = null;
  5113. this._ignoreBackdropClick = null;
  5114. this._isTransitioning = null;
  5115. this._scrollbarWidth = null;
  5116. };
  5117. _proto.handleUpdate = function handleUpdate() {
  5118. this._adjustDialog();
  5119. } // Private
  5120. ;
  5121. _proto._getConfig = function _getConfig(config) {
  5122. config = _objectSpread2({}, Default$3, {}, config);
  5123. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  5124. return config;
  5125. };
  5126. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  5127. var _this3 = this;
  5128. if (this._config.backdrop === 'static') {
  5129. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  5130. $(this._element).trigger(hideEventPrevented);
  5131. if (hideEventPrevented.defaultPrevented) {
  5132. return;
  5133. }
  5134. this._element.classList.add(ClassName$5.STATIC);
  5135. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  5136. $(this._element).one(Util.TRANSITION_END, function () {
  5137. _this3._element.classList.remove(ClassName$5.STATIC);
  5138. }).emulateTransitionEnd(modalTransitionDuration);
  5139. this._element.focus();
  5140. } else {
  5141. this.hide();
  5142. }
  5143. };
  5144. _proto._showElement = function _showElement(relatedTarget) {
  5145. var _this4 = this;
  5146. var transition = $(this._element).hasClass(ClassName$5.FADE);
  5147. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  5148. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  5149. // Don't move modal's DOM position
  5150. document.body.appendChild(this._element);
  5151. }
  5152. this._element.style.display = 'block';
  5153. this._element.removeAttribute('aria-hidden');
  5154. this._element.setAttribute('aria-modal', true);
  5155. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  5156. modalBody.scrollTop = 0;
  5157. } else {
  5158. this._element.scrollTop = 0;
  5159. }
  5160. if (transition) {
  5161. Util.reflow(this._element);
  5162. }
  5163. $(this._element).addClass(ClassName$5.SHOW);
  5164. if (this._config.focus) {
  5165. this._enforceFocus();
  5166. }
  5167. var shownEvent = $.Event(Event$5.SHOWN, {
  5168. relatedTarget: relatedTarget
  5169. });
  5170. var transitionComplete = function transitionComplete() {
  5171. if (_this4._config.focus) {
  5172. _this4._element.focus();
  5173. }
  5174. _this4._isTransitioning = false;
  5175. $(_this4._element).trigger(shownEvent);
  5176. };
  5177. if (transition) {
  5178. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  5179. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  5180. } else {
  5181. transitionComplete();
  5182. }
  5183. };
  5184. _proto._enforceFocus = function _enforceFocus() {
  5185. var _this5 = this;
  5186. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  5187. .on(Event$5.FOCUSIN, function (event) {
  5188. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  5189. _this5._element.focus();
  5190. }
  5191. });
  5192. };
  5193. _proto._setEscapeEvent = function _setEscapeEvent() {
  5194. var _this6 = this;
  5195. if (this._isShown && this._config.keyboard) {
  5196. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  5197. if (event.which === ESCAPE_KEYCODE$1) {
  5198. _this6._triggerBackdropTransition();
  5199. }
  5200. });
  5201. } else if (!this._isShown) {
  5202. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  5203. }
  5204. };
  5205. _proto._setResizeEvent = function _setResizeEvent() {
  5206. var _this7 = this;
  5207. if (this._isShown) {
  5208. $(window).on(Event$5.RESIZE, function (event) {
  5209. return _this7.handleUpdate(event);
  5210. });
  5211. } else {
  5212. $(window).off(Event$5.RESIZE);
  5213. }
  5214. };
  5215. _proto._hideModal = function _hideModal() {
  5216. var _this8 = this;
  5217. this._element.style.display = 'none';
  5218. this._element.setAttribute('aria-hidden', true);
  5219. this._element.removeAttribute('aria-modal');
  5220. this._isTransitioning = false;
  5221. this._showBackdrop(function () {
  5222. $(document.body).removeClass(ClassName$5.OPEN);
  5223. _this8._resetAdjustments();
  5224. _this8._resetScrollbar();
  5225. $(_this8._element).trigger(Event$5.HIDDEN);
  5226. });
  5227. };
  5228. _proto._removeBackdrop = function _removeBackdrop() {
  5229. if (this._backdrop) {
  5230. $(this._backdrop).remove();
  5231. this._backdrop = null;
  5232. }
  5233. };
  5234. _proto._showBackdrop = function _showBackdrop(callback) {
  5235. var _this9 = this;
  5236. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  5237. if (this._isShown && this._config.backdrop) {
  5238. this._backdrop = document.createElement('div');
  5239. this._backdrop.className = ClassName$5.BACKDROP;
  5240. if (animate) {
  5241. this._backdrop.classList.add(animate);
  5242. }
  5243. $(this._backdrop).appendTo(document.body);
  5244. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  5245. if (_this9._ignoreBackdropClick) {
  5246. _this9._ignoreBackdropClick = false;
  5247. return;
  5248. }
  5249. if (event.target !== event.currentTarget) {
  5250. return;
  5251. }
  5252. _this9._triggerBackdropTransition();
  5253. });
  5254. if (animate) {
  5255. Util.reflow(this._backdrop);
  5256. }
  5257. $(this._backdrop).addClass(ClassName$5.SHOW);
  5258. if (!callback) {
  5259. return;
  5260. }
  5261. if (!animate) {
  5262. callback();
  5263. return;
  5264. }
  5265. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  5266. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  5267. } else if (!this._isShown && this._backdrop) {
  5268. $(this._backdrop).removeClass(ClassName$5.SHOW);
  5269. var callbackRemove = function callbackRemove() {
  5270. _this9._removeBackdrop();
  5271. if (callback) {
  5272. callback();
  5273. }
  5274. };
  5275. if ($(this._element).hasClass(ClassName$5.FADE)) {
  5276. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  5277. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  5278. } else {
  5279. callbackRemove();
  5280. }
  5281. } else if (callback) {
  5282. callback();
  5283. }
  5284. } // ----------------------------------------------------------------------
  5285. // the following methods are used to handle overflowing modals
  5286. // todo (fat): these should probably be refactored out of modal.js
  5287. // ----------------------------------------------------------------------
  5288. ;
  5289. _proto._adjustDialog = function _adjustDialog() {
  5290. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  5291. if (!this._isBodyOverflowing && isModalOverflowing) {
  5292. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  5293. }
  5294. if (this._isBodyOverflowing && !isModalOverflowing) {
  5295. this._element.style.paddingRight = this._scrollbarWidth + "px";
  5296. }
  5297. };
  5298. _proto._resetAdjustments = function _resetAdjustments() {
  5299. this._element.style.paddingLeft = '';
  5300. this._element.style.paddingRight = '';
  5301. };
  5302. _proto._checkScrollbar = function _checkScrollbar() {
  5303. var rect = document.body.getBoundingClientRect();
  5304. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  5305. this._scrollbarWidth = this._getScrollbarWidth();
  5306. };
  5307. _proto._setScrollbar = function _setScrollbar() {
  5308. var _this10 = this;
  5309. if (this._isBodyOverflowing) {
  5310. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  5311. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  5312. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  5313. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  5314. $(fixedContent).each(function (index, element) {
  5315. var actualPadding = element.style.paddingRight;
  5316. var calculatedPadding = $(element).css('padding-right');
  5317. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  5318. }); // Adjust sticky content margin
  5319. $(stickyContent).each(function (index, element) {
  5320. var actualMargin = element.style.marginRight;
  5321. var calculatedMargin = $(element).css('margin-right');
  5322. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  5323. }); // Adjust body padding
  5324. var actualPadding = document.body.style.paddingRight;
  5325. var calculatedPadding = $(document.body).css('padding-right');
  5326. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  5327. }
  5328. $(document.body).addClass(ClassName$5.OPEN);
  5329. };
  5330. _proto._resetScrollbar = function _resetScrollbar() {
  5331. // Restore fixed content padding
  5332. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  5333. $(fixedContent).each(function (index, element) {
  5334. var padding = $(element).data('padding-right');
  5335. $(element).removeData('padding-right');
  5336. element.style.paddingRight = padding ? padding : '';
  5337. }); // Restore sticky content
  5338. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  5339. $(elements).each(function (index, element) {
  5340. var margin = $(element).data('margin-right');
  5341. if (typeof margin !== 'undefined') {
  5342. $(element).css('margin-right', margin).removeData('margin-right');
  5343. }
  5344. }); // Restore body padding
  5345. var padding = $(document.body).data('padding-right');
  5346. $(document.body).removeData('padding-right');
  5347. document.body.style.paddingRight = padding ? padding : '';
  5348. };
  5349. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  5350. // thx d.walsh
  5351. var scrollDiv = document.createElement('div');
  5352. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  5353. document.body.appendChild(scrollDiv);
  5354. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  5355. document.body.removeChild(scrollDiv);
  5356. return scrollbarWidth;
  5357. } // Static
  5358. ;
  5359. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  5360. return this.each(function () {
  5361. var data = $(this).data(DATA_KEY$5);
  5362. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  5363. if (!data) {
  5364. data = new Modal(this, _config);
  5365. $(this).data(DATA_KEY$5, data);
  5366. }
  5367. if (typeof config === 'string') {
  5368. if (typeof data[config] === 'undefined') {
  5369. throw new TypeError("No method named \"" + config + "\"");
  5370. }
  5371. data[config](relatedTarget);
  5372. } else if (_config.show) {
  5373. data.show(relatedTarget);
  5374. }
  5375. });
  5376. };
  5377. _createClass(Modal, null, [{
  5378. key: "VERSION",
  5379. get: function get() {
  5380. return VERSION$5;
  5381. }
  5382. }, {
  5383. key: "Default",
  5384. get: function get() {
  5385. return Default$3;
  5386. }
  5387. }]);
  5388. return Modal;
  5389. }();
  5390. /**
  5391. * ------------------------------------------------------------------------
  5392. * Data Api implementation
  5393. * ------------------------------------------------------------------------
  5394. */
  5395. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  5396. var _this11 = this;
  5397. var target;
  5398. var selector = Util.getSelectorFromElement(this);
  5399. if (selector) {
  5400. target = document.querySelector(selector);
  5401. }
  5402. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  5403. if (this.tagName === 'A' || this.tagName === 'AREA') {
  5404. event.preventDefault();
  5405. }
  5406. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  5407. if (showEvent.isDefaultPrevented()) {
  5408. // Only register focus restorer if modal will actually get shown
  5409. return;
  5410. }
  5411. $target.one(Event$5.HIDDEN, function () {
  5412. if ($(_this11).is(':visible')) {
  5413. _this11.focus();
  5414. }
  5415. });
  5416. });
  5417. Modal._jQueryInterface.call($(target), config, this);
  5418. });
  5419. /**
  5420. * ------------------------------------------------------------------------
  5421. * jQuery
  5422. * ------------------------------------------------------------------------
  5423. */
  5424. $.fn[NAME$5] = Modal._jQueryInterface;
  5425. $.fn[NAME$5].Constructor = Modal;
  5426. $.fn[NAME$5].noConflict = function () {
  5427. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  5428. return Modal._jQueryInterface;
  5429. };
  5430. /**
  5431. * --------------------------------------------------------------------------
  5432. * Bootstrap (v4.4.1): tools/sanitizer.js
  5433. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  5434. * --------------------------------------------------------------------------
  5435. */
  5436. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  5437. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  5438. var DefaultWhitelist = {
  5439. // Global attributes allowed on any supplied element below.
  5440. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  5441. a: ['target', 'href', 'title', 'rel'],
  5442. area: [],
  5443. b: [],
  5444. br: [],
  5445. col: [],
  5446. code: [],
  5447. div: [],
  5448. em: [],
  5449. hr: [],
  5450. h1: [],
  5451. h2: [],
  5452. h3: [],
  5453. h4: [],
  5454. h5: [],
  5455. h6: [],
  5456. i: [],
  5457. img: ['src', 'alt', 'title', 'width', 'height'],
  5458. li: [],
  5459. ol: [],
  5460. p: [],
  5461. pre: [],
  5462. s: [],
  5463. small: [],
  5464. span: [],
  5465. sub: [],
  5466. sup: [],
  5467. strong: [],
  5468. u: [],
  5469. ul: []
  5470. };
  5471. /**
  5472. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  5473. *
  5474. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  5475. */
  5476. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  5477. /**
  5478. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  5479. *
  5480. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  5481. */
  5482. 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;
  5483. function allowedAttribute(attr, allowedAttributeList) {
  5484. var attrName = attr.nodeName.toLowerCase();
  5485. if (allowedAttributeList.indexOf(attrName) !== -1) {
  5486. if (uriAttrs.indexOf(attrName) !== -1) {
  5487. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  5488. }
  5489. return true;
  5490. }
  5491. var regExp = allowedAttributeList.filter(function (attrRegex) {
  5492. return attrRegex instanceof RegExp;
  5493. }); // Check if a regular expression validates the attribute.
  5494. for (var i = 0, l = regExp.length; i < l; i++) {
  5495. if (attrName.match(regExp[i])) {
  5496. return true;
  5497. }
  5498. }
  5499. return false;
  5500. }
  5501. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  5502. if (unsafeHtml.length === 0) {
  5503. return unsafeHtml;
  5504. }
  5505. if (sanitizeFn && typeof sanitizeFn === 'function') {
  5506. return sanitizeFn(unsafeHtml);
  5507. }
  5508. var domParser = new window.DOMParser();
  5509. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  5510. var whitelistKeys = Object.keys(whiteList);
  5511. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  5512. var _loop = function _loop(i, len) {
  5513. var el = elements[i];
  5514. var elName = el.nodeName.toLowerCase();
  5515. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  5516. el.parentNode.removeChild(el);
  5517. return "continue";
  5518. }
  5519. var attributeList = [].slice.call(el.attributes);
  5520. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  5521. attributeList.forEach(function (attr) {
  5522. if (!allowedAttribute(attr, whitelistedAttributes)) {
  5523. el.removeAttribute(attr.nodeName);
  5524. }
  5525. });
  5526. };
  5527. for (var i = 0, len = elements.length; i < len; i++) {
  5528. var _ret = _loop(i);
  5529. if (_ret === "continue") continue;
  5530. }
  5531. return createdDocument.body.innerHTML;
  5532. }
  5533. /**
  5534. * ------------------------------------------------------------------------
  5535. * Constants
  5536. * ------------------------------------------------------------------------
  5537. */
  5538. var NAME$6 = 'tooltip';
  5539. var VERSION$6 = '4.4.1';
  5540. var DATA_KEY$6 = 'bs.tooltip';
  5541. var EVENT_KEY$6 = "." + DATA_KEY$6;
  5542. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  5543. var CLASS_PREFIX = 'bs-tooltip';
  5544. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  5545. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  5546. var DefaultType$4 = {
  5547. animation: 'boolean',
  5548. template: 'string',
  5549. title: '(string|element|function)',
  5550. trigger: 'string',
  5551. delay: '(number|object)',
  5552. html: 'boolean',
  5553. selector: '(string|boolean)',
  5554. placement: '(string|function)',
  5555. offset: '(number|string|function)',
  5556. container: '(string|element|boolean)',
  5557. fallbackPlacement: '(string|array)',
  5558. boundary: '(string|element)',
  5559. sanitize: 'boolean',
  5560. sanitizeFn: '(null|function)',
  5561. whiteList: 'object',
  5562. popperConfig: '(null|object)'
  5563. };
  5564. var AttachmentMap$1 = {
  5565. AUTO: 'auto',
  5566. TOP: 'top',
  5567. RIGHT: 'right',
  5568. BOTTOM: 'bottom',
  5569. LEFT: 'left'
  5570. };
  5571. var Default$4 = {
  5572. animation: true,
  5573. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  5574. trigger: 'hover focus',
  5575. title: '',
  5576. delay: 0,
  5577. html: false,
  5578. selector: false,
  5579. placement: 'top',
  5580. offset: 0,
  5581. container: false,
  5582. fallbackPlacement: 'flip',
  5583. boundary: 'scrollParent',
  5584. sanitize: true,
  5585. sanitizeFn: null,
  5586. whiteList: DefaultWhitelist,
  5587. popperConfig: null
  5588. };
  5589. var HoverState = {
  5590. SHOW: 'show',
  5591. OUT: 'out'
  5592. };
  5593. var Event$6 = {
  5594. HIDE: "hide" + EVENT_KEY$6,
  5595. HIDDEN: "hidden" + EVENT_KEY$6,
  5596. SHOW: "show" + EVENT_KEY$6,
  5597. SHOWN: "shown" + EVENT_KEY$6,
  5598. INSERTED: "inserted" + EVENT_KEY$6,
  5599. CLICK: "click" + EVENT_KEY$6,
  5600. FOCUSIN: "focusin" + EVENT_KEY$6,
  5601. FOCUSOUT: "focusout" + EVENT_KEY$6,
  5602. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  5603. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  5604. };
  5605. var ClassName$6 = {
  5606. FADE: 'fade',
  5607. SHOW: 'show'
  5608. };
  5609. var Selector$6 = {
  5610. TOOLTIP: '.tooltip',
  5611. TOOLTIP_INNER: '.tooltip-inner',
  5612. ARROW: '.arrow'
  5613. };
  5614. var Trigger = {
  5615. HOVER: 'hover',
  5616. FOCUS: 'focus',
  5617. CLICK: 'click',
  5618. MANUAL: 'manual'
  5619. };
  5620. /**
  5621. * ------------------------------------------------------------------------
  5622. * Class Definition
  5623. * ------------------------------------------------------------------------
  5624. */
  5625. var Tooltip =
  5626. /*#__PURE__*/
  5627. function () {
  5628. function Tooltip(element, config) {
  5629. if (typeof Popper === 'undefined') {
  5630. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  5631. } // private
  5632. this._isEnabled = true;
  5633. this._timeout = 0;
  5634. this._hoverState = '';
  5635. this._activeTrigger = {};
  5636. this._popper = null; // Protected
  5637. this.element = element;
  5638. this.config = this._getConfig(config);
  5639. this.tip = null;
  5640. this._setListeners();
  5641. } // Getters
  5642. var _proto = Tooltip.prototype;
  5643. // Public
  5644. _proto.enable = function enable() {
  5645. this._isEnabled = true;
  5646. };
  5647. _proto.disable = function disable() {
  5648. this._isEnabled = false;
  5649. };
  5650. _proto.toggleEnabled = function toggleEnabled() {
  5651. this._isEnabled = !this._isEnabled;
  5652. };
  5653. _proto.toggle = function toggle(event) {
  5654. if (!this._isEnabled) {
  5655. return;
  5656. }
  5657. if (event) {
  5658. var dataKey = this.constructor.DATA_KEY;
  5659. var context = $(event.currentTarget).data(dataKey);
  5660. if (!context) {
  5661. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5662. $(event.currentTarget).data(dataKey, context);
  5663. }
  5664. context._activeTrigger.click = !context._activeTrigger.click;
  5665. if (context._isWithActiveTrigger()) {
  5666. context._enter(null, context);
  5667. } else {
  5668. context._leave(null, context);
  5669. }
  5670. } else {
  5671. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  5672. this._leave(null, this);
  5673. return;
  5674. }
  5675. this._enter(null, this);
  5676. }
  5677. };
  5678. _proto.dispose = function dispose() {
  5679. clearTimeout(this._timeout);
  5680. $.removeData(this.element, this.constructor.DATA_KEY);
  5681. $(this.element).off(this.constructor.EVENT_KEY);
  5682. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  5683. if (this.tip) {
  5684. $(this.tip).remove();
  5685. }
  5686. this._isEnabled = null;
  5687. this._timeout = null;
  5688. this._hoverState = null;
  5689. this._activeTrigger = null;
  5690. if (this._popper) {
  5691. this._popper.destroy();
  5692. }
  5693. this._popper = null;
  5694. this.element = null;
  5695. this.config = null;
  5696. this.tip = null;
  5697. };
  5698. _proto.show = function show() {
  5699. var _this = this;
  5700. if ($(this.element).css('display') === 'none') {
  5701. throw new Error('Please use show on visible elements');
  5702. }
  5703. var showEvent = $.Event(this.constructor.Event.SHOW);
  5704. if (this.isWithContent() && this._isEnabled) {
  5705. $(this.element).trigger(showEvent);
  5706. var shadowRoot = Util.findShadowRoot(this.element);
  5707. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  5708. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  5709. return;
  5710. }
  5711. var tip = this.getTipElement();
  5712. var tipId = Util.getUID(this.constructor.NAME);
  5713. tip.setAttribute('id', tipId);
  5714. this.element.setAttribute('aria-describedby', tipId);
  5715. this.setContent();
  5716. if (this.config.animation) {
  5717. $(tip).addClass(ClassName$6.FADE);
  5718. }
  5719. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  5720. var attachment = this._getAttachment(placement);
  5721. this.addAttachmentClass(attachment);
  5722. var container = this._getContainer();
  5723. $(tip).data(this.constructor.DATA_KEY, this);
  5724. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  5725. $(tip).appendTo(container);
  5726. }
  5727. $(this.element).trigger(this.constructor.Event.INSERTED);
  5728. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  5729. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  5730. // empty mouseover listeners to the body's immediate children;
  5731. // only needed because of broken event delegation on iOS
  5732. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  5733. if ('ontouchstart' in document.documentElement) {
  5734. $(document.body).children().on('mouseover', null, $.noop);
  5735. }
  5736. var complete = function complete() {
  5737. if (_this.config.animation) {
  5738. _this._fixTransition();
  5739. }
  5740. var prevHoverState = _this._hoverState;
  5741. _this._hoverState = null;
  5742. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  5743. if (prevHoverState === HoverState.OUT) {
  5744. _this._leave(null, _this);
  5745. }
  5746. };
  5747. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  5748. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  5749. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5750. } else {
  5751. complete();
  5752. }
  5753. }
  5754. };
  5755. _proto.hide = function hide(callback) {
  5756. var _this2 = this;
  5757. var tip = this.getTipElement();
  5758. var hideEvent = $.Event(this.constructor.Event.HIDE);
  5759. var complete = function complete() {
  5760. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  5761. tip.parentNode.removeChild(tip);
  5762. }
  5763. _this2._cleanTipClass();
  5764. _this2.element.removeAttribute('aria-describedby');
  5765. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  5766. if (_this2._popper !== null) {
  5767. _this2._popper.destroy();
  5768. }
  5769. if (callback) {
  5770. callback();
  5771. }
  5772. };
  5773. $(this.element).trigger(hideEvent);
  5774. if (hideEvent.isDefaultPrevented()) {
  5775. return;
  5776. }
  5777. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  5778. // empty mouseover listeners we added for iOS support
  5779. if ('ontouchstart' in document.documentElement) {
  5780. $(document.body).children().off('mouseover', null, $.noop);
  5781. }
  5782. this._activeTrigger[Trigger.CLICK] = false;
  5783. this._activeTrigger[Trigger.FOCUS] = false;
  5784. this._activeTrigger[Trigger.HOVER] = false;
  5785. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  5786. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  5787. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5788. } else {
  5789. complete();
  5790. }
  5791. this._hoverState = '';
  5792. };
  5793. _proto.update = function update() {
  5794. if (this._popper !== null) {
  5795. this._popper.scheduleUpdate();
  5796. }
  5797. } // Protected
  5798. ;
  5799. _proto.isWithContent = function isWithContent() {
  5800. return Boolean(this.getTitle());
  5801. };
  5802. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5803. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  5804. };
  5805. _proto.getTipElement = function getTipElement() {
  5806. this.tip = this.tip || $(this.config.template)[0];
  5807. return this.tip;
  5808. };
  5809. _proto.setContent = function setContent() {
  5810. var tip = this.getTipElement();
  5811. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  5812. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  5813. };
  5814. _proto.setElementContent = function setElementContent($element, content) {
  5815. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  5816. // Content is a DOM node or a jQuery
  5817. if (this.config.html) {
  5818. if (!$(content).parent().is($element)) {
  5819. $element.empty().append(content);
  5820. }
  5821. } else {
  5822. $element.text($(content).text());
  5823. }
  5824. return;
  5825. }
  5826. if (this.config.html) {
  5827. if (this.config.sanitize) {
  5828. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  5829. }
  5830. $element.html(content);
  5831. } else {
  5832. $element.text(content);
  5833. }
  5834. };
  5835. _proto.getTitle = function getTitle() {
  5836. var title = this.element.getAttribute('data-original-title');
  5837. if (!title) {
  5838. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  5839. }
  5840. return title;
  5841. } // Private
  5842. ;
  5843. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  5844. var _this3 = this;
  5845. var defaultBsConfig = {
  5846. placement: attachment,
  5847. modifiers: {
  5848. offset: this._getOffset(),
  5849. flip: {
  5850. behavior: this.config.fallbackPlacement
  5851. },
  5852. arrow: {
  5853. element: Selector$6.ARROW
  5854. },
  5855. preventOverflow: {
  5856. boundariesElement: this.config.boundary
  5857. }
  5858. },
  5859. onCreate: function onCreate(data) {
  5860. if (data.originalPlacement !== data.placement) {
  5861. _this3._handlePopperPlacementChange(data);
  5862. }
  5863. },
  5864. onUpdate: function onUpdate(data) {
  5865. return _this3._handlePopperPlacementChange(data);
  5866. }
  5867. };
  5868. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  5869. };
  5870. _proto._getOffset = function _getOffset() {
  5871. var _this4 = this;
  5872. var offset = {};
  5873. if (typeof this.config.offset === 'function') {
  5874. offset.fn = function (data) {
  5875. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  5876. return data;
  5877. };
  5878. } else {
  5879. offset.offset = this.config.offset;
  5880. }
  5881. return offset;
  5882. };
  5883. _proto._getContainer = function _getContainer() {
  5884. if (this.config.container === false) {
  5885. return document.body;
  5886. }
  5887. if (Util.isElement(this.config.container)) {
  5888. return $(this.config.container);
  5889. }
  5890. return $(document).find(this.config.container);
  5891. };
  5892. _proto._getAttachment = function _getAttachment(placement) {
  5893. return AttachmentMap$1[placement.toUpperCase()];
  5894. };
  5895. _proto._setListeners = function _setListeners() {
  5896. var _this5 = this;
  5897. var triggers = this.config.trigger.split(' ');
  5898. triggers.forEach(function (trigger) {
  5899. if (trigger === 'click') {
  5900. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  5901. return _this5.toggle(event);
  5902. });
  5903. } else if (trigger !== Trigger.MANUAL) {
  5904. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  5905. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  5906. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  5907. return _this5._enter(event);
  5908. }).on(eventOut, _this5.config.selector, function (event) {
  5909. return _this5._leave(event);
  5910. });
  5911. }
  5912. });
  5913. this._hideModalHandler = function () {
  5914. if (_this5.element) {
  5915. _this5.hide();
  5916. }
  5917. };
  5918. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  5919. if (this.config.selector) {
  5920. this.config = _objectSpread2({}, this.config, {
  5921. trigger: 'manual',
  5922. selector: ''
  5923. });
  5924. } else {
  5925. this._fixTitle();
  5926. }
  5927. };
  5928. _proto._fixTitle = function _fixTitle() {
  5929. var titleType = typeof this.element.getAttribute('data-original-title');
  5930. if (this.element.getAttribute('title') || titleType !== 'string') {
  5931. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  5932. this.element.setAttribute('title', '');
  5933. }
  5934. };
  5935. _proto._enter = function _enter(event, context) {
  5936. var dataKey = this.constructor.DATA_KEY;
  5937. context = context || $(event.currentTarget).data(dataKey);
  5938. if (!context) {
  5939. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5940. $(event.currentTarget).data(dataKey, context);
  5941. }
  5942. if (event) {
  5943. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  5944. }
  5945. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  5946. context._hoverState = HoverState.SHOW;
  5947. return;
  5948. }
  5949. clearTimeout(context._timeout);
  5950. context._hoverState = HoverState.SHOW;
  5951. if (!context.config.delay || !context.config.delay.show) {
  5952. context.show();
  5953. return;
  5954. }
  5955. context._timeout = setTimeout(function () {
  5956. if (context._hoverState === HoverState.SHOW) {
  5957. context.show();
  5958. }
  5959. }, context.config.delay.show);
  5960. };
  5961. _proto._leave = function _leave(event, context) {
  5962. var dataKey = this.constructor.DATA_KEY;
  5963. context = context || $(event.currentTarget).data(dataKey);
  5964. if (!context) {
  5965. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5966. $(event.currentTarget).data(dataKey, context);
  5967. }
  5968. if (event) {
  5969. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  5970. }
  5971. if (context._isWithActiveTrigger()) {
  5972. return;
  5973. }
  5974. clearTimeout(context._timeout);
  5975. context._hoverState = HoverState.OUT;
  5976. if (!context.config.delay || !context.config.delay.hide) {
  5977. context.hide();
  5978. return;
  5979. }
  5980. context._timeout = setTimeout(function () {
  5981. if (context._hoverState === HoverState.OUT) {
  5982. context.hide();
  5983. }
  5984. }, context.config.delay.hide);
  5985. };
  5986. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  5987. for (var trigger in this._activeTrigger) {
  5988. if (this._activeTrigger[trigger]) {
  5989. return true;
  5990. }
  5991. }
  5992. return false;
  5993. };
  5994. _proto._getConfig = function _getConfig(config) {
  5995. var dataAttributes = $(this.element).data();
  5996. Object.keys(dataAttributes).forEach(function (dataAttr) {
  5997. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  5998. delete dataAttributes[dataAttr];
  5999. }
  6000. });
  6001. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  6002. if (typeof config.delay === 'number') {
  6003. config.delay = {
  6004. show: config.delay,
  6005. hide: config.delay
  6006. };
  6007. }
  6008. if (typeof config.title === 'number') {
  6009. config.title = config.title.toString();
  6010. }
  6011. if (typeof config.content === 'number') {
  6012. config.content = config.content.toString();
  6013. }
  6014. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  6015. if (config.sanitize) {
  6016. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  6017. }
  6018. return config;
  6019. };
  6020. _proto._getDelegateConfig = function _getDelegateConfig() {
  6021. var config = {};
  6022. if (this.config) {
  6023. for (var key in this.config) {
  6024. if (this.constructor.Default[key] !== this.config[key]) {
  6025. config[key] = this.config[key];
  6026. }
  6027. }
  6028. }
  6029. return config;
  6030. };
  6031. _proto._cleanTipClass = function _cleanTipClass() {
  6032. var $tip = $(this.getTipElement());
  6033. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  6034. if (tabClass !== null && tabClass.length) {
  6035. $tip.removeClass(tabClass.join(''));
  6036. }
  6037. };
  6038. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  6039. var popperInstance = popperData.instance;
  6040. this.tip = popperInstance.popper;
  6041. this._cleanTipClass();
  6042. this.addAttachmentClass(this._getAttachment(popperData.placement));
  6043. };
  6044. _proto._fixTransition = function _fixTransition() {
  6045. var tip = this.getTipElement();
  6046. var initConfigAnimation = this.config.animation;
  6047. if (tip.getAttribute('x-placement') !== null) {
  6048. return;
  6049. }
  6050. $(tip).removeClass(ClassName$6.FADE);
  6051. this.config.animation = false;
  6052. this.hide();
  6053. this.show();
  6054. this.config.animation = initConfigAnimation;
  6055. } // Static
  6056. ;
  6057. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  6058. return this.each(function () {
  6059. var data = $(this).data(DATA_KEY$6);
  6060. var _config = typeof config === 'object' && config;
  6061. if (!data && /dispose|hide/.test(config)) {
  6062. return;
  6063. }
  6064. if (!data) {
  6065. data = new Tooltip(this, _config);
  6066. $(this).data(DATA_KEY$6, data);
  6067. }
  6068. if (typeof config === 'string') {
  6069. if (typeof data[config] === 'undefined') {
  6070. throw new TypeError("No method named \"" + config + "\"");
  6071. }
  6072. data[config]();
  6073. }
  6074. });
  6075. };
  6076. _createClass(Tooltip, null, [{
  6077. key: "VERSION",
  6078. get: function get() {
  6079. return VERSION$6;
  6080. }
  6081. }, {
  6082. key: "Default",
  6083. get: function get() {
  6084. return Default$4;
  6085. }
  6086. }, {
  6087. key: "NAME",
  6088. get: function get() {
  6089. return NAME$6;
  6090. }
  6091. }, {
  6092. key: "DATA_KEY",
  6093. get: function get() {
  6094. return DATA_KEY$6;
  6095. }
  6096. }, {
  6097. key: "Event",
  6098. get: function get() {
  6099. return Event$6;
  6100. }
  6101. }, {
  6102. key: "EVENT_KEY",
  6103. get: function get() {
  6104. return EVENT_KEY$6;
  6105. }
  6106. }, {
  6107. key: "DefaultType",
  6108. get: function get() {
  6109. return DefaultType$4;
  6110. }
  6111. }]);
  6112. return Tooltip;
  6113. }();
  6114. /**
  6115. * ------------------------------------------------------------------------
  6116. * jQuery
  6117. * ------------------------------------------------------------------------
  6118. */
  6119. $.fn[NAME$6] = Tooltip._jQueryInterface;
  6120. $.fn[NAME$6].Constructor = Tooltip;
  6121. $.fn[NAME$6].noConflict = function () {
  6122. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  6123. return Tooltip._jQueryInterface;
  6124. };
  6125. /**
  6126. * ------------------------------------------------------------------------
  6127. * Constants
  6128. * ------------------------------------------------------------------------
  6129. */
  6130. var NAME$7 = 'popover';
  6131. var VERSION$7 = '4.4.1';
  6132. var DATA_KEY$7 = 'bs.popover';
  6133. var EVENT_KEY$7 = "." + DATA_KEY$7;
  6134. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  6135. var CLASS_PREFIX$1 = 'bs-popover';
  6136. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  6137. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  6138. placement: 'right',
  6139. trigger: 'click',
  6140. content: '',
  6141. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  6142. });
  6143. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  6144. content: '(string|element|function)'
  6145. });
  6146. var ClassName$7 = {
  6147. FADE: 'fade',
  6148. SHOW: 'show'
  6149. };
  6150. var Selector$7 = {
  6151. TITLE: '.popover-header',
  6152. CONTENT: '.popover-body'
  6153. };
  6154. var Event$7 = {
  6155. HIDE: "hide" + EVENT_KEY$7,
  6156. HIDDEN: "hidden" + EVENT_KEY$7,
  6157. SHOW: "show" + EVENT_KEY$7,
  6158. SHOWN: "shown" + EVENT_KEY$7,
  6159. INSERTED: "inserted" + EVENT_KEY$7,
  6160. CLICK: "click" + EVENT_KEY$7,
  6161. FOCUSIN: "focusin" + EVENT_KEY$7,
  6162. FOCUSOUT: "focusout" + EVENT_KEY$7,
  6163. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  6164. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  6165. };
  6166. /**
  6167. * ------------------------------------------------------------------------
  6168. * Class Definition
  6169. * ------------------------------------------------------------------------
  6170. */
  6171. var Popover =
  6172. /*#__PURE__*/
  6173. function (_Tooltip) {
  6174. _inheritsLoose(Popover, _Tooltip);
  6175. function Popover() {
  6176. return _Tooltip.apply(this, arguments) || this;
  6177. }
  6178. var _proto = Popover.prototype;
  6179. // Overrides
  6180. _proto.isWithContent = function isWithContent() {
  6181. return this.getTitle() || this._getContent();
  6182. };
  6183. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  6184. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  6185. };
  6186. _proto.getTipElement = function getTipElement() {
  6187. this.tip = this.tip || $(this.config.template)[0];
  6188. return this.tip;
  6189. };
  6190. _proto.setContent = function setContent() {
  6191. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  6192. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  6193. var content = this._getContent();
  6194. if (typeof content === 'function') {
  6195. content = content.call(this.element);
  6196. }
  6197. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  6198. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  6199. } // Private
  6200. ;
  6201. _proto._getContent = function _getContent() {
  6202. return this.element.getAttribute('data-content') || this.config.content;
  6203. };
  6204. _proto._cleanTipClass = function _cleanTipClass() {
  6205. var $tip = $(this.getTipElement());
  6206. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  6207. if (tabClass !== null && tabClass.length > 0) {
  6208. $tip.removeClass(tabClass.join(''));
  6209. }
  6210. } // Static
  6211. ;
  6212. Popover._jQueryInterface = function _jQueryInterface(config) {
  6213. return this.each(function () {
  6214. var data = $(this).data(DATA_KEY$7);
  6215. var _config = typeof config === 'object' ? config : null;
  6216. if (!data && /dispose|hide/.test(config)) {
  6217. return;
  6218. }
  6219. if (!data) {
  6220. data = new Popover(this, _config);
  6221. $(this).data(DATA_KEY$7, data);
  6222. }
  6223. if (typeof config === 'string') {
  6224. if (typeof data[config] === 'undefined') {
  6225. throw new TypeError("No method named \"" + config + "\"");
  6226. }
  6227. data[config]();
  6228. }
  6229. });
  6230. };
  6231. _createClass(Popover, null, [{
  6232. key: "VERSION",
  6233. // Getters
  6234. get: function get() {
  6235. return VERSION$7;
  6236. }
  6237. }, {
  6238. key: "Default",
  6239. get: function get() {
  6240. return Default$5;
  6241. }
  6242. }, {
  6243. key: "NAME",
  6244. get: function get() {
  6245. return NAME$7;
  6246. }
  6247. }, {
  6248. key: "DATA_KEY",
  6249. get: function get() {
  6250. return DATA_KEY$7;
  6251. }
  6252. }, {
  6253. key: "Event",
  6254. get: function get() {
  6255. return Event$7;
  6256. }
  6257. }, {
  6258. key: "EVENT_KEY",
  6259. get: function get() {
  6260. return EVENT_KEY$7;
  6261. }
  6262. }, {
  6263. key: "DefaultType",
  6264. get: function get() {
  6265. return DefaultType$5;
  6266. }
  6267. }]);
  6268. return Popover;
  6269. }(Tooltip);
  6270. /**
  6271. * ------------------------------------------------------------------------
  6272. * jQuery
  6273. * ------------------------------------------------------------------------
  6274. */
  6275. $.fn[NAME$7] = Popover._jQueryInterface;
  6276. $.fn[NAME$7].Constructor = Popover;
  6277. $.fn[NAME$7].noConflict = function () {
  6278. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  6279. return Popover._jQueryInterface;
  6280. };
  6281. /**
  6282. * ------------------------------------------------------------------------
  6283. * Constants
  6284. * ------------------------------------------------------------------------
  6285. */
  6286. var NAME$8 = 'scrollspy';
  6287. var VERSION$8 = '4.4.1';
  6288. var DATA_KEY$8 = 'bs.scrollspy';
  6289. var EVENT_KEY$8 = "." + DATA_KEY$8;
  6290. var DATA_API_KEY$6 = '.data-api';
  6291. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  6292. var Default$6 = {
  6293. offset: 10,
  6294. method: 'auto',
  6295. target: ''
  6296. };
  6297. var DefaultType$6 = {
  6298. offset: 'number',
  6299. method: 'string',
  6300. target: '(string|element)'
  6301. };
  6302. var Event$8 = {
  6303. ACTIVATE: "activate" + EVENT_KEY$8,
  6304. SCROLL: "scroll" + EVENT_KEY$8,
  6305. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  6306. };
  6307. var ClassName$8 = {
  6308. DROPDOWN_ITEM: 'dropdown-item',
  6309. DROPDOWN_MENU: 'dropdown-menu',
  6310. ACTIVE: 'active'
  6311. };
  6312. var Selector$8 = {
  6313. DATA_SPY: '[data-spy="scroll"]',
  6314. ACTIVE: '.active',
  6315. NAV_LIST_GROUP: '.nav, .list-group',
  6316. NAV_LINKS: '.nav-link',
  6317. NAV_ITEMS: '.nav-item',
  6318. LIST_ITEMS: '.list-group-item',
  6319. DROPDOWN: '.dropdown',
  6320. DROPDOWN_ITEMS: '.dropdown-item',
  6321. DROPDOWN_TOGGLE: '.dropdown-toggle'
  6322. };
  6323. var OffsetMethod = {
  6324. OFFSET: 'offset',
  6325. POSITION: 'position'
  6326. };
  6327. /**
  6328. * ------------------------------------------------------------------------
  6329. * Class Definition
  6330. * ------------------------------------------------------------------------
  6331. */
  6332. var ScrollSpy =
  6333. /*#__PURE__*/
  6334. function () {
  6335. function ScrollSpy(element, config) {
  6336. var _this = this;
  6337. this._element = element;
  6338. this._scrollElement = element.tagName === 'BODY' ? window : element;
  6339. this._config = this._getConfig(config);
  6340. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  6341. this._offsets = [];
  6342. this._targets = [];
  6343. this._activeTarget = null;
  6344. this._scrollHeight = 0;
  6345. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  6346. return _this._process(event);
  6347. });
  6348. this.refresh();
  6349. this._process();
  6350. } // Getters
  6351. var _proto = ScrollSpy.prototype;
  6352. // Public
  6353. _proto.refresh = function refresh() {
  6354. var _this2 = this;
  6355. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  6356. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  6357. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  6358. this._offsets = [];
  6359. this._targets = [];
  6360. this._scrollHeight = this._getScrollHeight();
  6361. var targets = [].slice.call(document.querySelectorAll(this._selector));
  6362. targets.map(function (element) {
  6363. var target;
  6364. var targetSelector = Util.getSelectorFromElement(element);
  6365. if (targetSelector) {
  6366. target = document.querySelector(targetSelector);
  6367. }
  6368. if (target) {
  6369. var targetBCR = target.getBoundingClientRect();
  6370. if (targetBCR.width || targetBCR.height) {
  6371. // TODO (fat): remove sketch reliance on jQuery position/offset
  6372. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  6373. }
  6374. }
  6375. return null;
  6376. }).filter(function (item) {
  6377. return item;
  6378. }).sort(function (a, b) {
  6379. return a[0] - b[0];
  6380. }).forEach(function (item) {
  6381. _this2._offsets.push(item[0]);
  6382. _this2._targets.push(item[1]);
  6383. });
  6384. };
  6385. _proto.dispose = function dispose() {
  6386. $.removeData(this._element, DATA_KEY$8);
  6387. $(this._scrollElement).off(EVENT_KEY$8);
  6388. this._element = null;
  6389. this._scrollElement = null;
  6390. this._config = null;
  6391. this._selector = null;
  6392. this._offsets = null;
  6393. this._targets = null;
  6394. this._activeTarget = null;
  6395. this._scrollHeight = null;
  6396. } // Private
  6397. ;
  6398. _proto._getConfig = function _getConfig(config) {
  6399. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  6400. if (typeof config.target !== 'string') {
  6401. var id = $(config.target).attr('id');
  6402. if (!id) {
  6403. id = Util.getUID(NAME$8);
  6404. $(config.target).attr('id', id);
  6405. }
  6406. config.target = "#" + id;
  6407. }
  6408. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  6409. return config;
  6410. };
  6411. _proto._getScrollTop = function _getScrollTop() {
  6412. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  6413. };
  6414. _proto._getScrollHeight = function _getScrollHeight() {
  6415. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  6416. };
  6417. _proto._getOffsetHeight = function _getOffsetHeight() {
  6418. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  6419. };
  6420. _proto._process = function _process() {
  6421. var scrollTop = this._getScrollTop() + this._config.offset;
  6422. var scrollHeight = this._getScrollHeight();
  6423. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  6424. if (this._scrollHeight !== scrollHeight) {
  6425. this.refresh();
  6426. }
  6427. if (scrollTop >= maxScroll) {
  6428. var target = this._targets[this._targets.length - 1];
  6429. if (this._activeTarget !== target) {
  6430. this._activate(target);
  6431. }
  6432. return;
  6433. }
  6434. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  6435. this._activeTarget = null;
  6436. this._clear();
  6437. return;
  6438. }
  6439. var offsetLength = this._offsets.length;
  6440. for (var i = offsetLength; i--;) {
  6441. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  6442. if (isActiveTarget) {
  6443. this._activate(this._targets[i]);
  6444. }
  6445. }
  6446. };
  6447. _proto._activate = function _activate(target) {
  6448. this._activeTarget = target;
  6449. this._clear();
  6450. var queries = this._selector.split(',').map(function (selector) {
  6451. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  6452. });
  6453. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  6454. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  6455. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  6456. $link.addClass(ClassName$8.ACTIVE);
  6457. } else {
  6458. // Set triggered link as active
  6459. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  6460. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  6461. $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
  6462. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  6463. }
  6464. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  6465. relatedTarget: target
  6466. });
  6467. };
  6468. _proto._clear = function _clear() {
  6469. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  6470. return node.classList.contains(ClassName$8.ACTIVE);
  6471. }).forEach(function (node) {
  6472. return node.classList.remove(ClassName$8.ACTIVE);
  6473. });
  6474. } // Static
  6475. ;
  6476. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  6477. return this.each(function () {
  6478. var data = $(this).data(DATA_KEY$8);
  6479. var _config = typeof config === 'object' && config;
  6480. if (!data) {
  6481. data = new ScrollSpy(this, _config);
  6482. $(this).data(DATA_KEY$8, data);
  6483. }
  6484. if (typeof config === 'string') {
  6485. if (typeof data[config] === 'undefined') {
  6486. throw new TypeError("No method named \"" + config + "\"");
  6487. }
  6488. data[config]();
  6489. }
  6490. });
  6491. };
  6492. _createClass(ScrollSpy, null, [{
  6493. key: "VERSION",
  6494. get: function get() {
  6495. return VERSION$8;
  6496. }
  6497. }, {
  6498. key: "Default",
  6499. get: function get() {
  6500. return Default$6;
  6501. }
  6502. }]);
  6503. return ScrollSpy;
  6504. }();
  6505. /**
  6506. * ------------------------------------------------------------------------
  6507. * Data Api implementation
  6508. * ------------------------------------------------------------------------
  6509. */
  6510. $(window).on(Event$8.LOAD_DATA_API, function () {
  6511. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  6512. var scrollSpysLength = scrollSpys.length;
  6513. for (var i = scrollSpysLength; i--;) {
  6514. var $spy = $(scrollSpys[i]);
  6515. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  6516. }
  6517. });
  6518. /**
  6519. * ------------------------------------------------------------------------
  6520. * jQuery
  6521. * ------------------------------------------------------------------------
  6522. */
  6523. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  6524. $.fn[NAME$8].Constructor = ScrollSpy;
  6525. $.fn[NAME$8].noConflict = function () {
  6526. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  6527. return ScrollSpy._jQueryInterface;
  6528. };
  6529. /**
  6530. * ------------------------------------------------------------------------
  6531. * Constants
  6532. * ------------------------------------------------------------------------
  6533. */
  6534. var NAME$9 = 'tab';
  6535. var VERSION$9 = '4.4.1';
  6536. var DATA_KEY$9 = 'bs.tab';
  6537. var EVENT_KEY$9 = "." + DATA_KEY$9;
  6538. var DATA_API_KEY$7 = '.data-api';
  6539. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  6540. var Event$9 = {
  6541. HIDE: "hide" + EVENT_KEY$9,
  6542. HIDDEN: "hidden" + EVENT_KEY$9,
  6543. SHOW: "show" + EVENT_KEY$9,
  6544. SHOWN: "shown" + EVENT_KEY$9,
  6545. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  6546. };
  6547. var ClassName$9 = {
  6548. DROPDOWN_MENU: 'dropdown-menu',
  6549. ACTIVE: 'active',
  6550. DISABLED: 'disabled',
  6551. FADE: 'fade',
  6552. SHOW: 'show'
  6553. };
  6554. var Selector$9 = {
  6555. DROPDOWN: '.dropdown',
  6556. NAV_LIST_GROUP: '.nav, .list-group',
  6557. ACTIVE: '.active',
  6558. ACTIVE_UL: '> li > .active',
  6559. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  6560. DROPDOWN_TOGGLE: '.dropdown-toggle',
  6561. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  6562. };
  6563. /**
  6564. * ------------------------------------------------------------------------
  6565. * Class Definition
  6566. * ------------------------------------------------------------------------
  6567. */
  6568. var Tab =
  6569. /*#__PURE__*/
  6570. function () {
  6571. function Tab(element) {
  6572. this._element = element;
  6573. } // Getters
  6574. var _proto = Tab.prototype;
  6575. // Public
  6576. _proto.show = function show() {
  6577. var _this = this;
  6578. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  6579. return;
  6580. }
  6581. var target;
  6582. var previous;
  6583. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  6584. var selector = Util.getSelectorFromElement(this._element);
  6585. if (listElement) {
  6586. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  6587. previous = $.makeArray($(listElement).find(itemSelector));
  6588. previous = previous[previous.length - 1];
  6589. }
  6590. var hideEvent = $.Event(Event$9.HIDE, {
  6591. relatedTarget: this._element
  6592. });
  6593. var showEvent = $.Event(Event$9.SHOW, {
  6594. relatedTarget: previous
  6595. });
  6596. if (previous) {
  6597. $(previous).trigger(hideEvent);
  6598. }
  6599. $(this._element).trigger(showEvent);
  6600. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  6601. return;
  6602. }
  6603. if (selector) {
  6604. target = document.querySelector(selector);
  6605. }
  6606. this._activate(this._element, listElement);
  6607. var complete = function complete() {
  6608. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  6609. relatedTarget: _this._element
  6610. });
  6611. var shownEvent = $.Event(Event$9.SHOWN, {
  6612. relatedTarget: previous
  6613. });
  6614. $(previous).trigger(hiddenEvent);
  6615. $(_this._element).trigger(shownEvent);
  6616. };
  6617. if (target) {
  6618. this._activate(target, target.parentNode, complete);
  6619. } else {
  6620. complete();
  6621. }
  6622. };
  6623. _proto.dispose = function dispose() {
  6624. $.removeData(this._element, DATA_KEY$9);
  6625. this._element = null;
  6626. } // Private
  6627. ;
  6628. _proto._activate = function _activate(element, container, callback) {
  6629. var _this2 = this;
  6630. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  6631. var active = activeElements[0];
  6632. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  6633. var complete = function complete() {
  6634. return _this2._transitionComplete(element, active, callback);
  6635. };
  6636. if (active && isTransitioning) {
  6637. var transitionDuration = Util.getTransitionDurationFromElement(active);
  6638. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6639. } else {
  6640. complete();
  6641. }
  6642. };
  6643. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  6644. if (active) {
  6645. $(active).removeClass(ClassName$9.ACTIVE);
  6646. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  6647. if (dropdownChild) {
  6648. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  6649. }
  6650. if (active.getAttribute('role') === 'tab') {
  6651. active.setAttribute('aria-selected', false);
  6652. }
  6653. }
  6654. $(element).addClass(ClassName$9.ACTIVE);
  6655. if (element.getAttribute('role') === 'tab') {
  6656. element.setAttribute('aria-selected', true);
  6657. }
  6658. Util.reflow(element);
  6659. if (element.classList.contains(ClassName$9.FADE)) {
  6660. element.classList.add(ClassName$9.SHOW);
  6661. }
  6662. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  6663. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  6664. if (dropdownElement) {
  6665. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  6666. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  6667. }
  6668. element.setAttribute('aria-expanded', true);
  6669. }
  6670. if (callback) {
  6671. callback();
  6672. }
  6673. } // Static
  6674. ;
  6675. Tab._jQueryInterface = function _jQueryInterface(config) {
  6676. return this.each(function () {
  6677. var $this = $(this);
  6678. var data = $this.data(DATA_KEY$9);
  6679. if (!data) {
  6680. data = new Tab(this);
  6681. $this.data(DATA_KEY$9, data);
  6682. }
  6683. if (typeof config === 'string') {
  6684. if (typeof data[config] === 'undefined') {
  6685. throw new TypeError("No method named \"" + config + "\"");
  6686. }
  6687. data[config]();
  6688. }
  6689. });
  6690. };
  6691. _createClass(Tab, null, [{
  6692. key: "VERSION",
  6693. get: function get() {
  6694. return VERSION$9;
  6695. }
  6696. }]);
  6697. return Tab;
  6698. }();
  6699. /**
  6700. * ------------------------------------------------------------------------
  6701. * Data Api implementation
  6702. * ------------------------------------------------------------------------
  6703. */
  6704. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  6705. event.preventDefault();
  6706. Tab._jQueryInterface.call($(this), 'show');
  6707. });
  6708. /**
  6709. * ------------------------------------------------------------------------
  6710. * jQuery
  6711. * ------------------------------------------------------------------------
  6712. */
  6713. $.fn[NAME$9] = Tab._jQueryInterface;
  6714. $.fn[NAME$9].Constructor = Tab;
  6715. $.fn[NAME$9].noConflict = function () {
  6716. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  6717. return Tab._jQueryInterface;
  6718. };
  6719. /**
  6720. * ------------------------------------------------------------------------
  6721. * Constants
  6722. * ------------------------------------------------------------------------
  6723. */
  6724. var NAME$a = 'toast';
  6725. var VERSION$a = '4.4.1';
  6726. var DATA_KEY$a = 'bs.toast';
  6727. var EVENT_KEY$a = "." + DATA_KEY$a;
  6728. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  6729. var Event$a = {
  6730. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  6731. HIDE: "hide" + EVENT_KEY$a,
  6732. HIDDEN: "hidden" + EVENT_KEY$a,
  6733. SHOW: "show" + EVENT_KEY$a,
  6734. SHOWN: "shown" + EVENT_KEY$a
  6735. };
  6736. var ClassName$a = {
  6737. FADE: 'fade',
  6738. HIDE: 'hide',
  6739. SHOW: 'show',
  6740. SHOWING: 'showing'
  6741. };
  6742. var DefaultType$7 = {
  6743. animation: 'boolean',
  6744. autohide: 'boolean',
  6745. delay: 'number'
  6746. };
  6747. var Default$7 = {
  6748. animation: true,
  6749. autohide: true,
  6750. delay: 500
  6751. };
  6752. var Selector$a = {
  6753. DATA_DISMISS: '[data-dismiss="toast"]'
  6754. };
  6755. /**
  6756. * ------------------------------------------------------------------------
  6757. * Class Definition
  6758. * ------------------------------------------------------------------------
  6759. */
  6760. var Toast =
  6761. /*#__PURE__*/
  6762. function () {
  6763. function Toast(element, config) {
  6764. this._element = element;
  6765. this._config = this._getConfig(config);
  6766. this._timeout = null;
  6767. this._setListeners();
  6768. } // Getters
  6769. var _proto = Toast.prototype;
  6770. // Public
  6771. _proto.show = function show() {
  6772. var _this = this;
  6773. var showEvent = $.Event(Event$a.SHOW);
  6774. $(this._element).trigger(showEvent);
  6775. if (showEvent.isDefaultPrevented()) {
  6776. return;
  6777. }
  6778. if (this._config.animation) {
  6779. this._element.classList.add(ClassName$a.FADE);
  6780. }
  6781. var complete = function complete() {
  6782. _this._element.classList.remove(ClassName$a.SHOWING);
  6783. _this._element.classList.add(ClassName$a.SHOW);
  6784. $(_this._element).trigger(Event$a.SHOWN);
  6785. if (_this._config.autohide) {
  6786. _this._timeout = setTimeout(function () {
  6787. _this.hide();
  6788. }, _this._config.delay);
  6789. }
  6790. };
  6791. this._element.classList.remove(ClassName$a.HIDE);
  6792. Util.reflow(this._element);
  6793. this._element.classList.add(ClassName$a.SHOWING);
  6794. if (this._config.animation) {
  6795. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6796. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6797. } else {
  6798. complete();
  6799. }
  6800. };
  6801. _proto.hide = function hide() {
  6802. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  6803. return;
  6804. }
  6805. var hideEvent = $.Event(Event$a.HIDE);
  6806. $(this._element).trigger(hideEvent);
  6807. if (hideEvent.isDefaultPrevented()) {
  6808. return;
  6809. }
  6810. this._close();
  6811. };
  6812. _proto.dispose = function dispose() {
  6813. clearTimeout(this._timeout);
  6814. this._timeout = null;
  6815. if (this._element.classList.contains(ClassName$a.SHOW)) {
  6816. this._element.classList.remove(ClassName$a.SHOW);
  6817. }
  6818. $(this._element).off(Event$a.CLICK_DISMISS);
  6819. $.removeData(this._element, DATA_KEY$a);
  6820. this._element = null;
  6821. this._config = null;
  6822. } // Private
  6823. ;
  6824. _proto._getConfig = function _getConfig(config) {
  6825. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  6826. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  6827. return config;
  6828. };
  6829. _proto._setListeners = function _setListeners() {
  6830. var _this2 = this;
  6831. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  6832. return _this2.hide();
  6833. });
  6834. };
  6835. _proto._close = function _close() {
  6836. var _this3 = this;
  6837. var complete = function complete() {
  6838. _this3._element.classList.add(ClassName$a.HIDE);
  6839. $(_this3._element).trigger(Event$a.HIDDEN);
  6840. };
  6841. this._element.classList.remove(ClassName$a.SHOW);
  6842. if (this._config.animation) {
  6843. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6844. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6845. } else {
  6846. complete();
  6847. }
  6848. } // Static
  6849. ;
  6850. Toast._jQueryInterface = function _jQueryInterface(config) {
  6851. return this.each(function () {
  6852. var $element = $(this);
  6853. var data = $element.data(DATA_KEY$a);
  6854. var _config = typeof config === 'object' && config;
  6855. if (!data) {
  6856. data = new Toast(this, _config);
  6857. $element.data(DATA_KEY$a, data);
  6858. }
  6859. if (typeof config === 'string') {
  6860. if (typeof data[config] === 'undefined') {
  6861. throw new TypeError("No method named \"" + config + "\"");
  6862. }
  6863. data[config](this);
  6864. }
  6865. });
  6866. };
  6867. _createClass(Toast, null, [{
  6868. key: "VERSION",
  6869. get: function get() {
  6870. return VERSION$a;
  6871. }
  6872. }, {
  6873. key: "DefaultType",
  6874. get: function get() {
  6875. return DefaultType$7;
  6876. }
  6877. }, {
  6878. key: "Default",
  6879. get: function get() {
  6880. return Default$7;
  6881. }
  6882. }]);
  6883. return Toast;
  6884. }();
  6885. /**
  6886. * ------------------------------------------------------------------------
  6887. * jQuery
  6888. * ------------------------------------------------------------------------
  6889. */
  6890. $.fn[NAME$a] = Toast._jQueryInterface;
  6891. $.fn[NAME$a].Constructor = Toast;
  6892. $.fn[NAME$a].noConflict = function () {
  6893. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  6894. return Toast._jQueryInterface;
  6895. };
  6896. exports.Alert = Alert;
  6897. exports.Button = Button;
  6898. exports.Carousel = Carousel;
  6899. exports.Collapse = Collapse;
  6900. exports.Dropdown = Dropdown;
  6901. exports.Modal = Modal;
  6902. exports.Popover = Popover;
  6903. exports.Scrollspy = ScrollSpy;
  6904. exports.Tab = Tab;
  6905. exports.Toast = Toast;
  6906. exports.Tooltip = Tooltip;
  6907. exports.Util = Util;
  6908. Object.defineProperty(exports, '__esModule', { value: true });
  6909. })));
  6910. //# sourceMappingURL=bootstrap.js.map
  6911. /***/ }),
  6912. /***/ "./node_modules/buffer/index.js":
  6913. /*!**************************************!*\
  6914. !*** ./node_modules/buffer/index.js ***!
  6915. \**************************************/
  6916. /*! no static exports found */
  6917. /***/ (function(module, exports, __webpack_require__) {
  6918. "use strict";
  6919. /* WEBPACK VAR INJECTION */(function(global) {/*!
  6920. * The buffer module from node.js, for the browser.
  6921. *
  6922. * @author Feross Aboukhadijeh <http://feross.org>
  6923. * @license MIT
  6924. */
  6925. /* eslint-disable no-proto */
  6926. var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
  6927. var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
  6928. var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
  6929. exports.Buffer = Buffer
  6930. exports.SlowBuffer = SlowBuffer
  6931. exports.INSPECT_MAX_BYTES = 50
  6932. /**
  6933. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  6934. * === true Use Uint8Array implementation (fastest)
  6935. * === false Use Object implementation (most compatible, even IE6)
  6936. *
  6937. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  6938. * Opera 11.6+, iOS 4.2+.
  6939. *
  6940. * Due to various browser bugs, sometimes the Object implementation will be used even
  6941. * when the browser supports typed arrays.
  6942. *
  6943. * Note:
  6944. *
  6945. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  6946. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  6947. *
  6948. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  6949. *
  6950. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  6951. * incorrect length in some situations.
  6952. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  6953. * get the Object implementation, which is slower but behaves correctly.
  6954. */
  6955. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  6956. ? global.TYPED_ARRAY_SUPPORT
  6957. : typedArraySupport()
  6958. /*
  6959. * Export kMaxLength after typed array support is determined.
  6960. */
  6961. exports.kMaxLength = kMaxLength()
  6962. function typedArraySupport () {
  6963. try {
  6964. var arr = new Uint8Array(1)
  6965. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  6966. return arr.foo() === 42 && // typed array instances can be augmented
  6967. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  6968. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  6969. } catch (e) {
  6970. return false
  6971. }
  6972. }
  6973. function kMaxLength () {
  6974. return Buffer.TYPED_ARRAY_SUPPORT
  6975. ? 0x7fffffff
  6976. : 0x3fffffff
  6977. }
  6978. function createBuffer (that, length) {
  6979. if (kMaxLength() < length) {
  6980. throw new RangeError('Invalid typed array length')
  6981. }
  6982. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6983. // Return an augmented `Uint8Array` instance, for best performance
  6984. that = new Uint8Array(length)
  6985. that.__proto__ = Buffer.prototype
  6986. } else {
  6987. // Fallback: Return an object instance of the Buffer class
  6988. if (that === null) {
  6989. that = new Buffer(length)
  6990. }
  6991. that.length = length
  6992. }
  6993. return that
  6994. }
  6995. /**
  6996. * The Buffer constructor returns instances of `Uint8Array` that have their
  6997. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  6998. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  6999. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  7000. * returns a single octet.
  7001. *
  7002. * The `Uint8Array` prototype remains unmodified.
  7003. */
  7004. function Buffer (arg, encodingOrOffset, length) {
  7005. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  7006. return new Buffer(arg, encodingOrOffset, length)
  7007. }
  7008. // Common case.
  7009. if (typeof arg === 'number') {
  7010. if (typeof encodingOrOffset === 'string') {
  7011. throw new Error(
  7012. 'If encoding is specified then the first argument must be a string'
  7013. )
  7014. }
  7015. return allocUnsafe(this, arg)
  7016. }
  7017. return from(this, arg, encodingOrOffset, length)
  7018. }
  7019. Buffer.poolSize = 8192 // not used by this implementation
  7020. // TODO: Legacy, not needed anymore. Remove in next major version.
  7021. Buffer._augment = function (arr) {
  7022. arr.__proto__ = Buffer.prototype
  7023. return arr
  7024. }
  7025. function from (that, value, encodingOrOffset, length) {
  7026. if (typeof value === 'number') {
  7027. throw new TypeError('"value" argument must not be a number')
  7028. }
  7029. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  7030. return fromArrayBuffer(that, value, encodingOrOffset, length)
  7031. }
  7032. if (typeof value === 'string') {
  7033. return fromString(that, value, encodingOrOffset)
  7034. }
  7035. return fromObject(that, value)
  7036. }
  7037. /**
  7038. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  7039. * if value is a number.
  7040. * Buffer.from(str[, encoding])
  7041. * Buffer.from(array)
  7042. * Buffer.from(buffer)
  7043. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  7044. **/
  7045. Buffer.from = function (value, encodingOrOffset, length) {
  7046. return from(null, value, encodingOrOffset, length)
  7047. }
  7048. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7049. Buffer.prototype.__proto__ = Uint8Array.prototype
  7050. Buffer.__proto__ = Uint8Array
  7051. if (typeof Symbol !== 'undefined' && Symbol.species &&
  7052. Buffer[Symbol.species] === Buffer) {
  7053. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  7054. Object.defineProperty(Buffer, Symbol.species, {
  7055. value: null,
  7056. configurable: true
  7057. })
  7058. }
  7059. }
  7060. function assertSize (size) {
  7061. if (typeof size !== 'number') {
  7062. throw new TypeError('"size" argument must be a number')
  7063. } else if (size < 0) {
  7064. throw new RangeError('"size" argument must not be negative')
  7065. }
  7066. }
  7067. function alloc (that, size, fill, encoding) {
  7068. assertSize(size)
  7069. if (size <= 0) {
  7070. return createBuffer(that, size)
  7071. }
  7072. if (fill !== undefined) {
  7073. // Only pay attention to encoding if it's a string. This
  7074. // prevents accidentally sending in a number that would
  7075. // be interpretted as a start offset.
  7076. return typeof encoding === 'string'
  7077. ? createBuffer(that, size).fill(fill, encoding)
  7078. : createBuffer(that, size).fill(fill)
  7079. }
  7080. return createBuffer(that, size)
  7081. }
  7082. /**
  7083. * Creates a new filled Buffer instance.
  7084. * alloc(size[, fill[, encoding]])
  7085. **/
  7086. Buffer.alloc = function (size, fill, encoding) {
  7087. return alloc(null, size, fill, encoding)
  7088. }
  7089. function allocUnsafe (that, size) {
  7090. assertSize(size)
  7091. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  7092. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  7093. for (var i = 0; i < size; ++i) {
  7094. that[i] = 0
  7095. }
  7096. }
  7097. return that
  7098. }
  7099. /**
  7100. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  7101. * */
  7102. Buffer.allocUnsafe = function (size) {
  7103. return allocUnsafe(null, size)
  7104. }
  7105. /**
  7106. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  7107. */
  7108. Buffer.allocUnsafeSlow = function (size) {
  7109. return allocUnsafe(null, size)
  7110. }
  7111. function fromString (that, string, encoding) {
  7112. if (typeof encoding !== 'string' || encoding === '') {
  7113. encoding = 'utf8'
  7114. }
  7115. if (!Buffer.isEncoding(encoding)) {
  7116. throw new TypeError('"encoding" must be a valid string encoding')
  7117. }
  7118. var length = byteLength(string, encoding) | 0
  7119. that = createBuffer(that, length)
  7120. var actual = that.write(string, encoding)
  7121. if (actual !== length) {
  7122. // Writing a hex string, for example, that contains invalid characters will
  7123. // cause everything after the first invalid character to be ignored. (e.g.
  7124. // 'abxxcd' will be treated as 'ab')
  7125. that = that.slice(0, actual)
  7126. }
  7127. return that
  7128. }
  7129. function fromArrayLike (that, array) {
  7130. var length = array.length < 0 ? 0 : checked(array.length) | 0
  7131. that = createBuffer(that, length)
  7132. for (var i = 0; i < length; i += 1) {
  7133. that[i] = array[i] & 255
  7134. }
  7135. return that
  7136. }
  7137. function fromArrayBuffer (that, array, byteOffset, length) {
  7138. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  7139. if (byteOffset < 0 || array.byteLength < byteOffset) {
  7140. throw new RangeError('\'offset\' is out of bounds')
  7141. }
  7142. if (array.byteLength < byteOffset + (length || 0)) {
  7143. throw new RangeError('\'length\' is out of bounds')
  7144. }
  7145. if (byteOffset === undefined && length === undefined) {
  7146. array = new Uint8Array(array)
  7147. } else if (length === undefined) {
  7148. array = new Uint8Array(array, byteOffset)
  7149. } else {
  7150. array = new Uint8Array(array, byteOffset, length)
  7151. }
  7152. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7153. // Return an augmented `Uint8Array` instance, for best performance
  7154. that = array
  7155. that.__proto__ = Buffer.prototype
  7156. } else {
  7157. // Fallback: Return an object instance of the Buffer class
  7158. that = fromArrayLike(that, array)
  7159. }
  7160. return that
  7161. }
  7162. function fromObject (that, obj) {
  7163. if (Buffer.isBuffer(obj)) {
  7164. var len = checked(obj.length) | 0
  7165. that = createBuffer(that, len)
  7166. if (that.length === 0) {
  7167. return that
  7168. }
  7169. obj.copy(that, 0, 0, len)
  7170. return that
  7171. }
  7172. if (obj) {
  7173. if ((typeof ArrayBuffer !== 'undefined' &&
  7174. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  7175. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  7176. return createBuffer(that, 0)
  7177. }
  7178. return fromArrayLike(that, obj)
  7179. }
  7180. if (obj.type === 'Buffer' && isArray(obj.data)) {
  7181. return fromArrayLike(that, obj.data)
  7182. }
  7183. }
  7184. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  7185. }
  7186. function checked (length) {
  7187. // Note: cannot use `length < kMaxLength()` here because that fails when
  7188. // length is NaN (which is otherwise coerced to zero.)
  7189. if (length >= kMaxLength()) {
  7190. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  7191. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  7192. }
  7193. return length | 0
  7194. }
  7195. function SlowBuffer (length) {
  7196. if (+length != length) { // eslint-disable-line eqeqeq
  7197. length = 0
  7198. }
  7199. return Buffer.alloc(+length)
  7200. }
  7201. Buffer.isBuffer = function isBuffer (b) {
  7202. return !!(b != null && b._isBuffer)
  7203. }
  7204. Buffer.compare = function compare (a, b) {
  7205. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  7206. throw new TypeError('Arguments must be Buffers')
  7207. }
  7208. if (a === b) return 0
  7209. var x = a.length
  7210. var y = b.length
  7211. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  7212. if (a[i] !== b[i]) {
  7213. x = a[i]
  7214. y = b[i]
  7215. break
  7216. }
  7217. }
  7218. if (x < y) return -1
  7219. if (y < x) return 1
  7220. return 0
  7221. }
  7222. Buffer.isEncoding = function isEncoding (encoding) {
  7223. switch (String(encoding).toLowerCase()) {
  7224. case 'hex':
  7225. case 'utf8':
  7226. case 'utf-8':
  7227. case 'ascii':
  7228. case 'latin1':
  7229. case 'binary':
  7230. case 'base64':
  7231. case 'ucs2':
  7232. case 'ucs-2':
  7233. case 'utf16le':
  7234. case 'utf-16le':
  7235. return true
  7236. default:
  7237. return false
  7238. }
  7239. }
  7240. Buffer.concat = function concat (list, length) {
  7241. if (!isArray(list)) {
  7242. throw new TypeError('"list" argument must be an Array of Buffers')
  7243. }
  7244. if (list.length === 0) {
  7245. return Buffer.alloc(0)
  7246. }
  7247. var i
  7248. if (length === undefined) {
  7249. length = 0
  7250. for (i = 0; i < list.length; ++i) {
  7251. length += list[i].length
  7252. }
  7253. }
  7254. var buffer = Buffer.allocUnsafe(length)
  7255. var pos = 0
  7256. for (i = 0; i < list.length; ++i) {
  7257. var buf = list[i]
  7258. if (!Buffer.isBuffer(buf)) {
  7259. throw new TypeError('"list" argument must be an Array of Buffers')
  7260. }
  7261. buf.copy(buffer, pos)
  7262. pos += buf.length
  7263. }
  7264. return buffer
  7265. }
  7266. function byteLength (string, encoding) {
  7267. if (Buffer.isBuffer(string)) {
  7268. return string.length
  7269. }
  7270. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  7271. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  7272. return string.byteLength
  7273. }
  7274. if (typeof string !== 'string') {
  7275. string = '' + string
  7276. }
  7277. var len = string.length
  7278. if (len === 0) return 0
  7279. // Use a for loop to avoid recursion
  7280. var loweredCase = false
  7281. for (;;) {
  7282. switch (encoding) {
  7283. case 'ascii':
  7284. case 'latin1':
  7285. case 'binary':
  7286. return len
  7287. case 'utf8':
  7288. case 'utf-8':
  7289. case undefined:
  7290. return utf8ToBytes(string).length
  7291. case 'ucs2':
  7292. case 'ucs-2':
  7293. case 'utf16le':
  7294. case 'utf-16le':
  7295. return len * 2
  7296. case 'hex':
  7297. return len >>> 1
  7298. case 'base64':
  7299. return base64ToBytes(string).length
  7300. default:
  7301. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  7302. encoding = ('' + encoding).toLowerCase()
  7303. loweredCase = true
  7304. }
  7305. }
  7306. }
  7307. Buffer.byteLength = byteLength
  7308. function slowToString (encoding, start, end) {
  7309. var loweredCase = false
  7310. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  7311. // property of a typed array.
  7312. // This behaves neither like String nor Uint8Array in that we set start/end
  7313. // to their upper/lower bounds if the value passed is out of range.
  7314. // undefined is handled specially as per ECMA-262 6th Edition,
  7315. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  7316. if (start === undefined || start < 0) {
  7317. start = 0
  7318. }
  7319. // Return early if start > this.length. Done here to prevent potential uint32
  7320. // coercion fail below.
  7321. if (start > this.length) {
  7322. return ''
  7323. }
  7324. if (end === undefined || end > this.length) {
  7325. end = this.length
  7326. }
  7327. if (end <= 0) {
  7328. return ''
  7329. }
  7330. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  7331. end >>>= 0
  7332. start >>>= 0
  7333. if (end <= start) {
  7334. return ''
  7335. }
  7336. if (!encoding) encoding = 'utf8'
  7337. while (true) {
  7338. switch (encoding) {
  7339. case 'hex':
  7340. return hexSlice(this, start, end)
  7341. case 'utf8':
  7342. case 'utf-8':
  7343. return utf8Slice(this, start, end)
  7344. case 'ascii':
  7345. return asciiSlice(this, start, end)
  7346. case 'latin1':
  7347. case 'binary':
  7348. return latin1Slice(this, start, end)
  7349. case 'base64':
  7350. return base64Slice(this, start, end)
  7351. case 'ucs2':
  7352. case 'ucs-2':
  7353. case 'utf16le':
  7354. case 'utf-16le':
  7355. return utf16leSlice(this, start, end)
  7356. default:
  7357. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  7358. encoding = (encoding + '').toLowerCase()
  7359. loweredCase = true
  7360. }
  7361. }
  7362. }
  7363. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  7364. // Buffer instances.
  7365. Buffer.prototype._isBuffer = true
  7366. function swap (b, n, m) {
  7367. var i = b[n]
  7368. b[n] = b[m]
  7369. b[m] = i
  7370. }
  7371. Buffer.prototype.swap16 = function swap16 () {
  7372. var len = this.length
  7373. if (len % 2 !== 0) {
  7374. throw new RangeError('Buffer size must be a multiple of 16-bits')
  7375. }
  7376. for (var i = 0; i < len; i += 2) {
  7377. swap(this, i, i + 1)
  7378. }
  7379. return this
  7380. }
  7381. Buffer.prototype.swap32 = function swap32 () {
  7382. var len = this.length
  7383. if (len % 4 !== 0) {
  7384. throw new RangeError('Buffer size must be a multiple of 32-bits')
  7385. }
  7386. for (var i = 0; i < len; i += 4) {
  7387. swap(this, i, i + 3)
  7388. swap(this, i + 1, i + 2)
  7389. }
  7390. return this
  7391. }
  7392. Buffer.prototype.swap64 = function swap64 () {
  7393. var len = this.length
  7394. if (len % 8 !== 0) {
  7395. throw new RangeError('Buffer size must be a multiple of 64-bits')
  7396. }
  7397. for (var i = 0; i < len; i += 8) {
  7398. swap(this, i, i + 7)
  7399. swap(this, i + 1, i + 6)
  7400. swap(this, i + 2, i + 5)
  7401. swap(this, i + 3, i + 4)
  7402. }
  7403. return this
  7404. }
  7405. Buffer.prototype.toString = function toString () {
  7406. var length = this.length | 0
  7407. if (length === 0) return ''
  7408. if (arguments.length === 0) return utf8Slice(this, 0, length)
  7409. return slowToString.apply(this, arguments)
  7410. }
  7411. Buffer.prototype.equals = function equals (b) {
  7412. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  7413. if (this === b) return true
  7414. return Buffer.compare(this, b) === 0
  7415. }
  7416. Buffer.prototype.inspect = function inspect () {
  7417. var str = ''
  7418. var max = exports.INSPECT_MAX_BYTES
  7419. if (this.length > 0) {
  7420. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  7421. if (this.length > max) str += ' ... '
  7422. }
  7423. return '<Buffer ' + str + '>'
  7424. }
  7425. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  7426. if (!Buffer.isBuffer(target)) {
  7427. throw new TypeError('Argument must be a Buffer')
  7428. }
  7429. if (start === undefined) {
  7430. start = 0
  7431. }
  7432. if (end === undefined) {
  7433. end = target ? target.length : 0
  7434. }
  7435. if (thisStart === undefined) {
  7436. thisStart = 0
  7437. }
  7438. if (thisEnd === undefined) {
  7439. thisEnd = this.length
  7440. }
  7441. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  7442. throw new RangeError('out of range index')
  7443. }
  7444. if (thisStart >= thisEnd && start >= end) {
  7445. return 0
  7446. }
  7447. if (thisStart >= thisEnd) {
  7448. return -1
  7449. }
  7450. if (start >= end) {
  7451. return 1
  7452. }
  7453. start >>>= 0
  7454. end >>>= 0
  7455. thisStart >>>= 0
  7456. thisEnd >>>= 0
  7457. if (this === target) return 0
  7458. var x = thisEnd - thisStart
  7459. var y = end - start
  7460. var len = Math.min(x, y)
  7461. var thisCopy = this.slice(thisStart, thisEnd)
  7462. var targetCopy = target.slice(start, end)
  7463. for (var i = 0; i < len; ++i) {
  7464. if (thisCopy[i] !== targetCopy[i]) {
  7465. x = thisCopy[i]
  7466. y = targetCopy[i]
  7467. break
  7468. }
  7469. }
  7470. if (x < y) return -1
  7471. if (y < x) return 1
  7472. return 0
  7473. }
  7474. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  7475. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  7476. //
  7477. // Arguments:
  7478. // - buffer - a Buffer to search
  7479. // - val - a string, Buffer, or number
  7480. // - byteOffset - an index into `buffer`; will be clamped to an int32
  7481. // - encoding - an optional encoding, relevant is val is a string
  7482. // - dir - true for indexOf, false for lastIndexOf
  7483. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  7484. // Empty buffer means no match
  7485. if (buffer.length === 0) return -1
  7486. // Normalize byteOffset
  7487. if (typeof byteOffset === 'string') {
  7488. encoding = byteOffset
  7489. byteOffset = 0
  7490. } else if (byteOffset > 0x7fffffff) {
  7491. byteOffset = 0x7fffffff
  7492. } else if (byteOffset < -0x80000000) {
  7493. byteOffset = -0x80000000
  7494. }
  7495. byteOffset = +byteOffset // Coerce to Number.
  7496. if (isNaN(byteOffset)) {
  7497. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  7498. byteOffset = dir ? 0 : (buffer.length - 1)
  7499. }
  7500. // Normalize byteOffset: negative offsets start from the end of the buffer
  7501. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  7502. if (byteOffset >= buffer.length) {
  7503. if (dir) return -1
  7504. else byteOffset = buffer.length - 1
  7505. } else if (byteOffset < 0) {
  7506. if (dir) byteOffset = 0
  7507. else return -1
  7508. }
  7509. // Normalize val
  7510. if (typeof val === 'string') {
  7511. val = Buffer.from(val, encoding)
  7512. }
  7513. // Finally, search either indexOf (if dir is true) or lastIndexOf
  7514. if (Buffer.isBuffer(val)) {
  7515. // Special case: looking for empty string/buffer always fails
  7516. if (val.length === 0) {
  7517. return -1
  7518. }
  7519. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  7520. } else if (typeof val === 'number') {
  7521. val = val & 0xFF // Search for a byte value [0-255]
  7522. if (Buffer.TYPED_ARRAY_SUPPORT &&
  7523. typeof Uint8Array.prototype.indexOf === 'function') {
  7524. if (dir) {
  7525. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  7526. } else {
  7527. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  7528. }
  7529. }
  7530. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  7531. }
  7532. throw new TypeError('val must be string, number or Buffer')
  7533. }
  7534. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  7535. var indexSize = 1
  7536. var arrLength = arr.length
  7537. var valLength = val.length
  7538. if (encoding !== undefined) {
  7539. encoding = String(encoding).toLowerCase()
  7540. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  7541. encoding === 'utf16le' || encoding === 'utf-16le') {
  7542. if (arr.length < 2 || val.length < 2) {
  7543. return -1
  7544. }
  7545. indexSize = 2
  7546. arrLength /= 2
  7547. valLength /= 2
  7548. byteOffset /= 2
  7549. }
  7550. }
  7551. function read (buf, i) {
  7552. if (indexSize === 1) {
  7553. return buf[i]
  7554. } else {
  7555. return buf.readUInt16BE(i * indexSize)
  7556. }
  7557. }
  7558. var i
  7559. if (dir) {
  7560. var foundIndex = -1
  7561. for (i = byteOffset; i < arrLength; i++) {
  7562. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  7563. if (foundIndex === -1) foundIndex = i
  7564. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  7565. } else {
  7566. if (foundIndex !== -1) i -= i - foundIndex
  7567. foundIndex = -1
  7568. }
  7569. }
  7570. } else {
  7571. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  7572. for (i = byteOffset; i >= 0; i--) {
  7573. var found = true
  7574. for (var j = 0; j < valLength; j++) {
  7575. if (read(arr, i + j) !== read(val, j)) {
  7576. found = false
  7577. break
  7578. }
  7579. }
  7580. if (found) return i
  7581. }
  7582. }
  7583. return -1
  7584. }
  7585. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  7586. return this.indexOf(val, byteOffset, encoding) !== -1
  7587. }
  7588. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  7589. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  7590. }
  7591. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  7592. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  7593. }
  7594. function hexWrite (buf, string, offset, length) {
  7595. offset = Number(offset) || 0
  7596. var remaining = buf.length - offset
  7597. if (!length) {
  7598. length = remaining
  7599. } else {
  7600. length = Number(length)
  7601. if (length > remaining) {
  7602. length = remaining
  7603. }
  7604. }
  7605. // must be an even number of digits
  7606. var strLen = string.length
  7607. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  7608. if (length > strLen / 2) {
  7609. length = strLen / 2
  7610. }
  7611. for (var i = 0; i < length; ++i) {
  7612. var parsed = parseInt(string.substr(i * 2, 2), 16)
  7613. if (isNaN(parsed)) return i
  7614. buf[offset + i] = parsed
  7615. }
  7616. return i
  7617. }
  7618. function utf8Write (buf, string, offset, length) {
  7619. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  7620. }
  7621. function asciiWrite (buf, string, offset, length) {
  7622. return blitBuffer(asciiToBytes(string), buf, offset, length)
  7623. }
  7624. function latin1Write (buf, string, offset, length) {
  7625. return asciiWrite(buf, string, offset, length)
  7626. }
  7627. function base64Write (buf, string, offset, length) {
  7628. return blitBuffer(base64ToBytes(string), buf, offset, length)
  7629. }
  7630. function ucs2Write (buf, string, offset, length) {
  7631. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  7632. }
  7633. Buffer.prototype.write = function write (string, offset, length, encoding) {
  7634. // Buffer#write(string)
  7635. if (offset === undefined) {
  7636. encoding = 'utf8'
  7637. length = this.length
  7638. offset = 0
  7639. // Buffer#write(string, encoding)
  7640. } else if (length === undefined && typeof offset === 'string') {
  7641. encoding = offset
  7642. length = this.length
  7643. offset = 0
  7644. // Buffer#write(string, offset[, length][, encoding])
  7645. } else if (isFinite(offset)) {
  7646. offset = offset | 0
  7647. if (isFinite(length)) {
  7648. length = length | 0
  7649. if (encoding === undefined) encoding = 'utf8'
  7650. } else {
  7651. encoding = length
  7652. length = undefined
  7653. }
  7654. // legacy write(string, encoding, offset, length) - remove in v0.13
  7655. } else {
  7656. throw new Error(
  7657. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  7658. )
  7659. }
  7660. var remaining = this.length - offset
  7661. if (length === undefined || length > remaining) length = remaining
  7662. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  7663. throw new RangeError('Attempt to write outside buffer bounds')
  7664. }
  7665. if (!encoding) encoding = 'utf8'
  7666. var loweredCase = false
  7667. for (;;) {
  7668. switch (encoding) {
  7669. case 'hex':
  7670. return hexWrite(this, string, offset, length)
  7671. case 'utf8':
  7672. case 'utf-8':
  7673. return utf8Write(this, string, offset, length)
  7674. case 'ascii':
  7675. return asciiWrite(this, string, offset, length)
  7676. case 'latin1':
  7677. case 'binary':
  7678. return latin1Write(this, string, offset, length)
  7679. case 'base64':
  7680. // Warning: maxLength not taken into account in base64Write
  7681. return base64Write(this, string, offset, length)
  7682. case 'ucs2':
  7683. case 'ucs-2':
  7684. case 'utf16le':
  7685. case 'utf-16le':
  7686. return ucs2Write(this, string, offset, length)
  7687. default:
  7688. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  7689. encoding = ('' + encoding).toLowerCase()
  7690. loweredCase = true
  7691. }
  7692. }
  7693. }
  7694. Buffer.prototype.toJSON = function toJSON () {
  7695. return {
  7696. type: 'Buffer',
  7697. data: Array.prototype.slice.call(this._arr || this, 0)
  7698. }
  7699. }
  7700. function base64Slice (buf, start, end) {
  7701. if (start === 0 && end === buf.length) {
  7702. return base64.fromByteArray(buf)
  7703. } else {
  7704. return base64.fromByteArray(buf.slice(start, end))
  7705. }
  7706. }
  7707. function utf8Slice (buf, start, end) {
  7708. end = Math.min(buf.length, end)
  7709. var res = []
  7710. var i = start
  7711. while (i < end) {
  7712. var firstByte = buf[i]
  7713. var codePoint = null
  7714. var bytesPerSequence = (firstByte > 0xEF) ? 4
  7715. : (firstByte > 0xDF) ? 3
  7716. : (firstByte > 0xBF) ? 2
  7717. : 1
  7718. if (i + bytesPerSequence <= end) {
  7719. var secondByte, thirdByte, fourthByte, tempCodePoint
  7720. switch (bytesPerSequence) {
  7721. case 1:
  7722. if (firstByte < 0x80) {
  7723. codePoint = firstByte
  7724. }
  7725. break
  7726. case 2:
  7727. secondByte = buf[i + 1]
  7728. if ((secondByte & 0xC0) === 0x80) {
  7729. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  7730. if (tempCodePoint > 0x7F) {
  7731. codePoint = tempCodePoint
  7732. }
  7733. }
  7734. break
  7735. case 3:
  7736. secondByte = buf[i + 1]
  7737. thirdByte = buf[i + 2]
  7738. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  7739. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  7740. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  7741. codePoint = tempCodePoint
  7742. }
  7743. }
  7744. break
  7745. case 4:
  7746. secondByte = buf[i + 1]
  7747. thirdByte = buf[i + 2]
  7748. fourthByte = buf[i + 3]
  7749. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  7750. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  7751. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  7752. codePoint = tempCodePoint
  7753. }
  7754. }
  7755. }
  7756. }
  7757. if (codePoint === null) {
  7758. // we did not generate a valid codePoint so insert a
  7759. // replacement char (U+FFFD) and advance only 1 byte
  7760. codePoint = 0xFFFD
  7761. bytesPerSequence = 1
  7762. } else if (codePoint > 0xFFFF) {
  7763. // encode to utf16 (surrogate pair dance)
  7764. codePoint -= 0x10000
  7765. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  7766. codePoint = 0xDC00 | codePoint & 0x3FF
  7767. }
  7768. res.push(codePoint)
  7769. i += bytesPerSequence
  7770. }
  7771. return decodeCodePointsArray(res)
  7772. }
  7773. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  7774. // the lowest limit is Chrome, with 0x10000 args.
  7775. // We go 1 magnitude less, for safety
  7776. var MAX_ARGUMENTS_LENGTH = 0x1000
  7777. function decodeCodePointsArray (codePoints) {
  7778. var len = codePoints.length
  7779. if (len <= MAX_ARGUMENTS_LENGTH) {
  7780. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  7781. }
  7782. // Decode in chunks to avoid "call stack size exceeded".
  7783. var res = ''
  7784. var i = 0
  7785. while (i < len) {
  7786. res += String.fromCharCode.apply(
  7787. String,
  7788. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  7789. )
  7790. }
  7791. return res
  7792. }
  7793. function asciiSlice (buf, start, end) {
  7794. var ret = ''
  7795. end = Math.min(buf.length, end)
  7796. for (var i = start; i < end; ++i) {
  7797. ret += String.fromCharCode(buf[i] & 0x7F)
  7798. }
  7799. return ret
  7800. }
  7801. function latin1Slice (buf, start, end) {
  7802. var ret = ''
  7803. end = Math.min(buf.length, end)
  7804. for (var i = start; i < end; ++i) {
  7805. ret += String.fromCharCode(buf[i])
  7806. }
  7807. return ret
  7808. }
  7809. function hexSlice (buf, start, end) {
  7810. var len = buf.length
  7811. if (!start || start < 0) start = 0
  7812. if (!end || end < 0 || end > len) end = len
  7813. var out = ''
  7814. for (var i = start; i < end; ++i) {
  7815. out += toHex(buf[i])
  7816. }
  7817. return out
  7818. }
  7819. function utf16leSlice (buf, start, end) {
  7820. var bytes = buf.slice(start, end)
  7821. var res = ''
  7822. for (var i = 0; i < bytes.length; i += 2) {
  7823. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  7824. }
  7825. return res
  7826. }
  7827. Buffer.prototype.slice = function slice (start, end) {
  7828. var len = this.length
  7829. start = ~~start
  7830. end = end === undefined ? len : ~~end
  7831. if (start < 0) {
  7832. start += len
  7833. if (start < 0) start = 0
  7834. } else if (start > len) {
  7835. start = len
  7836. }
  7837. if (end < 0) {
  7838. end += len
  7839. if (end < 0) end = 0
  7840. } else if (end > len) {
  7841. end = len
  7842. }
  7843. if (end < start) end = start
  7844. var newBuf
  7845. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7846. newBuf = this.subarray(start, end)
  7847. newBuf.__proto__ = Buffer.prototype
  7848. } else {
  7849. var sliceLen = end - start
  7850. newBuf = new Buffer(sliceLen, undefined)
  7851. for (var i = 0; i < sliceLen; ++i) {
  7852. newBuf[i] = this[i + start]
  7853. }
  7854. }
  7855. return newBuf
  7856. }
  7857. /*
  7858. * Need to make sure that buffer isn't trying to write out of bounds.
  7859. */
  7860. function checkOffset (offset, ext, length) {
  7861. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  7862. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  7863. }
  7864. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  7865. offset = offset | 0
  7866. byteLength = byteLength | 0
  7867. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7868. var val = this[offset]
  7869. var mul = 1
  7870. var i = 0
  7871. while (++i < byteLength && (mul *= 0x100)) {
  7872. val += this[offset + i] * mul
  7873. }
  7874. return val
  7875. }
  7876. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  7877. offset = offset | 0
  7878. byteLength = byteLength | 0
  7879. if (!noAssert) {
  7880. checkOffset(offset, byteLength, this.length)
  7881. }
  7882. var val = this[offset + --byteLength]
  7883. var mul = 1
  7884. while (byteLength > 0 && (mul *= 0x100)) {
  7885. val += this[offset + --byteLength] * mul
  7886. }
  7887. return val
  7888. }
  7889. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  7890. if (!noAssert) checkOffset(offset, 1, this.length)
  7891. return this[offset]
  7892. }
  7893. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  7894. if (!noAssert) checkOffset(offset, 2, this.length)
  7895. return this[offset] | (this[offset + 1] << 8)
  7896. }
  7897. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  7898. if (!noAssert) checkOffset(offset, 2, this.length)
  7899. return (this[offset] << 8) | this[offset + 1]
  7900. }
  7901. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  7902. if (!noAssert) checkOffset(offset, 4, this.length)
  7903. return ((this[offset]) |
  7904. (this[offset + 1] << 8) |
  7905. (this[offset + 2] << 16)) +
  7906. (this[offset + 3] * 0x1000000)
  7907. }
  7908. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  7909. if (!noAssert) checkOffset(offset, 4, this.length)
  7910. return (this[offset] * 0x1000000) +
  7911. ((this[offset + 1] << 16) |
  7912. (this[offset + 2] << 8) |
  7913. this[offset + 3])
  7914. }
  7915. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  7916. offset = offset | 0
  7917. byteLength = byteLength | 0
  7918. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7919. var val = this[offset]
  7920. var mul = 1
  7921. var i = 0
  7922. while (++i < byteLength && (mul *= 0x100)) {
  7923. val += this[offset + i] * mul
  7924. }
  7925. mul *= 0x80
  7926. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7927. return val
  7928. }
  7929. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  7930. offset = offset | 0
  7931. byteLength = byteLength | 0
  7932. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7933. var i = byteLength
  7934. var mul = 1
  7935. var val = this[offset + --i]
  7936. while (i > 0 && (mul *= 0x100)) {
  7937. val += this[offset + --i] * mul
  7938. }
  7939. mul *= 0x80
  7940. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7941. return val
  7942. }
  7943. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  7944. if (!noAssert) checkOffset(offset, 1, this.length)
  7945. if (!(this[offset] & 0x80)) return (this[offset])
  7946. return ((0xff - this[offset] + 1) * -1)
  7947. }
  7948. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  7949. if (!noAssert) checkOffset(offset, 2, this.length)
  7950. var val = this[offset] | (this[offset + 1] << 8)
  7951. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7952. }
  7953. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  7954. if (!noAssert) checkOffset(offset, 2, this.length)
  7955. var val = this[offset + 1] | (this[offset] << 8)
  7956. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7957. }
  7958. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  7959. if (!noAssert) checkOffset(offset, 4, this.length)
  7960. return (this[offset]) |
  7961. (this[offset + 1] << 8) |
  7962. (this[offset + 2] << 16) |
  7963. (this[offset + 3] << 24)
  7964. }
  7965. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  7966. if (!noAssert) checkOffset(offset, 4, this.length)
  7967. return (this[offset] << 24) |
  7968. (this[offset + 1] << 16) |
  7969. (this[offset + 2] << 8) |
  7970. (this[offset + 3])
  7971. }
  7972. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  7973. if (!noAssert) checkOffset(offset, 4, this.length)
  7974. return ieee754.read(this, offset, true, 23, 4)
  7975. }
  7976. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  7977. if (!noAssert) checkOffset(offset, 4, this.length)
  7978. return ieee754.read(this, offset, false, 23, 4)
  7979. }
  7980. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  7981. if (!noAssert) checkOffset(offset, 8, this.length)
  7982. return ieee754.read(this, offset, true, 52, 8)
  7983. }
  7984. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  7985. if (!noAssert) checkOffset(offset, 8, this.length)
  7986. return ieee754.read(this, offset, false, 52, 8)
  7987. }
  7988. function checkInt (buf, value, offset, ext, max, min) {
  7989. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  7990. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  7991. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7992. }
  7993. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  7994. value = +value
  7995. offset = offset | 0
  7996. byteLength = byteLength | 0
  7997. if (!noAssert) {
  7998. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7999. checkInt(this, value, offset, byteLength, maxBytes, 0)
  8000. }
  8001. var mul = 1
  8002. var i = 0
  8003. this[offset] = value & 0xFF
  8004. while (++i < byteLength && (mul *= 0x100)) {
  8005. this[offset + i] = (value / mul) & 0xFF
  8006. }
  8007. return offset + byteLength
  8008. }
  8009. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  8010. value = +value
  8011. offset = offset | 0
  8012. byteLength = byteLength | 0
  8013. if (!noAssert) {
  8014. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  8015. checkInt(this, value, offset, byteLength, maxBytes, 0)
  8016. }
  8017. var i = byteLength - 1
  8018. var mul = 1
  8019. this[offset + i] = value & 0xFF
  8020. while (--i >= 0 && (mul *= 0x100)) {
  8021. this[offset + i] = (value / mul) & 0xFF
  8022. }
  8023. return offset + byteLength
  8024. }
  8025. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  8026. value = +value
  8027. offset = offset | 0
  8028. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  8029. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  8030. this[offset] = (value & 0xff)
  8031. return offset + 1
  8032. }
  8033. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  8034. if (value < 0) value = 0xffff + value + 1
  8035. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  8036. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  8037. (littleEndian ? i : 1 - i) * 8
  8038. }
  8039. }
  8040. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  8041. value = +value
  8042. offset = offset | 0
  8043. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  8044. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8045. this[offset] = (value & 0xff)
  8046. this[offset + 1] = (value >>> 8)
  8047. } else {
  8048. objectWriteUInt16(this, value, offset, true)
  8049. }
  8050. return offset + 2
  8051. }
  8052. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  8053. value = +value
  8054. offset = offset | 0
  8055. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  8056. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8057. this[offset] = (value >>> 8)
  8058. this[offset + 1] = (value & 0xff)
  8059. } else {
  8060. objectWriteUInt16(this, value, offset, false)
  8061. }
  8062. return offset + 2
  8063. }
  8064. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  8065. if (value < 0) value = 0xffffffff + value + 1
  8066. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  8067. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  8068. }
  8069. }
  8070. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  8071. value = +value
  8072. offset = offset | 0
  8073. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  8074. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8075. this[offset + 3] = (value >>> 24)
  8076. this[offset + 2] = (value >>> 16)
  8077. this[offset + 1] = (value >>> 8)
  8078. this[offset] = (value & 0xff)
  8079. } else {
  8080. objectWriteUInt32(this, value, offset, true)
  8081. }
  8082. return offset + 4
  8083. }
  8084. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  8085. value = +value
  8086. offset = offset | 0
  8087. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  8088. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8089. this[offset] = (value >>> 24)
  8090. this[offset + 1] = (value >>> 16)
  8091. this[offset + 2] = (value >>> 8)
  8092. this[offset + 3] = (value & 0xff)
  8093. } else {
  8094. objectWriteUInt32(this, value, offset, false)
  8095. }
  8096. return offset + 4
  8097. }
  8098. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  8099. value = +value
  8100. offset = offset | 0
  8101. if (!noAssert) {
  8102. var limit = Math.pow(2, 8 * byteLength - 1)
  8103. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  8104. }
  8105. var i = 0
  8106. var mul = 1
  8107. var sub = 0
  8108. this[offset] = value & 0xFF
  8109. while (++i < byteLength && (mul *= 0x100)) {
  8110. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  8111. sub = 1
  8112. }
  8113. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  8114. }
  8115. return offset + byteLength
  8116. }
  8117. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  8118. value = +value
  8119. offset = offset | 0
  8120. if (!noAssert) {
  8121. var limit = Math.pow(2, 8 * byteLength - 1)
  8122. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  8123. }
  8124. var i = byteLength - 1
  8125. var mul = 1
  8126. var sub = 0
  8127. this[offset + i] = value & 0xFF
  8128. while (--i >= 0 && (mul *= 0x100)) {
  8129. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  8130. sub = 1
  8131. }
  8132. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  8133. }
  8134. return offset + byteLength
  8135. }
  8136. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  8137. value = +value
  8138. offset = offset | 0
  8139. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  8140. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  8141. if (value < 0) value = 0xff + value + 1
  8142. this[offset] = (value & 0xff)
  8143. return offset + 1
  8144. }
  8145. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  8146. value = +value
  8147. offset = offset | 0
  8148. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  8149. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8150. this[offset] = (value & 0xff)
  8151. this[offset + 1] = (value >>> 8)
  8152. } else {
  8153. objectWriteUInt16(this, value, offset, true)
  8154. }
  8155. return offset + 2
  8156. }
  8157. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  8158. value = +value
  8159. offset = offset | 0
  8160. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  8161. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8162. this[offset] = (value >>> 8)
  8163. this[offset + 1] = (value & 0xff)
  8164. } else {
  8165. objectWriteUInt16(this, value, offset, false)
  8166. }
  8167. return offset + 2
  8168. }
  8169. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  8170. value = +value
  8171. offset = offset | 0
  8172. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  8173. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8174. this[offset] = (value & 0xff)
  8175. this[offset + 1] = (value >>> 8)
  8176. this[offset + 2] = (value >>> 16)
  8177. this[offset + 3] = (value >>> 24)
  8178. } else {
  8179. objectWriteUInt32(this, value, offset, true)
  8180. }
  8181. return offset + 4
  8182. }
  8183. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  8184. value = +value
  8185. offset = offset | 0
  8186. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  8187. if (value < 0) value = 0xffffffff + value + 1
  8188. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8189. this[offset] = (value >>> 24)
  8190. this[offset + 1] = (value >>> 16)
  8191. this[offset + 2] = (value >>> 8)
  8192. this[offset + 3] = (value & 0xff)
  8193. } else {
  8194. objectWriteUInt32(this, value, offset, false)
  8195. }
  8196. return offset + 4
  8197. }
  8198. function checkIEEE754 (buf, value, offset, ext, max, min) {
  8199. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  8200. if (offset < 0) throw new RangeError('Index out of range')
  8201. }
  8202. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  8203. if (!noAssert) {
  8204. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  8205. }
  8206. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  8207. return offset + 4
  8208. }
  8209. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  8210. return writeFloat(this, value, offset, true, noAssert)
  8211. }
  8212. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  8213. return writeFloat(this, value, offset, false, noAssert)
  8214. }
  8215. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  8216. if (!noAssert) {
  8217. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  8218. }
  8219. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  8220. return offset + 8
  8221. }
  8222. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  8223. return writeDouble(this, value, offset, true, noAssert)
  8224. }
  8225. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  8226. return writeDouble(this, value, offset, false, noAssert)
  8227. }
  8228. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  8229. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  8230. if (!start) start = 0
  8231. if (!end && end !== 0) end = this.length
  8232. if (targetStart >= target.length) targetStart = target.length
  8233. if (!targetStart) targetStart = 0
  8234. if (end > 0 && end < start) end = start
  8235. // Copy 0 bytes; we're done
  8236. if (end === start) return 0
  8237. if (target.length === 0 || this.length === 0) return 0
  8238. // Fatal error conditions
  8239. if (targetStart < 0) {
  8240. throw new RangeError('targetStart out of bounds')
  8241. }
  8242. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  8243. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  8244. // Are we oob?
  8245. if (end > this.length) end = this.length
  8246. if (target.length - targetStart < end - start) {
  8247. end = target.length - targetStart + start
  8248. }
  8249. var len = end - start
  8250. var i
  8251. if (this === target && start < targetStart && targetStart < end) {
  8252. // descending copy from end
  8253. for (i = len - 1; i >= 0; --i) {
  8254. target[i + targetStart] = this[i + start]
  8255. }
  8256. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  8257. // ascending copy from start
  8258. for (i = 0; i < len; ++i) {
  8259. target[i + targetStart] = this[i + start]
  8260. }
  8261. } else {
  8262. Uint8Array.prototype.set.call(
  8263. target,
  8264. this.subarray(start, start + len),
  8265. targetStart
  8266. )
  8267. }
  8268. return len
  8269. }
  8270. // Usage:
  8271. // buffer.fill(number[, offset[, end]])
  8272. // buffer.fill(buffer[, offset[, end]])
  8273. // buffer.fill(string[, offset[, end]][, encoding])
  8274. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  8275. // Handle string cases:
  8276. if (typeof val === 'string') {
  8277. if (typeof start === 'string') {
  8278. encoding = start
  8279. start = 0
  8280. end = this.length
  8281. } else if (typeof end === 'string') {
  8282. encoding = end
  8283. end = this.length
  8284. }
  8285. if (val.length === 1) {
  8286. var code = val.charCodeAt(0)
  8287. if (code < 256) {
  8288. val = code
  8289. }
  8290. }
  8291. if (encoding !== undefined && typeof encoding !== 'string') {
  8292. throw new TypeError('encoding must be a string')
  8293. }
  8294. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  8295. throw new TypeError('Unknown encoding: ' + encoding)
  8296. }
  8297. } else if (typeof val === 'number') {
  8298. val = val & 255
  8299. }
  8300. // Invalid ranges are not set to a default, so can range check early.
  8301. if (start < 0 || this.length < start || this.length < end) {
  8302. throw new RangeError('Out of range index')
  8303. }
  8304. if (end <= start) {
  8305. return this
  8306. }
  8307. start = start >>> 0
  8308. end = end === undefined ? this.length : end >>> 0
  8309. if (!val) val = 0
  8310. var i
  8311. if (typeof val === 'number') {
  8312. for (i = start; i < end; ++i) {
  8313. this[i] = val
  8314. }
  8315. } else {
  8316. var bytes = Buffer.isBuffer(val)
  8317. ? val
  8318. : utf8ToBytes(new Buffer(val, encoding).toString())
  8319. var len = bytes.length
  8320. for (i = 0; i < end - start; ++i) {
  8321. this[i + start] = bytes[i % len]
  8322. }
  8323. }
  8324. return this
  8325. }
  8326. // HELPER FUNCTIONS
  8327. // ================
  8328. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  8329. function base64clean (str) {
  8330. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  8331. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  8332. // Node converts strings with length < 2 to ''
  8333. if (str.length < 2) return ''
  8334. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  8335. while (str.length % 4 !== 0) {
  8336. str = str + '='
  8337. }
  8338. return str
  8339. }
  8340. function stringtrim (str) {
  8341. if (str.trim) return str.trim()
  8342. return str.replace(/^\s+|\s+$/g, '')
  8343. }
  8344. function toHex (n) {
  8345. if (n < 16) return '0' + n.toString(16)
  8346. return n.toString(16)
  8347. }
  8348. function utf8ToBytes (string, units) {
  8349. units = units || Infinity
  8350. var codePoint
  8351. var length = string.length
  8352. var leadSurrogate = null
  8353. var bytes = []
  8354. for (var i = 0; i < length; ++i) {
  8355. codePoint = string.charCodeAt(i)
  8356. // is surrogate component
  8357. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  8358. // last char was a lead
  8359. if (!leadSurrogate) {
  8360. // no lead yet
  8361. if (codePoint > 0xDBFF) {
  8362. // unexpected trail
  8363. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8364. continue
  8365. } else if (i + 1 === length) {
  8366. // unpaired lead
  8367. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8368. continue
  8369. }
  8370. // valid lead
  8371. leadSurrogate = codePoint
  8372. continue
  8373. }
  8374. // 2 leads in a row
  8375. if (codePoint < 0xDC00) {
  8376. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8377. leadSurrogate = codePoint
  8378. continue
  8379. }
  8380. // valid surrogate pair
  8381. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  8382. } else if (leadSurrogate) {
  8383. // valid bmp char, but last char was a lead
  8384. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8385. }
  8386. leadSurrogate = null
  8387. // encode utf8
  8388. if (codePoint < 0x80) {
  8389. if ((units -= 1) < 0) break
  8390. bytes.push(codePoint)
  8391. } else if (codePoint < 0x800) {
  8392. if ((units -= 2) < 0) break
  8393. bytes.push(
  8394. codePoint >> 0x6 | 0xC0,
  8395. codePoint & 0x3F | 0x80
  8396. )
  8397. } else if (codePoint < 0x10000) {
  8398. if ((units -= 3) < 0) break
  8399. bytes.push(
  8400. codePoint >> 0xC | 0xE0,
  8401. codePoint >> 0x6 & 0x3F | 0x80,
  8402. codePoint & 0x3F | 0x80
  8403. )
  8404. } else if (codePoint < 0x110000) {
  8405. if ((units -= 4) < 0) break
  8406. bytes.push(
  8407. codePoint >> 0x12 | 0xF0,
  8408. codePoint >> 0xC & 0x3F | 0x80,
  8409. codePoint >> 0x6 & 0x3F | 0x80,
  8410. codePoint & 0x3F | 0x80
  8411. )
  8412. } else {
  8413. throw new Error('Invalid code point')
  8414. }
  8415. }
  8416. return bytes
  8417. }
  8418. function asciiToBytes (str) {
  8419. var byteArray = []
  8420. for (var i = 0; i < str.length; ++i) {
  8421. // Node's code seems to be doing this and not & 0x7F..
  8422. byteArray.push(str.charCodeAt(i) & 0xFF)
  8423. }
  8424. return byteArray
  8425. }
  8426. function utf16leToBytes (str, units) {
  8427. var c, hi, lo
  8428. var byteArray = []
  8429. for (var i = 0; i < str.length; ++i) {
  8430. if ((units -= 2) < 0) break
  8431. c = str.charCodeAt(i)
  8432. hi = c >> 8
  8433. lo = c % 256
  8434. byteArray.push(lo)
  8435. byteArray.push(hi)
  8436. }
  8437. return byteArray
  8438. }
  8439. function base64ToBytes (str) {
  8440. return base64.toByteArray(base64clean(str))
  8441. }
  8442. function blitBuffer (src, dst, offset, length) {
  8443. for (var i = 0; i < length; ++i) {
  8444. if ((i + offset >= dst.length) || (i >= src.length)) break
  8445. dst[i + offset] = src[i]
  8446. }
  8447. return i
  8448. }
  8449. function isnan (val) {
  8450. return val !== val // eslint-disable-line no-self-compare
  8451. }
  8452. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  8453. /***/ }),
  8454. /***/ "./node_modules/clipboard/dist/clipboard.js":
  8455. /*!**************************************************!*\
  8456. !*** ./node_modules/clipboard/dist/clipboard.js ***!
  8457. \**************************************************/
  8458. /*! no static exports found */
  8459. /***/ (function(module, exports, __webpack_require__) {
  8460. /*!
  8461. * clipboard.js v2.0.4
  8462. * https://zenorocha.github.io/clipboard.js
  8463. *
  8464. * Licensed MIT © Zeno Rocha
  8465. */
  8466. (function webpackUniversalModuleDefinition(root, factory) {
  8467. if(true)
  8468. module.exports = factory();
  8469. else {}
  8470. })(this, function() {
  8471. return /******/ (function(modules) { // webpackBootstrap
  8472. /******/ // The module cache
  8473. /******/ var installedModules = {};
  8474. /******/
  8475. /******/ // The require function
  8476. /******/ function __webpack_require__(moduleId) {
  8477. /******/
  8478. /******/ // Check if module is in cache
  8479. /******/ if(installedModules[moduleId]) {
  8480. /******/ return installedModules[moduleId].exports;
  8481. /******/ }
  8482. /******/ // Create a new module (and put it into the cache)
  8483. /******/ var module = installedModules[moduleId] = {
  8484. /******/ i: moduleId,
  8485. /******/ l: false,
  8486. /******/ exports: {}
  8487. /******/ };
  8488. /******/
  8489. /******/ // Execute the module function
  8490. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  8491. /******/
  8492. /******/ // Flag the module as loaded
  8493. /******/ module.l = true;
  8494. /******/
  8495. /******/ // Return the exports of the module
  8496. /******/ return module.exports;
  8497. /******/ }
  8498. /******/
  8499. /******/
  8500. /******/ // expose the modules object (__webpack_modules__)
  8501. /******/ __webpack_require__.m = modules;
  8502. /******/
  8503. /******/ // expose the module cache
  8504. /******/ __webpack_require__.c = installedModules;
  8505. /******/
  8506. /******/ // define getter function for harmony exports
  8507. /******/ __webpack_require__.d = function(exports, name, getter) {
  8508. /******/ if(!__webpack_require__.o(exports, name)) {
  8509. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  8510. /******/ }
  8511. /******/ };
  8512. /******/
  8513. /******/ // define __esModule on exports
  8514. /******/ __webpack_require__.r = function(exports) {
  8515. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  8516. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  8517. /******/ }
  8518. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  8519. /******/ };
  8520. /******/
  8521. /******/ // create a fake namespace object
  8522. /******/ // mode & 1: value is a module id, require it
  8523. /******/ // mode & 2: merge all properties of value into the ns
  8524. /******/ // mode & 4: return value when already ns object
  8525. /******/ // mode & 8|1: behave like require
  8526. /******/ __webpack_require__.t = function(value, mode) {
  8527. /******/ if(mode & 1) value = __webpack_require__(value);
  8528. /******/ if(mode & 8) return value;
  8529. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  8530. /******/ var ns = Object.create(null);
  8531. /******/ __webpack_require__.r(ns);
  8532. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  8533. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  8534. /******/ return ns;
  8535. /******/ };
  8536. /******/
  8537. /******/ // getDefaultExport function for compatibility with non-harmony modules
  8538. /******/ __webpack_require__.n = function(module) {
  8539. /******/ var getter = module && module.__esModule ?
  8540. /******/ function getDefault() { return module['default']; } :
  8541. /******/ function getModuleExports() { return module; };
  8542. /******/ __webpack_require__.d(getter, 'a', getter);
  8543. /******/ return getter;
  8544. /******/ };
  8545. /******/
  8546. /******/ // Object.prototype.hasOwnProperty.call
  8547. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  8548. /******/
  8549. /******/ // __webpack_public_path__
  8550. /******/ __webpack_require__.p = "";
  8551. /******/
  8552. /******/
  8553. /******/ // Load entry module and return exports
  8554. /******/ return __webpack_require__(__webpack_require__.s = 0);
  8555. /******/ })
  8556. /************************************************************************/
  8557. /******/ ([
  8558. /* 0 */
  8559. /***/ (function(module, exports, __webpack_require__) {
  8560. "use strict";
  8561. 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; };
  8562. 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; }; }();
  8563. var _clipboardAction = __webpack_require__(1);
  8564. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  8565. var _tinyEmitter = __webpack_require__(3);
  8566. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  8567. var _goodListener = __webpack_require__(4);
  8568. var _goodListener2 = _interopRequireDefault(_goodListener);
  8569. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8570. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8571. 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; }
  8572. 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; }
  8573. /**
  8574. * Base class which takes one or more elements, adds event listeners to them,
  8575. * and instantiates a new `ClipboardAction` on each click.
  8576. */
  8577. var Clipboard = function (_Emitter) {
  8578. _inherits(Clipboard, _Emitter);
  8579. /**
  8580. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  8581. * @param {Object} options
  8582. */
  8583. function Clipboard(trigger, options) {
  8584. _classCallCheck(this, Clipboard);
  8585. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
  8586. _this.resolveOptions(options);
  8587. _this.listenClick(trigger);
  8588. return _this;
  8589. }
  8590. /**
  8591. * Defines if attributes would be resolved using internal setter functions
  8592. * or custom functions that were passed in the constructor.
  8593. * @param {Object} options
  8594. */
  8595. _createClass(Clipboard, [{
  8596. key: 'resolveOptions',
  8597. value: function resolveOptions() {
  8598. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  8599. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  8600. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  8601. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  8602. this.container = _typeof(options.container) === 'object' ? options.container : document.body;
  8603. }
  8604. /**
  8605. * Adds a click event listener to the passed trigger.
  8606. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  8607. */
  8608. }, {
  8609. key: 'listenClick',
  8610. value: function listenClick(trigger) {
  8611. var _this2 = this;
  8612. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  8613. return _this2.onClick(e);
  8614. });
  8615. }
  8616. /**
  8617. * Defines a new `ClipboardAction` on each click event.
  8618. * @param {Event} e
  8619. */
  8620. }, {
  8621. key: 'onClick',
  8622. value: function onClick(e) {
  8623. var trigger = e.delegateTarget || e.currentTarget;
  8624. if (this.clipboardAction) {
  8625. this.clipboardAction = null;
  8626. }
  8627. this.clipboardAction = new _clipboardAction2.default({
  8628. action: this.action(trigger),
  8629. target: this.target(trigger),
  8630. text: this.text(trigger),
  8631. container: this.container,
  8632. trigger: trigger,
  8633. emitter: this
  8634. });
  8635. }
  8636. /**
  8637. * Default `action` lookup function.
  8638. * @param {Element} trigger
  8639. */
  8640. }, {
  8641. key: 'defaultAction',
  8642. value: function defaultAction(trigger) {
  8643. return getAttributeValue('action', trigger);
  8644. }
  8645. /**
  8646. * Default `target` lookup function.
  8647. * @param {Element} trigger
  8648. */
  8649. }, {
  8650. key: 'defaultTarget',
  8651. value: function defaultTarget(trigger) {
  8652. var selector = getAttributeValue('target', trigger);
  8653. if (selector) {
  8654. return document.querySelector(selector);
  8655. }
  8656. }
  8657. /**
  8658. * Returns the support of the given action, or all actions if no action is
  8659. * given.
  8660. * @param {String} [action]
  8661. */
  8662. }, {
  8663. key: 'defaultText',
  8664. /**
  8665. * Default `text` lookup function.
  8666. * @param {Element} trigger
  8667. */
  8668. value: function defaultText(trigger) {
  8669. return getAttributeValue('text', trigger);
  8670. }
  8671. /**
  8672. * Destroy lifecycle.
  8673. */
  8674. }, {
  8675. key: 'destroy',
  8676. value: function destroy() {
  8677. this.listener.destroy();
  8678. if (this.clipboardAction) {
  8679. this.clipboardAction.destroy();
  8680. this.clipboardAction = null;
  8681. }
  8682. }
  8683. }], [{
  8684. key: 'isSupported',
  8685. value: function isSupported() {
  8686. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
  8687. var actions = typeof action === 'string' ? [action] : action;
  8688. var support = !!document.queryCommandSupported;
  8689. actions.forEach(function (action) {
  8690. support = support && !!document.queryCommandSupported(action);
  8691. });
  8692. return support;
  8693. }
  8694. }]);
  8695. return Clipboard;
  8696. }(_tinyEmitter2.default);
  8697. /**
  8698. * Helper function to retrieve attribute value.
  8699. * @param {String} suffix
  8700. * @param {Element} element
  8701. */
  8702. function getAttributeValue(suffix, element) {
  8703. var attribute = 'data-clipboard-' + suffix;
  8704. if (!element.hasAttribute(attribute)) {
  8705. return;
  8706. }
  8707. return element.getAttribute(attribute);
  8708. }
  8709. module.exports = Clipboard;
  8710. /***/ }),
  8711. /* 1 */
  8712. /***/ (function(module, exports, __webpack_require__) {
  8713. "use strict";
  8714. 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; };
  8715. 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; }; }();
  8716. var _select = __webpack_require__(2);
  8717. var _select2 = _interopRequireDefault(_select);
  8718. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8719. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8720. /**
  8721. * Inner class which performs selection from either `text` or `target`
  8722. * properties and then executes copy or cut operations.
  8723. */
  8724. var ClipboardAction = function () {
  8725. /**
  8726. * @param {Object} options
  8727. */
  8728. function ClipboardAction(options) {
  8729. _classCallCheck(this, ClipboardAction);
  8730. this.resolveOptions(options);
  8731. this.initSelection();
  8732. }
  8733. /**
  8734. * Defines base properties passed from constructor.
  8735. * @param {Object} options
  8736. */
  8737. _createClass(ClipboardAction, [{
  8738. key: 'resolveOptions',
  8739. value: function resolveOptions() {
  8740. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  8741. this.action = options.action;
  8742. this.container = options.container;
  8743. this.emitter = options.emitter;
  8744. this.target = options.target;
  8745. this.text = options.text;
  8746. this.trigger = options.trigger;
  8747. this.selectedText = '';
  8748. }
  8749. /**
  8750. * Decides which selection strategy is going to be applied based
  8751. * on the existence of `text` and `target` properties.
  8752. */
  8753. }, {
  8754. key: 'initSelection',
  8755. value: function initSelection() {
  8756. if (this.text) {
  8757. this.selectFake();
  8758. } else if (this.target) {
  8759. this.selectTarget();
  8760. }
  8761. }
  8762. /**
  8763. * Creates a fake textarea element, sets its value from `text` property,
  8764. * and makes a selection on it.
  8765. */
  8766. }, {
  8767. key: 'selectFake',
  8768. value: function selectFake() {
  8769. var _this = this;
  8770. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  8771. this.removeFake();
  8772. this.fakeHandlerCallback = function () {
  8773. return _this.removeFake();
  8774. };
  8775. this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
  8776. this.fakeElem = document.createElement('textarea');
  8777. // Prevent zooming on iOS
  8778. this.fakeElem.style.fontSize = '12pt';
  8779. // Reset box model
  8780. this.fakeElem.style.border = '0';
  8781. this.fakeElem.style.padding = '0';
  8782. this.fakeElem.style.margin = '0';
  8783. // Move element out of screen horizontally
  8784. this.fakeElem.style.position = 'absolute';
  8785. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  8786. // Move element to the same position vertically
  8787. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  8788. this.fakeElem.style.top = yPosition + 'px';
  8789. this.fakeElem.setAttribute('readonly', '');
  8790. this.fakeElem.value = this.text;
  8791. this.container.appendChild(this.fakeElem);
  8792. this.selectedText = (0, _select2.default)(this.fakeElem);
  8793. this.copyText();
  8794. }
  8795. /**
  8796. * Only removes the fake element after another click event, that way
  8797. * a user can hit `Ctrl+C` to copy because selection still exists.
  8798. */
  8799. }, {
  8800. key: 'removeFake',
  8801. value: function removeFake() {
  8802. if (this.fakeHandler) {
  8803. this.container.removeEventListener('click', this.fakeHandlerCallback);
  8804. this.fakeHandler = null;
  8805. this.fakeHandlerCallback = null;
  8806. }
  8807. if (this.fakeElem) {
  8808. this.container.removeChild(this.fakeElem);
  8809. this.fakeElem = null;
  8810. }
  8811. }
  8812. /**
  8813. * Selects the content from element passed on `target` property.
  8814. */
  8815. }, {
  8816. key: 'selectTarget',
  8817. value: function selectTarget() {
  8818. this.selectedText = (0, _select2.default)(this.target);
  8819. this.copyText();
  8820. }
  8821. /**
  8822. * Executes the copy operation based on the current selection.
  8823. */
  8824. }, {
  8825. key: 'copyText',
  8826. value: function copyText() {
  8827. var succeeded = void 0;
  8828. try {
  8829. succeeded = document.execCommand(this.action);
  8830. } catch (err) {
  8831. succeeded = false;
  8832. }
  8833. this.handleResult(succeeded);
  8834. }
  8835. /**
  8836. * Fires an event based on the copy operation result.
  8837. * @param {Boolean} succeeded
  8838. */
  8839. }, {
  8840. key: 'handleResult',
  8841. value: function handleResult(succeeded) {
  8842. this.emitter.emit(succeeded ? 'success' : 'error', {
  8843. action: this.action,
  8844. text: this.selectedText,
  8845. trigger: this.trigger,
  8846. clearSelection: this.clearSelection.bind(this)
  8847. });
  8848. }
  8849. /**
  8850. * Moves focus away from `target` and back to the trigger, removes current selection.
  8851. */
  8852. }, {
  8853. key: 'clearSelection',
  8854. value: function clearSelection() {
  8855. if (this.trigger) {
  8856. this.trigger.focus();
  8857. }
  8858. window.getSelection().removeAllRanges();
  8859. }
  8860. /**
  8861. * Sets the `action` to be performed which can be either 'copy' or 'cut'.
  8862. * @param {String} action
  8863. */
  8864. }, {
  8865. key: 'destroy',
  8866. /**
  8867. * Destroy lifecycle.
  8868. */
  8869. value: function destroy() {
  8870. this.removeFake();
  8871. }
  8872. }, {
  8873. key: 'action',
  8874. set: function set() {
  8875. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
  8876. this._action = action;
  8877. if (this._action !== 'copy' && this._action !== 'cut') {
  8878. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  8879. }
  8880. }
  8881. /**
  8882. * Gets the `action` property.
  8883. * @return {String}
  8884. */
  8885. ,
  8886. get: function get() {
  8887. return this._action;
  8888. }
  8889. /**
  8890. * Sets the `target` property using an element
  8891. * that will be have its content copied.
  8892. * @param {Element} target
  8893. */
  8894. }, {
  8895. key: 'target',
  8896. set: function set(target) {
  8897. if (target !== undefined) {
  8898. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  8899. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  8900. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  8901. }
  8902. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  8903. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  8904. }
  8905. this._target = target;
  8906. } else {
  8907. throw new Error('Invalid "target" value, use a valid Element');
  8908. }
  8909. }
  8910. }
  8911. /**
  8912. * Gets the `target` property.
  8913. * @return {String|HTMLElement}
  8914. */
  8915. ,
  8916. get: function get() {
  8917. return this._target;
  8918. }
  8919. }]);
  8920. return ClipboardAction;
  8921. }();
  8922. module.exports = ClipboardAction;
  8923. /***/ }),
  8924. /* 2 */
  8925. /***/ (function(module, exports) {
  8926. function select(element) {
  8927. var selectedText;
  8928. if (element.nodeName === 'SELECT') {
  8929. element.focus();
  8930. selectedText = element.value;
  8931. }
  8932. else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  8933. var isReadOnly = element.hasAttribute('readonly');
  8934. if (!isReadOnly) {
  8935. element.setAttribute('readonly', '');
  8936. }
  8937. element.select();
  8938. element.setSelectionRange(0, element.value.length);
  8939. if (!isReadOnly) {
  8940. element.removeAttribute('readonly');
  8941. }
  8942. selectedText = element.value;
  8943. }
  8944. else {
  8945. if (element.hasAttribute('contenteditable')) {
  8946. element.focus();
  8947. }
  8948. var selection = window.getSelection();
  8949. var range = document.createRange();
  8950. range.selectNodeContents(element);
  8951. selection.removeAllRanges();
  8952. selection.addRange(range);
  8953. selectedText = selection.toString();
  8954. }
  8955. return selectedText;
  8956. }
  8957. module.exports = select;
  8958. /***/ }),
  8959. /* 3 */
  8960. /***/ (function(module, exports) {
  8961. function E () {
  8962. // Keep this empty so it's easier to inherit from
  8963. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  8964. }
  8965. E.prototype = {
  8966. on: function (name, callback, ctx) {
  8967. var e = this.e || (this.e = {});
  8968. (e[name] || (e[name] = [])).push({
  8969. fn: callback,
  8970. ctx: ctx
  8971. });
  8972. return this;
  8973. },
  8974. once: function (name, callback, ctx) {
  8975. var self = this;
  8976. function listener () {
  8977. self.off(name, listener);
  8978. callback.apply(ctx, arguments);
  8979. };
  8980. listener._ = callback
  8981. return this.on(name, listener, ctx);
  8982. },
  8983. emit: function (name) {
  8984. var data = [].slice.call(arguments, 1);
  8985. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  8986. var i = 0;
  8987. var len = evtArr.length;
  8988. for (i; i < len; i++) {
  8989. evtArr[i].fn.apply(evtArr[i].ctx, data);
  8990. }
  8991. return this;
  8992. },
  8993. off: function (name, callback) {
  8994. var e = this.e || (this.e = {});
  8995. var evts = e[name];
  8996. var liveEvents = [];
  8997. if (evts && callback) {
  8998. for (var i = 0, len = evts.length; i < len; i++) {
  8999. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  9000. liveEvents.push(evts[i]);
  9001. }
  9002. }
  9003. // Remove event from queue to prevent memory leak
  9004. // Suggested by https://github.com/lazd
  9005. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  9006. (liveEvents.length)
  9007. ? e[name] = liveEvents
  9008. : delete e[name];
  9009. return this;
  9010. }
  9011. };
  9012. module.exports = E;
  9013. /***/ }),
  9014. /* 4 */
  9015. /***/ (function(module, exports, __webpack_require__) {
  9016. var is = __webpack_require__(5);
  9017. var delegate = __webpack_require__(6);
  9018. /**
  9019. * Validates all params and calls the right
  9020. * listener function based on its target type.
  9021. *
  9022. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  9023. * @param {String} type
  9024. * @param {Function} callback
  9025. * @return {Object}
  9026. */
  9027. function listen(target, type, callback) {
  9028. if (!target && !type && !callback) {
  9029. throw new Error('Missing required arguments');
  9030. }
  9031. if (!is.string(type)) {
  9032. throw new TypeError('Second argument must be a String');
  9033. }
  9034. if (!is.fn(callback)) {
  9035. throw new TypeError('Third argument must be a Function');
  9036. }
  9037. if (is.node(target)) {
  9038. return listenNode(target, type, callback);
  9039. }
  9040. else if (is.nodeList(target)) {
  9041. return listenNodeList(target, type, callback);
  9042. }
  9043. else if (is.string(target)) {
  9044. return listenSelector(target, type, callback);
  9045. }
  9046. else {
  9047. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  9048. }
  9049. }
  9050. /**
  9051. * Adds an event listener to a HTML element
  9052. * and returns a remove listener function.
  9053. *
  9054. * @param {HTMLElement} node
  9055. * @param {String} type
  9056. * @param {Function} callback
  9057. * @return {Object}
  9058. */
  9059. function listenNode(node, type, callback) {
  9060. node.addEventListener(type, callback);
  9061. return {
  9062. destroy: function() {
  9063. node.removeEventListener(type, callback);
  9064. }
  9065. }
  9066. }
  9067. /**
  9068. * Add an event listener to a list of HTML elements
  9069. * and returns a remove listener function.
  9070. *
  9071. * @param {NodeList|HTMLCollection} nodeList
  9072. * @param {String} type
  9073. * @param {Function} callback
  9074. * @return {Object}
  9075. */
  9076. function listenNodeList(nodeList, type, callback) {
  9077. Array.prototype.forEach.call(nodeList, function(node) {
  9078. node.addEventListener(type, callback);
  9079. });
  9080. return {
  9081. destroy: function() {
  9082. Array.prototype.forEach.call(nodeList, function(node) {
  9083. node.removeEventListener(type, callback);
  9084. });
  9085. }
  9086. }
  9087. }
  9088. /**
  9089. * Add an event listener to a selector
  9090. * and returns a remove listener function.
  9091. *
  9092. * @param {String} selector
  9093. * @param {String} type
  9094. * @param {Function} callback
  9095. * @return {Object}
  9096. */
  9097. function listenSelector(selector, type, callback) {
  9098. return delegate(document.body, selector, type, callback);
  9099. }
  9100. module.exports = listen;
  9101. /***/ }),
  9102. /* 5 */
  9103. /***/ (function(module, exports) {
  9104. /**
  9105. * Check if argument is a HTML element.
  9106. *
  9107. * @param {Object} value
  9108. * @return {Boolean}
  9109. */
  9110. exports.node = function(value) {
  9111. return value !== undefined
  9112. && value instanceof HTMLElement
  9113. && value.nodeType === 1;
  9114. };
  9115. /**
  9116. * Check if argument is a list of HTML elements.
  9117. *
  9118. * @param {Object} value
  9119. * @return {Boolean}
  9120. */
  9121. exports.nodeList = function(value) {
  9122. var type = Object.prototype.toString.call(value);
  9123. return value !== undefined
  9124. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  9125. && ('length' in value)
  9126. && (value.length === 0 || exports.node(value[0]));
  9127. };
  9128. /**
  9129. * Check if argument is a string.
  9130. *
  9131. * @param {Object} value
  9132. * @return {Boolean}
  9133. */
  9134. exports.string = function(value) {
  9135. return typeof value === 'string'
  9136. || value instanceof String;
  9137. };
  9138. /**
  9139. * Check if argument is a function.
  9140. *
  9141. * @param {Object} value
  9142. * @return {Boolean}
  9143. */
  9144. exports.fn = function(value) {
  9145. var type = Object.prototype.toString.call(value);
  9146. return type === '[object Function]';
  9147. };
  9148. /***/ }),
  9149. /* 6 */
  9150. /***/ (function(module, exports, __webpack_require__) {
  9151. var closest = __webpack_require__(7);
  9152. /**
  9153. * Delegates event to a selector.
  9154. *
  9155. * @param {Element} element
  9156. * @param {String} selector
  9157. * @param {String} type
  9158. * @param {Function} callback
  9159. * @param {Boolean} useCapture
  9160. * @return {Object}
  9161. */
  9162. function _delegate(element, selector, type, callback, useCapture) {
  9163. var listenerFn = listener.apply(this, arguments);
  9164. element.addEventListener(type, listenerFn, useCapture);
  9165. return {
  9166. destroy: function() {
  9167. element.removeEventListener(type, listenerFn, useCapture);
  9168. }
  9169. }
  9170. }
  9171. /**
  9172. * Delegates event to a selector.
  9173. *
  9174. * @param {Element|String|Array} [elements]
  9175. * @param {String} selector
  9176. * @param {String} type
  9177. * @param {Function} callback
  9178. * @param {Boolean} useCapture
  9179. * @return {Object}
  9180. */
  9181. function delegate(elements, selector, type, callback, useCapture) {
  9182. // Handle the regular Element usage
  9183. if (typeof elements.addEventListener === 'function') {
  9184. return _delegate.apply(null, arguments);
  9185. }
  9186. // Handle Element-less usage, it defaults to global delegation
  9187. if (typeof type === 'function') {
  9188. // Use `document` as the first parameter, then apply arguments
  9189. // This is a short way to .unshift `arguments` without running into deoptimizations
  9190. return _delegate.bind(null, document).apply(null, arguments);
  9191. }
  9192. // Handle Selector-based usage
  9193. if (typeof elements === 'string') {
  9194. elements = document.querySelectorAll(elements);
  9195. }
  9196. // Handle Array-like based usage
  9197. return Array.prototype.map.call(elements, function (element) {
  9198. return _delegate(element, selector, type, callback, useCapture);
  9199. });
  9200. }
  9201. /**
  9202. * Finds closest match and invokes callback.
  9203. *
  9204. * @param {Element} element
  9205. * @param {String} selector
  9206. * @param {String} type
  9207. * @param {Function} callback
  9208. * @return {Function}
  9209. */
  9210. function listener(element, selector, type, callback) {
  9211. return function(e) {
  9212. e.delegateTarget = closest(e.target, selector);
  9213. if (e.delegateTarget) {
  9214. callback.call(element, e);
  9215. }
  9216. }
  9217. }
  9218. module.exports = delegate;
  9219. /***/ }),
  9220. /* 7 */
  9221. /***/ (function(module, exports) {
  9222. var DOCUMENT_NODE_TYPE = 9;
  9223. /**
  9224. * A polyfill for Element.matches()
  9225. */
  9226. if (typeof Element !== 'undefined' && !Element.prototype.matches) {
  9227. var proto = Element.prototype;
  9228. proto.matches = proto.matchesSelector ||
  9229. proto.mozMatchesSelector ||
  9230. proto.msMatchesSelector ||
  9231. proto.oMatchesSelector ||
  9232. proto.webkitMatchesSelector;
  9233. }
  9234. /**
  9235. * Finds the closest parent that matches a selector.
  9236. *
  9237. * @param {Element} element
  9238. * @param {String} selector
  9239. * @return {Function}
  9240. */
  9241. function closest (element, selector) {
  9242. while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
  9243. if (typeof element.matches === 'function' &&
  9244. element.matches(selector)) {
  9245. return element;
  9246. }
  9247. element = element.parentNode;
  9248. }
  9249. }
  9250. module.exports = closest;
  9251. /***/ })
  9252. /******/ ]);
  9253. });
  9254. /***/ }),
  9255. /***/ "./node_modules/css-loader/index.js?!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css&":
  9256. /*!*******************************************************************************************************************************************************************************************************************************************************************************************************!*\
  9257. !*** ./node_modules/css-loader??ref--6-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--6-2!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css& ***!
  9258. \*******************************************************************************************************************************************************************************************************************************************************************************************************/
  9259. /*! no static exports found */
  9260. /***/ (function(module, exports, __webpack_require__) {
  9261. exports = module.exports = __webpack_require__(/*! ../../../node_modules/css-loader/lib/css-base.js */ "./node_modules/css-loader/lib/css-base.js")(false);
  9262. // imports
  9263. // module
  9264. exports.push([module.i, "\n.loader[data-v-9a543b64],\n.loader[data-v-9a543b64]:after {\n border-radius: 50%;\n width: 10em;\n height: 10em;\n}\n.loader[data-v-9a543b64] {\n margin: 0px auto;\n position: relative;\n text-indent: -9999em;\n border-top: 1.1em solid rgba(255, 255, 255, 0.2);\n border-right: 1.1em solid rgba(255, 255, 255, 0.2);\n border-bottom: 1.1em solid rgba(255, 255, 255, 0.2);\n transform: translateZ(0);\n -webkit-animation: load8-data-v-9a543b64 1.1s infinite linear;\n animation: load8-data-v-9a543b64 1.1s infinite linear;\n overflow: hidden;\n}\n@-webkit-keyframes load8-data-v-9a543b64 {\n0% {\n transform: rotate(0deg);\n}\n100% {\n transform: rotate(360deg);\n}\n}\n@keyframes load8-data-v-9a543b64 {\n0% {\n transform: rotate(0deg);\n}\n100% {\n transform: rotate(360deg);\n}\n}\n", ""]);
  9265. // exports
  9266. /***/ }),
  9267. /***/ "./node_modules/css-loader/index.js?!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css&":
  9268. /*!********************************************************************************************************************************************************************************************************************************************************************************************!*\
  9269. !*** ./node_modules/css-loader??ref--6-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--6-2!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css& ***!
  9270. \********************************************************************************************************************************************************************************************************************************************************************************************/
  9271. /*! no static exports found */
  9272. /***/ (function(module, exports, __webpack_require__) {
  9273. exports = module.exports = __webpack_require__(/*! ../../../node_modules/css-loader/lib/css-base.js */ "./node_modules/css-loader/lib/css-base.js")(false);
  9274. // imports
  9275. // module
  9276. exports.push([module.i, "\n.full-height[data-v-1ae8ae93] {\n height: 100vh;\n}\n.flex-center[data-v-1ae8ae93] {\n align-items: center;\n display: flex;\n justify-content: center;\n}\n.position-ref[data-v-1ae8ae93] {\n position: relative;\n}\n.top-right[data-v-1ae8ae93] {\n position: absolute;\n right: 10px;\n top: 18px;\n}\n.content[data-v-1ae8ae93] {\n text-align: center;\n}\n.title[data-v-1ae8ae93] {\n font-size: 60px;\n}\n.links > a[data-v-1ae8ae93] {\n color: #636b6f;\n padding: 0 25px;\n font-size: 12px;\n font-weight: 600;\n letter-spacing: .1rem;\n text-decoration: none;\n text-transform: uppercase;\n}\n.m-b-md[data-v-1ae8ae93] {\n margin-bottom: 30px;\n color: #000000;\n}\n", ""]);
  9277. // exports
  9278. /***/ }),
  9279. /***/ "./node_modules/css-loader/lib/css-base.js":
  9280. /*!*************************************************!*\
  9281. !*** ./node_modules/css-loader/lib/css-base.js ***!
  9282. \*************************************************/
  9283. /*! no static exports found */
  9284. /***/ (function(module, exports) {
  9285. /*
  9286. MIT License http://www.opensource.org/licenses/mit-license.php
  9287. Author Tobias Koppers @sokra
  9288. */
  9289. // css base code, injected by the css-loader
  9290. module.exports = function(useSourceMap) {
  9291. var list = [];
  9292. // return the list of modules as css string
  9293. list.toString = function toString() {
  9294. return this.map(function (item) {
  9295. var content = cssWithMappingToString(item, useSourceMap);
  9296. if(item[2]) {
  9297. return "@media " + item[2] + "{" + content + "}";
  9298. } else {
  9299. return content;
  9300. }
  9301. }).join("");
  9302. };
  9303. // import a list of modules into the list
  9304. list.i = function(modules, mediaQuery) {
  9305. if(typeof modules === "string")
  9306. modules = [[null, modules, ""]];
  9307. var alreadyImportedModules = {};
  9308. for(var i = 0; i < this.length; i++) {
  9309. var id = this[i][0];
  9310. if(typeof id === "number")
  9311. alreadyImportedModules[id] = true;
  9312. }
  9313. for(i = 0; i < modules.length; i++) {
  9314. var item = modules[i];
  9315. // skip already imported module
  9316. // this implementation is not 100% perfect for weird media query combinations
  9317. // when a module is imported multiple times with different media queries.
  9318. // I hope this will never occur (Hey this way we have smaller bundles)
  9319. if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
  9320. if(mediaQuery && !item[2]) {
  9321. item[2] = mediaQuery;
  9322. } else if(mediaQuery) {
  9323. item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
  9324. }
  9325. list.push(item);
  9326. }
  9327. }
  9328. };
  9329. return list;
  9330. };
  9331. function cssWithMappingToString(item, useSourceMap) {
  9332. var content = item[1] || '';
  9333. var cssMapping = item[3];
  9334. if (!cssMapping) {
  9335. return content;
  9336. }
  9337. if (useSourceMap && typeof btoa === 'function') {
  9338. var sourceMapping = toComment(cssMapping);
  9339. var sourceURLs = cssMapping.sources.map(function (source) {
  9340. return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'
  9341. });
  9342. return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
  9343. }
  9344. return [content].join('\n');
  9345. }
  9346. // Adapted from convert-source-map (MIT)
  9347. function toComment(sourceMap) {
  9348. // eslint-disable-next-line no-undef
  9349. var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));
  9350. var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;
  9351. return '/*# ' + data + ' */';
  9352. }
  9353. /***/ }),
  9354. /***/ "./node_modules/ieee754/index.js":
  9355. /*!***************************************!*\
  9356. !*** ./node_modules/ieee754/index.js ***!
  9357. \***************************************/
  9358. /*! no static exports found */
  9359. /***/ (function(module, exports) {
  9360. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  9361. var e, m
  9362. var eLen = (nBytes * 8) - mLen - 1
  9363. var eMax = (1 << eLen) - 1
  9364. var eBias = eMax >> 1
  9365. var nBits = -7
  9366. var i = isLE ? (nBytes - 1) : 0
  9367. var d = isLE ? -1 : 1
  9368. var s = buffer[offset + i]
  9369. i += d
  9370. e = s & ((1 << (-nBits)) - 1)
  9371. s >>= (-nBits)
  9372. nBits += eLen
  9373. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  9374. m = e & ((1 << (-nBits)) - 1)
  9375. e >>= (-nBits)
  9376. nBits += mLen
  9377. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  9378. if (e === 0) {
  9379. e = 1 - eBias
  9380. } else if (e === eMax) {
  9381. return m ? NaN : ((s ? -1 : 1) * Infinity)
  9382. } else {
  9383. m = m + Math.pow(2, mLen)
  9384. e = e - eBias
  9385. }
  9386. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  9387. }
  9388. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  9389. var e, m, c
  9390. var eLen = (nBytes * 8) - mLen - 1
  9391. var eMax = (1 << eLen) - 1
  9392. var eBias = eMax >> 1
  9393. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  9394. var i = isLE ? 0 : (nBytes - 1)
  9395. var d = isLE ? 1 : -1
  9396. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  9397. value = Math.abs(value)
  9398. if (isNaN(value) || value === Infinity) {
  9399. m = isNaN(value) ? 1 : 0
  9400. e = eMax
  9401. } else {
  9402. e = Math.floor(Math.log(value) / Math.LN2)
  9403. if (value * (c = Math.pow(2, -e)) < 1) {
  9404. e--
  9405. c *= 2
  9406. }
  9407. if (e + eBias >= 1) {
  9408. value += rt / c
  9409. } else {
  9410. value += rt * Math.pow(2, 1 - eBias)
  9411. }
  9412. if (value * c >= 2) {
  9413. e++
  9414. c /= 2
  9415. }
  9416. if (e + eBias >= eMax) {
  9417. m = 0
  9418. e = eMax
  9419. } else if (e + eBias >= 1) {
  9420. m = ((value * c) - 1) * Math.pow(2, mLen)
  9421. e = e + eBias
  9422. } else {
  9423. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  9424. e = 0
  9425. }
  9426. }
  9427. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  9428. e = (e << mLen) | m
  9429. eLen += mLen
  9430. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  9431. buffer[offset + i - d] |= s * 128
  9432. }
  9433. /***/ }),
  9434. /***/ "./node_modules/isarray/index.js":
  9435. /*!***************************************!*\
  9436. !*** ./node_modules/isarray/index.js ***!
  9437. \***************************************/
  9438. /*! no static exports found */
  9439. /***/ (function(module, exports) {
  9440. var toString = {}.toString;
  9441. module.exports = Array.isArray || function (arr) {
  9442. return toString.call(arr) == '[object Array]';
  9443. };
  9444. /***/ }),
  9445. /***/ "./node_modules/jquery/dist/jquery.js":
  9446. /*!********************************************!*\
  9447. !*** ./node_modules/jquery/dist/jquery.js ***!
  9448. \********************************************/
  9449. /*! no static exports found */
  9450. /***/ (function(module, exports, __webpack_require__) {
  9451. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  9452. * jQuery JavaScript Library v3.4.1
  9453. * https://jquery.com/
  9454. *
  9455. * Includes Sizzle.js
  9456. * https://sizzlejs.com/
  9457. *
  9458. * Copyright JS Foundation and other contributors
  9459. * Released under the MIT license
  9460. * https://jquery.org/license
  9461. *
  9462. * Date: 2019-05-01T21:04Z
  9463. */
  9464. ( function( global, factory ) {
  9465. "use strict";
  9466. if ( true && typeof module.exports === "object" ) {
  9467. // For CommonJS and CommonJS-like environments where a proper `window`
  9468. // is present, execute the factory and get jQuery.
  9469. // For environments that do not have a `window` with a `document`
  9470. // (such as Node.js), expose a factory as module.exports.
  9471. // This accentuates the need for the creation of a real `window`.
  9472. // e.g. var jQuery = require("jquery")(window);
  9473. // See ticket #14549 for more info.
  9474. module.exports = global.document ?
  9475. factory( global, true ) :
  9476. function( w ) {
  9477. if ( !w.document ) {
  9478. throw new Error( "jQuery requires a window with a document" );
  9479. }
  9480. return factory( w );
  9481. };
  9482. } else {
  9483. factory( global );
  9484. }
  9485. // Pass this if window is not defined yet
  9486. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  9487. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  9488. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  9489. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  9490. // enough that all such attempts are guarded in a try block.
  9491. "use strict";
  9492. var arr = [];
  9493. var document = window.document;
  9494. var getProto = Object.getPrototypeOf;
  9495. var slice = arr.slice;
  9496. var concat = arr.concat;
  9497. var push = arr.push;
  9498. var indexOf = arr.indexOf;
  9499. var class2type = {};
  9500. var toString = class2type.toString;
  9501. var hasOwn = class2type.hasOwnProperty;
  9502. var fnToString = hasOwn.toString;
  9503. var ObjectFunctionString = fnToString.call( Object );
  9504. var support = {};
  9505. var isFunction = function isFunction( obj ) {
  9506. // Support: Chrome <=57, Firefox <=52
  9507. // In some browsers, typeof returns "function" for HTML <object> elements
  9508. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  9509. // We don't want to classify *any* DOM node as a function.
  9510. return typeof obj === "function" && typeof obj.nodeType !== "number";
  9511. };
  9512. var isWindow = function isWindow( obj ) {
  9513. return obj != null && obj === obj.window;
  9514. };
  9515. var preservedScriptAttributes = {
  9516. type: true,
  9517. src: true,
  9518. nonce: true,
  9519. noModule: true
  9520. };
  9521. function DOMEval( code, node, doc ) {
  9522. doc = doc || document;
  9523. var i, val,
  9524. script = doc.createElement( "script" );
  9525. script.text = code;
  9526. if ( node ) {
  9527. for ( i in preservedScriptAttributes ) {
  9528. // Support: Firefox 64+, Edge 18+
  9529. // Some browsers don't support the "nonce" property on scripts.
  9530. // On the other hand, just using `getAttribute` is not enough as
  9531. // the `nonce` attribute is reset to an empty string whenever it
  9532. // becomes browsing-context connected.
  9533. // See https://github.com/whatwg/html/issues/2369
  9534. // See https://html.spec.whatwg.org/#nonce-attributes
  9535. // The `node.getAttribute` check was added for the sake of
  9536. // `jQuery.globalEval` so that it can fake a nonce-containing node
  9537. // via an object.
  9538. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  9539. if ( val ) {
  9540. script.setAttribute( i, val );
  9541. }
  9542. }
  9543. }
  9544. doc.head.appendChild( script ).parentNode.removeChild( script );
  9545. }
  9546. function toType( obj ) {
  9547. if ( obj == null ) {
  9548. return obj + "";
  9549. }
  9550. // Support: Android <=2.3 only (functionish RegExp)
  9551. return typeof obj === "object" || typeof obj === "function" ?
  9552. class2type[ toString.call( obj ) ] || "object" :
  9553. typeof obj;
  9554. }
  9555. /* global Symbol */
  9556. // Defining this global in .eslintrc.json would create a danger of using the global
  9557. // unguarded in another place, it seems safer to define global only for this module
  9558. var
  9559. version = "3.4.1",
  9560. // Define a local copy of jQuery
  9561. jQuery = function( selector, context ) {
  9562. // The jQuery object is actually just the init constructor 'enhanced'
  9563. // Need init if jQuery is called (just allow error to be thrown if not included)
  9564. return new jQuery.fn.init( selector, context );
  9565. },
  9566. // Support: Android <=4.0 only
  9567. // Make sure we trim BOM and NBSP
  9568. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  9569. jQuery.fn = jQuery.prototype = {
  9570. // The current version of jQuery being used
  9571. jquery: version,
  9572. constructor: jQuery,
  9573. // The default length of a jQuery object is 0
  9574. length: 0,
  9575. toArray: function() {
  9576. return slice.call( this );
  9577. },
  9578. // Get the Nth element in the matched element set OR
  9579. // Get the whole matched element set as a clean array
  9580. get: function( num ) {
  9581. // Return all the elements in a clean array
  9582. if ( num == null ) {
  9583. return slice.call( this );
  9584. }
  9585. // Return just the one element from the set
  9586. return num < 0 ? this[ num + this.length ] : this[ num ];
  9587. },
  9588. // Take an array of elements and push it onto the stack
  9589. // (returning the new matched element set)
  9590. pushStack: function( elems ) {
  9591. // Build a new jQuery matched element set
  9592. var ret = jQuery.merge( this.constructor(), elems );
  9593. // Add the old object onto the stack (as a reference)
  9594. ret.prevObject = this;
  9595. // Return the newly-formed element set
  9596. return ret;
  9597. },
  9598. // Execute a callback for every element in the matched set.
  9599. each: function( callback ) {
  9600. return jQuery.each( this, callback );
  9601. },
  9602. map: function( callback ) {
  9603. return this.pushStack( jQuery.map( this, function( elem, i ) {
  9604. return callback.call( elem, i, elem );
  9605. } ) );
  9606. },
  9607. slice: function() {
  9608. return this.pushStack( slice.apply( this, arguments ) );
  9609. },
  9610. first: function() {
  9611. return this.eq( 0 );
  9612. },
  9613. last: function() {
  9614. return this.eq( -1 );
  9615. },
  9616. eq: function( i ) {
  9617. var len = this.length,
  9618. j = +i + ( i < 0 ? len : 0 );
  9619. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  9620. },
  9621. end: function() {
  9622. return this.prevObject || this.constructor();
  9623. },
  9624. // For internal use only.
  9625. // Behaves like an Array's method, not like a jQuery method.
  9626. push: push,
  9627. sort: arr.sort,
  9628. splice: arr.splice
  9629. };
  9630. jQuery.extend = jQuery.fn.extend = function() {
  9631. var options, name, src, copy, copyIsArray, clone,
  9632. target = arguments[ 0 ] || {},
  9633. i = 1,
  9634. length = arguments.length,
  9635. deep = false;
  9636. // Handle a deep copy situation
  9637. if ( typeof target === "boolean" ) {
  9638. deep = target;
  9639. // Skip the boolean and the target
  9640. target = arguments[ i ] || {};
  9641. i++;
  9642. }
  9643. // Handle case when target is a string or something (possible in deep copy)
  9644. if ( typeof target !== "object" && !isFunction( target ) ) {
  9645. target = {};
  9646. }
  9647. // Extend jQuery itself if only one argument is passed
  9648. if ( i === length ) {
  9649. target = this;
  9650. i--;
  9651. }
  9652. for ( ; i < length; i++ ) {
  9653. // Only deal with non-null/undefined values
  9654. if ( ( options = arguments[ i ] ) != null ) {
  9655. // Extend the base object
  9656. for ( name in options ) {
  9657. copy = options[ name ];
  9658. // Prevent Object.prototype pollution
  9659. // Prevent never-ending loop
  9660. if ( name === "__proto__" || target === copy ) {
  9661. continue;
  9662. }
  9663. // Recurse if we're merging plain objects or arrays
  9664. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  9665. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  9666. src = target[ name ];
  9667. // Ensure proper type for the source value
  9668. if ( copyIsArray && !Array.isArray( src ) ) {
  9669. clone = [];
  9670. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  9671. clone = {};
  9672. } else {
  9673. clone = src;
  9674. }
  9675. copyIsArray = false;
  9676. // Never move original objects, clone them
  9677. target[ name ] = jQuery.extend( deep, clone, copy );
  9678. // Don't bring in undefined values
  9679. } else if ( copy !== undefined ) {
  9680. target[ name ] = copy;
  9681. }
  9682. }
  9683. }
  9684. }
  9685. // Return the modified object
  9686. return target;
  9687. };
  9688. jQuery.extend( {
  9689. // Unique for each copy of jQuery on the page
  9690. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  9691. // Assume jQuery is ready without the ready module
  9692. isReady: true,
  9693. error: function( msg ) {
  9694. throw new Error( msg );
  9695. },
  9696. noop: function() {},
  9697. isPlainObject: function( obj ) {
  9698. var proto, Ctor;
  9699. // Detect obvious negatives
  9700. // Use toString instead of jQuery.type to catch host objects
  9701. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  9702. return false;
  9703. }
  9704. proto = getProto( obj );
  9705. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  9706. if ( !proto ) {
  9707. return true;
  9708. }
  9709. // Objects with prototype are plain iff they were constructed by a global Object function
  9710. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  9711. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  9712. },
  9713. isEmptyObject: function( obj ) {
  9714. var name;
  9715. for ( name in obj ) {
  9716. return false;
  9717. }
  9718. return true;
  9719. },
  9720. // Evaluates a script in a global context
  9721. globalEval: function( code, options ) {
  9722. DOMEval( code, { nonce: options && options.nonce } );
  9723. },
  9724. each: function( obj, callback ) {
  9725. var length, i = 0;
  9726. if ( isArrayLike( obj ) ) {
  9727. length = obj.length;
  9728. for ( ; i < length; i++ ) {
  9729. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  9730. break;
  9731. }
  9732. }
  9733. } else {
  9734. for ( i in obj ) {
  9735. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  9736. break;
  9737. }
  9738. }
  9739. }
  9740. return obj;
  9741. },
  9742. // Support: Android <=4.0 only
  9743. trim: function( text ) {
  9744. return text == null ?
  9745. "" :
  9746. ( text + "" ).replace( rtrim, "" );
  9747. },
  9748. // results is for internal usage only
  9749. makeArray: function( arr, results ) {
  9750. var ret = results || [];
  9751. if ( arr != null ) {
  9752. if ( isArrayLike( Object( arr ) ) ) {
  9753. jQuery.merge( ret,
  9754. typeof arr === "string" ?
  9755. [ arr ] : arr
  9756. );
  9757. } else {
  9758. push.call( ret, arr );
  9759. }
  9760. }
  9761. return ret;
  9762. },
  9763. inArray: function( elem, arr, i ) {
  9764. return arr == null ? -1 : indexOf.call( arr, elem, i );
  9765. },
  9766. // Support: Android <=4.0 only, PhantomJS 1 only
  9767. // push.apply(_, arraylike) throws on ancient WebKit
  9768. merge: function( first, second ) {
  9769. var len = +second.length,
  9770. j = 0,
  9771. i = first.length;
  9772. for ( ; j < len; j++ ) {
  9773. first[ i++ ] = second[ j ];
  9774. }
  9775. first.length = i;
  9776. return first;
  9777. },
  9778. grep: function( elems, callback, invert ) {
  9779. var callbackInverse,
  9780. matches = [],
  9781. i = 0,
  9782. length = elems.length,
  9783. callbackExpect = !invert;
  9784. // Go through the array, only saving the items
  9785. // that pass the validator function
  9786. for ( ; i < length; i++ ) {
  9787. callbackInverse = !callback( elems[ i ], i );
  9788. if ( callbackInverse !== callbackExpect ) {
  9789. matches.push( elems[ i ] );
  9790. }
  9791. }
  9792. return matches;
  9793. },
  9794. // arg is for internal usage only
  9795. map: function( elems, callback, arg ) {
  9796. var length, value,
  9797. i = 0,
  9798. ret = [];
  9799. // Go through the array, translating each of the items to their new values
  9800. if ( isArrayLike( elems ) ) {
  9801. length = elems.length;
  9802. for ( ; i < length; i++ ) {
  9803. value = callback( elems[ i ], i, arg );
  9804. if ( value != null ) {
  9805. ret.push( value );
  9806. }
  9807. }
  9808. // Go through every key on the object,
  9809. } else {
  9810. for ( i in elems ) {
  9811. value = callback( elems[ i ], i, arg );
  9812. if ( value != null ) {
  9813. ret.push( value );
  9814. }
  9815. }
  9816. }
  9817. // Flatten any nested arrays
  9818. return concat.apply( [], ret );
  9819. },
  9820. // A global GUID counter for objects
  9821. guid: 1,
  9822. // jQuery.support is not used in Core but other projects attach their
  9823. // properties to it so it needs to exist.
  9824. support: support
  9825. } );
  9826. if ( typeof Symbol === "function" ) {
  9827. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  9828. }
  9829. // Populate the class2type map
  9830. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  9831. function( i, name ) {
  9832. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  9833. } );
  9834. function isArrayLike( obj ) {
  9835. // Support: real iOS 8.2 only (not reproducible in simulator)
  9836. // `in` check used to prevent JIT error (gh-2145)
  9837. // hasOwn isn't used here due to false negatives
  9838. // regarding Nodelist length in IE
  9839. var length = !!obj && "length" in obj && obj.length,
  9840. type = toType( obj );
  9841. if ( isFunction( obj ) || isWindow( obj ) ) {
  9842. return false;
  9843. }
  9844. return type === "array" || length === 0 ||
  9845. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  9846. }
  9847. var Sizzle =
  9848. /*!
  9849. * Sizzle CSS Selector Engine v2.3.4
  9850. * https://sizzlejs.com/
  9851. *
  9852. * Copyright JS Foundation and other contributors
  9853. * Released under the MIT license
  9854. * https://js.foundation/
  9855. *
  9856. * Date: 2019-04-08
  9857. */
  9858. (function( window ) {
  9859. var i,
  9860. support,
  9861. Expr,
  9862. getText,
  9863. isXML,
  9864. tokenize,
  9865. compile,
  9866. select,
  9867. outermostContext,
  9868. sortInput,
  9869. hasDuplicate,
  9870. // Local document vars
  9871. setDocument,
  9872. document,
  9873. docElem,
  9874. documentIsHTML,
  9875. rbuggyQSA,
  9876. rbuggyMatches,
  9877. matches,
  9878. contains,
  9879. // Instance-specific data
  9880. expando = "sizzle" + 1 * new Date(),
  9881. preferredDoc = window.document,
  9882. dirruns = 0,
  9883. done = 0,
  9884. classCache = createCache(),
  9885. tokenCache = createCache(),
  9886. compilerCache = createCache(),
  9887. nonnativeSelectorCache = createCache(),
  9888. sortOrder = function( a, b ) {
  9889. if ( a === b ) {
  9890. hasDuplicate = true;
  9891. }
  9892. return 0;
  9893. },
  9894. // Instance methods
  9895. hasOwn = ({}).hasOwnProperty,
  9896. arr = [],
  9897. pop = arr.pop,
  9898. push_native = arr.push,
  9899. push = arr.push,
  9900. slice = arr.slice,
  9901. // Use a stripped-down indexOf as it's faster than native
  9902. // https://jsperf.com/thor-indexof-vs-for/5
  9903. indexOf = function( list, elem ) {
  9904. var i = 0,
  9905. len = list.length;
  9906. for ( ; i < len; i++ ) {
  9907. if ( list[i] === elem ) {
  9908. return i;
  9909. }
  9910. }
  9911. return -1;
  9912. },
  9913. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  9914. // Regular expressions
  9915. // http://www.w3.org/TR/css3-selectors/#whitespace
  9916. whitespace = "[\\x20\\t\\r\\n\\f]",
  9917. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  9918. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  9919. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  9920. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  9921. // Operator (capture 2)
  9922. "*([*^$|!~]?=)" + whitespace +
  9923. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  9924. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  9925. "*\\]",
  9926. pseudos = ":(" + identifier + ")(?:\\((" +
  9927. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  9928. // 1. quoted (capture 3; capture 4 or capture 5)
  9929. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  9930. // 2. simple (capture 6)
  9931. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  9932. // 3. anything else (capture 2)
  9933. ".*" +
  9934. ")\\)|)",
  9935. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  9936. rwhitespace = new RegExp( whitespace + "+", "g" ),
  9937. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  9938. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  9939. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  9940. rdescend = new RegExp( whitespace + "|>" ),
  9941. rpseudo = new RegExp( pseudos ),
  9942. ridentifier = new RegExp( "^" + identifier + "$" ),
  9943. matchExpr = {
  9944. "ID": new RegExp( "^#(" + identifier + ")" ),
  9945. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  9946. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  9947. "ATTR": new RegExp( "^" + attributes ),
  9948. "PSEUDO": new RegExp( "^" + pseudos ),
  9949. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  9950. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  9951. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  9952. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  9953. // For use in libraries implementing .is()
  9954. // We use this for POS matching in `select`
  9955. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  9956. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  9957. },
  9958. rhtml = /HTML$/i,
  9959. rinputs = /^(?:input|select|textarea|button)$/i,
  9960. rheader = /^h\d$/i,
  9961. rnative = /^[^{]+\{\s*\[native \w/,
  9962. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  9963. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  9964. rsibling = /[+~]/,
  9965. // CSS escapes
  9966. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  9967. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  9968. funescape = function( _, escaped, escapedWhitespace ) {
  9969. var high = "0x" + escaped - 0x10000;
  9970. // NaN means non-codepoint
  9971. // Support: Firefox<24
  9972. // Workaround erroneous numeric interpretation of +"0x"
  9973. return high !== high || escapedWhitespace ?
  9974. escaped :
  9975. high < 0 ?
  9976. // BMP codepoint
  9977. String.fromCharCode( high + 0x10000 ) :
  9978. // Supplemental Plane codepoint (surrogate pair)
  9979. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  9980. },
  9981. // CSS string/identifier serialization
  9982. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  9983. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  9984. fcssescape = function( ch, asCodePoint ) {
  9985. if ( asCodePoint ) {
  9986. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  9987. if ( ch === "\0" ) {
  9988. return "\uFFFD";
  9989. }
  9990. // Control characters and (dependent upon position) numbers get escaped as code points
  9991. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  9992. }
  9993. // Other potentially-special ASCII characters get backslash-escaped
  9994. return "\\" + ch;
  9995. },
  9996. // Used for iframes
  9997. // See setDocument()
  9998. // Removing the function wrapper causes a "Permission Denied"
  9999. // error in IE
  10000. unloadHandler = function() {
  10001. setDocument();
  10002. },
  10003. inDisabledFieldset = addCombinator(
  10004. function( elem ) {
  10005. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  10006. },
  10007. { dir: "parentNode", next: "legend" }
  10008. );
  10009. // Optimize for push.apply( _, NodeList )
  10010. try {
  10011. push.apply(
  10012. (arr = slice.call( preferredDoc.childNodes )),
  10013. preferredDoc.childNodes
  10014. );
  10015. // Support: Android<4.0
  10016. // Detect silently failing push.apply
  10017. arr[ preferredDoc.childNodes.length ].nodeType;
  10018. } catch ( e ) {
  10019. push = { apply: arr.length ?
  10020. // Leverage slice if possible
  10021. function( target, els ) {
  10022. push_native.apply( target, slice.call(els) );
  10023. } :
  10024. // Support: IE<9
  10025. // Otherwise append directly
  10026. function( target, els ) {
  10027. var j = target.length,
  10028. i = 0;
  10029. // Can't trust NodeList.length
  10030. while ( (target[j++] = els[i++]) ) {}
  10031. target.length = j - 1;
  10032. }
  10033. };
  10034. }
  10035. function Sizzle( selector, context, results, seed ) {
  10036. var m, i, elem, nid, match, groups, newSelector,
  10037. newContext = context && context.ownerDocument,
  10038. // nodeType defaults to 9, since context defaults to document
  10039. nodeType = context ? context.nodeType : 9;
  10040. results = results || [];
  10041. // Return early from calls with invalid selector or context
  10042. if ( typeof selector !== "string" || !selector ||
  10043. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  10044. return results;
  10045. }
  10046. // Try to shortcut find operations (as opposed to filters) in HTML documents
  10047. if ( !seed ) {
  10048. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  10049. setDocument( context );
  10050. }
  10051. context = context || document;
  10052. if ( documentIsHTML ) {
  10053. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  10054. // (excepting DocumentFragment context, where the methods don't exist)
  10055. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  10056. // ID selector
  10057. if ( (m = match[1]) ) {
  10058. // Document context
  10059. if ( nodeType === 9 ) {
  10060. if ( (elem = context.getElementById( m )) ) {
  10061. // Support: IE, Opera, Webkit
  10062. // TODO: identify versions
  10063. // getElementById can match elements by name instead of ID
  10064. if ( elem.id === m ) {
  10065. results.push( elem );
  10066. return results;
  10067. }
  10068. } else {
  10069. return results;
  10070. }
  10071. // Element context
  10072. } else {
  10073. // Support: IE, Opera, Webkit
  10074. // TODO: identify versions
  10075. // getElementById can match elements by name instead of ID
  10076. if ( newContext && (elem = newContext.getElementById( m )) &&
  10077. contains( context, elem ) &&
  10078. elem.id === m ) {
  10079. results.push( elem );
  10080. return results;
  10081. }
  10082. }
  10083. // Type selector
  10084. } else if ( match[2] ) {
  10085. push.apply( results, context.getElementsByTagName( selector ) );
  10086. return results;
  10087. // Class selector
  10088. } else if ( (m = match[3]) && support.getElementsByClassName &&
  10089. context.getElementsByClassName ) {
  10090. push.apply( results, context.getElementsByClassName( m ) );
  10091. return results;
  10092. }
  10093. }
  10094. // Take advantage of querySelectorAll
  10095. if ( support.qsa &&
  10096. !nonnativeSelectorCache[ selector + " " ] &&
  10097. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  10098. // Support: IE 8 only
  10099. // Exclude object elements
  10100. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  10101. newSelector = selector;
  10102. newContext = context;
  10103. // qSA considers elements outside a scoping root when evaluating child or
  10104. // descendant combinators, which is not what we want.
  10105. // In such cases, we work around the behavior by prefixing every selector in the
  10106. // list with an ID selector referencing the scope context.
  10107. // Thanks to Andrew Dupont for this technique.
  10108. if ( nodeType === 1 && rdescend.test( selector ) ) {
  10109. // Capture the context ID, setting it first if necessary
  10110. if ( (nid = context.getAttribute( "id" )) ) {
  10111. nid = nid.replace( rcssescape, fcssescape );
  10112. } else {
  10113. context.setAttribute( "id", (nid = expando) );
  10114. }
  10115. // Prefix every selector in the list
  10116. groups = tokenize( selector );
  10117. i = groups.length;
  10118. while ( i-- ) {
  10119. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  10120. }
  10121. newSelector = groups.join( "," );
  10122. // Expand context for sibling selectors
  10123. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  10124. context;
  10125. }
  10126. try {
  10127. push.apply( results,
  10128. newContext.querySelectorAll( newSelector )
  10129. );
  10130. return results;
  10131. } catch ( qsaError ) {
  10132. nonnativeSelectorCache( selector, true );
  10133. } finally {
  10134. if ( nid === expando ) {
  10135. context.removeAttribute( "id" );
  10136. }
  10137. }
  10138. }
  10139. }
  10140. }
  10141. // All others
  10142. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  10143. }
  10144. /**
  10145. * Create key-value caches of limited size
  10146. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  10147. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  10148. * deleting the oldest entry
  10149. */
  10150. function createCache() {
  10151. var keys = [];
  10152. function cache( key, value ) {
  10153. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  10154. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  10155. // Only keep the most recent entries
  10156. delete cache[ keys.shift() ];
  10157. }
  10158. return (cache[ key + " " ] = value);
  10159. }
  10160. return cache;
  10161. }
  10162. /**
  10163. * Mark a function for special use by Sizzle
  10164. * @param {Function} fn The function to mark
  10165. */
  10166. function markFunction( fn ) {
  10167. fn[ expando ] = true;
  10168. return fn;
  10169. }
  10170. /**
  10171. * Support testing using an element
  10172. * @param {Function} fn Passed the created element and returns a boolean result
  10173. */
  10174. function assert( fn ) {
  10175. var el = document.createElement("fieldset");
  10176. try {
  10177. return !!fn( el );
  10178. } catch (e) {
  10179. return false;
  10180. } finally {
  10181. // Remove from its parent by default
  10182. if ( el.parentNode ) {
  10183. el.parentNode.removeChild( el );
  10184. }
  10185. // release memory in IE
  10186. el = null;
  10187. }
  10188. }
  10189. /**
  10190. * Adds the same handler for all of the specified attrs
  10191. * @param {String} attrs Pipe-separated list of attributes
  10192. * @param {Function} handler The method that will be applied
  10193. */
  10194. function addHandle( attrs, handler ) {
  10195. var arr = attrs.split("|"),
  10196. i = arr.length;
  10197. while ( i-- ) {
  10198. Expr.attrHandle[ arr[i] ] = handler;
  10199. }
  10200. }
  10201. /**
  10202. * Checks document order of two siblings
  10203. * @param {Element} a
  10204. * @param {Element} b
  10205. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  10206. */
  10207. function siblingCheck( a, b ) {
  10208. var cur = b && a,
  10209. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  10210. a.sourceIndex - b.sourceIndex;
  10211. // Use IE sourceIndex if available on both nodes
  10212. if ( diff ) {
  10213. return diff;
  10214. }
  10215. // Check if b follows a
  10216. if ( cur ) {
  10217. while ( (cur = cur.nextSibling) ) {
  10218. if ( cur === b ) {
  10219. return -1;
  10220. }
  10221. }
  10222. }
  10223. return a ? 1 : -1;
  10224. }
  10225. /**
  10226. * Returns a function to use in pseudos for input types
  10227. * @param {String} type
  10228. */
  10229. function createInputPseudo( type ) {
  10230. return function( elem ) {
  10231. var name = elem.nodeName.toLowerCase();
  10232. return name === "input" && elem.type === type;
  10233. };
  10234. }
  10235. /**
  10236. * Returns a function to use in pseudos for buttons
  10237. * @param {String} type
  10238. */
  10239. function createButtonPseudo( type ) {
  10240. return function( elem ) {
  10241. var name = elem.nodeName.toLowerCase();
  10242. return (name === "input" || name === "button") && elem.type === type;
  10243. };
  10244. }
  10245. /**
  10246. * Returns a function to use in pseudos for :enabled/:disabled
  10247. * @param {Boolean} disabled true for :disabled; false for :enabled
  10248. */
  10249. function createDisabledPseudo( disabled ) {
  10250. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  10251. return function( elem ) {
  10252. // Only certain elements can match :enabled or :disabled
  10253. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  10254. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  10255. if ( "form" in elem ) {
  10256. // Check for inherited disabledness on relevant non-disabled elements:
  10257. // * listed form-associated elements in a disabled fieldset
  10258. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  10259. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  10260. // * option elements in a disabled optgroup
  10261. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  10262. // All such elements have a "form" property.
  10263. if ( elem.parentNode && elem.disabled === false ) {
  10264. // Option elements defer to a parent optgroup if present
  10265. if ( "label" in elem ) {
  10266. if ( "label" in elem.parentNode ) {
  10267. return elem.parentNode.disabled === disabled;
  10268. } else {
  10269. return elem.disabled === disabled;
  10270. }
  10271. }
  10272. // Support: IE 6 - 11
  10273. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  10274. return elem.isDisabled === disabled ||
  10275. // Where there is no isDisabled, check manually
  10276. /* jshint -W018 */
  10277. elem.isDisabled !== !disabled &&
  10278. inDisabledFieldset( elem ) === disabled;
  10279. }
  10280. return elem.disabled === disabled;
  10281. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  10282. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  10283. // even exist on them, let alone have a boolean value.
  10284. } else if ( "label" in elem ) {
  10285. return elem.disabled === disabled;
  10286. }
  10287. // Remaining elements are neither :enabled nor :disabled
  10288. return false;
  10289. };
  10290. }
  10291. /**
  10292. * Returns a function to use in pseudos for positionals
  10293. * @param {Function} fn
  10294. */
  10295. function createPositionalPseudo( fn ) {
  10296. return markFunction(function( argument ) {
  10297. argument = +argument;
  10298. return markFunction(function( seed, matches ) {
  10299. var j,
  10300. matchIndexes = fn( [], seed.length, argument ),
  10301. i = matchIndexes.length;
  10302. // Match elements found at the specified indexes
  10303. while ( i-- ) {
  10304. if ( seed[ (j = matchIndexes[i]) ] ) {
  10305. seed[j] = !(matches[j] = seed[j]);
  10306. }
  10307. }
  10308. });
  10309. });
  10310. }
  10311. /**
  10312. * Checks a node for validity as a Sizzle context
  10313. * @param {Element|Object=} context
  10314. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  10315. */
  10316. function testContext( context ) {
  10317. return context && typeof context.getElementsByTagName !== "undefined" && context;
  10318. }
  10319. // Expose support vars for convenience
  10320. support = Sizzle.support = {};
  10321. /**
  10322. * Detects XML nodes
  10323. * @param {Element|Object} elem An element or a document
  10324. * @returns {Boolean} True iff elem is a non-HTML XML node
  10325. */
  10326. isXML = Sizzle.isXML = function( elem ) {
  10327. var namespace = elem.namespaceURI,
  10328. docElem = (elem.ownerDocument || elem).documentElement;
  10329. // Support: IE <=8
  10330. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  10331. // https://bugs.jquery.com/ticket/4833
  10332. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  10333. };
  10334. /**
  10335. * Sets document-related variables once based on the current document
  10336. * @param {Element|Object} [doc] An element or document object to use to set the document
  10337. * @returns {Object} Returns the current document
  10338. */
  10339. setDocument = Sizzle.setDocument = function( node ) {
  10340. var hasCompare, subWindow,
  10341. doc = node ? node.ownerDocument || node : preferredDoc;
  10342. // Return early if doc is invalid or already selected
  10343. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  10344. return document;
  10345. }
  10346. // Update global variables
  10347. document = doc;
  10348. docElem = document.documentElement;
  10349. documentIsHTML = !isXML( document );
  10350. // Support: IE 9-11, Edge
  10351. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  10352. if ( preferredDoc !== document &&
  10353. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  10354. // Support: IE 11, Edge
  10355. if ( subWindow.addEventListener ) {
  10356. subWindow.addEventListener( "unload", unloadHandler, false );
  10357. // Support: IE 9 - 10 only
  10358. } else if ( subWindow.attachEvent ) {
  10359. subWindow.attachEvent( "onunload", unloadHandler );
  10360. }
  10361. }
  10362. /* Attributes
  10363. ---------------------------------------------------------------------- */
  10364. // Support: IE<8
  10365. // Verify that getAttribute really returns attributes and not properties
  10366. // (excepting IE8 booleans)
  10367. support.attributes = assert(function( el ) {
  10368. el.className = "i";
  10369. return !el.getAttribute("className");
  10370. });
  10371. /* getElement(s)By*
  10372. ---------------------------------------------------------------------- */
  10373. // Check if getElementsByTagName("*") returns only elements
  10374. support.getElementsByTagName = assert(function( el ) {
  10375. el.appendChild( document.createComment("") );
  10376. return !el.getElementsByTagName("*").length;
  10377. });
  10378. // Support: IE<9
  10379. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  10380. // Support: IE<10
  10381. // Check if getElementById returns elements by name
  10382. // The broken getElementById methods don't pick up programmatically-set names,
  10383. // so use a roundabout getElementsByName test
  10384. support.getById = assert(function( el ) {
  10385. docElem.appendChild( el ).id = expando;
  10386. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  10387. });
  10388. // ID filter and find
  10389. if ( support.getById ) {
  10390. Expr.filter["ID"] = function( id ) {
  10391. var attrId = id.replace( runescape, funescape );
  10392. return function( elem ) {
  10393. return elem.getAttribute("id") === attrId;
  10394. };
  10395. };
  10396. Expr.find["ID"] = function( id, context ) {
  10397. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  10398. var elem = context.getElementById( id );
  10399. return elem ? [ elem ] : [];
  10400. }
  10401. };
  10402. } else {
  10403. Expr.filter["ID"] = function( id ) {
  10404. var attrId = id.replace( runescape, funescape );
  10405. return function( elem ) {
  10406. var node = typeof elem.getAttributeNode !== "undefined" &&
  10407. elem.getAttributeNode("id");
  10408. return node && node.value === attrId;
  10409. };
  10410. };
  10411. // Support: IE 6 - 7 only
  10412. // getElementById is not reliable as a find shortcut
  10413. Expr.find["ID"] = function( id, context ) {
  10414. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  10415. var node, i, elems,
  10416. elem = context.getElementById( id );
  10417. if ( elem ) {
  10418. // Verify the id attribute
  10419. node = elem.getAttributeNode("id");
  10420. if ( node && node.value === id ) {
  10421. return [ elem ];
  10422. }
  10423. // Fall back on getElementsByName
  10424. elems = context.getElementsByName( id );
  10425. i = 0;
  10426. while ( (elem = elems[i++]) ) {
  10427. node = elem.getAttributeNode("id");
  10428. if ( node && node.value === id ) {
  10429. return [ elem ];
  10430. }
  10431. }
  10432. }
  10433. return [];
  10434. }
  10435. };
  10436. }
  10437. // Tag
  10438. Expr.find["TAG"] = support.getElementsByTagName ?
  10439. function( tag, context ) {
  10440. if ( typeof context.getElementsByTagName !== "undefined" ) {
  10441. return context.getElementsByTagName( tag );
  10442. // DocumentFragment nodes don't have gEBTN
  10443. } else if ( support.qsa ) {
  10444. return context.querySelectorAll( tag );
  10445. }
  10446. } :
  10447. function( tag, context ) {
  10448. var elem,
  10449. tmp = [],
  10450. i = 0,
  10451. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  10452. results = context.getElementsByTagName( tag );
  10453. // Filter out possible comments
  10454. if ( tag === "*" ) {
  10455. while ( (elem = results[i++]) ) {
  10456. if ( elem.nodeType === 1 ) {
  10457. tmp.push( elem );
  10458. }
  10459. }
  10460. return tmp;
  10461. }
  10462. return results;
  10463. };
  10464. // Class
  10465. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  10466. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  10467. return context.getElementsByClassName( className );
  10468. }
  10469. };
  10470. /* QSA/matchesSelector
  10471. ---------------------------------------------------------------------- */
  10472. // QSA and matchesSelector support
  10473. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  10474. rbuggyMatches = [];
  10475. // qSa(:focus) reports false when true (Chrome 21)
  10476. // We allow this because of a bug in IE8/9 that throws an error
  10477. // whenever `document.activeElement` is accessed on an iframe
  10478. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  10479. // See https://bugs.jquery.com/ticket/13378
  10480. rbuggyQSA = [];
  10481. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  10482. // Build QSA regex
  10483. // Regex strategy adopted from Diego Perini
  10484. assert(function( el ) {
  10485. // Select is set to empty string on purpose
  10486. // This is to test IE's treatment of not explicitly
  10487. // setting a boolean content attribute,
  10488. // since its presence should be enough
  10489. // https://bugs.jquery.com/ticket/12359
  10490. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  10491. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  10492. "<option selected=''></option></select>";
  10493. // Support: IE8, Opera 11-12.16
  10494. // Nothing should be selected when empty strings follow ^= or $= or *=
  10495. // The test attribute must be unknown in Opera but "safe" for WinRT
  10496. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  10497. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  10498. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  10499. }
  10500. // Support: IE8
  10501. // Boolean attributes and "value" are not treated correctly
  10502. if ( !el.querySelectorAll("[selected]").length ) {
  10503. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  10504. }
  10505. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  10506. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  10507. rbuggyQSA.push("~=");
  10508. }
  10509. // Webkit/Opera - :checked should return selected option elements
  10510. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  10511. // IE8 throws error here and will not see later tests
  10512. if ( !el.querySelectorAll(":checked").length ) {
  10513. rbuggyQSA.push(":checked");
  10514. }
  10515. // Support: Safari 8+, iOS 8+
  10516. // https://bugs.webkit.org/show_bug.cgi?id=136851
  10517. // In-page `selector#id sibling-combinator selector` fails
  10518. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  10519. rbuggyQSA.push(".#.+[+~]");
  10520. }
  10521. });
  10522. assert(function( el ) {
  10523. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  10524. "<select disabled='disabled'><option/></select>";
  10525. // Support: Windows 8 Native Apps
  10526. // The type and name attributes are restricted during .innerHTML assignment
  10527. var input = document.createElement("input");
  10528. input.setAttribute( "type", "hidden" );
  10529. el.appendChild( input ).setAttribute( "name", "D" );
  10530. // Support: IE8
  10531. // Enforce case-sensitivity of name attribute
  10532. if ( el.querySelectorAll("[name=d]").length ) {
  10533. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  10534. }
  10535. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  10536. // IE8 throws error here and will not see later tests
  10537. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  10538. rbuggyQSA.push( ":enabled", ":disabled" );
  10539. }
  10540. // Support: IE9-11+
  10541. // IE's :disabled selector does not pick up the children of disabled fieldsets
  10542. docElem.appendChild( el ).disabled = true;
  10543. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  10544. rbuggyQSA.push( ":enabled", ":disabled" );
  10545. }
  10546. // Opera 10-11 does not throw on post-comma invalid pseudos
  10547. el.querySelectorAll("*,:x");
  10548. rbuggyQSA.push(",.*:");
  10549. });
  10550. }
  10551. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  10552. docElem.webkitMatchesSelector ||
  10553. docElem.mozMatchesSelector ||
  10554. docElem.oMatchesSelector ||
  10555. docElem.msMatchesSelector) )) ) {
  10556. assert(function( el ) {
  10557. // Check to see if it's possible to do matchesSelector
  10558. // on a disconnected node (IE 9)
  10559. support.disconnectedMatch = matches.call( el, "*" );
  10560. // This should fail with an exception
  10561. // Gecko does not error, returns false instead
  10562. matches.call( el, "[s!='']:x" );
  10563. rbuggyMatches.push( "!=", pseudos );
  10564. });
  10565. }
  10566. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  10567. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  10568. /* Contains
  10569. ---------------------------------------------------------------------- */
  10570. hasCompare = rnative.test( docElem.compareDocumentPosition );
  10571. // Element contains another
  10572. // Purposefully self-exclusive
  10573. // As in, an element does not contain itself
  10574. contains = hasCompare || rnative.test( docElem.contains ) ?
  10575. function( a, b ) {
  10576. var adown = a.nodeType === 9 ? a.documentElement : a,
  10577. bup = b && b.parentNode;
  10578. return a === bup || !!( bup && bup.nodeType === 1 && (
  10579. adown.contains ?
  10580. adown.contains( bup ) :
  10581. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  10582. ));
  10583. } :
  10584. function( a, b ) {
  10585. if ( b ) {
  10586. while ( (b = b.parentNode) ) {
  10587. if ( b === a ) {
  10588. return true;
  10589. }
  10590. }
  10591. }
  10592. return false;
  10593. };
  10594. /* Sorting
  10595. ---------------------------------------------------------------------- */
  10596. // Document order sorting
  10597. sortOrder = hasCompare ?
  10598. function( a, b ) {
  10599. // Flag for duplicate removal
  10600. if ( a === b ) {
  10601. hasDuplicate = true;
  10602. return 0;
  10603. }
  10604. // Sort on method existence if only one input has compareDocumentPosition
  10605. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  10606. if ( compare ) {
  10607. return compare;
  10608. }
  10609. // Calculate position if both inputs belong to the same document
  10610. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  10611. a.compareDocumentPosition( b ) :
  10612. // Otherwise we know they are disconnected
  10613. 1;
  10614. // Disconnected nodes
  10615. if ( compare & 1 ||
  10616. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  10617. // Choose the first element that is related to our preferred document
  10618. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  10619. return -1;
  10620. }
  10621. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  10622. return 1;
  10623. }
  10624. // Maintain original order
  10625. return sortInput ?
  10626. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  10627. 0;
  10628. }
  10629. return compare & 4 ? -1 : 1;
  10630. } :
  10631. function( a, b ) {
  10632. // Exit early if the nodes are identical
  10633. if ( a === b ) {
  10634. hasDuplicate = true;
  10635. return 0;
  10636. }
  10637. var cur,
  10638. i = 0,
  10639. aup = a.parentNode,
  10640. bup = b.parentNode,
  10641. ap = [ a ],
  10642. bp = [ b ];
  10643. // Parentless nodes are either documents or disconnected
  10644. if ( !aup || !bup ) {
  10645. return a === document ? -1 :
  10646. b === document ? 1 :
  10647. aup ? -1 :
  10648. bup ? 1 :
  10649. sortInput ?
  10650. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  10651. 0;
  10652. // If the nodes are siblings, we can do a quick check
  10653. } else if ( aup === bup ) {
  10654. return siblingCheck( a, b );
  10655. }
  10656. // Otherwise we need full lists of their ancestors for comparison
  10657. cur = a;
  10658. while ( (cur = cur.parentNode) ) {
  10659. ap.unshift( cur );
  10660. }
  10661. cur = b;
  10662. while ( (cur = cur.parentNode) ) {
  10663. bp.unshift( cur );
  10664. }
  10665. // Walk down the tree looking for a discrepancy
  10666. while ( ap[i] === bp[i] ) {
  10667. i++;
  10668. }
  10669. return i ?
  10670. // Do a sibling check if the nodes have a common ancestor
  10671. siblingCheck( ap[i], bp[i] ) :
  10672. // Otherwise nodes in our document sort first
  10673. ap[i] === preferredDoc ? -1 :
  10674. bp[i] === preferredDoc ? 1 :
  10675. 0;
  10676. };
  10677. return document;
  10678. };
  10679. Sizzle.matches = function( expr, elements ) {
  10680. return Sizzle( expr, null, null, elements );
  10681. };
  10682. Sizzle.matchesSelector = function( elem, expr ) {
  10683. // Set document vars if needed
  10684. if ( ( elem.ownerDocument || elem ) !== document ) {
  10685. setDocument( elem );
  10686. }
  10687. if ( support.matchesSelector && documentIsHTML &&
  10688. !nonnativeSelectorCache[ expr + " " ] &&
  10689. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  10690. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  10691. try {
  10692. var ret = matches.call( elem, expr );
  10693. // IE 9's matchesSelector returns false on disconnected nodes
  10694. if ( ret || support.disconnectedMatch ||
  10695. // As well, disconnected nodes are said to be in a document
  10696. // fragment in IE 9
  10697. elem.document && elem.document.nodeType !== 11 ) {
  10698. return ret;
  10699. }
  10700. } catch (e) {
  10701. nonnativeSelectorCache( expr, true );
  10702. }
  10703. }
  10704. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  10705. };
  10706. Sizzle.contains = function( context, elem ) {
  10707. // Set document vars if needed
  10708. if ( ( context.ownerDocument || context ) !== document ) {
  10709. setDocument( context );
  10710. }
  10711. return contains( context, elem );
  10712. };
  10713. Sizzle.attr = function( elem, name ) {
  10714. // Set document vars if needed
  10715. if ( ( elem.ownerDocument || elem ) !== document ) {
  10716. setDocument( elem );
  10717. }
  10718. var fn = Expr.attrHandle[ name.toLowerCase() ],
  10719. // Don't get fooled by Object.prototype properties (jQuery #13807)
  10720. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  10721. fn( elem, name, !documentIsHTML ) :
  10722. undefined;
  10723. return val !== undefined ?
  10724. val :
  10725. support.attributes || !documentIsHTML ?
  10726. elem.getAttribute( name ) :
  10727. (val = elem.getAttributeNode(name)) && val.specified ?
  10728. val.value :
  10729. null;
  10730. };
  10731. Sizzle.escape = function( sel ) {
  10732. return (sel + "").replace( rcssescape, fcssescape );
  10733. };
  10734. Sizzle.error = function( msg ) {
  10735. throw new Error( "Syntax error, unrecognized expression: " + msg );
  10736. };
  10737. /**
  10738. * Document sorting and removing duplicates
  10739. * @param {ArrayLike} results
  10740. */
  10741. Sizzle.uniqueSort = function( results ) {
  10742. var elem,
  10743. duplicates = [],
  10744. j = 0,
  10745. i = 0;
  10746. // Unless we *know* we can detect duplicates, assume their presence
  10747. hasDuplicate = !support.detectDuplicates;
  10748. sortInput = !support.sortStable && results.slice( 0 );
  10749. results.sort( sortOrder );
  10750. if ( hasDuplicate ) {
  10751. while ( (elem = results[i++]) ) {
  10752. if ( elem === results[ i ] ) {
  10753. j = duplicates.push( i );
  10754. }
  10755. }
  10756. while ( j-- ) {
  10757. results.splice( duplicates[ j ], 1 );
  10758. }
  10759. }
  10760. // Clear input after sorting to release objects
  10761. // See https://github.com/jquery/sizzle/pull/225
  10762. sortInput = null;
  10763. return results;
  10764. };
  10765. /**
  10766. * Utility function for retrieving the text value of an array of DOM nodes
  10767. * @param {Array|Element} elem
  10768. */
  10769. getText = Sizzle.getText = function( elem ) {
  10770. var node,
  10771. ret = "",
  10772. i = 0,
  10773. nodeType = elem.nodeType;
  10774. if ( !nodeType ) {
  10775. // If no nodeType, this is expected to be an array
  10776. while ( (node = elem[i++]) ) {
  10777. // Do not traverse comment nodes
  10778. ret += getText( node );
  10779. }
  10780. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  10781. // Use textContent for elements
  10782. // innerText usage removed for consistency of new lines (jQuery #11153)
  10783. if ( typeof elem.textContent === "string" ) {
  10784. return elem.textContent;
  10785. } else {
  10786. // Traverse its children
  10787. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  10788. ret += getText( elem );
  10789. }
  10790. }
  10791. } else if ( nodeType === 3 || nodeType === 4 ) {
  10792. return elem.nodeValue;
  10793. }
  10794. // Do not include comment or processing instruction nodes
  10795. return ret;
  10796. };
  10797. Expr = Sizzle.selectors = {
  10798. // Can be adjusted by the user
  10799. cacheLength: 50,
  10800. createPseudo: markFunction,
  10801. match: matchExpr,
  10802. attrHandle: {},
  10803. find: {},
  10804. relative: {
  10805. ">": { dir: "parentNode", first: true },
  10806. " ": { dir: "parentNode" },
  10807. "+": { dir: "previousSibling", first: true },
  10808. "~": { dir: "previousSibling" }
  10809. },
  10810. preFilter: {
  10811. "ATTR": function( match ) {
  10812. match[1] = match[1].replace( runescape, funescape );
  10813. // Move the given value to match[3] whether quoted or unquoted
  10814. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  10815. if ( match[2] === "~=" ) {
  10816. match[3] = " " + match[3] + " ";
  10817. }
  10818. return match.slice( 0, 4 );
  10819. },
  10820. "CHILD": function( match ) {
  10821. /* matches from matchExpr["CHILD"]
  10822. 1 type (only|nth|...)
  10823. 2 what (child|of-type)
  10824. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  10825. 4 xn-component of xn+y argument ([+-]?\d*n|)
  10826. 5 sign of xn-component
  10827. 6 x of xn-component
  10828. 7 sign of y-component
  10829. 8 y of y-component
  10830. */
  10831. match[1] = match[1].toLowerCase();
  10832. if ( match[1].slice( 0, 3 ) === "nth" ) {
  10833. // nth-* requires argument
  10834. if ( !match[3] ) {
  10835. Sizzle.error( match[0] );
  10836. }
  10837. // numeric x and y parameters for Expr.filter.CHILD
  10838. // remember that false/true cast respectively to 0/1
  10839. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  10840. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  10841. // other types prohibit arguments
  10842. } else if ( match[3] ) {
  10843. Sizzle.error( match[0] );
  10844. }
  10845. return match;
  10846. },
  10847. "PSEUDO": function( match ) {
  10848. var excess,
  10849. unquoted = !match[6] && match[2];
  10850. if ( matchExpr["CHILD"].test( match[0] ) ) {
  10851. return null;
  10852. }
  10853. // Accept quoted arguments as-is
  10854. if ( match[3] ) {
  10855. match[2] = match[4] || match[5] || "";
  10856. // Strip excess characters from unquoted arguments
  10857. } else if ( unquoted && rpseudo.test( unquoted ) &&
  10858. // Get excess from tokenize (recursively)
  10859. (excess = tokenize( unquoted, true )) &&
  10860. // advance to the next closing parenthesis
  10861. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  10862. // excess is a negative index
  10863. match[0] = match[0].slice( 0, excess );
  10864. match[2] = unquoted.slice( 0, excess );
  10865. }
  10866. // Return only captures needed by the pseudo filter method (type and argument)
  10867. return match.slice( 0, 3 );
  10868. }
  10869. },
  10870. filter: {
  10871. "TAG": function( nodeNameSelector ) {
  10872. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  10873. return nodeNameSelector === "*" ?
  10874. function() { return true; } :
  10875. function( elem ) {
  10876. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  10877. };
  10878. },
  10879. "CLASS": function( className ) {
  10880. var pattern = classCache[ className + " " ];
  10881. return pattern ||
  10882. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  10883. classCache( className, function( elem ) {
  10884. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  10885. });
  10886. },
  10887. "ATTR": function( name, operator, check ) {
  10888. return function( elem ) {
  10889. var result = Sizzle.attr( elem, name );
  10890. if ( result == null ) {
  10891. return operator === "!=";
  10892. }
  10893. if ( !operator ) {
  10894. return true;
  10895. }
  10896. result += "";
  10897. return operator === "=" ? result === check :
  10898. operator === "!=" ? result !== check :
  10899. operator === "^=" ? check && result.indexOf( check ) === 0 :
  10900. operator === "*=" ? check && result.indexOf( check ) > -1 :
  10901. operator === "$=" ? check && result.slice( -check.length ) === check :
  10902. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  10903. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  10904. false;
  10905. };
  10906. },
  10907. "CHILD": function( type, what, argument, first, last ) {
  10908. var simple = type.slice( 0, 3 ) !== "nth",
  10909. forward = type.slice( -4 ) !== "last",
  10910. ofType = what === "of-type";
  10911. return first === 1 && last === 0 ?
  10912. // Shortcut for :nth-*(n)
  10913. function( elem ) {
  10914. return !!elem.parentNode;
  10915. } :
  10916. function( elem, context, xml ) {
  10917. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  10918. dir = simple !== forward ? "nextSibling" : "previousSibling",
  10919. parent = elem.parentNode,
  10920. name = ofType && elem.nodeName.toLowerCase(),
  10921. useCache = !xml && !ofType,
  10922. diff = false;
  10923. if ( parent ) {
  10924. // :(first|last|only)-(child|of-type)
  10925. if ( simple ) {
  10926. while ( dir ) {
  10927. node = elem;
  10928. while ( (node = node[ dir ]) ) {
  10929. if ( ofType ?
  10930. node.nodeName.toLowerCase() === name :
  10931. node.nodeType === 1 ) {
  10932. return false;
  10933. }
  10934. }
  10935. // Reverse direction for :only-* (if we haven't yet done so)
  10936. start = dir = type === "only" && !start && "nextSibling";
  10937. }
  10938. return true;
  10939. }
  10940. start = [ forward ? parent.firstChild : parent.lastChild ];
  10941. // non-xml :nth-child(...) stores cache data on `parent`
  10942. if ( forward && useCache ) {
  10943. // Seek `elem` from a previously-cached index
  10944. // ...in a gzip-friendly way
  10945. node = parent;
  10946. outerCache = node[ expando ] || (node[ expando ] = {});
  10947. // Support: IE <9 only
  10948. // Defend against cloned attroperties (jQuery gh-1709)
  10949. uniqueCache = outerCache[ node.uniqueID ] ||
  10950. (outerCache[ node.uniqueID ] = {});
  10951. cache = uniqueCache[ type ] || [];
  10952. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10953. diff = nodeIndex && cache[ 2 ];
  10954. node = nodeIndex && parent.childNodes[ nodeIndex ];
  10955. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10956. // Fallback to seeking `elem` from the start
  10957. (diff = nodeIndex = 0) || start.pop()) ) {
  10958. // When found, cache indexes on `parent` and break
  10959. if ( node.nodeType === 1 && ++diff && node === elem ) {
  10960. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  10961. break;
  10962. }
  10963. }
  10964. } else {
  10965. // Use previously-cached element index if available
  10966. if ( useCache ) {
  10967. // ...in a gzip-friendly way
  10968. node = elem;
  10969. outerCache = node[ expando ] || (node[ expando ] = {});
  10970. // Support: IE <9 only
  10971. // Defend against cloned attroperties (jQuery gh-1709)
  10972. uniqueCache = outerCache[ node.uniqueID ] ||
  10973. (outerCache[ node.uniqueID ] = {});
  10974. cache = uniqueCache[ type ] || [];
  10975. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10976. diff = nodeIndex;
  10977. }
  10978. // xml :nth-child(...)
  10979. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  10980. if ( diff === false ) {
  10981. // Use the same loop as above to seek `elem` from the start
  10982. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10983. (diff = nodeIndex = 0) || start.pop()) ) {
  10984. if ( ( ofType ?
  10985. node.nodeName.toLowerCase() === name :
  10986. node.nodeType === 1 ) &&
  10987. ++diff ) {
  10988. // Cache the index of each encountered element
  10989. if ( useCache ) {
  10990. outerCache = node[ expando ] || (node[ expando ] = {});
  10991. // Support: IE <9 only
  10992. // Defend against cloned attroperties (jQuery gh-1709)
  10993. uniqueCache = outerCache[ node.uniqueID ] ||
  10994. (outerCache[ node.uniqueID ] = {});
  10995. uniqueCache[ type ] = [ dirruns, diff ];
  10996. }
  10997. if ( node === elem ) {
  10998. break;
  10999. }
  11000. }
  11001. }
  11002. }
  11003. }
  11004. // Incorporate the offset, then check against cycle size
  11005. diff -= last;
  11006. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  11007. }
  11008. };
  11009. },
  11010. "PSEUDO": function( pseudo, argument ) {
  11011. // pseudo-class names are case-insensitive
  11012. // http://www.w3.org/TR/selectors/#pseudo-classes
  11013. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  11014. // Remember that setFilters inherits from pseudos
  11015. var args,
  11016. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  11017. Sizzle.error( "unsupported pseudo: " + pseudo );
  11018. // The user may use createPseudo to indicate that
  11019. // arguments are needed to create the filter function
  11020. // just as Sizzle does
  11021. if ( fn[ expando ] ) {
  11022. return fn( argument );
  11023. }
  11024. // But maintain support for old signatures
  11025. if ( fn.length > 1 ) {
  11026. args = [ pseudo, pseudo, "", argument ];
  11027. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  11028. markFunction(function( seed, matches ) {
  11029. var idx,
  11030. matched = fn( seed, argument ),
  11031. i = matched.length;
  11032. while ( i-- ) {
  11033. idx = indexOf( seed, matched[i] );
  11034. seed[ idx ] = !( matches[ idx ] = matched[i] );
  11035. }
  11036. }) :
  11037. function( elem ) {
  11038. return fn( elem, 0, args );
  11039. };
  11040. }
  11041. return fn;
  11042. }
  11043. },
  11044. pseudos: {
  11045. // Potentially complex pseudos
  11046. "not": markFunction(function( selector ) {
  11047. // Trim the selector passed to compile
  11048. // to avoid treating leading and trailing
  11049. // spaces as combinators
  11050. var input = [],
  11051. results = [],
  11052. matcher = compile( selector.replace( rtrim, "$1" ) );
  11053. return matcher[ expando ] ?
  11054. markFunction(function( seed, matches, context, xml ) {
  11055. var elem,
  11056. unmatched = matcher( seed, null, xml, [] ),
  11057. i = seed.length;
  11058. // Match elements unmatched by `matcher`
  11059. while ( i-- ) {
  11060. if ( (elem = unmatched[i]) ) {
  11061. seed[i] = !(matches[i] = elem);
  11062. }
  11063. }
  11064. }) :
  11065. function( elem, context, xml ) {
  11066. input[0] = elem;
  11067. matcher( input, null, xml, results );
  11068. // Don't keep the element (issue #299)
  11069. input[0] = null;
  11070. return !results.pop();
  11071. };
  11072. }),
  11073. "has": markFunction(function( selector ) {
  11074. return function( elem ) {
  11075. return Sizzle( selector, elem ).length > 0;
  11076. };
  11077. }),
  11078. "contains": markFunction(function( text ) {
  11079. text = text.replace( runescape, funescape );
  11080. return function( elem ) {
  11081. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  11082. };
  11083. }),
  11084. // "Whether an element is represented by a :lang() selector
  11085. // is based solely on the element's language value
  11086. // being equal to the identifier C,
  11087. // or beginning with the identifier C immediately followed by "-".
  11088. // The matching of C against the element's language value is performed case-insensitively.
  11089. // The identifier C does not have to be a valid language name."
  11090. // http://www.w3.org/TR/selectors/#lang-pseudo
  11091. "lang": markFunction( function( lang ) {
  11092. // lang value must be a valid identifier
  11093. if ( !ridentifier.test(lang || "") ) {
  11094. Sizzle.error( "unsupported lang: " + lang );
  11095. }
  11096. lang = lang.replace( runescape, funescape ).toLowerCase();
  11097. return function( elem ) {
  11098. var elemLang;
  11099. do {
  11100. if ( (elemLang = documentIsHTML ?
  11101. elem.lang :
  11102. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  11103. elemLang = elemLang.toLowerCase();
  11104. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  11105. }
  11106. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  11107. return false;
  11108. };
  11109. }),
  11110. // Miscellaneous
  11111. "target": function( elem ) {
  11112. var hash = window.location && window.location.hash;
  11113. return hash && hash.slice( 1 ) === elem.id;
  11114. },
  11115. "root": function( elem ) {
  11116. return elem === docElem;
  11117. },
  11118. "focus": function( elem ) {
  11119. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  11120. },
  11121. // Boolean properties
  11122. "enabled": createDisabledPseudo( false ),
  11123. "disabled": createDisabledPseudo( true ),
  11124. "checked": function( elem ) {
  11125. // In CSS3, :checked should return both checked and selected elements
  11126. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  11127. var nodeName = elem.nodeName.toLowerCase();
  11128. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  11129. },
  11130. "selected": function( elem ) {
  11131. // Accessing this property makes selected-by-default
  11132. // options in Safari work properly
  11133. if ( elem.parentNode ) {
  11134. elem.parentNode.selectedIndex;
  11135. }
  11136. return elem.selected === true;
  11137. },
  11138. // Contents
  11139. "empty": function( elem ) {
  11140. // http://www.w3.org/TR/selectors/#empty-pseudo
  11141. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  11142. // but not by others (comment: 8; processing instruction: 7; etc.)
  11143. // nodeType < 6 works because attributes (2) do not appear as children
  11144. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  11145. if ( elem.nodeType < 6 ) {
  11146. return false;
  11147. }
  11148. }
  11149. return true;
  11150. },
  11151. "parent": function( elem ) {
  11152. return !Expr.pseudos["empty"]( elem );
  11153. },
  11154. // Element/input types
  11155. "header": function( elem ) {
  11156. return rheader.test( elem.nodeName );
  11157. },
  11158. "input": function( elem ) {
  11159. return rinputs.test( elem.nodeName );
  11160. },
  11161. "button": function( elem ) {
  11162. var name = elem.nodeName.toLowerCase();
  11163. return name === "input" && elem.type === "button" || name === "button";
  11164. },
  11165. "text": function( elem ) {
  11166. var attr;
  11167. return elem.nodeName.toLowerCase() === "input" &&
  11168. elem.type === "text" &&
  11169. // Support: IE<8
  11170. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  11171. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  11172. },
  11173. // Position-in-collection
  11174. "first": createPositionalPseudo(function() {
  11175. return [ 0 ];
  11176. }),
  11177. "last": createPositionalPseudo(function( matchIndexes, length ) {
  11178. return [ length - 1 ];
  11179. }),
  11180. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  11181. return [ argument < 0 ? argument + length : argument ];
  11182. }),
  11183. "even": createPositionalPseudo(function( matchIndexes, length ) {
  11184. var i = 0;
  11185. for ( ; i < length; i += 2 ) {
  11186. matchIndexes.push( i );
  11187. }
  11188. return matchIndexes;
  11189. }),
  11190. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  11191. var i = 1;
  11192. for ( ; i < length; i += 2 ) {
  11193. matchIndexes.push( i );
  11194. }
  11195. return matchIndexes;
  11196. }),
  11197. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  11198. var i = argument < 0 ?
  11199. argument + length :
  11200. argument > length ?
  11201. length :
  11202. argument;
  11203. for ( ; --i >= 0; ) {
  11204. matchIndexes.push( i );
  11205. }
  11206. return matchIndexes;
  11207. }),
  11208. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  11209. var i = argument < 0 ? argument + length : argument;
  11210. for ( ; ++i < length; ) {
  11211. matchIndexes.push( i );
  11212. }
  11213. return matchIndexes;
  11214. })
  11215. }
  11216. };
  11217. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  11218. // Add button/input type pseudos
  11219. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  11220. Expr.pseudos[ i ] = createInputPseudo( i );
  11221. }
  11222. for ( i in { submit: true, reset: true } ) {
  11223. Expr.pseudos[ i ] = createButtonPseudo( i );
  11224. }
  11225. // Easy API for creating new setFilters
  11226. function setFilters() {}
  11227. setFilters.prototype = Expr.filters = Expr.pseudos;
  11228. Expr.setFilters = new setFilters();
  11229. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  11230. var matched, match, tokens, type,
  11231. soFar, groups, preFilters,
  11232. cached = tokenCache[ selector + " " ];
  11233. if ( cached ) {
  11234. return parseOnly ? 0 : cached.slice( 0 );
  11235. }
  11236. soFar = selector;
  11237. groups = [];
  11238. preFilters = Expr.preFilter;
  11239. while ( soFar ) {
  11240. // Comma and first run
  11241. if ( !matched || (match = rcomma.exec( soFar )) ) {
  11242. if ( match ) {
  11243. // Don't consume trailing commas as valid
  11244. soFar = soFar.slice( match[0].length ) || soFar;
  11245. }
  11246. groups.push( (tokens = []) );
  11247. }
  11248. matched = false;
  11249. // Combinators
  11250. if ( (match = rcombinators.exec( soFar )) ) {
  11251. matched = match.shift();
  11252. tokens.push({
  11253. value: matched,
  11254. // Cast descendant combinators to space
  11255. type: match[0].replace( rtrim, " " )
  11256. });
  11257. soFar = soFar.slice( matched.length );
  11258. }
  11259. // Filters
  11260. for ( type in Expr.filter ) {
  11261. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  11262. (match = preFilters[ type ]( match ))) ) {
  11263. matched = match.shift();
  11264. tokens.push({
  11265. value: matched,
  11266. type: type,
  11267. matches: match
  11268. });
  11269. soFar = soFar.slice( matched.length );
  11270. }
  11271. }
  11272. if ( !matched ) {
  11273. break;
  11274. }
  11275. }
  11276. // Return the length of the invalid excess
  11277. // if we're just parsing
  11278. // Otherwise, throw an error or return tokens
  11279. return parseOnly ?
  11280. soFar.length :
  11281. soFar ?
  11282. Sizzle.error( selector ) :
  11283. // Cache the tokens
  11284. tokenCache( selector, groups ).slice( 0 );
  11285. };
  11286. function toSelector( tokens ) {
  11287. var i = 0,
  11288. len = tokens.length,
  11289. selector = "";
  11290. for ( ; i < len; i++ ) {
  11291. selector += tokens[i].value;
  11292. }
  11293. return selector;
  11294. }
  11295. function addCombinator( matcher, combinator, base ) {
  11296. var dir = combinator.dir,
  11297. skip = combinator.next,
  11298. key = skip || dir,
  11299. checkNonElements = base && key === "parentNode",
  11300. doneName = done++;
  11301. return combinator.first ?
  11302. // Check against closest ancestor/preceding element
  11303. function( elem, context, xml ) {
  11304. while ( (elem = elem[ dir ]) ) {
  11305. if ( elem.nodeType === 1 || checkNonElements ) {
  11306. return matcher( elem, context, xml );
  11307. }
  11308. }
  11309. return false;
  11310. } :
  11311. // Check against all ancestor/preceding elements
  11312. function( elem, context, xml ) {
  11313. var oldCache, uniqueCache, outerCache,
  11314. newCache = [ dirruns, doneName ];
  11315. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  11316. if ( xml ) {
  11317. while ( (elem = elem[ dir ]) ) {
  11318. if ( elem.nodeType === 1 || checkNonElements ) {
  11319. if ( matcher( elem, context, xml ) ) {
  11320. return true;
  11321. }
  11322. }
  11323. }
  11324. } else {
  11325. while ( (elem = elem[ dir ]) ) {
  11326. if ( elem.nodeType === 1 || checkNonElements ) {
  11327. outerCache = elem[ expando ] || (elem[ expando ] = {});
  11328. // Support: IE <9 only
  11329. // Defend against cloned attroperties (jQuery gh-1709)
  11330. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  11331. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  11332. elem = elem[ dir ] || elem;
  11333. } else if ( (oldCache = uniqueCache[ key ]) &&
  11334. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  11335. // Assign to newCache so results back-propagate to previous elements
  11336. return (newCache[ 2 ] = oldCache[ 2 ]);
  11337. } else {
  11338. // Reuse newcache so results back-propagate to previous elements
  11339. uniqueCache[ key ] = newCache;
  11340. // A match means we're done; a fail means we have to keep checking
  11341. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  11342. return true;
  11343. }
  11344. }
  11345. }
  11346. }
  11347. }
  11348. return false;
  11349. };
  11350. }
  11351. function elementMatcher( matchers ) {
  11352. return matchers.length > 1 ?
  11353. function( elem, context, xml ) {
  11354. var i = matchers.length;
  11355. while ( i-- ) {
  11356. if ( !matchers[i]( elem, context, xml ) ) {
  11357. return false;
  11358. }
  11359. }
  11360. return true;
  11361. } :
  11362. matchers[0];
  11363. }
  11364. function multipleContexts( selector, contexts, results ) {
  11365. var i = 0,
  11366. len = contexts.length;
  11367. for ( ; i < len; i++ ) {
  11368. Sizzle( selector, contexts[i], results );
  11369. }
  11370. return results;
  11371. }
  11372. function condense( unmatched, map, filter, context, xml ) {
  11373. var elem,
  11374. newUnmatched = [],
  11375. i = 0,
  11376. len = unmatched.length,
  11377. mapped = map != null;
  11378. for ( ; i < len; i++ ) {
  11379. if ( (elem = unmatched[i]) ) {
  11380. if ( !filter || filter( elem, context, xml ) ) {
  11381. newUnmatched.push( elem );
  11382. if ( mapped ) {
  11383. map.push( i );
  11384. }
  11385. }
  11386. }
  11387. }
  11388. return newUnmatched;
  11389. }
  11390. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  11391. if ( postFilter && !postFilter[ expando ] ) {
  11392. postFilter = setMatcher( postFilter );
  11393. }
  11394. if ( postFinder && !postFinder[ expando ] ) {
  11395. postFinder = setMatcher( postFinder, postSelector );
  11396. }
  11397. return markFunction(function( seed, results, context, xml ) {
  11398. var temp, i, elem,
  11399. preMap = [],
  11400. postMap = [],
  11401. preexisting = results.length,
  11402. // Get initial elements from seed or context
  11403. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  11404. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  11405. matcherIn = preFilter && ( seed || !selector ) ?
  11406. condense( elems, preMap, preFilter, context, xml ) :
  11407. elems,
  11408. matcherOut = matcher ?
  11409. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  11410. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  11411. // ...intermediate processing is necessary
  11412. [] :
  11413. // ...otherwise use results directly
  11414. results :
  11415. matcherIn;
  11416. // Find primary matches
  11417. if ( matcher ) {
  11418. matcher( matcherIn, matcherOut, context, xml );
  11419. }
  11420. // Apply postFilter
  11421. if ( postFilter ) {
  11422. temp = condense( matcherOut, postMap );
  11423. postFilter( temp, [], context, xml );
  11424. // Un-match failing elements by moving them back to matcherIn
  11425. i = temp.length;
  11426. while ( i-- ) {
  11427. if ( (elem = temp[i]) ) {
  11428. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  11429. }
  11430. }
  11431. }
  11432. if ( seed ) {
  11433. if ( postFinder || preFilter ) {
  11434. if ( postFinder ) {
  11435. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  11436. temp = [];
  11437. i = matcherOut.length;
  11438. while ( i-- ) {
  11439. if ( (elem = matcherOut[i]) ) {
  11440. // Restore matcherIn since elem is not yet a final match
  11441. temp.push( (matcherIn[i] = elem) );
  11442. }
  11443. }
  11444. postFinder( null, (matcherOut = []), temp, xml );
  11445. }
  11446. // Move matched elements from seed to results to keep them synchronized
  11447. i = matcherOut.length;
  11448. while ( i-- ) {
  11449. if ( (elem = matcherOut[i]) &&
  11450. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  11451. seed[temp] = !(results[temp] = elem);
  11452. }
  11453. }
  11454. }
  11455. // Add elements to results, through postFinder if defined
  11456. } else {
  11457. matcherOut = condense(
  11458. matcherOut === results ?
  11459. matcherOut.splice( preexisting, matcherOut.length ) :
  11460. matcherOut
  11461. );
  11462. if ( postFinder ) {
  11463. postFinder( null, results, matcherOut, xml );
  11464. } else {
  11465. push.apply( results, matcherOut );
  11466. }
  11467. }
  11468. });
  11469. }
  11470. function matcherFromTokens( tokens ) {
  11471. var checkContext, matcher, j,
  11472. len = tokens.length,
  11473. leadingRelative = Expr.relative[ tokens[0].type ],
  11474. implicitRelative = leadingRelative || Expr.relative[" "],
  11475. i = leadingRelative ? 1 : 0,
  11476. // The foundational matcher ensures that elements are reachable from top-level context(s)
  11477. matchContext = addCombinator( function( elem ) {
  11478. return elem === checkContext;
  11479. }, implicitRelative, true ),
  11480. matchAnyContext = addCombinator( function( elem ) {
  11481. return indexOf( checkContext, elem ) > -1;
  11482. }, implicitRelative, true ),
  11483. matchers = [ function( elem, context, xml ) {
  11484. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  11485. (checkContext = context).nodeType ?
  11486. matchContext( elem, context, xml ) :
  11487. matchAnyContext( elem, context, xml ) );
  11488. // Avoid hanging onto element (issue #299)
  11489. checkContext = null;
  11490. return ret;
  11491. } ];
  11492. for ( ; i < len; i++ ) {
  11493. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  11494. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  11495. } else {
  11496. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  11497. // Return special upon seeing a positional matcher
  11498. if ( matcher[ expando ] ) {
  11499. // Find the next relative operator (if any) for proper handling
  11500. j = ++i;
  11501. for ( ; j < len; j++ ) {
  11502. if ( Expr.relative[ tokens[j].type ] ) {
  11503. break;
  11504. }
  11505. }
  11506. return setMatcher(
  11507. i > 1 && elementMatcher( matchers ),
  11508. i > 1 && toSelector(
  11509. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  11510. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  11511. ).replace( rtrim, "$1" ),
  11512. matcher,
  11513. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  11514. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  11515. j < len && toSelector( tokens )
  11516. );
  11517. }
  11518. matchers.push( matcher );
  11519. }
  11520. }
  11521. return elementMatcher( matchers );
  11522. }
  11523. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  11524. var bySet = setMatchers.length > 0,
  11525. byElement = elementMatchers.length > 0,
  11526. superMatcher = function( seed, context, xml, results, outermost ) {
  11527. var elem, j, matcher,
  11528. matchedCount = 0,
  11529. i = "0",
  11530. unmatched = seed && [],
  11531. setMatched = [],
  11532. contextBackup = outermostContext,
  11533. // We must always have either seed elements or outermost context
  11534. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  11535. // Use integer dirruns iff this is the outermost matcher
  11536. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  11537. len = elems.length;
  11538. if ( outermost ) {
  11539. outermostContext = context === document || context || outermost;
  11540. }
  11541. // Add elements passing elementMatchers directly to results
  11542. // Support: IE<9, Safari
  11543. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  11544. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  11545. if ( byElement && elem ) {
  11546. j = 0;
  11547. if ( !context && elem.ownerDocument !== document ) {
  11548. setDocument( elem );
  11549. xml = !documentIsHTML;
  11550. }
  11551. while ( (matcher = elementMatchers[j++]) ) {
  11552. if ( matcher( elem, context || document, xml) ) {
  11553. results.push( elem );
  11554. break;
  11555. }
  11556. }
  11557. if ( outermost ) {
  11558. dirruns = dirrunsUnique;
  11559. }
  11560. }
  11561. // Track unmatched elements for set filters
  11562. if ( bySet ) {
  11563. // They will have gone through all possible matchers
  11564. if ( (elem = !matcher && elem) ) {
  11565. matchedCount--;
  11566. }
  11567. // Lengthen the array for every element, matched or not
  11568. if ( seed ) {
  11569. unmatched.push( elem );
  11570. }
  11571. }
  11572. }
  11573. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  11574. // makes the latter nonnegative.
  11575. matchedCount += i;
  11576. // Apply set filters to unmatched elements
  11577. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  11578. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  11579. // no element matchers and no seed.
  11580. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  11581. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  11582. // numerically zero.
  11583. if ( bySet && i !== matchedCount ) {
  11584. j = 0;
  11585. while ( (matcher = setMatchers[j++]) ) {
  11586. matcher( unmatched, setMatched, context, xml );
  11587. }
  11588. if ( seed ) {
  11589. // Reintegrate element matches to eliminate the need for sorting
  11590. if ( matchedCount > 0 ) {
  11591. while ( i-- ) {
  11592. if ( !(unmatched[i] || setMatched[i]) ) {
  11593. setMatched[i] = pop.call( results );
  11594. }
  11595. }
  11596. }
  11597. // Discard index placeholder values to get only actual matches
  11598. setMatched = condense( setMatched );
  11599. }
  11600. // Add matches to results
  11601. push.apply( results, setMatched );
  11602. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  11603. if ( outermost && !seed && setMatched.length > 0 &&
  11604. ( matchedCount + setMatchers.length ) > 1 ) {
  11605. Sizzle.uniqueSort( results );
  11606. }
  11607. }
  11608. // Override manipulation of globals by nested matchers
  11609. if ( outermost ) {
  11610. dirruns = dirrunsUnique;
  11611. outermostContext = contextBackup;
  11612. }
  11613. return unmatched;
  11614. };
  11615. return bySet ?
  11616. markFunction( superMatcher ) :
  11617. superMatcher;
  11618. }
  11619. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  11620. var i,
  11621. setMatchers = [],
  11622. elementMatchers = [],
  11623. cached = compilerCache[ selector + " " ];
  11624. if ( !cached ) {
  11625. // Generate a function of recursive functions that can be used to check each element
  11626. if ( !match ) {
  11627. match = tokenize( selector );
  11628. }
  11629. i = match.length;
  11630. while ( i-- ) {
  11631. cached = matcherFromTokens( match[i] );
  11632. if ( cached[ expando ] ) {
  11633. setMatchers.push( cached );
  11634. } else {
  11635. elementMatchers.push( cached );
  11636. }
  11637. }
  11638. // Cache the compiled function
  11639. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  11640. // Save selector and tokenization
  11641. cached.selector = selector;
  11642. }
  11643. return cached;
  11644. };
  11645. /**
  11646. * A low-level selection function that works with Sizzle's compiled
  11647. * selector functions
  11648. * @param {String|Function} selector A selector or a pre-compiled
  11649. * selector function built with Sizzle.compile
  11650. * @param {Element} context
  11651. * @param {Array} [results]
  11652. * @param {Array} [seed] A set of elements to match against
  11653. */
  11654. select = Sizzle.select = function( selector, context, results, seed ) {
  11655. var i, tokens, token, type, find,
  11656. compiled = typeof selector === "function" && selector,
  11657. match = !seed && tokenize( (selector = compiled.selector || selector) );
  11658. results = results || [];
  11659. // Try to minimize operations if there is only one selector in the list and no seed
  11660. // (the latter of which guarantees us context)
  11661. if ( match.length === 1 ) {
  11662. // Reduce context if the leading compound selector is an ID
  11663. tokens = match[0] = match[0].slice( 0 );
  11664. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  11665. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  11666. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  11667. if ( !context ) {
  11668. return results;
  11669. // Precompiled matchers will still verify ancestry, so step up a level
  11670. } else if ( compiled ) {
  11671. context = context.parentNode;
  11672. }
  11673. selector = selector.slice( tokens.shift().value.length );
  11674. }
  11675. // Fetch a seed set for right-to-left matching
  11676. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  11677. while ( i-- ) {
  11678. token = tokens[i];
  11679. // Abort if we hit a combinator
  11680. if ( Expr.relative[ (type = token.type) ] ) {
  11681. break;
  11682. }
  11683. if ( (find = Expr.find[ type ]) ) {
  11684. // Search, expanding context for leading sibling combinators
  11685. if ( (seed = find(
  11686. token.matches[0].replace( runescape, funescape ),
  11687. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  11688. )) ) {
  11689. // If seed is empty or no tokens remain, we can return early
  11690. tokens.splice( i, 1 );
  11691. selector = seed.length && toSelector( tokens );
  11692. if ( !selector ) {
  11693. push.apply( results, seed );
  11694. return results;
  11695. }
  11696. break;
  11697. }
  11698. }
  11699. }
  11700. }
  11701. // Compile and execute a filtering function if one is not provided
  11702. // Provide `match` to avoid retokenization if we modified the selector above
  11703. ( compiled || compile( selector, match ) )(
  11704. seed,
  11705. context,
  11706. !documentIsHTML,
  11707. results,
  11708. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  11709. );
  11710. return results;
  11711. };
  11712. // One-time assignments
  11713. // Sort stability
  11714. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  11715. // Support: Chrome 14-35+
  11716. // Always assume duplicates if they aren't passed to the comparison function
  11717. support.detectDuplicates = !!hasDuplicate;
  11718. // Initialize against the default document
  11719. setDocument();
  11720. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  11721. // Detached nodes confoundingly follow *each other*
  11722. support.sortDetached = assert(function( el ) {
  11723. // Should return 1, but returns 4 (following)
  11724. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  11725. });
  11726. // Support: IE<8
  11727. // Prevent attribute/property "interpolation"
  11728. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  11729. if ( !assert(function( el ) {
  11730. el.innerHTML = "<a href='#'></a>";
  11731. return el.firstChild.getAttribute("href") === "#" ;
  11732. }) ) {
  11733. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  11734. if ( !isXML ) {
  11735. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  11736. }
  11737. });
  11738. }
  11739. // Support: IE<9
  11740. // Use defaultValue in place of getAttribute("value")
  11741. if ( !support.attributes || !assert(function( el ) {
  11742. el.innerHTML = "<input/>";
  11743. el.firstChild.setAttribute( "value", "" );
  11744. return el.firstChild.getAttribute( "value" ) === "";
  11745. }) ) {
  11746. addHandle( "value", function( elem, name, isXML ) {
  11747. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  11748. return elem.defaultValue;
  11749. }
  11750. });
  11751. }
  11752. // Support: IE<9
  11753. // Use getAttributeNode to fetch booleans when getAttribute lies
  11754. if ( !assert(function( el ) {
  11755. return el.getAttribute("disabled") == null;
  11756. }) ) {
  11757. addHandle( booleans, function( elem, name, isXML ) {
  11758. var val;
  11759. if ( !isXML ) {
  11760. return elem[ name ] === true ? name.toLowerCase() :
  11761. (val = elem.getAttributeNode( name )) && val.specified ?
  11762. val.value :
  11763. null;
  11764. }
  11765. });
  11766. }
  11767. return Sizzle;
  11768. })( window );
  11769. jQuery.find = Sizzle;
  11770. jQuery.expr = Sizzle.selectors;
  11771. // Deprecated
  11772. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  11773. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  11774. jQuery.text = Sizzle.getText;
  11775. jQuery.isXMLDoc = Sizzle.isXML;
  11776. jQuery.contains = Sizzle.contains;
  11777. jQuery.escapeSelector = Sizzle.escape;
  11778. var dir = function( elem, dir, until ) {
  11779. var matched = [],
  11780. truncate = until !== undefined;
  11781. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  11782. if ( elem.nodeType === 1 ) {
  11783. if ( truncate && jQuery( elem ).is( until ) ) {
  11784. break;
  11785. }
  11786. matched.push( elem );
  11787. }
  11788. }
  11789. return matched;
  11790. };
  11791. var siblings = function( n, elem ) {
  11792. var matched = [];
  11793. for ( ; n; n = n.nextSibling ) {
  11794. if ( n.nodeType === 1 && n !== elem ) {
  11795. matched.push( n );
  11796. }
  11797. }
  11798. return matched;
  11799. };
  11800. var rneedsContext = jQuery.expr.match.needsContext;
  11801. function nodeName( elem, name ) {
  11802. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  11803. };
  11804. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  11805. // Implement the identical functionality for filter and not
  11806. function winnow( elements, qualifier, not ) {
  11807. if ( isFunction( qualifier ) ) {
  11808. return jQuery.grep( elements, function( elem, i ) {
  11809. return !!qualifier.call( elem, i, elem ) !== not;
  11810. } );
  11811. }
  11812. // Single element
  11813. if ( qualifier.nodeType ) {
  11814. return jQuery.grep( elements, function( elem ) {
  11815. return ( elem === qualifier ) !== not;
  11816. } );
  11817. }
  11818. // Arraylike of elements (jQuery, arguments, Array)
  11819. if ( typeof qualifier !== "string" ) {
  11820. return jQuery.grep( elements, function( elem ) {
  11821. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  11822. } );
  11823. }
  11824. // Filtered directly for both simple and complex selectors
  11825. return jQuery.filter( qualifier, elements, not );
  11826. }
  11827. jQuery.filter = function( expr, elems, not ) {
  11828. var elem = elems[ 0 ];
  11829. if ( not ) {
  11830. expr = ":not(" + expr + ")";
  11831. }
  11832. if ( elems.length === 1 && elem.nodeType === 1 ) {
  11833. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  11834. }
  11835. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  11836. return elem.nodeType === 1;
  11837. } ) );
  11838. };
  11839. jQuery.fn.extend( {
  11840. find: function( selector ) {
  11841. var i, ret,
  11842. len = this.length,
  11843. self = this;
  11844. if ( typeof selector !== "string" ) {
  11845. return this.pushStack( jQuery( selector ).filter( function() {
  11846. for ( i = 0; i < len; i++ ) {
  11847. if ( jQuery.contains( self[ i ], this ) ) {
  11848. return true;
  11849. }
  11850. }
  11851. } ) );
  11852. }
  11853. ret = this.pushStack( [] );
  11854. for ( i = 0; i < len; i++ ) {
  11855. jQuery.find( selector, self[ i ], ret );
  11856. }
  11857. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  11858. },
  11859. filter: function( selector ) {
  11860. return this.pushStack( winnow( this, selector || [], false ) );
  11861. },
  11862. not: function( selector ) {
  11863. return this.pushStack( winnow( this, selector || [], true ) );
  11864. },
  11865. is: function( selector ) {
  11866. return !!winnow(
  11867. this,
  11868. // If this is a positional/relative selector, check membership in the returned set
  11869. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  11870. typeof selector === "string" && rneedsContext.test( selector ) ?
  11871. jQuery( selector ) :
  11872. selector || [],
  11873. false
  11874. ).length;
  11875. }
  11876. } );
  11877. // Initialize a jQuery object
  11878. // A central reference to the root jQuery(document)
  11879. var rootjQuery,
  11880. // A simple way to check for HTML strings
  11881. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  11882. // Strict HTML recognition (#11290: must start with <)
  11883. // Shortcut simple #id case for speed
  11884. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  11885. init = jQuery.fn.init = function( selector, context, root ) {
  11886. var match, elem;
  11887. // HANDLE: $(""), $(null), $(undefined), $(false)
  11888. if ( !selector ) {
  11889. return this;
  11890. }
  11891. // Method init() accepts an alternate rootjQuery
  11892. // so migrate can support jQuery.sub (gh-2101)
  11893. root = root || rootjQuery;
  11894. // Handle HTML strings
  11895. if ( typeof selector === "string" ) {
  11896. if ( selector[ 0 ] === "<" &&
  11897. selector[ selector.length - 1 ] === ">" &&
  11898. selector.length >= 3 ) {
  11899. // Assume that strings that start and end with <> are HTML and skip the regex check
  11900. match = [ null, selector, null ];
  11901. } else {
  11902. match = rquickExpr.exec( selector );
  11903. }
  11904. // Match html or make sure no context is specified for #id
  11905. if ( match && ( match[ 1 ] || !context ) ) {
  11906. // HANDLE: $(html) -> $(array)
  11907. if ( match[ 1 ] ) {
  11908. context = context instanceof jQuery ? context[ 0 ] : context;
  11909. // Option to run scripts is true for back-compat
  11910. // Intentionally let the error be thrown if parseHTML is not present
  11911. jQuery.merge( this, jQuery.parseHTML(
  11912. match[ 1 ],
  11913. context && context.nodeType ? context.ownerDocument || context : document,
  11914. true
  11915. ) );
  11916. // HANDLE: $(html, props)
  11917. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  11918. for ( match in context ) {
  11919. // Properties of context are called as methods if possible
  11920. if ( isFunction( this[ match ] ) ) {
  11921. this[ match ]( context[ match ] );
  11922. // ...and otherwise set as attributes
  11923. } else {
  11924. this.attr( match, context[ match ] );
  11925. }
  11926. }
  11927. }
  11928. return this;
  11929. // HANDLE: $(#id)
  11930. } else {
  11931. elem = document.getElementById( match[ 2 ] );
  11932. if ( elem ) {
  11933. // Inject the element directly into the jQuery object
  11934. this[ 0 ] = elem;
  11935. this.length = 1;
  11936. }
  11937. return this;
  11938. }
  11939. // HANDLE: $(expr, $(...))
  11940. } else if ( !context || context.jquery ) {
  11941. return ( context || root ).find( selector );
  11942. // HANDLE: $(expr, context)
  11943. // (which is just equivalent to: $(context).find(expr)
  11944. } else {
  11945. return this.constructor( context ).find( selector );
  11946. }
  11947. // HANDLE: $(DOMElement)
  11948. } else if ( selector.nodeType ) {
  11949. this[ 0 ] = selector;
  11950. this.length = 1;
  11951. return this;
  11952. // HANDLE: $(function)
  11953. // Shortcut for document ready
  11954. } else if ( isFunction( selector ) ) {
  11955. return root.ready !== undefined ?
  11956. root.ready( selector ) :
  11957. // Execute immediately if ready is not present
  11958. selector( jQuery );
  11959. }
  11960. return jQuery.makeArray( selector, this );
  11961. };
  11962. // Give the init function the jQuery prototype for later instantiation
  11963. init.prototype = jQuery.fn;
  11964. // Initialize central reference
  11965. rootjQuery = jQuery( document );
  11966. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  11967. // Methods guaranteed to produce a unique set when starting from a unique set
  11968. guaranteedUnique = {
  11969. children: true,
  11970. contents: true,
  11971. next: true,
  11972. prev: true
  11973. };
  11974. jQuery.fn.extend( {
  11975. has: function( target ) {
  11976. var targets = jQuery( target, this ),
  11977. l = targets.length;
  11978. return this.filter( function() {
  11979. var i = 0;
  11980. for ( ; i < l; i++ ) {
  11981. if ( jQuery.contains( this, targets[ i ] ) ) {
  11982. return true;
  11983. }
  11984. }
  11985. } );
  11986. },
  11987. closest: function( selectors, context ) {
  11988. var cur,
  11989. i = 0,
  11990. l = this.length,
  11991. matched = [],
  11992. targets = typeof selectors !== "string" && jQuery( selectors );
  11993. // Positional selectors never match, since there's no _selection_ context
  11994. if ( !rneedsContext.test( selectors ) ) {
  11995. for ( ; i < l; i++ ) {
  11996. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  11997. // Always skip document fragments
  11998. if ( cur.nodeType < 11 && ( targets ?
  11999. targets.index( cur ) > -1 :
  12000. // Don't pass non-elements to Sizzle
  12001. cur.nodeType === 1 &&
  12002. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  12003. matched.push( cur );
  12004. break;
  12005. }
  12006. }
  12007. }
  12008. }
  12009. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  12010. },
  12011. // Determine the position of an element within the set
  12012. index: function( elem ) {
  12013. // No argument, return index in parent
  12014. if ( !elem ) {
  12015. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  12016. }
  12017. // Index in selector
  12018. if ( typeof elem === "string" ) {
  12019. return indexOf.call( jQuery( elem ), this[ 0 ] );
  12020. }
  12021. // Locate the position of the desired element
  12022. return indexOf.call( this,
  12023. // If it receives a jQuery object, the first element is used
  12024. elem.jquery ? elem[ 0 ] : elem
  12025. );
  12026. },
  12027. add: function( selector, context ) {
  12028. return this.pushStack(
  12029. jQuery.uniqueSort(
  12030. jQuery.merge( this.get(), jQuery( selector, context ) )
  12031. )
  12032. );
  12033. },
  12034. addBack: function( selector ) {
  12035. return this.add( selector == null ?
  12036. this.prevObject : this.prevObject.filter( selector )
  12037. );
  12038. }
  12039. } );
  12040. function sibling( cur, dir ) {
  12041. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  12042. return cur;
  12043. }
  12044. jQuery.each( {
  12045. parent: function( elem ) {
  12046. var parent = elem.parentNode;
  12047. return parent && parent.nodeType !== 11 ? parent : null;
  12048. },
  12049. parents: function( elem ) {
  12050. return dir( elem, "parentNode" );
  12051. },
  12052. parentsUntil: function( elem, i, until ) {
  12053. return dir( elem, "parentNode", until );
  12054. },
  12055. next: function( elem ) {
  12056. return sibling( elem, "nextSibling" );
  12057. },
  12058. prev: function( elem ) {
  12059. return sibling( elem, "previousSibling" );
  12060. },
  12061. nextAll: function( elem ) {
  12062. return dir( elem, "nextSibling" );
  12063. },
  12064. prevAll: function( elem ) {
  12065. return dir( elem, "previousSibling" );
  12066. },
  12067. nextUntil: function( elem, i, until ) {
  12068. return dir( elem, "nextSibling", until );
  12069. },
  12070. prevUntil: function( elem, i, until ) {
  12071. return dir( elem, "previousSibling", until );
  12072. },
  12073. siblings: function( elem ) {
  12074. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  12075. },
  12076. children: function( elem ) {
  12077. return siblings( elem.firstChild );
  12078. },
  12079. contents: function( elem ) {
  12080. if ( typeof elem.contentDocument !== "undefined" ) {
  12081. return elem.contentDocument;
  12082. }
  12083. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  12084. // Treat the template element as a regular one in browsers that
  12085. // don't support it.
  12086. if ( nodeName( elem, "template" ) ) {
  12087. elem = elem.content || elem;
  12088. }
  12089. return jQuery.merge( [], elem.childNodes );
  12090. }
  12091. }, function( name, fn ) {
  12092. jQuery.fn[ name ] = function( until, selector ) {
  12093. var matched = jQuery.map( this, fn, until );
  12094. if ( name.slice( -5 ) !== "Until" ) {
  12095. selector = until;
  12096. }
  12097. if ( selector && typeof selector === "string" ) {
  12098. matched = jQuery.filter( selector, matched );
  12099. }
  12100. if ( this.length > 1 ) {
  12101. // Remove duplicates
  12102. if ( !guaranteedUnique[ name ] ) {
  12103. jQuery.uniqueSort( matched );
  12104. }
  12105. // Reverse order for parents* and prev-derivatives
  12106. if ( rparentsprev.test( name ) ) {
  12107. matched.reverse();
  12108. }
  12109. }
  12110. return this.pushStack( matched );
  12111. };
  12112. } );
  12113. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  12114. // Convert String-formatted options into Object-formatted ones
  12115. function createOptions( options ) {
  12116. var object = {};
  12117. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  12118. object[ flag ] = true;
  12119. } );
  12120. return object;
  12121. }
  12122. /*
  12123. * Create a callback list using the following parameters:
  12124. *
  12125. * options: an optional list of space-separated options that will change how
  12126. * the callback list behaves or a more traditional option object
  12127. *
  12128. * By default a callback list will act like an event callback list and can be
  12129. * "fired" multiple times.
  12130. *
  12131. * Possible options:
  12132. *
  12133. * once: will ensure the callback list can only be fired once (like a Deferred)
  12134. *
  12135. * memory: will keep track of previous values and will call any callback added
  12136. * after the list has been fired right away with the latest "memorized"
  12137. * values (like a Deferred)
  12138. *
  12139. * unique: will ensure a callback can only be added once (no duplicate in the list)
  12140. *
  12141. * stopOnFalse: interrupt callings when a callback returns false
  12142. *
  12143. */
  12144. jQuery.Callbacks = function( options ) {
  12145. // Convert options from String-formatted to Object-formatted if needed
  12146. // (we check in cache first)
  12147. options = typeof options === "string" ?
  12148. createOptions( options ) :
  12149. jQuery.extend( {}, options );
  12150. var // Flag to know if list is currently firing
  12151. firing,
  12152. // Last fire value for non-forgettable lists
  12153. memory,
  12154. // Flag to know if list was already fired
  12155. fired,
  12156. // Flag to prevent firing
  12157. locked,
  12158. // Actual callback list
  12159. list = [],
  12160. // Queue of execution data for repeatable lists
  12161. queue = [],
  12162. // Index of currently firing callback (modified by add/remove as needed)
  12163. firingIndex = -1,
  12164. // Fire callbacks
  12165. fire = function() {
  12166. // Enforce single-firing
  12167. locked = locked || options.once;
  12168. // Execute callbacks for all pending executions,
  12169. // respecting firingIndex overrides and runtime changes
  12170. fired = firing = true;
  12171. for ( ; queue.length; firingIndex = -1 ) {
  12172. memory = queue.shift();
  12173. while ( ++firingIndex < list.length ) {
  12174. // Run callback and check for early termination
  12175. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  12176. options.stopOnFalse ) {
  12177. // Jump to end and forget the data so .add doesn't re-fire
  12178. firingIndex = list.length;
  12179. memory = false;
  12180. }
  12181. }
  12182. }
  12183. // Forget the data if we're done with it
  12184. if ( !options.memory ) {
  12185. memory = false;
  12186. }
  12187. firing = false;
  12188. // Clean up if we're done firing for good
  12189. if ( locked ) {
  12190. // Keep an empty list if we have data for future add calls
  12191. if ( memory ) {
  12192. list = [];
  12193. // Otherwise, this object is spent
  12194. } else {
  12195. list = "";
  12196. }
  12197. }
  12198. },
  12199. // Actual Callbacks object
  12200. self = {
  12201. // Add a callback or a collection of callbacks to the list
  12202. add: function() {
  12203. if ( list ) {
  12204. // If we have memory from a past run, we should fire after adding
  12205. if ( memory && !firing ) {
  12206. firingIndex = list.length - 1;
  12207. queue.push( memory );
  12208. }
  12209. ( function add( args ) {
  12210. jQuery.each( args, function( _, arg ) {
  12211. if ( isFunction( arg ) ) {
  12212. if ( !options.unique || !self.has( arg ) ) {
  12213. list.push( arg );
  12214. }
  12215. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  12216. // Inspect recursively
  12217. add( arg );
  12218. }
  12219. } );
  12220. } )( arguments );
  12221. if ( memory && !firing ) {
  12222. fire();
  12223. }
  12224. }
  12225. return this;
  12226. },
  12227. // Remove a callback from the list
  12228. remove: function() {
  12229. jQuery.each( arguments, function( _, arg ) {
  12230. var index;
  12231. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  12232. list.splice( index, 1 );
  12233. // Handle firing indexes
  12234. if ( index <= firingIndex ) {
  12235. firingIndex--;
  12236. }
  12237. }
  12238. } );
  12239. return this;
  12240. },
  12241. // Check if a given callback is in the list.
  12242. // If no argument is given, return whether or not list has callbacks attached.
  12243. has: function( fn ) {
  12244. return fn ?
  12245. jQuery.inArray( fn, list ) > -1 :
  12246. list.length > 0;
  12247. },
  12248. // Remove all callbacks from the list
  12249. empty: function() {
  12250. if ( list ) {
  12251. list = [];
  12252. }
  12253. return this;
  12254. },
  12255. // Disable .fire and .add
  12256. // Abort any current/pending executions
  12257. // Clear all callbacks and values
  12258. disable: function() {
  12259. locked = queue = [];
  12260. list = memory = "";
  12261. return this;
  12262. },
  12263. disabled: function() {
  12264. return !list;
  12265. },
  12266. // Disable .fire
  12267. // Also disable .add unless we have memory (since it would have no effect)
  12268. // Abort any pending executions
  12269. lock: function() {
  12270. locked = queue = [];
  12271. if ( !memory && !firing ) {
  12272. list = memory = "";
  12273. }
  12274. return this;
  12275. },
  12276. locked: function() {
  12277. return !!locked;
  12278. },
  12279. // Call all callbacks with the given context and arguments
  12280. fireWith: function( context, args ) {
  12281. if ( !locked ) {
  12282. args = args || [];
  12283. args = [ context, args.slice ? args.slice() : args ];
  12284. queue.push( args );
  12285. if ( !firing ) {
  12286. fire();
  12287. }
  12288. }
  12289. return this;
  12290. },
  12291. // Call all the callbacks with the given arguments
  12292. fire: function() {
  12293. self.fireWith( this, arguments );
  12294. return this;
  12295. },
  12296. // To know if the callbacks have already been called at least once
  12297. fired: function() {
  12298. return !!fired;
  12299. }
  12300. };
  12301. return self;
  12302. };
  12303. function Identity( v ) {
  12304. return v;
  12305. }
  12306. function Thrower( ex ) {
  12307. throw ex;
  12308. }
  12309. function adoptValue( value, resolve, reject, noValue ) {
  12310. var method;
  12311. try {
  12312. // Check for promise aspect first to privilege synchronous behavior
  12313. if ( value && isFunction( ( method = value.promise ) ) ) {
  12314. method.call( value ).done( resolve ).fail( reject );
  12315. // Other thenables
  12316. } else if ( value && isFunction( ( method = value.then ) ) ) {
  12317. method.call( value, resolve, reject );
  12318. // Other non-thenables
  12319. } else {
  12320. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  12321. // * false: [ value ].slice( 0 ) => resolve( value )
  12322. // * true: [ value ].slice( 1 ) => resolve()
  12323. resolve.apply( undefined, [ value ].slice( noValue ) );
  12324. }
  12325. // For Promises/A+, convert exceptions into rejections
  12326. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  12327. // Deferred#then to conditionally suppress rejection.
  12328. } catch ( value ) {
  12329. // Support: Android 4.0 only
  12330. // Strict mode functions invoked without .call/.apply get global-object context
  12331. reject.apply( undefined, [ value ] );
  12332. }
  12333. }
  12334. jQuery.extend( {
  12335. Deferred: function( func ) {
  12336. var tuples = [
  12337. // action, add listener, callbacks,
  12338. // ... .then handlers, argument index, [final state]
  12339. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  12340. jQuery.Callbacks( "memory" ), 2 ],
  12341. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  12342. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  12343. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  12344. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  12345. ],
  12346. state = "pending",
  12347. promise = {
  12348. state: function() {
  12349. return state;
  12350. },
  12351. always: function() {
  12352. deferred.done( arguments ).fail( arguments );
  12353. return this;
  12354. },
  12355. "catch": function( fn ) {
  12356. return promise.then( null, fn );
  12357. },
  12358. // Keep pipe for back-compat
  12359. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  12360. var fns = arguments;
  12361. return jQuery.Deferred( function( newDefer ) {
  12362. jQuery.each( tuples, function( i, tuple ) {
  12363. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  12364. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  12365. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  12366. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  12367. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  12368. deferred[ tuple[ 1 ] ]( function() {
  12369. var returned = fn && fn.apply( this, arguments );
  12370. if ( returned && isFunction( returned.promise ) ) {
  12371. returned.promise()
  12372. .progress( newDefer.notify )
  12373. .done( newDefer.resolve )
  12374. .fail( newDefer.reject );
  12375. } else {
  12376. newDefer[ tuple[ 0 ] + "With" ](
  12377. this,
  12378. fn ? [ returned ] : arguments
  12379. );
  12380. }
  12381. } );
  12382. } );
  12383. fns = null;
  12384. } ).promise();
  12385. },
  12386. then: function( onFulfilled, onRejected, onProgress ) {
  12387. var maxDepth = 0;
  12388. function resolve( depth, deferred, handler, special ) {
  12389. return function() {
  12390. var that = this,
  12391. args = arguments,
  12392. mightThrow = function() {
  12393. var returned, then;
  12394. // Support: Promises/A+ section 2.3.3.3.3
  12395. // https://promisesaplus.com/#point-59
  12396. // Ignore double-resolution attempts
  12397. if ( depth < maxDepth ) {
  12398. return;
  12399. }
  12400. returned = handler.apply( that, args );
  12401. // Support: Promises/A+ section 2.3.1
  12402. // https://promisesaplus.com/#point-48
  12403. if ( returned === deferred.promise() ) {
  12404. throw new TypeError( "Thenable self-resolution" );
  12405. }
  12406. // Support: Promises/A+ sections 2.3.3.1, 3.5
  12407. // https://promisesaplus.com/#point-54
  12408. // https://promisesaplus.com/#point-75
  12409. // Retrieve `then` only once
  12410. then = returned &&
  12411. // Support: Promises/A+ section 2.3.4
  12412. // https://promisesaplus.com/#point-64
  12413. // Only check objects and functions for thenability
  12414. ( typeof returned === "object" ||
  12415. typeof returned === "function" ) &&
  12416. returned.then;
  12417. // Handle a returned thenable
  12418. if ( isFunction( then ) ) {
  12419. // Special processors (notify) just wait for resolution
  12420. if ( special ) {
  12421. then.call(
  12422. returned,
  12423. resolve( maxDepth, deferred, Identity, special ),
  12424. resolve( maxDepth, deferred, Thrower, special )
  12425. );
  12426. // Normal processors (resolve) also hook into progress
  12427. } else {
  12428. // ...and disregard older resolution values
  12429. maxDepth++;
  12430. then.call(
  12431. returned,
  12432. resolve( maxDepth, deferred, Identity, special ),
  12433. resolve( maxDepth, deferred, Thrower, special ),
  12434. resolve( maxDepth, deferred, Identity,
  12435. deferred.notifyWith )
  12436. );
  12437. }
  12438. // Handle all other returned values
  12439. } else {
  12440. // Only substitute handlers pass on context
  12441. // and multiple values (non-spec behavior)
  12442. if ( handler !== Identity ) {
  12443. that = undefined;
  12444. args = [ returned ];
  12445. }
  12446. // Process the value(s)
  12447. // Default process is resolve
  12448. ( special || deferred.resolveWith )( that, args );
  12449. }
  12450. },
  12451. // Only normal processors (resolve) catch and reject exceptions
  12452. process = special ?
  12453. mightThrow :
  12454. function() {
  12455. try {
  12456. mightThrow();
  12457. } catch ( e ) {
  12458. if ( jQuery.Deferred.exceptionHook ) {
  12459. jQuery.Deferred.exceptionHook( e,
  12460. process.stackTrace );
  12461. }
  12462. // Support: Promises/A+ section 2.3.3.3.4.1
  12463. // https://promisesaplus.com/#point-61
  12464. // Ignore post-resolution exceptions
  12465. if ( depth + 1 >= maxDepth ) {
  12466. // Only substitute handlers pass on context
  12467. // and multiple values (non-spec behavior)
  12468. if ( handler !== Thrower ) {
  12469. that = undefined;
  12470. args = [ e ];
  12471. }
  12472. deferred.rejectWith( that, args );
  12473. }
  12474. }
  12475. };
  12476. // Support: Promises/A+ section 2.3.3.3.1
  12477. // https://promisesaplus.com/#point-57
  12478. // Re-resolve promises immediately to dodge false rejection from
  12479. // subsequent errors
  12480. if ( depth ) {
  12481. process();
  12482. } else {
  12483. // Call an optional hook to record the stack, in case of exception
  12484. // since it's otherwise lost when execution goes async
  12485. if ( jQuery.Deferred.getStackHook ) {
  12486. process.stackTrace = jQuery.Deferred.getStackHook();
  12487. }
  12488. window.setTimeout( process );
  12489. }
  12490. };
  12491. }
  12492. return jQuery.Deferred( function( newDefer ) {
  12493. // progress_handlers.add( ... )
  12494. tuples[ 0 ][ 3 ].add(
  12495. resolve(
  12496. 0,
  12497. newDefer,
  12498. isFunction( onProgress ) ?
  12499. onProgress :
  12500. Identity,
  12501. newDefer.notifyWith
  12502. )
  12503. );
  12504. // fulfilled_handlers.add( ... )
  12505. tuples[ 1 ][ 3 ].add(
  12506. resolve(
  12507. 0,
  12508. newDefer,
  12509. isFunction( onFulfilled ) ?
  12510. onFulfilled :
  12511. Identity
  12512. )
  12513. );
  12514. // rejected_handlers.add( ... )
  12515. tuples[ 2 ][ 3 ].add(
  12516. resolve(
  12517. 0,
  12518. newDefer,
  12519. isFunction( onRejected ) ?
  12520. onRejected :
  12521. Thrower
  12522. )
  12523. );
  12524. } ).promise();
  12525. },
  12526. // Get a promise for this deferred
  12527. // If obj is provided, the promise aspect is added to the object
  12528. promise: function( obj ) {
  12529. return obj != null ? jQuery.extend( obj, promise ) : promise;
  12530. }
  12531. },
  12532. deferred = {};
  12533. // Add list-specific methods
  12534. jQuery.each( tuples, function( i, tuple ) {
  12535. var list = tuple[ 2 ],
  12536. stateString = tuple[ 5 ];
  12537. // promise.progress = list.add
  12538. // promise.done = list.add
  12539. // promise.fail = list.add
  12540. promise[ tuple[ 1 ] ] = list.add;
  12541. // Handle state
  12542. if ( stateString ) {
  12543. list.add(
  12544. function() {
  12545. // state = "resolved" (i.e., fulfilled)
  12546. // state = "rejected"
  12547. state = stateString;
  12548. },
  12549. // rejected_callbacks.disable
  12550. // fulfilled_callbacks.disable
  12551. tuples[ 3 - i ][ 2 ].disable,
  12552. // rejected_handlers.disable
  12553. // fulfilled_handlers.disable
  12554. tuples[ 3 - i ][ 3 ].disable,
  12555. // progress_callbacks.lock
  12556. tuples[ 0 ][ 2 ].lock,
  12557. // progress_handlers.lock
  12558. tuples[ 0 ][ 3 ].lock
  12559. );
  12560. }
  12561. // progress_handlers.fire
  12562. // fulfilled_handlers.fire
  12563. // rejected_handlers.fire
  12564. list.add( tuple[ 3 ].fire );
  12565. // deferred.notify = function() { deferred.notifyWith(...) }
  12566. // deferred.resolve = function() { deferred.resolveWith(...) }
  12567. // deferred.reject = function() { deferred.rejectWith(...) }
  12568. deferred[ tuple[ 0 ] ] = function() {
  12569. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  12570. return this;
  12571. };
  12572. // deferred.notifyWith = list.fireWith
  12573. // deferred.resolveWith = list.fireWith
  12574. // deferred.rejectWith = list.fireWith
  12575. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  12576. } );
  12577. // Make the deferred a promise
  12578. promise.promise( deferred );
  12579. // Call given func if any
  12580. if ( func ) {
  12581. func.call( deferred, deferred );
  12582. }
  12583. // All done!
  12584. return deferred;
  12585. },
  12586. // Deferred helper
  12587. when: function( singleValue ) {
  12588. var
  12589. // count of uncompleted subordinates
  12590. remaining = arguments.length,
  12591. // count of unprocessed arguments
  12592. i = remaining,
  12593. // subordinate fulfillment data
  12594. resolveContexts = Array( i ),
  12595. resolveValues = slice.call( arguments ),
  12596. // the master Deferred
  12597. master = jQuery.Deferred(),
  12598. // subordinate callback factory
  12599. updateFunc = function( i ) {
  12600. return function( value ) {
  12601. resolveContexts[ i ] = this;
  12602. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  12603. if ( !( --remaining ) ) {
  12604. master.resolveWith( resolveContexts, resolveValues );
  12605. }
  12606. };
  12607. };
  12608. // Single- and empty arguments are adopted like Promise.resolve
  12609. if ( remaining <= 1 ) {
  12610. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  12611. !remaining );
  12612. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  12613. if ( master.state() === "pending" ||
  12614. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  12615. return master.then();
  12616. }
  12617. }
  12618. // Multiple arguments are aggregated like Promise.all array elements
  12619. while ( i-- ) {
  12620. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  12621. }
  12622. return master.promise();
  12623. }
  12624. } );
  12625. // These usually indicate a programmer mistake during development,
  12626. // warn about them ASAP rather than swallowing them by default.
  12627. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  12628. jQuery.Deferred.exceptionHook = function( error, stack ) {
  12629. // Support: IE 8 - 9 only
  12630. // Console exists when dev tools are open, which can happen at any time
  12631. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  12632. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  12633. }
  12634. };
  12635. jQuery.readyException = function( error ) {
  12636. window.setTimeout( function() {
  12637. throw error;
  12638. } );
  12639. };
  12640. // The deferred used on DOM ready
  12641. var readyList = jQuery.Deferred();
  12642. jQuery.fn.ready = function( fn ) {
  12643. readyList
  12644. .then( fn )
  12645. // Wrap jQuery.readyException in a function so that the lookup
  12646. // happens at the time of error handling instead of callback
  12647. // registration.
  12648. .catch( function( error ) {
  12649. jQuery.readyException( error );
  12650. } );
  12651. return this;
  12652. };
  12653. jQuery.extend( {
  12654. // Is the DOM ready to be used? Set to true once it occurs.
  12655. isReady: false,
  12656. // A counter to track how many items to wait for before
  12657. // the ready event fires. See #6781
  12658. readyWait: 1,
  12659. // Handle when the DOM is ready
  12660. ready: function( wait ) {
  12661. // Abort if there are pending holds or we're already ready
  12662. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  12663. return;
  12664. }
  12665. // Remember that the DOM is ready
  12666. jQuery.isReady = true;
  12667. // If a normal DOM Ready event fired, decrement, and wait if need be
  12668. if ( wait !== true && --jQuery.readyWait > 0 ) {
  12669. return;
  12670. }
  12671. // If there are functions bound, to execute
  12672. readyList.resolveWith( document, [ jQuery ] );
  12673. }
  12674. } );
  12675. jQuery.ready.then = readyList.then;
  12676. // The ready event handler and self cleanup method
  12677. function completed() {
  12678. document.removeEventListener( "DOMContentLoaded", completed );
  12679. window.removeEventListener( "load", completed );
  12680. jQuery.ready();
  12681. }
  12682. // Catch cases where $(document).ready() is called
  12683. // after the browser event has already occurred.
  12684. // Support: IE <=9 - 10 only
  12685. // Older IE sometimes signals "interactive" too soon
  12686. if ( document.readyState === "complete" ||
  12687. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  12688. // Handle it asynchronously to allow scripts the opportunity to delay ready
  12689. window.setTimeout( jQuery.ready );
  12690. } else {
  12691. // Use the handy event callback
  12692. document.addEventListener( "DOMContentLoaded", completed );
  12693. // A fallback to window.onload, that will always work
  12694. window.addEventListener( "load", completed );
  12695. }
  12696. // Multifunctional method to get and set values of a collection
  12697. // The value/s can optionally be executed if it's a function
  12698. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  12699. var i = 0,
  12700. len = elems.length,
  12701. bulk = key == null;
  12702. // Sets many values
  12703. if ( toType( key ) === "object" ) {
  12704. chainable = true;
  12705. for ( i in key ) {
  12706. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  12707. }
  12708. // Sets one value
  12709. } else if ( value !== undefined ) {
  12710. chainable = true;
  12711. if ( !isFunction( value ) ) {
  12712. raw = true;
  12713. }
  12714. if ( bulk ) {
  12715. // Bulk operations run against the entire set
  12716. if ( raw ) {
  12717. fn.call( elems, value );
  12718. fn = null;
  12719. // ...except when executing function values
  12720. } else {
  12721. bulk = fn;
  12722. fn = function( elem, key, value ) {
  12723. return bulk.call( jQuery( elem ), value );
  12724. };
  12725. }
  12726. }
  12727. if ( fn ) {
  12728. for ( ; i < len; i++ ) {
  12729. fn(
  12730. elems[ i ], key, raw ?
  12731. value :
  12732. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  12733. );
  12734. }
  12735. }
  12736. }
  12737. if ( chainable ) {
  12738. return elems;
  12739. }
  12740. // Gets
  12741. if ( bulk ) {
  12742. return fn.call( elems );
  12743. }
  12744. return len ? fn( elems[ 0 ], key ) : emptyGet;
  12745. };
  12746. // Matches dashed string for camelizing
  12747. var rmsPrefix = /^-ms-/,
  12748. rdashAlpha = /-([a-z])/g;
  12749. // Used by camelCase as callback to replace()
  12750. function fcamelCase( all, letter ) {
  12751. return letter.toUpperCase();
  12752. }
  12753. // Convert dashed to camelCase; used by the css and data modules
  12754. // Support: IE <=9 - 11, Edge 12 - 15
  12755. // Microsoft forgot to hump their vendor prefix (#9572)
  12756. function camelCase( string ) {
  12757. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  12758. }
  12759. var acceptData = function( owner ) {
  12760. // Accepts only:
  12761. // - Node
  12762. // - Node.ELEMENT_NODE
  12763. // - Node.DOCUMENT_NODE
  12764. // - Object
  12765. // - Any
  12766. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  12767. };
  12768. function Data() {
  12769. this.expando = jQuery.expando + Data.uid++;
  12770. }
  12771. Data.uid = 1;
  12772. Data.prototype = {
  12773. cache: function( owner ) {
  12774. // Check if the owner object already has a cache
  12775. var value = owner[ this.expando ];
  12776. // If not, create one
  12777. if ( !value ) {
  12778. value = {};
  12779. // We can accept data for non-element nodes in modern browsers,
  12780. // but we should not, see #8335.
  12781. // Always return an empty object.
  12782. if ( acceptData( owner ) ) {
  12783. // If it is a node unlikely to be stringify-ed or looped over
  12784. // use plain assignment
  12785. if ( owner.nodeType ) {
  12786. owner[ this.expando ] = value;
  12787. // Otherwise secure it in a non-enumerable property
  12788. // configurable must be true to allow the property to be
  12789. // deleted when data is removed
  12790. } else {
  12791. Object.defineProperty( owner, this.expando, {
  12792. value: value,
  12793. configurable: true
  12794. } );
  12795. }
  12796. }
  12797. }
  12798. return value;
  12799. },
  12800. set: function( owner, data, value ) {
  12801. var prop,
  12802. cache = this.cache( owner );
  12803. // Handle: [ owner, key, value ] args
  12804. // Always use camelCase key (gh-2257)
  12805. if ( typeof data === "string" ) {
  12806. cache[ camelCase( data ) ] = value;
  12807. // Handle: [ owner, { properties } ] args
  12808. } else {
  12809. // Copy the properties one-by-one to the cache object
  12810. for ( prop in data ) {
  12811. cache[ camelCase( prop ) ] = data[ prop ];
  12812. }
  12813. }
  12814. return cache;
  12815. },
  12816. get: function( owner, key ) {
  12817. return key === undefined ?
  12818. this.cache( owner ) :
  12819. // Always use camelCase key (gh-2257)
  12820. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  12821. },
  12822. access: function( owner, key, value ) {
  12823. // In cases where either:
  12824. //
  12825. // 1. No key was specified
  12826. // 2. A string key was specified, but no value provided
  12827. //
  12828. // Take the "read" path and allow the get method to determine
  12829. // which value to return, respectively either:
  12830. //
  12831. // 1. The entire cache object
  12832. // 2. The data stored at the key
  12833. //
  12834. if ( key === undefined ||
  12835. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  12836. return this.get( owner, key );
  12837. }
  12838. // When the key is not a string, or both a key and value
  12839. // are specified, set or extend (existing objects) with either:
  12840. //
  12841. // 1. An object of properties
  12842. // 2. A key and value
  12843. //
  12844. this.set( owner, key, value );
  12845. // Since the "set" path can have two possible entry points
  12846. // return the expected data based on which path was taken[*]
  12847. return value !== undefined ? value : key;
  12848. },
  12849. remove: function( owner, key ) {
  12850. var i,
  12851. cache = owner[ this.expando ];
  12852. if ( cache === undefined ) {
  12853. return;
  12854. }
  12855. if ( key !== undefined ) {
  12856. // Support array or space separated string of keys
  12857. if ( Array.isArray( key ) ) {
  12858. // If key is an array of keys...
  12859. // We always set camelCase keys, so remove that.
  12860. key = key.map( camelCase );
  12861. } else {
  12862. key = camelCase( key );
  12863. // If a key with the spaces exists, use it.
  12864. // Otherwise, create an array by matching non-whitespace
  12865. key = key in cache ?
  12866. [ key ] :
  12867. ( key.match( rnothtmlwhite ) || [] );
  12868. }
  12869. i = key.length;
  12870. while ( i-- ) {
  12871. delete cache[ key[ i ] ];
  12872. }
  12873. }
  12874. // Remove the expando if there's no more data
  12875. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  12876. // Support: Chrome <=35 - 45
  12877. // Webkit & Blink performance suffers when deleting properties
  12878. // from DOM nodes, so set to undefined instead
  12879. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  12880. if ( owner.nodeType ) {
  12881. owner[ this.expando ] = undefined;
  12882. } else {
  12883. delete owner[ this.expando ];
  12884. }
  12885. }
  12886. },
  12887. hasData: function( owner ) {
  12888. var cache = owner[ this.expando ];
  12889. return cache !== undefined && !jQuery.isEmptyObject( cache );
  12890. }
  12891. };
  12892. var dataPriv = new Data();
  12893. var dataUser = new Data();
  12894. // Implementation Summary
  12895. //
  12896. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  12897. // 2. Improve the module's maintainability by reducing the storage
  12898. // paths to a single mechanism.
  12899. // 3. Use the same single mechanism to support "private" and "user" data.
  12900. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  12901. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  12902. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  12903. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  12904. rmultiDash = /[A-Z]/g;
  12905. function getData( data ) {
  12906. if ( data === "true" ) {
  12907. return true;
  12908. }
  12909. if ( data === "false" ) {
  12910. return false;
  12911. }
  12912. if ( data === "null" ) {
  12913. return null;
  12914. }
  12915. // Only convert to a number if it doesn't change the string
  12916. if ( data === +data + "" ) {
  12917. return +data;
  12918. }
  12919. if ( rbrace.test( data ) ) {
  12920. return JSON.parse( data );
  12921. }
  12922. return data;
  12923. }
  12924. function dataAttr( elem, key, data ) {
  12925. var name;
  12926. // If nothing was found internally, try to fetch any
  12927. // data from the HTML5 data-* attribute
  12928. if ( data === undefined && elem.nodeType === 1 ) {
  12929. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  12930. data = elem.getAttribute( name );
  12931. if ( typeof data === "string" ) {
  12932. try {
  12933. data = getData( data );
  12934. } catch ( e ) {}
  12935. // Make sure we set the data so it isn't changed later
  12936. dataUser.set( elem, key, data );
  12937. } else {
  12938. data = undefined;
  12939. }
  12940. }
  12941. return data;
  12942. }
  12943. jQuery.extend( {
  12944. hasData: function( elem ) {
  12945. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  12946. },
  12947. data: function( elem, name, data ) {
  12948. return dataUser.access( elem, name, data );
  12949. },
  12950. removeData: function( elem, name ) {
  12951. dataUser.remove( elem, name );
  12952. },
  12953. // TODO: Now that all calls to _data and _removeData have been replaced
  12954. // with direct calls to dataPriv methods, these can be deprecated.
  12955. _data: function( elem, name, data ) {
  12956. return dataPriv.access( elem, name, data );
  12957. },
  12958. _removeData: function( elem, name ) {
  12959. dataPriv.remove( elem, name );
  12960. }
  12961. } );
  12962. jQuery.fn.extend( {
  12963. data: function( key, value ) {
  12964. var i, name, data,
  12965. elem = this[ 0 ],
  12966. attrs = elem && elem.attributes;
  12967. // Gets all values
  12968. if ( key === undefined ) {
  12969. if ( this.length ) {
  12970. data = dataUser.get( elem );
  12971. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  12972. i = attrs.length;
  12973. while ( i-- ) {
  12974. // Support: IE 11 only
  12975. // The attrs elements can be null (#14894)
  12976. if ( attrs[ i ] ) {
  12977. name = attrs[ i ].name;
  12978. if ( name.indexOf( "data-" ) === 0 ) {
  12979. name = camelCase( name.slice( 5 ) );
  12980. dataAttr( elem, name, data[ name ] );
  12981. }
  12982. }
  12983. }
  12984. dataPriv.set( elem, "hasDataAttrs", true );
  12985. }
  12986. }
  12987. return data;
  12988. }
  12989. // Sets multiple values
  12990. if ( typeof key === "object" ) {
  12991. return this.each( function() {
  12992. dataUser.set( this, key );
  12993. } );
  12994. }
  12995. return access( this, function( value ) {
  12996. var data;
  12997. // The calling jQuery object (element matches) is not empty
  12998. // (and therefore has an element appears at this[ 0 ]) and the
  12999. // `value` parameter was not undefined. An empty jQuery object
  13000. // will result in `undefined` for elem = this[ 0 ] which will
  13001. // throw an exception if an attempt to read a data cache is made.
  13002. if ( elem && value === undefined ) {
  13003. // Attempt to get data from the cache
  13004. // The key will always be camelCased in Data
  13005. data = dataUser.get( elem, key );
  13006. if ( data !== undefined ) {
  13007. return data;
  13008. }
  13009. // Attempt to "discover" the data in
  13010. // HTML5 custom data-* attrs
  13011. data = dataAttr( elem, key );
  13012. if ( data !== undefined ) {
  13013. return data;
  13014. }
  13015. // We tried really hard, but the data doesn't exist.
  13016. return;
  13017. }
  13018. // Set the data...
  13019. this.each( function() {
  13020. // We always store the camelCased key
  13021. dataUser.set( this, key, value );
  13022. } );
  13023. }, null, value, arguments.length > 1, null, true );
  13024. },
  13025. removeData: function( key ) {
  13026. return this.each( function() {
  13027. dataUser.remove( this, key );
  13028. } );
  13029. }
  13030. } );
  13031. jQuery.extend( {
  13032. queue: function( elem, type, data ) {
  13033. var queue;
  13034. if ( elem ) {
  13035. type = ( type || "fx" ) + "queue";
  13036. queue = dataPriv.get( elem, type );
  13037. // Speed up dequeue by getting out quickly if this is just a lookup
  13038. if ( data ) {
  13039. if ( !queue || Array.isArray( data ) ) {
  13040. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  13041. } else {
  13042. queue.push( data );
  13043. }
  13044. }
  13045. return queue || [];
  13046. }
  13047. },
  13048. dequeue: function( elem, type ) {
  13049. type = type || "fx";
  13050. var queue = jQuery.queue( elem, type ),
  13051. startLength = queue.length,
  13052. fn = queue.shift(),
  13053. hooks = jQuery._queueHooks( elem, type ),
  13054. next = function() {
  13055. jQuery.dequeue( elem, type );
  13056. };
  13057. // If the fx queue is dequeued, always remove the progress sentinel
  13058. if ( fn === "inprogress" ) {
  13059. fn = queue.shift();
  13060. startLength--;
  13061. }
  13062. if ( fn ) {
  13063. // Add a progress sentinel to prevent the fx queue from being
  13064. // automatically dequeued
  13065. if ( type === "fx" ) {
  13066. queue.unshift( "inprogress" );
  13067. }
  13068. // Clear up the last queue stop function
  13069. delete hooks.stop;
  13070. fn.call( elem, next, hooks );
  13071. }
  13072. if ( !startLength && hooks ) {
  13073. hooks.empty.fire();
  13074. }
  13075. },
  13076. // Not public - generate a queueHooks object, or return the current one
  13077. _queueHooks: function( elem, type ) {
  13078. var key = type + "queueHooks";
  13079. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  13080. empty: jQuery.Callbacks( "once memory" ).add( function() {
  13081. dataPriv.remove( elem, [ type + "queue", key ] );
  13082. } )
  13083. } );
  13084. }
  13085. } );
  13086. jQuery.fn.extend( {
  13087. queue: function( type, data ) {
  13088. var setter = 2;
  13089. if ( typeof type !== "string" ) {
  13090. data = type;
  13091. type = "fx";
  13092. setter--;
  13093. }
  13094. if ( arguments.length < setter ) {
  13095. return jQuery.queue( this[ 0 ], type );
  13096. }
  13097. return data === undefined ?
  13098. this :
  13099. this.each( function() {
  13100. var queue = jQuery.queue( this, type, data );
  13101. // Ensure a hooks for this queue
  13102. jQuery._queueHooks( this, type );
  13103. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  13104. jQuery.dequeue( this, type );
  13105. }
  13106. } );
  13107. },
  13108. dequeue: function( type ) {
  13109. return this.each( function() {
  13110. jQuery.dequeue( this, type );
  13111. } );
  13112. },
  13113. clearQueue: function( type ) {
  13114. return this.queue( type || "fx", [] );
  13115. },
  13116. // Get a promise resolved when queues of a certain type
  13117. // are emptied (fx is the type by default)
  13118. promise: function( type, obj ) {
  13119. var tmp,
  13120. count = 1,
  13121. defer = jQuery.Deferred(),
  13122. elements = this,
  13123. i = this.length,
  13124. resolve = function() {
  13125. if ( !( --count ) ) {
  13126. defer.resolveWith( elements, [ elements ] );
  13127. }
  13128. };
  13129. if ( typeof type !== "string" ) {
  13130. obj = type;
  13131. type = undefined;
  13132. }
  13133. type = type || "fx";
  13134. while ( i-- ) {
  13135. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  13136. if ( tmp && tmp.empty ) {
  13137. count++;
  13138. tmp.empty.add( resolve );
  13139. }
  13140. }
  13141. resolve();
  13142. return defer.promise( obj );
  13143. }
  13144. } );
  13145. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  13146. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  13147. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  13148. var documentElement = document.documentElement;
  13149. var isAttached = function( elem ) {
  13150. return jQuery.contains( elem.ownerDocument, elem );
  13151. },
  13152. composed = { composed: true };
  13153. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  13154. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  13155. // Support: iOS 10.0-10.2 only
  13156. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  13157. // leading to errors. We need to check for `getRootNode`.
  13158. if ( documentElement.getRootNode ) {
  13159. isAttached = function( elem ) {
  13160. return jQuery.contains( elem.ownerDocument, elem ) ||
  13161. elem.getRootNode( composed ) === elem.ownerDocument;
  13162. };
  13163. }
  13164. var isHiddenWithinTree = function( elem, el ) {
  13165. // isHiddenWithinTree might be called from jQuery#filter function;
  13166. // in that case, element will be second argument
  13167. elem = el || elem;
  13168. // Inline style trumps all
  13169. return elem.style.display === "none" ||
  13170. elem.style.display === "" &&
  13171. // Otherwise, check computed style
  13172. // Support: Firefox <=43 - 45
  13173. // Disconnected elements can have computed display: none, so first confirm that elem is
  13174. // in the document.
  13175. isAttached( elem ) &&
  13176. jQuery.css( elem, "display" ) === "none";
  13177. };
  13178. var swap = function( elem, options, callback, args ) {
  13179. var ret, name,
  13180. old = {};
  13181. // Remember the old values, and insert the new ones
  13182. for ( name in options ) {
  13183. old[ name ] = elem.style[ name ];
  13184. elem.style[ name ] = options[ name ];
  13185. }
  13186. ret = callback.apply( elem, args || [] );
  13187. // Revert the old values
  13188. for ( name in options ) {
  13189. elem.style[ name ] = old[ name ];
  13190. }
  13191. return ret;
  13192. };
  13193. function adjustCSS( elem, prop, valueParts, tween ) {
  13194. var adjusted, scale,
  13195. maxIterations = 20,
  13196. currentValue = tween ?
  13197. function() {
  13198. return tween.cur();
  13199. } :
  13200. function() {
  13201. return jQuery.css( elem, prop, "" );
  13202. },
  13203. initial = currentValue(),
  13204. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  13205. // Starting value computation is required for potential unit mismatches
  13206. initialInUnit = elem.nodeType &&
  13207. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  13208. rcssNum.exec( jQuery.css( elem, prop ) );
  13209. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  13210. // Support: Firefox <=54
  13211. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  13212. initial = initial / 2;
  13213. // Trust units reported by jQuery.css
  13214. unit = unit || initialInUnit[ 3 ];
  13215. // Iteratively approximate from a nonzero starting point
  13216. initialInUnit = +initial || 1;
  13217. while ( maxIterations-- ) {
  13218. // Evaluate and update our best guess (doubling guesses that zero out).
  13219. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  13220. jQuery.style( elem, prop, initialInUnit + unit );
  13221. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  13222. maxIterations = 0;
  13223. }
  13224. initialInUnit = initialInUnit / scale;
  13225. }
  13226. initialInUnit = initialInUnit * 2;
  13227. jQuery.style( elem, prop, initialInUnit + unit );
  13228. // Make sure we update the tween properties later on
  13229. valueParts = valueParts || [];
  13230. }
  13231. if ( valueParts ) {
  13232. initialInUnit = +initialInUnit || +initial || 0;
  13233. // Apply relative offset (+=/-=) if specified
  13234. adjusted = valueParts[ 1 ] ?
  13235. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  13236. +valueParts[ 2 ];
  13237. if ( tween ) {
  13238. tween.unit = unit;
  13239. tween.start = initialInUnit;
  13240. tween.end = adjusted;
  13241. }
  13242. }
  13243. return adjusted;
  13244. }
  13245. var defaultDisplayMap = {};
  13246. function getDefaultDisplay( elem ) {
  13247. var temp,
  13248. doc = elem.ownerDocument,
  13249. nodeName = elem.nodeName,
  13250. display = defaultDisplayMap[ nodeName ];
  13251. if ( display ) {
  13252. return display;
  13253. }
  13254. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  13255. display = jQuery.css( temp, "display" );
  13256. temp.parentNode.removeChild( temp );
  13257. if ( display === "none" ) {
  13258. display = "block";
  13259. }
  13260. defaultDisplayMap[ nodeName ] = display;
  13261. return display;
  13262. }
  13263. function showHide( elements, show ) {
  13264. var display, elem,
  13265. values = [],
  13266. index = 0,
  13267. length = elements.length;
  13268. // Determine new display value for elements that need to change
  13269. for ( ; index < length; index++ ) {
  13270. elem = elements[ index ];
  13271. if ( !elem.style ) {
  13272. continue;
  13273. }
  13274. display = elem.style.display;
  13275. if ( show ) {
  13276. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  13277. // check is required in this first loop unless we have a nonempty display value (either
  13278. // inline or about-to-be-restored)
  13279. if ( display === "none" ) {
  13280. values[ index ] = dataPriv.get( elem, "display" ) || null;
  13281. if ( !values[ index ] ) {
  13282. elem.style.display = "";
  13283. }
  13284. }
  13285. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  13286. values[ index ] = getDefaultDisplay( elem );
  13287. }
  13288. } else {
  13289. if ( display !== "none" ) {
  13290. values[ index ] = "none";
  13291. // Remember what we're overwriting
  13292. dataPriv.set( elem, "display", display );
  13293. }
  13294. }
  13295. }
  13296. // Set the display of the elements in a second loop to avoid constant reflow
  13297. for ( index = 0; index < length; index++ ) {
  13298. if ( values[ index ] != null ) {
  13299. elements[ index ].style.display = values[ index ];
  13300. }
  13301. }
  13302. return elements;
  13303. }
  13304. jQuery.fn.extend( {
  13305. show: function() {
  13306. return showHide( this, true );
  13307. },
  13308. hide: function() {
  13309. return showHide( this );
  13310. },
  13311. toggle: function( state ) {
  13312. if ( typeof state === "boolean" ) {
  13313. return state ? this.show() : this.hide();
  13314. }
  13315. return this.each( function() {
  13316. if ( isHiddenWithinTree( this ) ) {
  13317. jQuery( this ).show();
  13318. } else {
  13319. jQuery( this ).hide();
  13320. }
  13321. } );
  13322. }
  13323. } );
  13324. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  13325. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  13326. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  13327. // We have to close these tags to support XHTML (#13200)
  13328. var wrapMap = {
  13329. // Support: IE <=9 only
  13330. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  13331. // XHTML parsers do not magically insert elements in the
  13332. // same way that tag soup parsers do. So we cannot shorten
  13333. // this by omitting <tbody> or other required elements.
  13334. thead: [ 1, "<table>", "</table>" ],
  13335. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  13336. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  13337. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  13338. _default: [ 0, "", "" ]
  13339. };
  13340. // Support: IE <=9 only
  13341. wrapMap.optgroup = wrapMap.option;
  13342. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  13343. wrapMap.th = wrapMap.td;
  13344. function getAll( context, tag ) {
  13345. // Support: IE <=9 - 11 only
  13346. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  13347. var ret;
  13348. if ( typeof context.getElementsByTagName !== "undefined" ) {
  13349. ret = context.getElementsByTagName( tag || "*" );
  13350. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  13351. ret = context.querySelectorAll( tag || "*" );
  13352. } else {
  13353. ret = [];
  13354. }
  13355. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  13356. return jQuery.merge( [ context ], ret );
  13357. }
  13358. return ret;
  13359. }
  13360. // Mark scripts as having already been evaluated
  13361. function setGlobalEval( elems, refElements ) {
  13362. var i = 0,
  13363. l = elems.length;
  13364. for ( ; i < l; i++ ) {
  13365. dataPriv.set(
  13366. elems[ i ],
  13367. "globalEval",
  13368. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  13369. );
  13370. }
  13371. }
  13372. var rhtml = /<|&#?\w+;/;
  13373. function buildFragment( elems, context, scripts, selection, ignored ) {
  13374. var elem, tmp, tag, wrap, attached, j,
  13375. fragment = context.createDocumentFragment(),
  13376. nodes = [],
  13377. i = 0,
  13378. l = elems.length;
  13379. for ( ; i < l; i++ ) {
  13380. elem = elems[ i ];
  13381. if ( elem || elem === 0 ) {
  13382. // Add nodes directly
  13383. if ( toType( elem ) === "object" ) {
  13384. // Support: Android <=4.0 only, PhantomJS 1 only
  13385. // push.apply(_, arraylike) throws on ancient WebKit
  13386. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  13387. // Convert non-html into a text node
  13388. } else if ( !rhtml.test( elem ) ) {
  13389. nodes.push( context.createTextNode( elem ) );
  13390. // Convert html into DOM nodes
  13391. } else {
  13392. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  13393. // Deserialize a standard representation
  13394. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  13395. wrap = wrapMap[ tag ] || wrapMap._default;
  13396. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  13397. // Descend through wrappers to the right content
  13398. j = wrap[ 0 ];
  13399. while ( j-- ) {
  13400. tmp = tmp.lastChild;
  13401. }
  13402. // Support: Android <=4.0 only, PhantomJS 1 only
  13403. // push.apply(_, arraylike) throws on ancient WebKit
  13404. jQuery.merge( nodes, tmp.childNodes );
  13405. // Remember the top-level container
  13406. tmp = fragment.firstChild;
  13407. // Ensure the created nodes are orphaned (#12392)
  13408. tmp.textContent = "";
  13409. }
  13410. }
  13411. }
  13412. // Remove wrapper from fragment
  13413. fragment.textContent = "";
  13414. i = 0;
  13415. while ( ( elem = nodes[ i++ ] ) ) {
  13416. // Skip elements already in the context collection (trac-4087)
  13417. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  13418. if ( ignored ) {
  13419. ignored.push( elem );
  13420. }
  13421. continue;
  13422. }
  13423. attached = isAttached( elem );
  13424. // Append to fragment
  13425. tmp = getAll( fragment.appendChild( elem ), "script" );
  13426. // Preserve script evaluation history
  13427. if ( attached ) {
  13428. setGlobalEval( tmp );
  13429. }
  13430. // Capture executables
  13431. if ( scripts ) {
  13432. j = 0;
  13433. while ( ( elem = tmp[ j++ ] ) ) {
  13434. if ( rscriptType.test( elem.type || "" ) ) {
  13435. scripts.push( elem );
  13436. }
  13437. }
  13438. }
  13439. }
  13440. return fragment;
  13441. }
  13442. ( function() {
  13443. var fragment = document.createDocumentFragment(),
  13444. div = fragment.appendChild( document.createElement( "div" ) ),
  13445. input = document.createElement( "input" );
  13446. // Support: Android 4.0 - 4.3 only
  13447. // Check state lost if the name is set (#11217)
  13448. // Support: Windows Web Apps (WWA)
  13449. // `name` and `type` must use .setAttribute for WWA (#14901)
  13450. input.setAttribute( "type", "radio" );
  13451. input.setAttribute( "checked", "checked" );
  13452. input.setAttribute( "name", "t" );
  13453. div.appendChild( input );
  13454. // Support: Android <=4.1 only
  13455. // Older WebKit doesn't clone checked state correctly in fragments
  13456. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  13457. // Support: IE <=11 only
  13458. // Make sure textarea (and checkbox) defaultValue is properly cloned
  13459. div.innerHTML = "<textarea>x</textarea>";
  13460. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  13461. } )();
  13462. var
  13463. rkeyEvent = /^key/,
  13464. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  13465. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  13466. function returnTrue() {
  13467. return true;
  13468. }
  13469. function returnFalse() {
  13470. return false;
  13471. }
  13472. // Support: IE <=9 - 11+
  13473. // focus() and blur() are asynchronous, except when they are no-op.
  13474. // So expect focus to be synchronous when the element is already active,
  13475. // and blur to be synchronous when the element is not already active.
  13476. // (focus and blur are always synchronous in other supported browsers,
  13477. // this just defines when we can count on it).
  13478. function expectSync( elem, type ) {
  13479. return ( elem === safeActiveElement() ) === ( type === "focus" );
  13480. }
  13481. // Support: IE <=9 only
  13482. // Accessing document.activeElement can throw unexpectedly
  13483. // https://bugs.jquery.com/ticket/13393
  13484. function safeActiveElement() {
  13485. try {
  13486. return document.activeElement;
  13487. } catch ( err ) { }
  13488. }
  13489. function on( elem, types, selector, data, fn, one ) {
  13490. var origFn, type;
  13491. // Types can be a map of types/handlers
  13492. if ( typeof types === "object" ) {
  13493. // ( types-Object, selector, data )
  13494. if ( typeof selector !== "string" ) {
  13495. // ( types-Object, data )
  13496. data = data || selector;
  13497. selector = undefined;
  13498. }
  13499. for ( type in types ) {
  13500. on( elem, type, selector, data, types[ type ], one );
  13501. }
  13502. return elem;
  13503. }
  13504. if ( data == null && fn == null ) {
  13505. // ( types, fn )
  13506. fn = selector;
  13507. data = selector = undefined;
  13508. } else if ( fn == null ) {
  13509. if ( typeof selector === "string" ) {
  13510. // ( types, selector, fn )
  13511. fn = data;
  13512. data = undefined;
  13513. } else {
  13514. // ( types, data, fn )
  13515. fn = data;
  13516. data = selector;
  13517. selector = undefined;
  13518. }
  13519. }
  13520. if ( fn === false ) {
  13521. fn = returnFalse;
  13522. } else if ( !fn ) {
  13523. return elem;
  13524. }
  13525. if ( one === 1 ) {
  13526. origFn = fn;
  13527. fn = function( event ) {
  13528. // Can use an empty set, since event contains the info
  13529. jQuery().off( event );
  13530. return origFn.apply( this, arguments );
  13531. };
  13532. // Use same guid so caller can remove using origFn
  13533. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  13534. }
  13535. return elem.each( function() {
  13536. jQuery.event.add( this, types, fn, data, selector );
  13537. } );
  13538. }
  13539. /*
  13540. * Helper functions for managing events -- not part of the public interface.
  13541. * Props to Dean Edwards' addEvent library for many of the ideas.
  13542. */
  13543. jQuery.event = {
  13544. global: {},
  13545. add: function( elem, types, handler, data, selector ) {
  13546. var handleObjIn, eventHandle, tmp,
  13547. events, t, handleObj,
  13548. special, handlers, type, namespaces, origType,
  13549. elemData = dataPriv.get( elem );
  13550. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  13551. if ( !elemData ) {
  13552. return;
  13553. }
  13554. // Caller can pass in an object of custom data in lieu of the handler
  13555. if ( handler.handler ) {
  13556. handleObjIn = handler;
  13557. handler = handleObjIn.handler;
  13558. selector = handleObjIn.selector;
  13559. }
  13560. // Ensure that invalid selectors throw exceptions at attach time
  13561. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  13562. if ( selector ) {
  13563. jQuery.find.matchesSelector( documentElement, selector );
  13564. }
  13565. // Make sure that the handler has a unique ID, used to find/remove it later
  13566. if ( !handler.guid ) {
  13567. handler.guid = jQuery.guid++;
  13568. }
  13569. // Init the element's event structure and main handler, if this is the first
  13570. if ( !( events = elemData.events ) ) {
  13571. events = elemData.events = {};
  13572. }
  13573. if ( !( eventHandle = elemData.handle ) ) {
  13574. eventHandle = elemData.handle = function( e ) {
  13575. // Discard the second event of a jQuery.event.trigger() and
  13576. // when an event is called after a page has unloaded
  13577. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  13578. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  13579. };
  13580. }
  13581. // Handle multiple events separated by a space
  13582. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  13583. t = types.length;
  13584. while ( t-- ) {
  13585. tmp = rtypenamespace.exec( types[ t ] ) || [];
  13586. type = origType = tmp[ 1 ];
  13587. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  13588. // There *must* be a type, no attaching namespace-only handlers
  13589. if ( !type ) {
  13590. continue;
  13591. }
  13592. // If event changes its type, use the special event handlers for the changed type
  13593. special = jQuery.event.special[ type ] || {};
  13594. // If selector defined, determine special event api type, otherwise given type
  13595. type = ( selector ? special.delegateType : special.bindType ) || type;
  13596. // Update special based on newly reset type
  13597. special = jQuery.event.special[ type ] || {};
  13598. // handleObj is passed to all event handlers
  13599. handleObj = jQuery.extend( {
  13600. type: type,
  13601. origType: origType,
  13602. data: data,
  13603. handler: handler,
  13604. guid: handler.guid,
  13605. selector: selector,
  13606. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  13607. namespace: namespaces.join( "." )
  13608. }, handleObjIn );
  13609. // Init the event handler queue if we're the first
  13610. if ( !( handlers = events[ type ] ) ) {
  13611. handlers = events[ type ] = [];
  13612. handlers.delegateCount = 0;
  13613. // Only use addEventListener if the special events handler returns false
  13614. if ( !special.setup ||
  13615. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  13616. if ( elem.addEventListener ) {
  13617. elem.addEventListener( type, eventHandle );
  13618. }
  13619. }
  13620. }
  13621. if ( special.add ) {
  13622. special.add.call( elem, handleObj );
  13623. if ( !handleObj.handler.guid ) {
  13624. handleObj.handler.guid = handler.guid;
  13625. }
  13626. }
  13627. // Add to the element's handler list, delegates in front
  13628. if ( selector ) {
  13629. handlers.splice( handlers.delegateCount++, 0, handleObj );
  13630. } else {
  13631. handlers.push( handleObj );
  13632. }
  13633. // Keep track of which events have ever been used, for event optimization
  13634. jQuery.event.global[ type ] = true;
  13635. }
  13636. },
  13637. // Detach an event or set of events from an element
  13638. remove: function( elem, types, handler, selector, mappedTypes ) {
  13639. var j, origCount, tmp,
  13640. events, t, handleObj,
  13641. special, handlers, type, namespaces, origType,
  13642. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  13643. if ( !elemData || !( events = elemData.events ) ) {
  13644. return;
  13645. }
  13646. // Once for each type.namespace in types; type may be omitted
  13647. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  13648. t = types.length;
  13649. while ( t-- ) {
  13650. tmp = rtypenamespace.exec( types[ t ] ) || [];
  13651. type = origType = tmp[ 1 ];
  13652. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  13653. // Unbind all events (on this namespace, if provided) for the element
  13654. if ( !type ) {
  13655. for ( type in events ) {
  13656. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  13657. }
  13658. continue;
  13659. }
  13660. special = jQuery.event.special[ type ] || {};
  13661. type = ( selector ? special.delegateType : special.bindType ) || type;
  13662. handlers = events[ type ] || [];
  13663. tmp = tmp[ 2 ] &&
  13664. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  13665. // Remove matching events
  13666. origCount = j = handlers.length;
  13667. while ( j-- ) {
  13668. handleObj = handlers[ j ];
  13669. if ( ( mappedTypes || origType === handleObj.origType ) &&
  13670. ( !handler || handler.guid === handleObj.guid ) &&
  13671. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  13672. ( !selector || selector === handleObj.selector ||
  13673. selector === "**" && handleObj.selector ) ) {
  13674. handlers.splice( j, 1 );
  13675. if ( handleObj.selector ) {
  13676. handlers.delegateCount--;
  13677. }
  13678. if ( special.remove ) {
  13679. special.remove.call( elem, handleObj );
  13680. }
  13681. }
  13682. }
  13683. // Remove generic event handler if we removed something and no more handlers exist
  13684. // (avoids potential for endless recursion during removal of special event handlers)
  13685. if ( origCount && !handlers.length ) {
  13686. if ( !special.teardown ||
  13687. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  13688. jQuery.removeEvent( elem, type, elemData.handle );
  13689. }
  13690. delete events[ type ];
  13691. }
  13692. }
  13693. // Remove data and the expando if it's no longer used
  13694. if ( jQuery.isEmptyObject( events ) ) {
  13695. dataPriv.remove( elem, "handle events" );
  13696. }
  13697. },
  13698. dispatch: function( nativeEvent ) {
  13699. // Make a writable jQuery.Event from the native event object
  13700. var event = jQuery.event.fix( nativeEvent );
  13701. var i, j, ret, matched, handleObj, handlerQueue,
  13702. args = new Array( arguments.length ),
  13703. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  13704. special = jQuery.event.special[ event.type ] || {};
  13705. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  13706. args[ 0 ] = event;
  13707. for ( i = 1; i < arguments.length; i++ ) {
  13708. args[ i ] = arguments[ i ];
  13709. }
  13710. event.delegateTarget = this;
  13711. // Call the preDispatch hook for the mapped type, and let it bail if desired
  13712. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  13713. return;
  13714. }
  13715. // Determine handlers
  13716. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  13717. // Run delegates first; they may want to stop propagation beneath us
  13718. i = 0;
  13719. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  13720. event.currentTarget = matched.elem;
  13721. j = 0;
  13722. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  13723. !event.isImmediatePropagationStopped() ) {
  13724. // If the event is namespaced, then each handler is only invoked if it is
  13725. // specially universal or its namespaces are a superset of the event's.
  13726. if ( !event.rnamespace || handleObj.namespace === false ||
  13727. event.rnamespace.test( handleObj.namespace ) ) {
  13728. event.handleObj = handleObj;
  13729. event.data = handleObj.data;
  13730. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  13731. handleObj.handler ).apply( matched.elem, args );
  13732. if ( ret !== undefined ) {
  13733. if ( ( event.result = ret ) === false ) {
  13734. event.preventDefault();
  13735. event.stopPropagation();
  13736. }
  13737. }
  13738. }
  13739. }
  13740. }
  13741. // Call the postDispatch hook for the mapped type
  13742. if ( special.postDispatch ) {
  13743. special.postDispatch.call( this, event );
  13744. }
  13745. return event.result;
  13746. },
  13747. handlers: function( event, handlers ) {
  13748. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  13749. handlerQueue = [],
  13750. delegateCount = handlers.delegateCount,
  13751. cur = event.target;
  13752. // Find delegate handlers
  13753. if ( delegateCount &&
  13754. // Support: IE <=9
  13755. // Black-hole SVG <use> instance trees (trac-13180)
  13756. cur.nodeType &&
  13757. // Support: Firefox <=42
  13758. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  13759. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  13760. // Support: IE 11 only
  13761. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  13762. !( event.type === "click" && event.button >= 1 ) ) {
  13763. for ( ; cur !== this; cur = cur.parentNode || this ) {
  13764. // Don't check non-elements (#13208)
  13765. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  13766. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  13767. matchedHandlers = [];
  13768. matchedSelectors = {};
  13769. for ( i = 0; i < delegateCount; i++ ) {
  13770. handleObj = handlers[ i ];
  13771. // Don't conflict with Object.prototype properties (#13203)
  13772. sel = handleObj.selector + " ";
  13773. if ( matchedSelectors[ sel ] === undefined ) {
  13774. matchedSelectors[ sel ] = handleObj.needsContext ?
  13775. jQuery( sel, this ).index( cur ) > -1 :
  13776. jQuery.find( sel, this, null, [ cur ] ).length;
  13777. }
  13778. if ( matchedSelectors[ sel ] ) {
  13779. matchedHandlers.push( handleObj );
  13780. }
  13781. }
  13782. if ( matchedHandlers.length ) {
  13783. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  13784. }
  13785. }
  13786. }
  13787. }
  13788. // Add the remaining (directly-bound) handlers
  13789. cur = this;
  13790. if ( delegateCount < handlers.length ) {
  13791. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  13792. }
  13793. return handlerQueue;
  13794. },
  13795. addProp: function( name, hook ) {
  13796. Object.defineProperty( jQuery.Event.prototype, name, {
  13797. enumerable: true,
  13798. configurable: true,
  13799. get: isFunction( hook ) ?
  13800. function() {
  13801. if ( this.originalEvent ) {
  13802. return hook( this.originalEvent );
  13803. }
  13804. } :
  13805. function() {
  13806. if ( this.originalEvent ) {
  13807. return this.originalEvent[ name ];
  13808. }
  13809. },
  13810. set: function( value ) {
  13811. Object.defineProperty( this, name, {
  13812. enumerable: true,
  13813. configurable: true,
  13814. writable: true,
  13815. value: value
  13816. } );
  13817. }
  13818. } );
  13819. },
  13820. fix: function( originalEvent ) {
  13821. return originalEvent[ jQuery.expando ] ?
  13822. originalEvent :
  13823. new jQuery.Event( originalEvent );
  13824. },
  13825. special: {
  13826. load: {
  13827. // Prevent triggered image.load events from bubbling to window.load
  13828. noBubble: true
  13829. },
  13830. click: {
  13831. // Utilize native event to ensure correct state for checkable inputs
  13832. setup: function( data ) {
  13833. // For mutual compressibility with _default, replace `this` access with a local var.
  13834. // `|| data` is dead code meant only to preserve the variable through minification.
  13835. var el = this || data;
  13836. // Claim the first handler
  13837. if ( rcheckableType.test( el.type ) &&
  13838. el.click && nodeName( el, "input" ) ) {
  13839. // dataPriv.set( el, "click", ... )
  13840. leverageNative( el, "click", returnTrue );
  13841. }
  13842. // Return false to allow normal processing in the caller
  13843. return false;
  13844. },
  13845. trigger: function( data ) {
  13846. // For mutual compressibility with _default, replace `this` access with a local var.
  13847. // `|| data` is dead code meant only to preserve the variable through minification.
  13848. var el = this || data;
  13849. // Force setup before triggering a click
  13850. if ( rcheckableType.test( el.type ) &&
  13851. el.click && nodeName( el, "input" ) ) {
  13852. leverageNative( el, "click" );
  13853. }
  13854. // Return non-false to allow normal event-path propagation
  13855. return true;
  13856. },
  13857. // For cross-browser consistency, suppress native .click() on links
  13858. // Also prevent it if we're currently inside a leveraged native-event stack
  13859. _default: function( event ) {
  13860. var target = event.target;
  13861. return rcheckableType.test( target.type ) &&
  13862. target.click && nodeName( target, "input" ) &&
  13863. dataPriv.get( target, "click" ) ||
  13864. nodeName( target, "a" );
  13865. }
  13866. },
  13867. beforeunload: {
  13868. postDispatch: function( event ) {
  13869. // Support: Firefox 20+
  13870. // Firefox doesn't alert if the returnValue field is not set.
  13871. if ( event.result !== undefined && event.originalEvent ) {
  13872. event.originalEvent.returnValue = event.result;
  13873. }
  13874. }
  13875. }
  13876. }
  13877. };
  13878. // Ensure the presence of an event listener that handles manually-triggered
  13879. // synthetic events by interrupting progress until reinvoked in response to
  13880. // *native* events that it fires directly, ensuring that state changes have
  13881. // already occurred before other listeners are invoked.
  13882. function leverageNative( el, type, expectSync ) {
  13883. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  13884. if ( !expectSync ) {
  13885. if ( dataPriv.get( el, type ) === undefined ) {
  13886. jQuery.event.add( el, type, returnTrue );
  13887. }
  13888. return;
  13889. }
  13890. // Register the controller as a special universal handler for all event namespaces
  13891. dataPriv.set( el, type, false );
  13892. jQuery.event.add( el, type, {
  13893. namespace: false,
  13894. handler: function( event ) {
  13895. var notAsync, result,
  13896. saved = dataPriv.get( this, type );
  13897. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  13898. // Interrupt processing of the outer synthetic .trigger()ed event
  13899. // Saved data should be false in such cases, but might be a leftover capture object
  13900. // from an async native handler (gh-4350)
  13901. if ( !saved.length ) {
  13902. // Store arguments for use when handling the inner native event
  13903. // There will always be at least one argument (an event object), so this array
  13904. // will not be confused with a leftover capture object.
  13905. saved = slice.call( arguments );
  13906. dataPriv.set( this, type, saved );
  13907. // Trigger the native event and capture its result
  13908. // Support: IE <=9 - 11+
  13909. // focus() and blur() are asynchronous
  13910. notAsync = expectSync( this, type );
  13911. this[ type ]();
  13912. result = dataPriv.get( this, type );
  13913. if ( saved !== result || notAsync ) {
  13914. dataPriv.set( this, type, false );
  13915. } else {
  13916. result = {};
  13917. }
  13918. if ( saved !== result ) {
  13919. // Cancel the outer synthetic event
  13920. event.stopImmediatePropagation();
  13921. event.preventDefault();
  13922. return result.value;
  13923. }
  13924. // If this is an inner synthetic event for an event with a bubbling surrogate
  13925. // (focus or blur), assume that the surrogate already propagated from triggering the
  13926. // native event and prevent that from happening again here.
  13927. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  13928. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  13929. // less bad than duplication.
  13930. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  13931. event.stopPropagation();
  13932. }
  13933. // If this is a native event triggered above, everything is now in order
  13934. // Fire an inner synthetic event with the original arguments
  13935. } else if ( saved.length ) {
  13936. // ...and capture the result
  13937. dataPriv.set( this, type, {
  13938. value: jQuery.event.trigger(
  13939. // Support: IE <=9 - 11+
  13940. // Extend with the prototype to reset the above stopImmediatePropagation()
  13941. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  13942. saved.slice( 1 ),
  13943. this
  13944. )
  13945. } );
  13946. // Abort handling of the native event
  13947. event.stopImmediatePropagation();
  13948. }
  13949. }
  13950. } );
  13951. }
  13952. jQuery.removeEvent = function( elem, type, handle ) {
  13953. // This "if" is needed for plain objects
  13954. if ( elem.removeEventListener ) {
  13955. elem.removeEventListener( type, handle );
  13956. }
  13957. };
  13958. jQuery.Event = function( src, props ) {
  13959. // Allow instantiation without the 'new' keyword
  13960. if ( !( this instanceof jQuery.Event ) ) {
  13961. return new jQuery.Event( src, props );
  13962. }
  13963. // Event object
  13964. if ( src && src.type ) {
  13965. this.originalEvent = src;
  13966. this.type = src.type;
  13967. // Events bubbling up the document may have been marked as prevented
  13968. // by a handler lower down the tree; reflect the correct value.
  13969. this.isDefaultPrevented = src.defaultPrevented ||
  13970. src.defaultPrevented === undefined &&
  13971. // Support: Android <=2.3 only
  13972. src.returnValue === false ?
  13973. returnTrue :
  13974. returnFalse;
  13975. // Create target properties
  13976. // Support: Safari <=6 - 7 only
  13977. // Target should not be a text node (#504, #13143)
  13978. this.target = ( src.target && src.target.nodeType === 3 ) ?
  13979. src.target.parentNode :
  13980. src.target;
  13981. this.currentTarget = src.currentTarget;
  13982. this.relatedTarget = src.relatedTarget;
  13983. // Event type
  13984. } else {
  13985. this.type = src;
  13986. }
  13987. // Put explicitly provided properties onto the event object
  13988. if ( props ) {
  13989. jQuery.extend( this, props );
  13990. }
  13991. // Create a timestamp if incoming event doesn't have one
  13992. this.timeStamp = src && src.timeStamp || Date.now();
  13993. // Mark it as fixed
  13994. this[ jQuery.expando ] = true;
  13995. };
  13996. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  13997. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  13998. jQuery.Event.prototype = {
  13999. constructor: jQuery.Event,
  14000. isDefaultPrevented: returnFalse,
  14001. isPropagationStopped: returnFalse,
  14002. isImmediatePropagationStopped: returnFalse,
  14003. isSimulated: false,
  14004. preventDefault: function() {
  14005. var e = this.originalEvent;
  14006. this.isDefaultPrevented = returnTrue;
  14007. if ( e && !this.isSimulated ) {
  14008. e.preventDefault();
  14009. }
  14010. },
  14011. stopPropagation: function() {
  14012. var e = this.originalEvent;
  14013. this.isPropagationStopped = returnTrue;
  14014. if ( e && !this.isSimulated ) {
  14015. e.stopPropagation();
  14016. }
  14017. },
  14018. stopImmediatePropagation: function() {
  14019. var e = this.originalEvent;
  14020. this.isImmediatePropagationStopped = returnTrue;
  14021. if ( e && !this.isSimulated ) {
  14022. e.stopImmediatePropagation();
  14023. }
  14024. this.stopPropagation();
  14025. }
  14026. };
  14027. // Includes all common event props including KeyEvent and MouseEvent specific props
  14028. jQuery.each( {
  14029. altKey: true,
  14030. bubbles: true,
  14031. cancelable: true,
  14032. changedTouches: true,
  14033. ctrlKey: true,
  14034. detail: true,
  14035. eventPhase: true,
  14036. metaKey: true,
  14037. pageX: true,
  14038. pageY: true,
  14039. shiftKey: true,
  14040. view: true,
  14041. "char": true,
  14042. code: true,
  14043. charCode: true,
  14044. key: true,
  14045. keyCode: true,
  14046. button: true,
  14047. buttons: true,
  14048. clientX: true,
  14049. clientY: true,
  14050. offsetX: true,
  14051. offsetY: true,
  14052. pointerId: true,
  14053. pointerType: true,
  14054. screenX: true,
  14055. screenY: true,
  14056. targetTouches: true,
  14057. toElement: true,
  14058. touches: true,
  14059. which: function( event ) {
  14060. var button = event.button;
  14061. // Add which for key events
  14062. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  14063. return event.charCode != null ? event.charCode : event.keyCode;
  14064. }
  14065. // Add which for click: 1 === left; 2 === middle; 3 === right
  14066. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  14067. if ( button & 1 ) {
  14068. return 1;
  14069. }
  14070. if ( button & 2 ) {
  14071. return 3;
  14072. }
  14073. if ( button & 4 ) {
  14074. return 2;
  14075. }
  14076. return 0;
  14077. }
  14078. return event.which;
  14079. }
  14080. }, jQuery.event.addProp );
  14081. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  14082. jQuery.event.special[ type ] = {
  14083. // Utilize native event if possible so blur/focus sequence is correct
  14084. setup: function() {
  14085. // Claim the first handler
  14086. // dataPriv.set( this, "focus", ... )
  14087. // dataPriv.set( this, "blur", ... )
  14088. leverageNative( this, type, expectSync );
  14089. // Return false to allow normal processing in the caller
  14090. return false;
  14091. },
  14092. trigger: function() {
  14093. // Force setup before trigger
  14094. leverageNative( this, type );
  14095. // Return non-false to allow normal event-path propagation
  14096. return true;
  14097. },
  14098. delegateType: delegateType
  14099. };
  14100. } );
  14101. // Create mouseenter/leave events using mouseover/out and event-time checks
  14102. // so that event delegation works in jQuery.
  14103. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  14104. //
  14105. // Support: Safari 7 only
  14106. // Safari sends mouseenter too often; see:
  14107. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  14108. // for the description of the bug (it existed in older Chrome versions as well).
  14109. jQuery.each( {
  14110. mouseenter: "mouseover",
  14111. mouseleave: "mouseout",
  14112. pointerenter: "pointerover",
  14113. pointerleave: "pointerout"
  14114. }, function( orig, fix ) {
  14115. jQuery.event.special[ orig ] = {
  14116. delegateType: fix,
  14117. bindType: fix,
  14118. handle: function( event ) {
  14119. var ret,
  14120. target = this,
  14121. related = event.relatedTarget,
  14122. handleObj = event.handleObj;
  14123. // For mouseenter/leave call the handler if related is outside the target.
  14124. // NB: No relatedTarget if the mouse left/entered the browser window
  14125. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  14126. event.type = handleObj.origType;
  14127. ret = handleObj.handler.apply( this, arguments );
  14128. event.type = fix;
  14129. }
  14130. return ret;
  14131. }
  14132. };
  14133. } );
  14134. jQuery.fn.extend( {
  14135. on: function( types, selector, data, fn ) {
  14136. return on( this, types, selector, data, fn );
  14137. },
  14138. one: function( types, selector, data, fn ) {
  14139. return on( this, types, selector, data, fn, 1 );
  14140. },
  14141. off: function( types, selector, fn ) {
  14142. var handleObj, type;
  14143. if ( types && types.preventDefault && types.handleObj ) {
  14144. // ( event ) dispatched jQuery.Event
  14145. handleObj = types.handleObj;
  14146. jQuery( types.delegateTarget ).off(
  14147. handleObj.namespace ?
  14148. handleObj.origType + "." + handleObj.namespace :
  14149. handleObj.origType,
  14150. handleObj.selector,
  14151. handleObj.handler
  14152. );
  14153. return this;
  14154. }
  14155. if ( typeof types === "object" ) {
  14156. // ( types-object [, selector] )
  14157. for ( type in types ) {
  14158. this.off( type, selector, types[ type ] );
  14159. }
  14160. return this;
  14161. }
  14162. if ( selector === false || typeof selector === "function" ) {
  14163. // ( types [, fn] )
  14164. fn = selector;
  14165. selector = undefined;
  14166. }
  14167. if ( fn === false ) {
  14168. fn = returnFalse;
  14169. }
  14170. return this.each( function() {
  14171. jQuery.event.remove( this, types, fn, selector );
  14172. } );
  14173. }
  14174. } );
  14175. var
  14176. /* eslint-disable max-len */
  14177. // See https://github.com/eslint/eslint/issues/3229
  14178. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  14179. /* eslint-enable */
  14180. // Support: IE <=10 - 11, Edge 12 - 13 only
  14181. // In IE/Edge using regex groups here causes severe slowdowns.
  14182. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  14183. rnoInnerhtml = /<script|<style|<link/i,
  14184. // checked="checked" or checked
  14185. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  14186. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  14187. // Prefer a tbody over its parent table for containing new rows
  14188. function manipulationTarget( elem, content ) {
  14189. if ( nodeName( elem, "table" ) &&
  14190. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  14191. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  14192. }
  14193. return elem;
  14194. }
  14195. // Replace/restore the type attribute of script elements for safe DOM manipulation
  14196. function disableScript( elem ) {
  14197. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  14198. return elem;
  14199. }
  14200. function restoreScript( elem ) {
  14201. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  14202. elem.type = elem.type.slice( 5 );
  14203. } else {
  14204. elem.removeAttribute( "type" );
  14205. }
  14206. return elem;
  14207. }
  14208. function cloneCopyEvent( src, dest ) {
  14209. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  14210. if ( dest.nodeType !== 1 ) {
  14211. return;
  14212. }
  14213. // 1. Copy private data: events, handlers, etc.
  14214. if ( dataPriv.hasData( src ) ) {
  14215. pdataOld = dataPriv.access( src );
  14216. pdataCur = dataPriv.set( dest, pdataOld );
  14217. events = pdataOld.events;
  14218. if ( events ) {
  14219. delete pdataCur.handle;
  14220. pdataCur.events = {};
  14221. for ( type in events ) {
  14222. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  14223. jQuery.event.add( dest, type, events[ type ][ i ] );
  14224. }
  14225. }
  14226. }
  14227. }
  14228. // 2. Copy user data
  14229. if ( dataUser.hasData( src ) ) {
  14230. udataOld = dataUser.access( src );
  14231. udataCur = jQuery.extend( {}, udataOld );
  14232. dataUser.set( dest, udataCur );
  14233. }
  14234. }
  14235. // Fix IE bugs, see support tests
  14236. function fixInput( src, dest ) {
  14237. var nodeName = dest.nodeName.toLowerCase();
  14238. // Fails to persist the checked state of a cloned checkbox or radio button.
  14239. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  14240. dest.checked = src.checked;
  14241. // Fails to return the selected option to the default selected state when cloning options
  14242. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  14243. dest.defaultValue = src.defaultValue;
  14244. }
  14245. }
  14246. function domManip( collection, args, callback, ignored ) {
  14247. // Flatten any nested arrays
  14248. args = concat.apply( [], args );
  14249. var fragment, first, scripts, hasScripts, node, doc,
  14250. i = 0,
  14251. l = collection.length,
  14252. iNoClone = l - 1,
  14253. value = args[ 0 ],
  14254. valueIsFunction = isFunction( value );
  14255. // We can't cloneNode fragments that contain checked, in WebKit
  14256. if ( valueIsFunction ||
  14257. ( l > 1 && typeof value === "string" &&
  14258. !support.checkClone && rchecked.test( value ) ) ) {
  14259. return collection.each( function( index ) {
  14260. var self = collection.eq( index );
  14261. if ( valueIsFunction ) {
  14262. args[ 0 ] = value.call( this, index, self.html() );
  14263. }
  14264. domManip( self, args, callback, ignored );
  14265. } );
  14266. }
  14267. if ( l ) {
  14268. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  14269. first = fragment.firstChild;
  14270. if ( fragment.childNodes.length === 1 ) {
  14271. fragment = first;
  14272. }
  14273. // Require either new content or an interest in ignored elements to invoke the callback
  14274. if ( first || ignored ) {
  14275. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  14276. hasScripts = scripts.length;
  14277. // Use the original fragment for the last item
  14278. // instead of the first because it can end up
  14279. // being emptied incorrectly in certain situations (#8070).
  14280. for ( ; i < l; i++ ) {
  14281. node = fragment;
  14282. if ( i !== iNoClone ) {
  14283. node = jQuery.clone( node, true, true );
  14284. // Keep references to cloned scripts for later restoration
  14285. if ( hasScripts ) {
  14286. // Support: Android <=4.0 only, PhantomJS 1 only
  14287. // push.apply(_, arraylike) throws on ancient WebKit
  14288. jQuery.merge( scripts, getAll( node, "script" ) );
  14289. }
  14290. }
  14291. callback.call( collection[ i ], node, i );
  14292. }
  14293. if ( hasScripts ) {
  14294. doc = scripts[ scripts.length - 1 ].ownerDocument;
  14295. // Reenable scripts
  14296. jQuery.map( scripts, restoreScript );
  14297. // Evaluate executable scripts on first document insertion
  14298. for ( i = 0; i < hasScripts; i++ ) {
  14299. node = scripts[ i ];
  14300. if ( rscriptType.test( node.type || "" ) &&
  14301. !dataPriv.access( node, "globalEval" ) &&
  14302. jQuery.contains( doc, node ) ) {
  14303. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  14304. // Optional AJAX dependency, but won't run scripts if not present
  14305. if ( jQuery._evalUrl && !node.noModule ) {
  14306. jQuery._evalUrl( node.src, {
  14307. nonce: node.nonce || node.getAttribute( "nonce" )
  14308. } );
  14309. }
  14310. } else {
  14311. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  14312. }
  14313. }
  14314. }
  14315. }
  14316. }
  14317. }
  14318. return collection;
  14319. }
  14320. function remove( elem, selector, keepData ) {
  14321. var node,
  14322. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  14323. i = 0;
  14324. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  14325. if ( !keepData && node.nodeType === 1 ) {
  14326. jQuery.cleanData( getAll( node ) );
  14327. }
  14328. if ( node.parentNode ) {
  14329. if ( keepData && isAttached( node ) ) {
  14330. setGlobalEval( getAll( node, "script" ) );
  14331. }
  14332. node.parentNode.removeChild( node );
  14333. }
  14334. }
  14335. return elem;
  14336. }
  14337. jQuery.extend( {
  14338. htmlPrefilter: function( html ) {
  14339. return html.replace( rxhtmlTag, "<$1></$2>" );
  14340. },
  14341. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  14342. var i, l, srcElements, destElements,
  14343. clone = elem.cloneNode( true ),
  14344. inPage = isAttached( elem );
  14345. // Fix IE cloning issues
  14346. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  14347. !jQuery.isXMLDoc( elem ) ) {
  14348. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  14349. destElements = getAll( clone );
  14350. srcElements = getAll( elem );
  14351. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  14352. fixInput( srcElements[ i ], destElements[ i ] );
  14353. }
  14354. }
  14355. // Copy the events from the original to the clone
  14356. if ( dataAndEvents ) {
  14357. if ( deepDataAndEvents ) {
  14358. srcElements = srcElements || getAll( elem );
  14359. destElements = destElements || getAll( clone );
  14360. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  14361. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  14362. }
  14363. } else {
  14364. cloneCopyEvent( elem, clone );
  14365. }
  14366. }
  14367. // Preserve script evaluation history
  14368. destElements = getAll( clone, "script" );
  14369. if ( destElements.length > 0 ) {
  14370. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  14371. }
  14372. // Return the cloned set
  14373. return clone;
  14374. },
  14375. cleanData: function( elems ) {
  14376. var data, elem, type,
  14377. special = jQuery.event.special,
  14378. i = 0;
  14379. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  14380. if ( acceptData( elem ) ) {
  14381. if ( ( data = elem[ dataPriv.expando ] ) ) {
  14382. if ( data.events ) {
  14383. for ( type in data.events ) {
  14384. if ( special[ type ] ) {
  14385. jQuery.event.remove( elem, type );
  14386. // This is a shortcut to avoid jQuery.event.remove's overhead
  14387. } else {
  14388. jQuery.removeEvent( elem, type, data.handle );
  14389. }
  14390. }
  14391. }
  14392. // Support: Chrome <=35 - 45+
  14393. // Assign undefined instead of using delete, see Data#remove
  14394. elem[ dataPriv.expando ] = undefined;
  14395. }
  14396. if ( elem[ dataUser.expando ] ) {
  14397. // Support: Chrome <=35 - 45+
  14398. // Assign undefined instead of using delete, see Data#remove
  14399. elem[ dataUser.expando ] = undefined;
  14400. }
  14401. }
  14402. }
  14403. }
  14404. } );
  14405. jQuery.fn.extend( {
  14406. detach: function( selector ) {
  14407. return remove( this, selector, true );
  14408. },
  14409. remove: function( selector ) {
  14410. return remove( this, selector );
  14411. },
  14412. text: function( value ) {
  14413. return access( this, function( value ) {
  14414. return value === undefined ?
  14415. jQuery.text( this ) :
  14416. this.empty().each( function() {
  14417. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  14418. this.textContent = value;
  14419. }
  14420. } );
  14421. }, null, value, arguments.length );
  14422. },
  14423. append: function() {
  14424. return domManip( this, arguments, function( elem ) {
  14425. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  14426. var target = manipulationTarget( this, elem );
  14427. target.appendChild( elem );
  14428. }
  14429. } );
  14430. },
  14431. prepend: function() {
  14432. return domManip( this, arguments, function( elem ) {
  14433. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  14434. var target = manipulationTarget( this, elem );
  14435. target.insertBefore( elem, target.firstChild );
  14436. }
  14437. } );
  14438. },
  14439. before: function() {
  14440. return domManip( this, arguments, function( elem ) {
  14441. if ( this.parentNode ) {
  14442. this.parentNode.insertBefore( elem, this );
  14443. }
  14444. } );
  14445. },
  14446. after: function() {
  14447. return domManip( this, arguments, function( elem ) {
  14448. if ( this.parentNode ) {
  14449. this.parentNode.insertBefore( elem, this.nextSibling );
  14450. }
  14451. } );
  14452. },
  14453. empty: function() {
  14454. var elem,
  14455. i = 0;
  14456. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  14457. if ( elem.nodeType === 1 ) {
  14458. // Prevent memory leaks
  14459. jQuery.cleanData( getAll( elem, false ) );
  14460. // Remove any remaining nodes
  14461. elem.textContent = "";
  14462. }
  14463. }
  14464. return this;
  14465. },
  14466. clone: function( dataAndEvents, deepDataAndEvents ) {
  14467. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  14468. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  14469. return this.map( function() {
  14470. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  14471. } );
  14472. },
  14473. html: function( value ) {
  14474. return access( this, function( value ) {
  14475. var elem = this[ 0 ] || {},
  14476. i = 0,
  14477. l = this.length;
  14478. if ( value === undefined && elem.nodeType === 1 ) {
  14479. return elem.innerHTML;
  14480. }
  14481. // See if we can take a shortcut and just use innerHTML
  14482. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  14483. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  14484. value = jQuery.htmlPrefilter( value );
  14485. try {
  14486. for ( ; i < l; i++ ) {
  14487. elem = this[ i ] || {};
  14488. // Remove element nodes and prevent memory leaks
  14489. if ( elem.nodeType === 1 ) {
  14490. jQuery.cleanData( getAll( elem, false ) );
  14491. elem.innerHTML = value;
  14492. }
  14493. }
  14494. elem = 0;
  14495. // If using innerHTML throws an exception, use the fallback method
  14496. } catch ( e ) {}
  14497. }
  14498. if ( elem ) {
  14499. this.empty().append( value );
  14500. }
  14501. }, null, value, arguments.length );
  14502. },
  14503. replaceWith: function() {
  14504. var ignored = [];
  14505. // Make the changes, replacing each non-ignored context element with the new content
  14506. return domManip( this, arguments, function( elem ) {
  14507. var parent = this.parentNode;
  14508. if ( jQuery.inArray( this, ignored ) < 0 ) {
  14509. jQuery.cleanData( getAll( this ) );
  14510. if ( parent ) {
  14511. parent.replaceChild( elem, this );
  14512. }
  14513. }
  14514. // Force callback invocation
  14515. }, ignored );
  14516. }
  14517. } );
  14518. jQuery.each( {
  14519. appendTo: "append",
  14520. prependTo: "prepend",
  14521. insertBefore: "before",
  14522. insertAfter: "after",
  14523. replaceAll: "replaceWith"
  14524. }, function( name, original ) {
  14525. jQuery.fn[ name ] = function( selector ) {
  14526. var elems,
  14527. ret = [],
  14528. insert = jQuery( selector ),
  14529. last = insert.length - 1,
  14530. i = 0;
  14531. for ( ; i <= last; i++ ) {
  14532. elems = i === last ? this : this.clone( true );
  14533. jQuery( insert[ i ] )[ original ]( elems );
  14534. // Support: Android <=4.0 only, PhantomJS 1 only
  14535. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  14536. push.apply( ret, elems.get() );
  14537. }
  14538. return this.pushStack( ret );
  14539. };
  14540. } );
  14541. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  14542. var getStyles = function( elem ) {
  14543. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  14544. // IE throws on elements created in popups
  14545. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  14546. var view = elem.ownerDocument.defaultView;
  14547. if ( !view || !view.opener ) {
  14548. view = window;
  14549. }
  14550. return view.getComputedStyle( elem );
  14551. };
  14552. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  14553. ( function() {
  14554. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  14555. // so they're executed at the same time to save the second computation.
  14556. function computeStyleTests() {
  14557. // This is a singleton, we need to execute it only once
  14558. if ( !div ) {
  14559. return;
  14560. }
  14561. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  14562. "margin-top:1px;padding:0;border:0";
  14563. div.style.cssText =
  14564. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  14565. "margin:auto;border:1px;padding:1px;" +
  14566. "width:60%;top:1%";
  14567. documentElement.appendChild( container ).appendChild( div );
  14568. var divStyle = window.getComputedStyle( div );
  14569. pixelPositionVal = divStyle.top !== "1%";
  14570. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  14571. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  14572. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  14573. // Some styles come back with percentage values, even though they shouldn't
  14574. div.style.right = "60%";
  14575. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  14576. // Support: IE 9 - 11 only
  14577. // Detect misreporting of content dimensions for box-sizing:border-box elements
  14578. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  14579. // Support: IE 9 only
  14580. // Detect overflow:scroll screwiness (gh-3699)
  14581. // Support: Chrome <=64
  14582. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  14583. div.style.position = "absolute";
  14584. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  14585. documentElement.removeChild( container );
  14586. // Nullify the div so it wouldn't be stored in the memory and
  14587. // it will also be a sign that checks already performed
  14588. div = null;
  14589. }
  14590. function roundPixelMeasures( measure ) {
  14591. return Math.round( parseFloat( measure ) );
  14592. }
  14593. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  14594. reliableMarginLeftVal,
  14595. container = document.createElement( "div" ),
  14596. div = document.createElement( "div" );
  14597. // Finish early in limited (non-browser) environments
  14598. if ( !div.style ) {
  14599. return;
  14600. }
  14601. // Support: IE <=9 - 11 only
  14602. // Style of cloned element affects source element cloned (#8908)
  14603. div.style.backgroundClip = "content-box";
  14604. div.cloneNode( true ).style.backgroundClip = "";
  14605. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  14606. jQuery.extend( support, {
  14607. boxSizingReliable: function() {
  14608. computeStyleTests();
  14609. return boxSizingReliableVal;
  14610. },
  14611. pixelBoxStyles: function() {
  14612. computeStyleTests();
  14613. return pixelBoxStylesVal;
  14614. },
  14615. pixelPosition: function() {
  14616. computeStyleTests();
  14617. return pixelPositionVal;
  14618. },
  14619. reliableMarginLeft: function() {
  14620. computeStyleTests();
  14621. return reliableMarginLeftVal;
  14622. },
  14623. scrollboxSize: function() {
  14624. computeStyleTests();
  14625. return scrollboxSizeVal;
  14626. }
  14627. } );
  14628. } )();
  14629. function curCSS( elem, name, computed ) {
  14630. var width, minWidth, maxWidth, ret,
  14631. // Support: Firefox 51+
  14632. // Retrieving style before computed somehow
  14633. // fixes an issue with getting wrong values
  14634. // on detached elements
  14635. style = elem.style;
  14636. computed = computed || getStyles( elem );
  14637. // getPropertyValue is needed for:
  14638. // .css('filter') (IE 9 only, #12537)
  14639. // .css('--customProperty) (#3144)
  14640. if ( computed ) {
  14641. ret = computed.getPropertyValue( name ) || computed[ name ];
  14642. if ( ret === "" && !isAttached( elem ) ) {
  14643. ret = jQuery.style( elem, name );
  14644. }
  14645. // A tribute to the "awesome hack by Dean Edwards"
  14646. // Android Browser returns percentage for some values,
  14647. // but width seems to be reliably pixels.
  14648. // This is against the CSSOM draft spec:
  14649. // https://drafts.csswg.org/cssom/#resolved-values
  14650. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  14651. // Remember the original values
  14652. width = style.width;
  14653. minWidth = style.minWidth;
  14654. maxWidth = style.maxWidth;
  14655. // Put in the new values to get a computed value out
  14656. style.minWidth = style.maxWidth = style.width = ret;
  14657. ret = computed.width;
  14658. // Revert the changed values
  14659. style.width = width;
  14660. style.minWidth = minWidth;
  14661. style.maxWidth = maxWidth;
  14662. }
  14663. }
  14664. return ret !== undefined ?
  14665. // Support: IE <=9 - 11 only
  14666. // IE returns zIndex value as an integer.
  14667. ret + "" :
  14668. ret;
  14669. }
  14670. function addGetHookIf( conditionFn, hookFn ) {
  14671. // Define the hook, we'll check on the first run if it's really needed.
  14672. return {
  14673. get: function() {
  14674. if ( conditionFn() ) {
  14675. // Hook not needed (or it's not possible to use it due
  14676. // to missing dependency), remove it.
  14677. delete this.get;
  14678. return;
  14679. }
  14680. // Hook needed; redefine it so that the support test is not executed again.
  14681. return ( this.get = hookFn ).apply( this, arguments );
  14682. }
  14683. };
  14684. }
  14685. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  14686. emptyStyle = document.createElement( "div" ).style,
  14687. vendorProps = {};
  14688. // Return a vendor-prefixed property or undefined
  14689. function vendorPropName( name ) {
  14690. // Check for vendor prefixed names
  14691. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  14692. i = cssPrefixes.length;
  14693. while ( i-- ) {
  14694. name = cssPrefixes[ i ] + capName;
  14695. if ( name in emptyStyle ) {
  14696. return name;
  14697. }
  14698. }
  14699. }
  14700. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  14701. function finalPropName( name ) {
  14702. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  14703. if ( final ) {
  14704. return final;
  14705. }
  14706. if ( name in emptyStyle ) {
  14707. return name;
  14708. }
  14709. return vendorProps[ name ] = vendorPropName( name ) || name;
  14710. }
  14711. var
  14712. // Swappable if display is none or starts with table
  14713. // except "table", "table-cell", or "table-caption"
  14714. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  14715. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  14716. rcustomProp = /^--/,
  14717. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  14718. cssNormalTransform = {
  14719. letterSpacing: "0",
  14720. fontWeight: "400"
  14721. };
  14722. function setPositiveNumber( elem, value, subtract ) {
  14723. // Any relative (+/-) values have already been
  14724. // normalized at this point
  14725. var matches = rcssNum.exec( value );
  14726. return matches ?
  14727. // Guard against undefined "subtract", e.g., when used as in cssHooks
  14728. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  14729. value;
  14730. }
  14731. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  14732. var i = dimension === "width" ? 1 : 0,
  14733. extra = 0,
  14734. delta = 0;
  14735. // Adjustment may not be necessary
  14736. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  14737. return 0;
  14738. }
  14739. for ( ; i < 4; i += 2 ) {
  14740. // Both box models exclude margin
  14741. if ( box === "margin" ) {
  14742. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  14743. }
  14744. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  14745. if ( !isBorderBox ) {
  14746. // Add padding
  14747. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  14748. // For "border" or "margin", add border
  14749. if ( box !== "padding" ) {
  14750. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  14751. // But still keep track of it otherwise
  14752. } else {
  14753. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  14754. }
  14755. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  14756. // "padding" or "margin"
  14757. } else {
  14758. // For "content", subtract padding
  14759. if ( box === "content" ) {
  14760. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  14761. }
  14762. // For "content" or "padding", subtract border
  14763. if ( box !== "margin" ) {
  14764. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  14765. }
  14766. }
  14767. }
  14768. // Account for positive content-box scroll gutter when requested by providing computedVal
  14769. if ( !isBorderBox && computedVal >= 0 ) {
  14770. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  14771. // Assuming integer scroll gutter, subtract the rest and round down
  14772. delta += Math.max( 0, Math.ceil(
  14773. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  14774. computedVal -
  14775. delta -
  14776. extra -
  14777. 0.5
  14778. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  14779. // Use an explicit zero to avoid NaN (gh-3964)
  14780. ) ) || 0;
  14781. }
  14782. return delta;
  14783. }
  14784. function getWidthOrHeight( elem, dimension, extra ) {
  14785. // Start with computed style
  14786. var styles = getStyles( elem ),
  14787. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  14788. // Fake content-box until we know it's needed to know the true value.
  14789. boxSizingNeeded = !support.boxSizingReliable() || extra,
  14790. isBorderBox = boxSizingNeeded &&
  14791. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  14792. valueIsBorderBox = isBorderBox,
  14793. val = curCSS( elem, dimension, styles ),
  14794. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  14795. // Support: Firefox <=54
  14796. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  14797. if ( rnumnonpx.test( val ) ) {
  14798. if ( !extra ) {
  14799. return val;
  14800. }
  14801. val = "auto";
  14802. }
  14803. // Fall back to offsetWidth/offsetHeight when value is "auto"
  14804. // This happens for inline elements with no explicit setting (gh-3571)
  14805. // Support: Android <=4.1 - 4.3 only
  14806. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  14807. // Support: IE 9-11 only
  14808. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  14809. // We use getClientRects() to check for hidden/disconnected.
  14810. // In those cases, the computed value can be trusted to be border-box
  14811. if ( ( !support.boxSizingReliable() && isBorderBox ||
  14812. val === "auto" ||
  14813. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  14814. elem.getClientRects().length ) {
  14815. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  14816. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  14817. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  14818. // retrieved value as a content box dimension.
  14819. valueIsBorderBox = offsetProp in elem;
  14820. if ( valueIsBorderBox ) {
  14821. val = elem[ offsetProp ];
  14822. }
  14823. }
  14824. // Normalize "" and auto
  14825. val = parseFloat( val ) || 0;
  14826. // Adjust for the element's box model
  14827. return ( val +
  14828. boxModelAdjustment(
  14829. elem,
  14830. dimension,
  14831. extra || ( isBorderBox ? "border" : "content" ),
  14832. valueIsBorderBox,
  14833. styles,
  14834. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  14835. val
  14836. )
  14837. ) + "px";
  14838. }
  14839. jQuery.extend( {
  14840. // Add in style property hooks for overriding the default
  14841. // behavior of getting and setting a style property
  14842. cssHooks: {
  14843. opacity: {
  14844. get: function( elem, computed ) {
  14845. if ( computed ) {
  14846. // We should always get a number back from opacity
  14847. var ret = curCSS( elem, "opacity" );
  14848. return ret === "" ? "1" : ret;
  14849. }
  14850. }
  14851. }
  14852. },
  14853. // Don't automatically add "px" to these possibly-unitless properties
  14854. cssNumber: {
  14855. "animationIterationCount": true,
  14856. "columnCount": true,
  14857. "fillOpacity": true,
  14858. "flexGrow": true,
  14859. "flexShrink": true,
  14860. "fontWeight": true,
  14861. "gridArea": true,
  14862. "gridColumn": true,
  14863. "gridColumnEnd": true,
  14864. "gridColumnStart": true,
  14865. "gridRow": true,
  14866. "gridRowEnd": true,
  14867. "gridRowStart": true,
  14868. "lineHeight": true,
  14869. "opacity": true,
  14870. "order": true,
  14871. "orphans": true,
  14872. "widows": true,
  14873. "zIndex": true,
  14874. "zoom": true
  14875. },
  14876. // Add in properties whose names you wish to fix before
  14877. // setting or getting the value
  14878. cssProps: {},
  14879. // Get and set the style property on a DOM Node
  14880. style: function( elem, name, value, extra ) {
  14881. // Don't set styles on text and comment nodes
  14882. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  14883. return;
  14884. }
  14885. // Make sure that we're working with the right name
  14886. var ret, type, hooks,
  14887. origName = camelCase( name ),
  14888. isCustomProp = rcustomProp.test( name ),
  14889. style = elem.style;
  14890. // Make sure that we're working with the right name. We don't
  14891. // want to query the value if it is a CSS custom property
  14892. // since they are user-defined.
  14893. if ( !isCustomProp ) {
  14894. name = finalPropName( origName );
  14895. }
  14896. // Gets hook for the prefixed version, then unprefixed version
  14897. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14898. // Check if we're setting a value
  14899. if ( value !== undefined ) {
  14900. type = typeof value;
  14901. // Convert "+=" or "-=" to relative numbers (#7345)
  14902. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  14903. value = adjustCSS( elem, name, ret );
  14904. // Fixes bug #9237
  14905. type = "number";
  14906. }
  14907. // Make sure that null and NaN values aren't set (#7116)
  14908. if ( value == null || value !== value ) {
  14909. return;
  14910. }
  14911. // If a number was passed in, add the unit (except for certain CSS properties)
  14912. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  14913. // "px" to a few hardcoded values.
  14914. if ( type === "number" && !isCustomProp ) {
  14915. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  14916. }
  14917. // background-* props affect original clone's values
  14918. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  14919. style[ name ] = "inherit";
  14920. }
  14921. // If a hook was provided, use that value, otherwise just set the specified value
  14922. if ( !hooks || !( "set" in hooks ) ||
  14923. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  14924. if ( isCustomProp ) {
  14925. style.setProperty( name, value );
  14926. } else {
  14927. style[ name ] = value;
  14928. }
  14929. }
  14930. } else {
  14931. // If a hook was provided get the non-computed value from there
  14932. if ( hooks && "get" in hooks &&
  14933. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  14934. return ret;
  14935. }
  14936. // Otherwise just get the value from the style object
  14937. return style[ name ];
  14938. }
  14939. },
  14940. css: function( elem, name, extra, styles ) {
  14941. var val, num, hooks,
  14942. origName = camelCase( name ),
  14943. isCustomProp = rcustomProp.test( name );
  14944. // Make sure that we're working with the right name. We don't
  14945. // want to modify the value if it is a CSS custom property
  14946. // since they are user-defined.
  14947. if ( !isCustomProp ) {
  14948. name = finalPropName( origName );
  14949. }
  14950. // Try prefixed name followed by the unprefixed name
  14951. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14952. // If a hook was provided get the computed value from there
  14953. if ( hooks && "get" in hooks ) {
  14954. val = hooks.get( elem, true, extra );
  14955. }
  14956. // Otherwise, if a way to get the computed value exists, use that
  14957. if ( val === undefined ) {
  14958. val = curCSS( elem, name, styles );
  14959. }
  14960. // Convert "normal" to computed value
  14961. if ( val === "normal" && name in cssNormalTransform ) {
  14962. val = cssNormalTransform[ name ];
  14963. }
  14964. // Make numeric if forced or a qualifier was provided and val looks numeric
  14965. if ( extra === "" || extra ) {
  14966. num = parseFloat( val );
  14967. return extra === true || isFinite( num ) ? num || 0 : val;
  14968. }
  14969. return val;
  14970. }
  14971. } );
  14972. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  14973. jQuery.cssHooks[ dimension ] = {
  14974. get: function( elem, computed, extra ) {
  14975. if ( computed ) {
  14976. // Certain elements can have dimension info if we invisibly show them
  14977. // but it must have a current display style that would benefit
  14978. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  14979. // Support: Safari 8+
  14980. // Table columns in Safari have non-zero offsetWidth & zero
  14981. // getBoundingClientRect().width unless display is changed.
  14982. // Support: IE <=11 only
  14983. // Running getBoundingClientRect on a disconnected node
  14984. // in IE throws an error.
  14985. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  14986. swap( elem, cssShow, function() {
  14987. return getWidthOrHeight( elem, dimension, extra );
  14988. } ) :
  14989. getWidthOrHeight( elem, dimension, extra );
  14990. }
  14991. },
  14992. set: function( elem, value, extra ) {
  14993. var matches,
  14994. styles = getStyles( elem ),
  14995. // Only read styles.position if the test has a chance to fail
  14996. // to avoid forcing a reflow.
  14997. scrollboxSizeBuggy = !support.scrollboxSize() &&
  14998. styles.position === "absolute",
  14999. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  15000. boxSizingNeeded = scrollboxSizeBuggy || extra,
  15001. isBorderBox = boxSizingNeeded &&
  15002. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  15003. subtract = extra ?
  15004. boxModelAdjustment(
  15005. elem,
  15006. dimension,
  15007. extra,
  15008. isBorderBox,
  15009. styles
  15010. ) :
  15011. 0;
  15012. // Account for unreliable border-box dimensions by comparing offset* to computed and
  15013. // faking a content-box to get border and padding (gh-3699)
  15014. if ( isBorderBox && scrollboxSizeBuggy ) {
  15015. subtract -= Math.ceil(
  15016. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  15017. parseFloat( styles[ dimension ] ) -
  15018. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  15019. 0.5
  15020. );
  15021. }
  15022. // Convert to pixels if value adjustment is needed
  15023. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  15024. ( matches[ 3 ] || "px" ) !== "px" ) {
  15025. elem.style[ dimension ] = value;
  15026. value = jQuery.css( elem, dimension );
  15027. }
  15028. return setPositiveNumber( elem, value, subtract );
  15029. }
  15030. };
  15031. } );
  15032. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  15033. function( elem, computed ) {
  15034. if ( computed ) {
  15035. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  15036. elem.getBoundingClientRect().left -
  15037. swap( elem, { marginLeft: 0 }, function() {
  15038. return elem.getBoundingClientRect().left;
  15039. } )
  15040. ) + "px";
  15041. }
  15042. }
  15043. );
  15044. // These hooks are used by animate to expand properties
  15045. jQuery.each( {
  15046. margin: "",
  15047. padding: "",
  15048. border: "Width"
  15049. }, function( prefix, suffix ) {
  15050. jQuery.cssHooks[ prefix + suffix ] = {
  15051. expand: function( value ) {
  15052. var i = 0,
  15053. expanded = {},
  15054. // Assumes a single number if not a string
  15055. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  15056. for ( ; i < 4; i++ ) {
  15057. expanded[ prefix + cssExpand[ i ] + suffix ] =
  15058. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  15059. }
  15060. return expanded;
  15061. }
  15062. };
  15063. if ( prefix !== "margin" ) {
  15064. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  15065. }
  15066. } );
  15067. jQuery.fn.extend( {
  15068. css: function( name, value ) {
  15069. return access( this, function( elem, name, value ) {
  15070. var styles, len,
  15071. map = {},
  15072. i = 0;
  15073. if ( Array.isArray( name ) ) {
  15074. styles = getStyles( elem );
  15075. len = name.length;
  15076. for ( ; i < len; i++ ) {
  15077. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  15078. }
  15079. return map;
  15080. }
  15081. return value !== undefined ?
  15082. jQuery.style( elem, name, value ) :
  15083. jQuery.css( elem, name );
  15084. }, name, value, arguments.length > 1 );
  15085. }
  15086. } );
  15087. function Tween( elem, options, prop, end, easing ) {
  15088. return new Tween.prototype.init( elem, options, prop, end, easing );
  15089. }
  15090. jQuery.Tween = Tween;
  15091. Tween.prototype = {
  15092. constructor: Tween,
  15093. init: function( elem, options, prop, end, easing, unit ) {
  15094. this.elem = elem;
  15095. this.prop = prop;
  15096. this.easing = easing || jQuery.easing._default;
  15097. this.options = options;
  15098. this.start = this.now = this.cur();
  15099. this.end = end;
  15100. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  15101. },
  15102. cur: function() {
  15103. var hooks = Tween.propHooks[ this.prop ];
  15104. return hooks && hooks.get ?
  15105. hooks.get( this ) :
  15106. Tween.propHooks._default.get( this );
  15107. },
  15108. run: function( percent ) {
  15109. var eased,
  15110. hooks = Tween.propHooks[ this.prop ];
  15111. if ( this.options.duration ) {
  15112. this.pos = eased = jQuery.easing[ this.easing ](
  15113. percent, this.options.duration * percent, 0, 1, this.options.duration
  15114. );
  15115. } else {
  15116. this.pos = eased = percent;
  15117. }
  15118. this.now = ( this.end - this.start ) * eased + this.start;
  15119. if ( this.options.step ) {
  15120. this.options.step.call( this.elem, this.now, this );
  15121. }
  15122. if ( hooks && hooks.set ) {
  15123. hooks.set( this );
  15124. } else {
  15125. Tween.propHooks._default.set( this );
  15126. }
  15127. return this;
  15128. }
  15129. };
  15130. Tween.prototype.init.prototype = Tween.prototype;
  15131. Tween.propHooks = {
  15132. _default: {
  15133. get: function( tween ) {
  15134. var result;
  15135. // Use a property on the element directly when it is not a DOM element,
  15136. // or when there is no matching style property that exists.
  15137. if ( tween.elem.nodeType !== 1 ||
  15138. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  15139. return tween.elem[ tween.prop ];
  15140. }
  15141. // Passing an empty string as a 3rd parameter to .css will automatically
  15142. // attempt a parseFloat and fallback to a string if the parse fails.
  15143. // Simple values such as "10px" are parsed to Float;
  15144. // complex values such as "rotate(1rad)" are returned as-is.
  15145. result = jQuery.css( tween.elem, tween.prop, "" );
  15146. // Empty strings, null, undefined and "auto" are converted to 0.
  15147. return !result || result === "auto" ? 0 : result;
  15148. },
  15149. set: function( tween ) {
  15150. // Use step hook for back compat.
  15151. // Use cssHook if its there.
  15152. // Use .style if available and use plain properties where available.
  15153. if ( jQuery.fx.step[ tween.prop ] ) {
  15154. jQuery.fx.step[ tween.prop ]( tween );
  15155. } else if ( tween.elem.nodeType === 1 && (
  15156. jQuery.cssHooks[ tween.prop ] ||
  15157. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  15158. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  15159. } else {
  15160. tween.elem[ tween.prop ] = tween.now;
  15161. }
  15162. }
  15163. }
  15164. };
  15165. // Support: IE <=9 only
  15166. // Panic based approach to setting things on disconnected nodes
  15167. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  15168. set: function( tween ) {
  15169. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  15170. tween.elem[ tween.prop ] = tween.now;
  15171. }
  15172. }
  15173. };
  15174. jQuery.easing = {
  15175. linear: function( p ) {
  15176. return p;
  15177. },
  15178. swing: function( p ) {
  15179. return 0.5 - Math.cos( p * Math.PI ) / 2;
  15180. },
  15181. _default: "swing"
  15182. };
  15183. jQuery.fx = Tween.prototype.init;
  15184. // Back compat <1.8 extension point
  15185. jQuery.fx.step = {};
  15186. var
  15187. fxNow, inProgress,
  15188. rfxtypes = /^(?:toggle|show|hide)$/,
  15189. rrun = /queueHooks$/;
  15190. function schedule() {
  15191. if ( inProgress ) {
  15192. if ( document.hidden === false && window.requestAnimationFrame ) {
  15193. window.requestAnimationFrame( schedule );
  15194. } else {
  15195. window.setTimeout( schedule, jQuery.fx.interval );
  15196. }
  15197. jQuery.fx.tick();
  15198. }
  15199. }
  15200. // Animations created synchronously will run synchronously
  15201. function createFxNow() {
  15202. window.setTimeout( function() {
  15203. fxNow = undefined;
  15204. } );
  15205. return ( fxNow = Date.now() );
  15206. }
  15207. // Generate parameters to create a standard animation
  15208. function genFx( type, includeWidth ) {
  15209. var which,
  15210. i = 0,
  15211. attrs = { height: type };
  15212. // If we include width, step value is 1 to do all cssExpand values,
  15213. // otherwise step value is 2 to skip over Left and Right
  15214. includeWidth = includeWidth ? 1 : 0;
  15215. for ( ; i < 4; i += 2 - includeWidth ) {
  15216. which = cssExpand[ i ];
  15217. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  15218. }
  15219. if ( includeWidth ) {
  15220. attrs.opacity = attrs.width = type;
  15221. }
  15222. return attrs;
  15223. }
  15224. function createTween( value, prop, animation ) {
  15225. var tween,
  15226. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  15227. index = 0,
  15228. length = collection.length;
  15229. for ( ; index < length; index++ ) {
  15230. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  15231. // We're done with this property
  15232. return tween;
  15233. }
  15234. }
  15235. }
  15236. function defaultPrefilter( elem, props, opts ) {
  15237. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  15238. isBox = "width" in props || "height" in props,
  15239. anim = this,
  15240. orig = {},
  15241. style = elem.style,
  15242. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  15243. dataShow = dataPriv.get( elem, "fxshow" );
  15244. // Queue-skipping animations hijack the fx hooks
  15245. if ( !opts.queue ) {
  15246. hooks = jQuery._queueHooks( elem, "fx" );
  15247. if ( hooks.unqueued == null ) {
  15248. hooks.unqueued = 0;
  15249. oldfire = hooks.empty.fire;
  15250. hooks.empty.fire = function() {
  15251. if ( !hooks.unqueued ) {
  15252. oldfire();
  15253. }
  15254. };
  15255. }
  15256. hooks.unqueued++;
  15257. anim.always( function() {
  15258. // Ensure the complete handler is called before this completes
  15259. anim.always( function() {
  15260. hooks.unqueued--;
  15261. if ( !jQuery.queue( elem, "fx" ).length ) {
  15262. hooks.empty.fire();
  15263. }
  15264. } );
  15265. } );
  15266. }
  15267. // Detect show/hide animations
  15268. for ( prop in props ) {
  15269. value = props[ prop ];
  15270. if ( rfxtypes.test( value ) ) {
  15271. delete props[ prop ];
  15272. toggle = toggle || value === "toggle";
  15273. if ( value === ( hidden ? "hide" : "show" ) ) {
  15274. // Pretend to be hidden if this is a "show" and
  15275. // there is still data from a stopped show/hide
  15276. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  15277. hidden = true;
  15278. // Ignore all other no-op show/hide data
  15279. } else {
  15280. continue;
  15281. }
  15282. }
  15283. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  15284. }
  15285. }
  15286. // Bail out if this is a no-op like .hide().hide()
  15287. propTween = !jQuery.isEmptyObject( props );
  15288. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  15289. return;
  15290. }
  15291. // Restrict "overflow" and "display" styles during box animations
  15292. if ( isBox && elem.nodeType === 1 ) {
  15293. // Support: IE <=9 - 11, Edge 12 - 15
  15294. // Record all 3 overflow attributes because IE does not infer the shorthand
  15295. // from identically-valued overflowX and overflowY and Edge just mirrors
  15296. // the overflowX value there.
  15297. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  15298. // Identify a display type, preferring old show/hide data over the CSS cascade
  15299. restoreDisplay = dataShow && dataShow.display;
  15300. if ( restoreDisplay == null ) {
  15301. restoreDisplay = dataPriv.get( elem, "display" );
  15302. }
  15303. display = jQuery.css( elem, "display" );
  15304. if ( display === "none" ) {
  15305. if ( restoreDisplay ) {
  15306. display = restoreDisplay;
  15307. } else {
  15308. // Get nonempty value(s) by temporarily forcing visibility
  15309. showHide( [ elem ], true );
  15310. restoreDisplay = elem.style.display || restoreDisplay;
  15311. display = jQuery.css( elem, "display" );
  15312. showHide( [ elem ] );
  15313. }
  15314. }
  15315. // Animate inline elements as inline-block
  15316. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  15317. if ( jQuery.css( elem, "float" ) === "none" ) {
  15318. // Restore the original display value at the end of pure show/hide animations
  15319. if ( !propTween ) {
  15320. anim.done( function() {
  15321. style.display = restoreDisplay;
  15322. } );
  15323. if ( restoreDisplay == null ) {
  15324. display = style.display;
  15325. restoreDisplay = display === "none" ? "" : display;
  15326. }
  15327. }
  15328. style.display = "inline-block";
  15329. }
  15330. }
  15331. }
  15332. if ( opts.overflow ) {
  15333. style.overflow = "hidden";
  15334. anim.always( function() {
  15335. style.overflow = opts.overflow[ 0 ];
  15336. style.overflowX = opts.overflow[ 1 ];
  15337. style.overflowY = opts.overflow[ 2 ];
  15338. } );
  15339. }
  15340. // Implement show/hide animations
  15341. propTween = false;
  15342. for ( prop in orig ) {
  15343. // General show/hide setup for this element animation
  15344. if ( !propTween ) {
  15345. if ( dataShow ) {
  15346. if ( "hidden" in dataShow ) {
  15347. hidden = dataShow.hidden;
  15348. }
  15349. } else {
  15350. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  15351. }
  15352. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  15353. if ( toggle ) {
  15354. dataShow.hidden = !hidden;
  15355. }
  15356. // Show elements before animating them
  15357. if ( hidden ) {
  15358. showHide( [ elem ], true );
  15359. }
  15360. /* eslint-disable no-loop-func */
  15361. anim.done( function() {
  15362. /* eslint-enable no-loop-func */
  15363. // The final step of a "hide" animation is actually hiding the element
  15364. if ( !hidden ) {
  15365. showHide( [ elem ] );
  15366. }
  15367. dataPriv.remove( elem, "fxshow" );
  15368. for ( prop in orig ) {
  15369. jQuery.style( elem, prop, orig[ prop ] );
  15370. }
  15371. } );
  15372. }
  15373. // Per-property setup
  15374. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  15375. if ( !( prop in dataShow ) ) {
  15376. dataShow[ prop ] = propTween.start;
  15377. if ( hidden ) {
  15378. propTween.end = propTween.start;
  15379. propTween.start = 0;
  15380. }
  15381. }
  15382. }
  15383. }
  15384. function propFilter( props, specialEasing ) {
  15385. var index, name, easing, value, hooks;
  15386. // camelCase, specialEasing and expand cssHook pass
  15387. for ( index in props ) {
  15388. name = camelCase( index );
  15389. easing = specialEasing[ name ];
  15390. value = props[ index ];
  15391. if ( Array.isArray( value ) ) {
  15392. easing = value[ 1 ];
  15393. value = props[ index ] = value[ 0 ];
  15394. }
  15395. if ( index !== name ) {
  15396. props[ name ] = value;
  15397. delete props[ index ];
  15398. }
  15399. hooks = jQuery.cssHooks[ name ];
  15400. if ( hooks && "expand" in hooks ) {
  15401. value = hooks.expand( value );
  15402. delete props[ name ];
  15403. // Not quite $.extend, this won't overwrite existing keys.
  15404. // Reusing 'index' because we have the correct "name"
  15405. for ( index in value ) {
  15406. if ( !( index in props ) ) {
  15407. props[ index ] = value[ index ];
  15408. specialEasing[ index ] = easing;
  15409. }
  15410. }
  15411. } else {
  15412. specialEasing[ name ] = easing;
  15413. }
  15414. }
  15415. }
  15416. function Animation( elem, properties, options ) {
  15417. var result,
  15418. stopped,
  15419. index = 0,
  15420. length = Animation.prefilters.length,
  15421. deferred = jQuery.Deferred().always( function() {
  15422. // Don't match elem in the :animated selector
  15423. delete tick.elem;
  15424. } ),
  15425. tick = function() {
  15426. if ( stopped ) {
  15427. return false;
  15428. }
  15429. var currentTime = fxNow || createFxNow(),
  15430. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  15431. // Support: Android 2.3 only
  15432. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  15433. temp = remaining / animation.duration || 0,
  15434. percent = 1 - temp,
  15435. index = 0,
  15436. length = animation.tweens.length;
  15437. for ( ; index < length; index++ ) {
  15438. animation.tweens[ index ].run( percent );
  15439. }
  15440. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  15441. // If there's more to do, yield
  15442. if ( percent < 1 && length ) {
  15443. return remaining;
  15444. }
  15445. // If this was an empty animation, synthesize a final progress notification
  15446. if ( !length ) {
  15447. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  15448. }
  15449. // Resolve the animation and report its conclusion
  15450. deferred.resolveWith( elem, [ animation ] );
  15451. return false;
  15452. },
  15453. animation = deferred.promise( {
  15454. elem: elem,
  15455. props: jQuery.extend( {}, properties ),
  15456. opts: jQuery.extend( true, {
  15457. specialEasing: {},
  15458. easing: jQuery.easing._default
  15459. }, options ),
  15460. originalProperties: properties,
  15461. originalOptions: options,
  15462. startTime: fxNow || createFxNow(),
  15463. duration: options.duration,
  15464. tweens: [],
  15465. createTween: function( prop, end ) {
  15466. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  15467. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  15468. animation.tweens.push( tween );
  15469. return tween;
  15470. },
  15471. stop: function( gotoEnd ) {
  15472. var index = 0,
  15473. // If we are going to the end, we want to run all the tweens
  15474. // otherwise we skip this part
  15475. length = gotoEnd ? animation.tweens.length : 0;
  15476. if ( stopped ) {
  15477. return this;
  15478. }
  15479. stopped = true;
  15480. for ( ; index < length; index++ ) {
  15481. animation.tweens[ index ].run( 1 );
  15482. }
  15483. // Resolve when we played the last frame; otherwise, reject
  15484. if ( gotoEnd ) {
  15485. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  15486. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  15487. } else {
  15488. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  15489. }
  15490. return this;
  15491. }
  15492. } ),
  15493. props = animation.props;
  15494. propFilter( props, animation.opts.specialEasing );
  15495. for ( ; index < length; index++ ) {
  15496. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  15497. if ( result ) {
  15498. if ( isFunction( result.stop ) ) {
  15499. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  15500. result.stop.bind( result );
  15501. }
  15502. return result;
  15503. }
  15504. }
  15505. jQuery.map( props, createTween, animation );
  15506. if ( isFunction( animation.opts.start ) ) {
  15507. animation.opts.start.call( elem, animation );
  15508. }
  15509. // Attach callbacks from options
  15510. animation
  15511. .progress( animation.opts.progress )
  15512. .done( animation.opts.done, animation.opts.complete )
  15513. .fail( animation.opts.fail )
  15514. .always( animation.opts.always );
  15515. jQuery.fx.timer(
  15516. jQuery.extend( tick, {
  15517. elem: elem,
  15518. anim: animation,
  15519. queue: animation.opts.queue
  15520. } )
  15521. );
  15522. return animation;
  15523. }
  15524. jQuery.Animation = jQuery.extend( Animation, {
  15525. tweeners: {
  15526. "*": [ function( prop, value ) {
  15527. var tween = this.createTween( prop, value );
  15528. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  15529. return tween;
  15530. } ]
  15531. },
  15532. tweener: function( props, callback ) {
  15533. if ( isFunction( props ) ) {
  15534. callback = props;
  15535. props = [ "*" ];
  15536. } else {
  15537. props = props.match( rnothtmlwhite );
  15538. }
  15539. var prop,
  15540. index = 0,
  15541. length = props.length;
  15542. for ( ; index < length; index++ ) {
  15543. prop = props[ index ];
  15544. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  15545. Animation.tweeners[ prop ].unshift( callback );
  15546. }
  15547. },
  15548. prefilters: [ defaultPrefilter ],
  15549. prefilter: function( callback, prepend ) {
  15550. if ( prepend ) {
  15551. Animation.prefilters.unshift( callback );
  15552. } else {
  15553. Animation.prefilters.push( callback );
  15554. }
  15555. }
  15556. } );
  15557. jQuery.speed = function( speed, easing, fn ) {
  15558. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  15559. complete: fn || !fn && easing ||
  15560. isFunction( speed ) && speed,
  15561. duration: speed,
  15562. easing: fn && easing || easing && !isFunction( easing ) && easing
  15563. };
  15564. // Go to the end state if fx are off
  15565. if ( jQuery.fx.off ) {
  15566. opt.duration = 0;
  15567. } else {
  15568. if ( typeof opt.duration !== "number" ) {
  15569. if ( opt.duration in jQuery.fx.speeds ) {
  15570. opt.duration = jQuery.fx.speeds[ opt.duration ];
  15571. } else {
  15572. opt.duration = jQuery.fx.speeds._default;
  15573. }
  15574. }
  15575. }
  15576. // Normalize opt.queue - true/undefined/null -> "fx"
  15577. if ( opt.queue == null || opt.queue === true ) {
  15578. opt.queue = "fx";
  15579. }
  15580. // Queueing
  15581. opt.old = opt.complete;
  15582. opt.complete = function() {
  15583. if ( isFunction( opt.old ) ) {
  15584. opt.old.call( this );
  15585. }
  15586. if ( opt.queue ) {
  15587. jQuery.dequeue( this, opt.queue );
  15588. }
  15589. };
  15590. return opt;
  15591. };
  15592. jQuery.fn.extend( {
  15593. fadeTo: function( speed, to, easing, callback ) {
  15594. // Show any hidden elements after setting opacity to 0
  15595. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  15596. // Animate to the value specified
  15597. .end().animate( { opacity: to }, speed, easing, callback );
  15598. },
  15599. animate: function( prop, speed, easing, callback ) {
  15600. var empty = jQuery.isEmptyObject( prop ),
  15601. optall = jQuery.speed( speed, easing, callback ),
  15602. doAnimation = function() {
  15603. // Operate on a copy of prop so per-property easing won't be lost
  15604. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  15605. // Empty animations, or finishing resolves immediately
  15606. if ( empty || dataPriv.get( this, "finish" ) ) {
  15607. anim.stop( true );
  15608. }
  15609. };
  15610. doAnimation.finish = doAnimation;
  15611. return empty || optall.queue === false ?
  15612. this.each( doAnimation ) :
  15613. this.queue( optall.queue, doAnimation );
  15614. },
  15615. stop: function( type, clearQueue, gotoEnd ) {
  15616. var stopQueue = function( hooks ) {
  15617. var stop = hooks.stop;
  15618. delete hooks.stop;
  15619. stop( gotoEnd );
  15620. };
  15621. if ( typeof type !== "string" ) {
  15622. gotoEnd = clearQueue;
  15623. clearQueue = type;
  15624. type = undefined;
  15625. }
  15626. if ( clearQueue && type !== false ) {
  15627. this.queue( type || "fx", [] );
  15628. }
  15629. return this.each( function() {
  15630. var dequeue = true,
  15631. index = type != null && type + "queueHooks",
  15632. timers = jQuery.timers,
  15633. data = dataPriv.get( this );
  15634. if ( index ) {
  15635. if ( data[ index ] && data[ index ].stop ) {
  15636. stopQueue( data[ index ] );
  15637. }
  15638. } else {
  15639. for ( index in data ) {
  15640. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  15641. stopQueue( data[ index ] );
  15642. }
  15643. }
  15644. }
  15645. for ( index = timers.length; index--; ) {
  15646. if ( timers[ index ].elem === this &&
  15647. ( type == null || timers[ index ].queue === type ) ) {
  15648. timers[ index ].anim.stop( gotoEnd );
  15649. dequeue = false;
  15650. timers.splice( index, 1 );
  15651. }
  15652. }
  15653. // Start the next in the queue if the last step wasn't forced.
  15654. // Timers currently will call their complete callbacks, which
  15655. // will dequeue but only if they were gotoEnd.
  15656. if ( dequeue || !gotoEnd ) {
  15657. jQuery.dequeue( this, type );
  15658. }
  15659. } );
  15660. },
  15661. finish: function( type ) {
  15662. if ( type !== false ) {
  15663. type = type || "fx";
  15664. }
  15665. return this.each( function() {
  15666. var index,
  15667. data = dataPriv.get( this ),
  15668. queue = data[ type + "queue" ],
  15669. hooks = data[ type + "queueHooks" ],
  15670. timers = jQuery.timers,
  15671. length = queue ? queue.length : 0;
  15672. // Enable finishing flag on private data
  15673. data.finish = true;
  15674. // Empty the queue first
  15675. jQuery.queue( this, type, [] );
  15676. if ( hooks && hooks.stop ) {
  15677. hooks.stop.call( this, true );
  15678. }
  15679. // Look for any active animations, and finish them
  15680. for ( index = timers.length; index--; ) {
  15681. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  15682. timers[ index ].anim.stop( true );
  15683. timers.splice( index, 1 );
  15684. }
  15685. }
  15686. // Look for any animations in the old queue and finish them
  15687. for ( index = 0; index < length; index++ ) {
  15688. if ( queue[ index ] && queue[ index ].finish ) {
  15689. queue[ index ].finish.call( this );
  15690. }
  15691. }
  15692. // Turn off finishing flag
  15693. delete data.finish;
  15694. } );
  15695. }
  15696. } );
  15697. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  15698. var cssFn = jQuery.fn[ name ];
  15699. jQuery.fn[ name ] = function( speed, easing, callback ) {
  15700. return speed == null || typeof speed === "boolean" ?
  15701. cssFn.apply( this, arguments ) :
  15702. this.animate( genFx( name, true ), speed, easing, callback );
  15703. };
  15704. } );
  15705. // Generate shortcuts for custom animations
  15706. jQuery.each( {
  15707. slideDown: genFx( "show" ),
  15708. slideUp: genFx( "hide" ),
  15709. slideToggle: genFx( "toggle" ),
  15710. fadeIn: { opacity: "show" },
  15711. fadeOut: { opacity: "hide" },
  15712. fadeToggle: { opacity: "toggle" }
  15713. }, function( name, props ) {
  15714. jQuery.fn[ name ] = function( speed, easing, callback ) {
  15715. return this.animate( props, speed, easing, callback );
  15716. };
  15717. } );
  15718. jQuery.timers = [];
  15719. jQuery.fx.tick = function() {
  15720. var timer,
  15721. i = 0,
  15722. timers = jQuery.timers;
  15723. fxNow = Date.now();
  15724. for ( ; i < timers.length; i++ ) {
  15725. timer = timers[ i ];
  15726. // Run the timer and safely remove it when done (allowing for external removal)
  15727. if ( !timer() && timers[ i ] === timer ) {
  15728. timers.splice( i--, 1 );
  15729. }
  15730. }
  15731. if ( !timers.length ) {
  15732. jQuery.fx.stop();
  15733. }
  15734. fxNow = undefined;
  15735. };
  15736. jQuery.fx.timer = function( timer ) {
  15737. jQuery.timers.push( timer );
  15738. jQuery.fx.start();
  15739. };
  15740. jQuery.fx.interval = 13;
  15741. jQuery.fx.start = function() {
  15742. if ( inProgress ) {
  15743. return;
  15744. }
  15745. inProgress = true;
  15746. schedule();
  15747. };
  15748. jQuery.fx.stop = function() {
  15749. inProgress = null;
  15750. };
  15751. jQuery.fx.speeds = {
  15752. slow: 600,
  15753. fast: 200,
  15754. // Default speed
  15755. _default: 400
  15756. };
  15757. // Based off of the plugin by Clint Helfers, with permission.
  15758. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  15759. jQuery.fn.delay = function( time, type ) {
  15760. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  15761. type = type || "fx";
  15762. return this.queue( type, function( next, hooks ) {
  15763. var timeout = window.setTimeout( next, time );
  15764. hooks.stop = function() {
  15765. window.clearTimeout( timeout );
  15766. };
  15767. } );
  15768. };
  15769. ( function() {
  15770. var input = document.createElement( "input" ),
  15771. select = document.createElement( "select" ),
  15772. opt = select.appendChild( document.createElement( "option" ) );
  15773. input.type = "checkbox";
  15774. // Support: Android <=4.3 only
  15775. // Default value for a checkbox should be "on"
  15776. support.checkOn = input.value !== "";
  15777. // Support: IE <=11 only
  15778. // Must access selectedIndex to make default options select
  15779. support.optSelected = opt.selected;
  15780. // Support: IE <=11 only
  15781. // An input loses its value after becoming a radio
  15782. input = document.createElement( "input" );
  15783. input.value = "t";
  15784. input.type = "radio";
  15785. support.radioValue = input.value === "t";
  15786. } )();
  15787. var boolHook,
  15788. attrHandle = jQuery.expr.attrHandle;
  15789. jQuery.fn.extend( {
  15790. attr: function( name, value ) {
  15791. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  15792. },
  15793. removeAttr: function( name ) {
  15794. return this.each( function() {
  15795. jQuery.removeAttr( this, name );
  15796. } );
  15797. }
  15798. } );
  15799. jQuery.extend( {
  15800. attr: function( elem, name, value ) {
  15801. var ret, hooks,
  15802. nType = elem.nodeType;
  15803. // Don't get/set attributes on text, comment and attribute nodes
  15804. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15805. return;
  15806. }
  15807. // Fallback to prop when attributes are not supported
  15808. if ( typeof elem.getAttribute === "undefined" ) {
  15809. return jQuery.prop( elem, name, value );
  15810. }
  15811. // Attribute hooks are determined by the lowercase version
  15812. // Grab necessary hook if one is defined
  15813. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15814. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  15815. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  15816. }
  15817. if ( value !== undefined ) {
  15818. if ( value === null ) {
  15819. jQuery.removeAttr( elem, name );
  15820. return;
  15821. }
  15822. if ( hooks && "set" in hooks &&
  15823. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15824. return ret;
  15825. }
  15826. elem.setAttribute( name, value + "" );
  15827. return value;
  15828. }
  15829. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15830. return ret;
  15831. }
  15832. ret = jQuery.find.attr( elem, name );
  15833. // Non-existent attributes return null, we normalize to undefined
  15834. return ret == null ? undefined : ret;
  15835. },
  15836. attrHooks: {
  15837. type: {
  15838. set: function( elem, value ) {
  15839. if ( !support.radioValue && value === "radio" &&
  15840. nodeName( elem, "input" ) ) {
  15841. var val = elem.value;
  15842. elem.setAttribute( "type", value );
  15843. if ( val ) {
  15844. elem.value = val;
  15845. }
  15846. return value;
  15847. }
  15848. }
  15849. }
  15850. },
  15851. removeAttr: function( elem, value ) {
  15852. var name,
  15853. i = 0,
  15854. // Attribute names can contain non-HTML whitespace characters
  15855. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  15856. attrNames = value && value.match( rnothtmlwhite );
  15857. if ( attrNames && elem.nodeType === 1 ) {
  15858. while ( ( name = attrNames[ i++ ] ) ) {
  15859. elem.removeAttribute( name );
  15860. }
  15861. }
  15862. }
  15863. } );
  15864. // Hooks for boolean attributes
  15865. boolHook = {
  15866. set: function( elem, value, name ) {
  15867. if ( value === false ) {
  15868. // Remove boolean attributes when set to false
  15869. jQuery.removeAttr( elem, name );
  15870. } else {
  15871. elem.setAttribute( name, name );
  15872. }
  15873. return name;
  15874. }
  15875. };
  15876. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  15877. var getter = attrHandle[ name ] || jQuery.find.attr;
  15878. attrHandle[ name ] = function( elem, name, isXML ) {
  15879. var ret, handle,
  15880. lowercaseName = name.toLowerCase();
  15881. if ( !isXML ) {
  15882. // Avoid an infinite loop by temporarily removing this function from the getter
  15883. handle = attrHandle[ lowercaseName ];
  15884. attrHandle[ lowercaseName ] = ret;
  15885. ret = getter( elem, name, isXML ) != null ?
  15886. lowercaseName :
  15887. null;
  15888. attrHandle[ lowercaseName ] = handle;
  15889. }
  15890. return ret;
  15891. };
  15892. } );
  15893. var rfocusable = /^(?:input|select|textarea|button)$/i,
  15894. rclickable = /^(?:a|area)$/i;
  15895. jQuery.fn.extend( {
  15896. prop: function( name, value ) {
  15897. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  15898. },
  15899. removeProp: function( name ) {
  15900. return this.each( function() {
  15901. delete this[ jQuery.propFix[ name ] || name ];
  15902. } );
  15903. }
  15904. } );
  15905. jQuery.extend( {
  15906. prop: function( elem, name, value ) {
  15907. var ret, hooks,
  15908. nType = elem.nodeType;
  15909. // Don't get/set properties on text, comment and attribute nodes
  15910. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15911. return;
  15912. }
  15913. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15914. // Fix name and attach hooks
  15915. name = jQuery.propFix[ name ] || name;
  15916. hooks = jQuery.propHooks[ name ];
  15917. }
  15918. if ( value !== undefined ) {
  15919. if ( hooks && "set" in hooks &&
  15920. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15921. return ret;
  15922. }
  15923. return ( elem[ name ] = value );
  15924. }
  15925. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15926. return ret;
  15927. }
  15928. return elem[ name ];
  15929. },
  15930. propHooks: {
  15931. tabIndex: {
  15932. get: function( elem ) {
  15933. // Support: IE <=9 - 11 only
  15934. // elem.tabIndex doesn't always return the
  15935. // correct value when it hasn't been explicitly set
  15936. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  15937. // Use proper attribute retrieval(#12072)
  15938. var tabindex = jQuery.find.attr( elem, "tabindex" );
  15939. if ( tabindex ) {
  15940. return parseInt( tabindex, 10 );
  15941. }
  15942. if (
  15943. rfocusable.test( elem.nodeName ) ||
  15944. rclickable.test( elem.nodeName ) &&
  15945. elem.href
  15946. ) {
  15947. return 0;
  15948. }
  15949. return -1;
  15950. }
  15951. }
  15952. },
  15953. propFix: {
  15954. "for": "htmlFor",
  15955. "class": "className"
  15956. }
  15957. } );
  15958. // Support: IE <=11 only
  15959. // Accessing the selectedIndex property
  15960. // forces the browser to respect setting selected
  15961. // on the option
  15962. // The getter ensures a default option is selected
  15963. // when in an optgroup
  15964. // eslint rule "no-unused-expressions" is disabled for this code
  15965. // since it considers such accessions noop
  15966. if ( !support.optSelected ) {
  15967. jQuery.propHooks.selected = {
  15968. get: function( elem ) {
  15969. /* eslint no-unused-expressions: "off" */
  15970. var parent = elem.parentNode;
  15971. if ( parent && parent.parentNode ) {
  15972. parent.parentNode.selectedIndex;
  15973. }
  15974. return null;
  15975. },
  15976. set: function( elem ) {
  15977. /* eslint no-unused-expressions: "off" */
  15978. var parent = elem.parentNode;
  15979. if ( parent ) {
  15980. parent.selectedIndex;
  15981. if ( parent.parentNode ) {
  15982. parent.parentNode.selectedIndex;
  15983. }
  15984. }
  15985. }
  15986. };
  15987. }
  15988. jQuery.each( [
  15989. "tabIndex",
  15990. "readOnly",
  15991. "maxLength",
  15992. "cellSpacing",
  15993. "cellPadding",
  15994. "rowSpan",
  15995. "colSpan",
  15996. "useMap",
  15997. "frameBorder",
  15998. "contentEditable"
  15999. ], function() {
  16000. jQuery.propFix[ this.toLowerCase() ] = this;
  16001. } );
  16002. // Strip and collapse whitespace according to HTML spec
  16003. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  16004. function stripAndCollapse( value ) {
  16005. var tokens = value.match( rnothtmlwhite ) || [];
  16006. return tokens.join( " " );
  16007. }
  16008. function getClass( elem ) {
  16009. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  16010. }
  16011. function classesToArray( value ) {
  16012. if ( Array.isArray( value ) ) {
  16013. return value;
  16014. }
  16015. if ( typeof value === "string" ) {
  16016. return value.match( rnothtmlwhite ) || [];
  16017. }
  16018. return [];
  16019. }
  16020. jQuery.fn.extend( {
  16021. addClass: function( value ) {
  16022. var classes, elem, cur, curValue, clazz, j, finalValue,
  16023. i = 0;
  16024. if ( isFunction( value ) ) {
  16025. return this.each( function( j ) {
  16026. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  16027. } );
  16028. }
  16029. classes = classesToArray( value );
  16030. if ( classes.length ) {
  16031. while ( ( elem = this[ i++ ] ) ) {
  16032. curValue = getClass( elem );
  16033. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  16034. if ( cur ) {
  16035. j = 0;
  16036. while ( ( clazz = classes[ j++ ] ) ) {
  16037. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  16038. cur += clazz + " ";
  16039. }
  16040. }
  16041. // Only assign if different to avoid unneeded rendering.
  16042. finalValue = stripAndCollapse( cur );
  16043. if ( curValue !== finalValue ) {
  16044. elem.setAttribute( "class", finalValue );
  16045. }
  16046. }
  16047. }
  16048. }
  16049. return this;
  16050. },
  16051. removeClass: function( value ) {
  16052. var classes, elem, cur, curValue, clazz, j, finalValue,
  16053. i = 0;
  16054. if ( isFunction( value ) ) {
  16055. return this.each( function( j ) {
  16056. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  16057. } );
  16058. }
  16059. if ( !arguments.length ) {
  16060. return this.attr( "class", "" );
  16061. }
  16062. classes = classesToArray( value );
  16063. if ( classes.length ) {
  16064. while ( ( elem = this[ i++ ] ) ) {
  16065. curValue = getClass( elem );
  16066. // This expression is here for better compressibility (see addClass)
  16067. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  16068. if ( cur ) {
  16069. j = 0;
  16070. while ( ( clazz = classes[ j++ ] ) ) {
  16071. // Remove *all* instances
  16072. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  16073. cur = cur.replace( " " + clazz + " ", " " );
  16074. }
  16075. }
  16076. // Only assign if different to avoid unneeded rendering.
  16077. finalValue = stripAndCollapse( cur );
  16078. if ( curValue !== finalValue ) {
  16079. elem.setAttribute( "class", finalValue );
  16080. }
  16081. }
  16082. }
  16083. }
  16084. return this;
  16085. },
  16086. toggleClass: function( value, stateVal ) {
  16087. var type = typeof value,
  16088. isValidValue = type === "string" || Array.isArray( value );
  16089. if ( typeof stateVal === "boolean" && isValidValue ) {
  16090. return stateVal ? this.addClass( value ) : this.removeClass( value );
  16091. }
  16092. if ( isFunction( value ) ) {
  16093. return this.each( function( i ) {
  16094. jQuery( this ).toggleClass(
  16095. value.call( this, i, getClass( this ), stateVal ),
  16096. stateVal
  16097. );
  16098. } );
  16099. }
  16100. return this.each( function() {
  16101. var className, i, self, classNames;
  16102. if ( isValidValue ) {
  16103. // Toggle individual class names
  16104. i = 0;
  16105. self = jQuery( this );
  16106. classNames = classesToArray( value );
  16107. while ( ( className = classNames[ i++ ] ) ) {
  16108. // Check each className given, space separated list
  16109. if ( self.hasClass( className ) ) {
  16110. self.removeClass( className );
  16111. } else {
  16112. self.addClass( className );
  16113. }
  16114. }
  16115. // Toggle whole class name
  16116. } else if ( value === undefined || type === "boolean" ) {
  16117. className = getClass( this );
  16118. if ( className ) {
  16119. // Store className if set
  16120. dataPriv.set( this, "__className__", className );
  16121. }
  16122. // If the element has a class name or if we're passed `false`,
  16123. // then remove the whole classname (if there was one, the above saved it).
  16124. // Otherwise bring back whatever was previously saved (if anything),
  16125. // falling back to the empty string if nothing was stored.
  16126. if ( this.setAttribute ) {
  16127. this.setAttribute( "class",
  16128. className || value === false ?
  16129. "" :
  16130. dataPriv.get( this, "__className__" ) || ""
  16131. );
  16132. }
  16133. }
  16134. } );
  16135. },
  16136. hasClass: function( selector ) {
  16137. var className, elem,
  16138. i = 0;
  16139. className = " " + selector + " ";
  16140. while ( ( elem = this[ i++ ] ) ) {
  16141. if ( elem.nodeType === 1 &&
  16142. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  16143. return true;
  16144. }
  16145. }
  16146. return false;
  16147. }
  16148. } );
  16149. var rreturn = /\r/g;
  16150. jQuery.fn.extend( {
  16151. val: function( value ) {
  16152. var hooks, ret, valueIsFunction,
  16153. elem = this[ 0 ];
  16154. if ( !arguments.length ) {
  16155. if ( elem ) {
  16156. hooks = jQuery.valHooks[ elem.type ] ||
  16157. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  16158. if ( hooks &&
  16159. "get" in hooks &&
  16160. ( ret = hooks.get( elem, "value" ) ) !== undefined
  16161. ) {
  16162. return ret;
  16163. }
  16164. ret = elem.value;
  16165. // Handle most common string cases
  16166. if ( typeof ret === "string" ) {
  16167. return ret.replace( rreturn, "" );
  16168. }
  16169. // Handle cases where value is null/undef or number
  16170. return ret == null ? "" : ret;
  16171. }
  16172. return;
  16173. }
  16174. valueIsFunction = isFunction( value );
  16175. return this.each( function( i ) {
  16176. var val;
  16177. if ( this.nodeType !== 1 ) {
  16178. return;
  16179. }
  16180. if ( valueIsFunction ) {
  16181. val = value.call( this, i, jQuery( this ).val() );
  16182. } else {
  16183. val = value;
  16184. }
  16185. // Treat null/undefined as ""; convert numbers to string
  16186. if ( val == null ) {
  16187. val = "";
  16188. } else if ( typeof val === "number" ) {
  16189. val += "";
  16190. } else if ( Array.isArray( val ) ) {
  16191. val = jQuery.map( val, function( value ) {
  16192. return value == null ? "" : value + "";
  16193. } );
  16194. }
  16195. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  16196. // If set returns undefined, fall back to normal setting
  16197. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  16198. this.value = val;
  16199. }
  16200. } );
  16201. }
  16202. } );
  16203. jQuery.extend( {
  16204. valHooks: {
  16205. option: {
  16206. get: function( elem ) {
  16207. var val = jQuery.find.attr( elem, "value" );
  16208. return val != null ?
  16209. val :
  16210. // Support: IE <=10 - 11 only
  16211. // option.text throws exceptions (#14686, #14858)
  16212. // Strip and collapse whitespace
  16213. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  16214. stripAndCollapse( jQuery.text( elem ) );
  16215. }
  16216. },
  16217. select: {
  16218. get: function( elem ) {
  16219. var value, option, i,
  16220. options = elem.options,
  16221. index = elem.selectedIndex,
  16222. one = elem.type === "select-one",
  16223. values = one ? null : [],
  16224. max = one ? index + 1 : options.length;
  16225. if ( index < 0 ) {
  16226. i = max;
  16227. } else {
  16228. i = one ? index : 0;
  16229. }
  16230. // Loop through all the selected options
  16231. for ( ; i < max; i++ ) {
  16232. option = options[ i ];
  16233. // Support: IE <=9 only
  16234. // IE8-9 doesn't update selected after form reset (#2551)
  16235. if ( ( option.selected || i === index ) &&
  16236. // Don't return options that are disabled or in a disabled optgroup
  16237. !option.disabled &&
  16238. ( !option.parentNode.disabled ||
  16239. !nodeName( option.parentNode, "optgroup" ) ) ) {
  16240. // Get the specific value for the option
  16241. value = jQuery( option ).val();
  16242. // We don't need an array for one selects
  16243. if ( one ) {
  16244. return value;
  16245. }
  16246. // Multi-Selects return an array
  16247. values.push( value );
  16248. }
  16249. }
  16250. return values;
  16251. },
  16252. set: function( elem, value ) {
  16253. var optionSet, option,
  16254. options = elem.options,
  16255. values = jQuery.makeArray( value ),
  16256. i = options.length;
  16257. while ( i-- ) {
  16258. option = options[ i ];
  16259. /* eslint-disable no-cond-assign */
  16260. if ( option.selected =
  16261. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  16262. ) {
  16263. optionSet = true;
  16264. }
  16265. /* eslint-enable no-cond-assign */
  16266. }
  16267. // Force browsers to behave consistently when non-matching value is set
  16268. if ( !optionSet ) {
  16269. elem.selectedIndex = -1;
  16270. }
  16271. return values;
  16272. }
  16273. }
  16274. }
  16275. } );
  16276. // Radios and checkboxes getter/setter
  16277. jQuery.each( [ "radio", "checkbox" ], function() {
  16278. jQuery.valHooks[ this ] = {
  16279. set: function( elem, value ) {
  16280. if ( Array.isArray( value ) ) {
  16281. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  16282. }
  16283. }
  16284. };
  16285. if ( !support.checkOn ) {
  16286. jQuery.valHooks[ this ].get = function( elem ) {
  16287. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  16288. };
  16289. }
  16290. } );
  16291. // Return jQuery for attributes-only inclusion
  16292. support.focusin = "onfocusin" in window;
  16293. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  16294. stopPropagationCallback = function( e ) {
  16295. e.stopPropagation();
  16296. };
  16297. jQuery.extend( jQuery.event, {
  16298. trigger: function( event, data, elem, onlyHandlers ) {
  16299. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  16300. eventPath = [ elem || document ],
  16301. type = hasOwn.call( event, "type" ) ? event.type : event,
  16302. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  16303. cur = lastElement = tmp = elem = elem || document;
  16304. // Don't do events on text and comment nodes
  16305. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  16306. return;
  16307. }
  16308. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  16309. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  16310. return;
  16311. }
  16312. if ( type.indexOf( "." ) > -1 ) {
  16313. // Namespaced trigger; create a regexp to match event type in handle()
  16314. namespaces = type.split( "." );
  16315. type = namespaces.shift();
  16316. namespaces.sort();
  16317. }
  16318. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  16319. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  16320. event = event[ jQuery.expando ] ?
  16321. event :
  16322. new jQuery.Event( type, typeof event === "object" && event );
  16323. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  16324. event.isTrigger = onlyHandlers ? 2 : 3;
  16325. event.namespace = namespaces.join( "." );
  16326. event.rnamespace = event.namespace ?
  16327. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  16328. null;
  16329. // Clean up the event in case it is being reused
  16330. event.result = undefined;
  16331. if ( !event.target ) {
  16332. event.target = elem;
  16333. }
  16334. // Clone any incoming data and prepend the event, creating the handler arg list
  16335. data = data == null ?
  16336. [ event ] :
  16337. jQuery.makeArray( data, [ event ] );
  16338. // Allow special events to draw outside the lines
  16339. special = jQuery.event.special[ type ] || {};
  16340. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  16341. return;
  16342. }
  16343. // Determine event propagation path in advance, per W3C events spec (#9951)
  16344. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  16345. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  16346. bubbleType = special.delegateType || type;
  16347. if ( !rfocusMorph.test( bubbleType + type ) ) {
  16348. cur = cur.parentNode;
  16349. }
  16350. for ( ; cur; cur = cur.parentNode ) {
  16351. eventPath.push( cur );
  16352. tmp = cur;
  16353. }
  16354. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  16355. if ( tmp === ( elem.ownerDocument || document ) ) {
  16356. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  16357. }
  16358. }
  16359. // Fire handlers on the event path
  16360. i = 0;
  16361. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  16362. lastElement = cur;
  16363. event.type = i > 1 ?
  16364. bubbleType :
  16365. special.bindType || type;
  16366. // jQuery handler
  16367. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  16368. dataPriv.get( cur, "handle" );
  16369. if ( handle ) {
  16370. handle.apply( cur, data );
  16371. }
  16372. // Native handler
  16373. handle = ontype && cur[ ontype ];
  16374. if ( handle && handle.apply && acceptData( cur ) ) {
  16375. event.result = handle.apply( cur, data );
  16376. if ( event.result === false ) {
  16377. event.preventDefault();
  16378. }
  16379. }
  16380. }
  16381. event.type = type;
  16382. // If nobody prevented the default action, do it now
  16383. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  16384. if ( ( !special._default ||
  16385. special._default.apply( eventPath.pop(), data ) === false ) &&
  16386. acceptData( elem ) ) {
  16387. // Call a native DOM method on the target with the same name as the event.
  16388. // Don't do default actions on window, that's where global variables be (#6170)
  16389. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  16390. // Don't re-trigger an onFOO event when we call its FOO() method
  16391. tmp = elem[ ontype ];
  16392. if ( tmp ) {
  16393. elem[ ontype ] = null;
  16394. }
  16395. // Prevent re-triggering of the same event, since we already bubbled it above
  16396. jQuery.event.triggered = type;
  16397. if ( event.isPropagationStopped() ) {
  16398. lastElement.addEventListener( type, stopPropagationCallback );
  16399. }
  16400. elem[ type ]();
  16401. if ( event.isPropagationStopped() ) {
  16402. lastElement.removeEventListener( type, stopPropagationCallback );
  16403. }
  16404. jQuery.event.triggered = undefined;
  16405. if ( tmp ) {
  16406. elem[ ontype ] = tmp;
  16407. }
  16408. }
  16409. }
  16410. }
  16411. return event.result;
  16412. },
  16413. // Piggyback on a donor event to simulate a different one
  16414. // Used only for `focus(in | out)` events
  16415. simulate: function( type, elem, event ) {
  16416. var e = jQuery.extend(
  16417. new jQuery.Event(),
  16418. event,
  16419. {
  16420. type: type,
  16421. isSimulated: true
  16422. }
  16423. );
  16424. jQuery.event.trigger( e, null, elem );
  16425. }
  16426. } );
  16427. jQuery.fn.extend( {
  16428. trigger: function( type, data ) {
  16429. return this.each( function() {
  16430. jQuery.event.trigger( type, data, this );
  16431. } );
  16432. },
  16433. triggerHandler: function( type, data ) {
  16434. var elem = this[ 0 ];
  16435. if ( elem ) {
  16436. return jQuery.event.trigger( type, data, elem, true );
  16437. }
  16438. }
  16439. } );
  16440. // Support: Firefox <=44
  16441. // Firefox doesn't have focus(in | out) events
  16442. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  16443. //
  16444. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  16445. // focus(in | out) events fire after focus & blur events,
  16446. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  16447. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  16448. if ( !support.focusin ) {
  16449. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  16450. // Attach a single capturing handler on the document while someone wants focusin/focusout
  16451. var handler = function( event ) {
  16452. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  16453. };
  16454. jQuery.event.special[ fix ] = {
  16455. setup: function() {
  16456. var doc = this.ownerDocument || this,
  16457. attaches = dataPriv.access( doc, fix );
  16458. if ( !attaches ) {
  16459. doc.addEventListener( orig, handler, true );
  16460. }
  16461. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  16462. },
  16463. teardown: function() {
  16464. var doc = this.ownerDocument || this,
  16465. attaches = dataPriv.access( doc, fix ) - 1;
  16466. if ( !attaches ) {
  16467. doc.removeEventListener( orig, handler, true );
  16468. dataPriv.remove( doc, fix );
  16469. } else {
  16470. dataPriv.access( doc, fix, attaches );
  16471. }
  16472. }
  16473. };
  16474. } );
  16475. }
  16476. var location = window.location;
  16477. var nonce = Date.now();
  16478. var rquery = ( /\?/ );
  16479. // Cross-browser xml parsing
  16480. jQuery.parseXML = function( data ) {
  16481. var xml;
  16482. if ( !data || typeof data !== "string" ) {
  16483. return null;
  16484. }
  16485. // Support: IE 9 - 11 only
  16486. // IE throws on parseFromString with invalid input.
  16487. try {
  16488. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  16489. } catch ( e ) {
  16490. xml = undefined;
  16491. }
  16492. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  16493. jQuery.error( "Invalid XML: " + data );
  16494. }
  16495. return xml;
  16496. };
  16497. var
  16498. rbracket = /\[\]$/,
  16499. rCRLF = /\r?\n/g,
  16500. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  16501. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  16502. function buildParams( prefix, obj, traditional, add ) {
  16503. var name;
  16504. if ( Array.isArray( obj ) ) {
  16505. // Serialize array item.
  16506. jQuery.each( obj, function( i, v ) {
  16507. if ( traditional || rbracket.test( prefix ) ) {
  16508. // Treat each array item as a scalar.
  16509. add( prefix, v );
  16510. } else {
  16511. // Item is non-scalar (array or object), encode its numeric index.
  16512. buildParams(
  16513. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  16514. v,
  16515. traditional,
  16516. add
  16517. );
  16518. }
  16519. } );
  16520. } else if ( !traditional && toType( obj ) === "object" ) {
  16521. // Serialize object item.
  16522. for ( name in obj ) {
  16523. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  16524. }
  16525. } else {
  16526. // Serialize scalar item.
  16527. add( prefix, obj );
  16528. }
  16529. }
  16530. // Serialize an array of form elements or a set of
  16531. // key/values into a query string
  16532. jQuery.param = function( a, traditional ) {
  16533. var prefix,
  16534. s = [],
  16535. add = function( key, valueOrFunction ) {
  16536. // If value is a function, invoke it and use its return value
  16537. var value = isFunction( valueOrFunction ) ?
  16538. valueOrFunction() :
  16539. valueOrFunction;
  16540. s[ s.length ] = encodeURIComponent( key ) + "=" +
  16541. encodeURIComponent( value == null ? "" : value );
  16542. };
  16543. if ( a == null ) {
  16544. return "";
  16545. }
  16546. // If an array was passed in, assume that it is an array of form elements.
  16547. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  16548. // Serialize the form elements
  16549. jQuery.each( a, function() {
  16550. add( this.name, this.value );
  16551. } );
  16552. } else {
  16553. // If traditional, encode the "old" way (the way 1.3.2 or older
  16554. // did it), otherwise encode params recursively.
  16555. for ( prefix in a ) {
  16556. buildParams( prefix, a[ prefix ], traditional, add );
  16557. }
  16558. }
  16559. // Return the resulting serialization
  16560. return s.join( "&" );
  16561. };
  16562. jQuery.fn.extend( {
  16563. serialize: function() {
  16564. return jQuery.param( this.serializeArray() );
  16565. },
  16566. serializeArray: function() {
  16567. return this.map( function() {
  16568. // Can add propHook for "elements" to filter or add form elements
  16569. var elements = jQuery.prop( this, "elements" );
  16570. return elements ? jQuery.makeArray( elements ) : this;
  16571. } )
  16572. .filter( function() {
  16573. var type = this.type;
  16574. // Use .is( ":disabled" ) so that fieldset[disabled] works
  16575. return this.name && !jQuery( this ).is( ":disabled" ) &&
  16576. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  16577. ( this.checked || !rcheckableType.test( type ) );
  16578. } )
  16579. .map( function( i, elem ) {
  16580. var val = jQuery( this ).val();
  16581. if ( val == null ) {
  16582. return null;
  16583. }
  16584. if ( Array.isArray( val ) ) {
  16585. return jQuery.map( val, function( val ) {
  16586. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  16587. } );
  16588. }
  16589. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  16590. } ).get();
  16591. }
  16592. } );
  16593. var
  16594. r20 = /%20/g,
  16595. rhash = /#.*$/,
  16596. rantiCache = /([?&])_=[^&]*/,
  16597. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  16598. // #7653, #8125, #8152: local protocol detection
  16599. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  16600. rnoContent = /^(?:GET|HEAD)$/,
  16601. rprotocol = /^\/\//,
  16602. /* Prefilters
  16603. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  16604. * 2) These are called:
  16605. * - BEFORE asking for a transport
  16606. * - AFTER param serialization (s.data is a string if s.processData is true)
  16607. * 3) key is the dataType
  16608. * 4) the catchall symbol "*" can be used
  16609. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  16610. */
  16611. prefilters = {},
  16612. /* Transports bindings
  16613. * 1) key is the dataType
  16614. * 2) the catchall symbol "*" can be used
  16615. * 3) selection will start with transport dataType and THEN go to "*" if needed
  16616. */
  16617. transports = {},
  16618. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  16619. allTypes = "*/".concat( "*" ),
  16620. // Anchor tag for parsing the document origin
  16621. originAnchor = document.createElement( "a" );
  16622. originAnchor.href = location.href;
  16623. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  16624. function addToPrefiltersOrTransports( structure ) {
  16625. // dataTypeExpression is optional and defaults to "*"
  16626. return function( dataTypeExpression, func ) {
  16627. if ( typeof dataTypeExpression !== "string" ) {
  16628. func = dataTypeExpression;
  16629. dataTypeExpression = "*";
  16630. }
  16631. var dataType,
  16632. i = 0,
  16633. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  16634. if ( isFunction( func ) ) {
  16635. // For each dataType in the dataTypeExpression
  16636. while ( ( dataType = dataTypes[ i++ ] ) ) {
  16637. // Prepend if requested
  16638. if ( dataType[ 0 ] === "+" ) {
  16639. dataType = dataType.slice( 1 ) || "*";
  16640. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  16641. // Otherwise append
  16642. } else {
  16643. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  16644. }
  16645. }
  16646. }
  16647. };
  16648. }
  16649. // Base inspection function for prefilters and transports
  16650. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  16651. var inspected = {},
  16652. seekingTransport = ( structure === transports );
  16653. function inspect( dataType ) {
  16654. var selected;
  16655. inspected[ dataType ] = true;
  16656. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  16657. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  16658. if ( typeof dataTypeOrTransport === "string" &&
  16659. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  16660. options.dataTypes.unshift( dataTypeOrTransport );
  16661. inspect( dataTypeOrTransport );
  16662. return false;
  16663. } else if ( seekingTransport ) {
  16664. return !( selected = dataTypeOrTransport );
  16665. }
  16666. } );
  16667. return selected;
  16668. }
  16669. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  16670. }
  16671. // A special extend for ajax options
  16672. // that takes "flat" options (not to be deep extended)
  16673. // Fixes #9887
  16674. function ajaxExtend( target, src ) {
  16675. var key, deep,
  16676. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  16677. for ( key in src ) {
  16678. if ( src[ key ] !== undefined ) {
  16679. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  16680. }
  16681. }
  16682. if ( deep ) {
  16683. jQuery.extend( true, target, deep );
  16684. }
  16685. return target;
  16686. }
  16687. /* Handles responses to an ajax request:
  16688. * - finds the right dataType (mediates between content-type and expected dataType)
  16689. * - returns the corresponding response
  16690. */
  16691. function ajaxHandleResponses( s, jqXHR, responses ) {
  16692. var ct, type, finalDataType, firstDataType,
  16693. contents = s.contents,
  16694. dataTypes = s.dataTypes;
  16695. // Remove auto dataType and get content-type in the process
  16696. while ( dataTypes[ 0 ] === "*" ) {
  16697. dataTypes.shift();
  16698. if ( ct === undefined ) {
  16699. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  16700. }
  16701. }
  16702. // Check if we're dealing with a known content-type
  16703. if ( ct ) {
  16704. for ( type in contents ) {
  16705. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  16706. dataTypes.unshift( type );
  16707. break;
  16708. }
  16709. }
  16710. }
  16711. // Check to see if we have a response for the expected dataType
  16712. if ( dataTypes[ 0 ] in responses ) {
  16713. finalDataType = dataTypes[ 0 ];
  16714. } else {
  16715. // Try convertible dataTypes
  16716. for ( type in responses ) {
  16717. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  16718. finalDataType = type;
  16719. break;
  16720. }
  16721. if ( !firstDataType ) {
  16722. firstDataType = type;
  16723. }
  16724. }
  16725. // Or just use first one
  16726. finalDataType = finalDataType || firstDataType;
  16727. }
  16728. // If we found a dataType
  16729. // We add the dataType to the list if needed
  16730. // and return the corresponding response
  16731. if ( finalDataType ) {
  16732. if ( finalDataType !== dataTypes[ 0 ] ) {
  16733. dataTypes.unshift( finalDataType );
  16734. }
  16735. return responses[ finalDataType ];
  16736. }
  16737. }
  16738. /* Chain conversions given the request and the original response
  16739. * Also sets the responseXXX fields on the jqXHR instance
  16740. */
  16741. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  16742. var conv2, current, conv, tmp, prev,
  16743. converters = {},
  16744. // Work with a copy of dataTypes in case we need to modify it for conversion
  16745. dataTypes = s.dataTypes.slice();
  16746. // Create converters map with lowercased keys
  16747. if ( dataTypes[ 1 ] ) {
  16748. for ( conv in s.converters ) {
  16749. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  16750. }
  16751. }
  16752. current = dataTypes.shift();
  16753. // Convert to each sequential dataType
  16754. while ( current ) {
  16755. if ( s.responseFields[ current ] ) {
  16756. jqXHR[ s.responseFields[ current ] ] = response;
  16757. }
  16758. // Apply the dataFilter if provided
  16759. if ( !prev && isSuccess && s.dataFilter ) {
  16760. response = s.dataFilter( response, s.dataType );
  16761. }
  16762. prev = current;
  16763. current = dataTypes.shift();
  16764. if ( current ) {
  16765. // There's only work to do if current dataType is non-auto
  16766. if ( current === "*" ) {
  16767. current = prev;
  16768. // Convert response if prev dataType is non-auto and differs from current
  16769. } else if ( prev !== "*" && prev !== current ) {
  16770. // Seek a direct converter
  16771. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  16772. // If none found, seek a pair
  16773. if ( !conv ) {
  16774. for ( conv2 in converters ) {
  16775. // If conv2 outputs current
  16776. tmp = conv2.split( " " );
  16777. if ( tmp[ 1 ] === current ) {
  16778. // If prev can be converted to accepted input
  16779. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  16780. converters[ "* " + tmp[ 0 ] ];
  16781. if ( conv ) {
  16782. // Condense equivalence converters
  16783. if ( conv === true ) {
  16784. conv = converters[ conv2 ];
  16785. // Otherwise, insert the intermediate dataType
  16786. } else if ( converters[ conv2 ] !== true ) {
  16787. current = tmp[ 0 ];
  16788. dataTypes.unshift( tmp[ 1 ] );
  16789. }
  16790. break;
  16791. }
  16792. }
  16793. }
  16794. }
  16795. // Apply converter (if not an equivalence)
  16796. if ( conv !== true ) {
  16797. // Unless errors are allowed to bubble, catch and return them
  16798. if ( conv && s.throws ) {
  16799. response = conv( response );
  16800. } else {
  16801. try {
  16802. response = conv( response );
  16803. } catch ( e ) {
  16804. return {
  16805. state: "parsererror",
  16806. error: conv ? e : "No conversion from " + prev + " to " + current
  16807. };
  16808. }
  16809. }
  16810. }
  16811. }
  16812. }
  16813. }
  16814. return { state: "success", data: response };
  16815. }
  16816. jQuery.extend( {
  16817. // Counter for holding the number of active queries
  16818. active: 0,
  16819. // Last-Modified header cache for next request
  16820. lastModified: {},
  16821. etag: {},
  16822. ajaxSettings: {
  16823. url: location.href,
  16824. type: "GET",
  16825. isLocal: rlocalProtocol.test( location.protocol ),
  16826. global: true,
  16827. processData: true,
  16828. async: true,
  16829. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  16830. /*
  16831. timeout: 0,
  16832. data: null,
  16833. dataType: null,
  16834. username: null,
  16835. password: null,
  16836. cache: null,
  16837. throws: false,
  16838. traditional: false,
  16839. headers: {},
  16840. */
  16841. accepts: {
  16842. "*": allTypes,
  16843. text: "text/plain",
  16844. html: "text/html",
  16845. xml: "application/xml, text/xml",
  16846. json: "application/json, text/javascript"
  16847. },
  16848. contents: {
  16849. xml: /\bxml\b/,
  16850. html: /\bhtml/,
  16851. json: /\bjson\b/
  16852. },
  16853. responseFields: {
  16854. xml: "responseXML",
  16855. text: "responseText",
  16856. json: "responseJSON"
  16857. },
  16858. // Data converters
  16859. // Keys separate source (or catchall "*") and destination types with a single space
  16860. converters: {
  16861. // Convert anything to text
  16862. "* text": String,
  16863. // Text to html (true = no transformation)
  16864. "text html": true,
  16865. // Evaluate text as a json expression
  16866. "text json": JSON.parse,
  16867. // Parse text as xml
  16868. "text xml": jQuery.parseXML
  16869. },
  16870. // For options that shouldn't be deep extended:
  16871. // you can add your own custom options here if
  16872. // and when you create one that shouldn't be
  16873. // deep extended (see ajaxExtend)
  16874. flatOptions: {
  16875. url: true,
  16876. context: true
  16877. }
  16878. },
  16879. // Creates a full fledged settings object into target
  16880. // with both ajaxSettings and settings fields.
  16881. // If target is omitted, writes into ajaxSettings.
  16882. ajaxSetup: function( target, settings ) {
  16883. return settings ?
  16884. // Building a settings object
  16885. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  16886. // Extending ajaxSettings
  16887. ajaxExtend( jQuery.ajaxSettings, target );
  16888. },
  16889. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  16890. ajaxTransport: addToPrefiltersOrTransports( transports ),
  16891. // Main method
  16892. ajax: function( url, options ) {
  16893. // If url is an object, simulate pre-1.5 signature
  16894. if ( typeof url === "object" ) {
  16895. options = url;
  16896. url = undefined;
  16897. }
  16898. // Force options to be an object
  16899. options = options || {};
  16900. var transport,
  16901. // URL without anti-cache param
  16902. cacheURL,
  16903. // Response headers
  16904. responseHeadersString,
  16905. responseHeaders,
  16906. // timeout handle
  16907. timeoutTimer,
  16908. // Url cleanup var
  16909. urlAnchor,
  16910. // Request state (becomes false upon send and true upon completion)
  16911. completed,
  16912. // To know if global events are to be dispatched
  16913. fireGlobals,
  16914. // Loop variable
  16915. i,
  16916. // uncached part of the url
  16917. uncached,
  16918. // Create the final options object
  16919. s = jQuery.ajaxSetup( {}, options ),
  16920. // Callbacks context
  16921. callbackContext = s.context || s,
  16922. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  16923. globalEventContext = s.context &&
  16924. ( callbackContext.nodeType || callbackContext.jquery ) ?
  16925. jQuery( callbackContext ) :
  16926. jQuery.event,
  16927. // Deferreds
  16928. deferred = jQuery.Deferred(),
  16929. completeDeferred = jQuery.Callbacks( "once memory" ),
  16930. // Status-dependent callbacks
  16931. statusCode = s.statusCode || {},
  16932. // Headers (they are sent all at once)
  16933. requestHeaders = {},
  16934. requestHeadersNames = {},
  16935. // Default abort message
  16936. strAbort = "canceled",
  16937. // Fake xhr
  16938. jqXHR = {
  16939. readyState: 0,
  16940. // Builds headers hashtable if needed
  16941. getResponseHeader: function( key ) {
  16942. var match;
  16943. if ( completed ) {
  16944. if ( !responseHeaders ) {
  16945. responseHeaders = {};
  16946. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  16947. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  16948. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  16949. .concat( match[ 2 ] );
  16950. }
  16951. }
  16952. match = responseHeaders[ key.toLowerCase() + " " ];
  16953. }
  16954. return match == null ? null : match.join( ", " );
  16955. },
  16956. // Raw string
  16957. getAllResponseHeaders: function() {
  16958. return completed ? responseHeadersString : null;
  16959. },
  16960. // Caches the header
  16961. setRequestHeader: function( name, value ) {
  16962. if ( completed == null ) {
  16963. name = requestHeadersNames[ name.toLowerCase() ] =
  16964. requestHeadersNames[ name.toLowerCase() ] || name;
  16965. requestHeaders[ name ] = value;
  16966. }
  16967. return this;
  16968. },
  16969. // Overrides response content-type header
  16970. overrideMimeType: function( type ) {
  16971. if ( completed == null ) {
  16972. s.mimeType = type;
  16973. }
  16974. return this;
  16975. },
  16976. // Status-dependent callbacks
  16977. statusCode: function( map ) {
  16978. var code;
  16979. if ( map ) {
  16980. if ( completed ) {
  16981. // Execute the appropriate callbacks
  16982. jqXHR.always( map[ jqXHR.status ] );
  16983. } else {
  16984. // Lazy-add the new callbacks in a way that preserves old ones
  16985. for ( code in map ) {
  16986. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  16987. }
  16988. }
  16989. }
  16990. return this;
  16991. },
  16992. // Cancel the request
  16993. abort: function( statusText ) {
  16994. var finalText = statusText || strAbort;
  16995. if ( transport ) {
  16996. transport.abort( finalText );
  16997. }
  16998. done( 0, finalText );
  16999. return this;
  17000. }
  17001. };
  17002. // Attach deferreds
  17003. deferred.promise( jqXHR );
  17004. // Add protocol if not provided (prefilters might expect it)
  17005. // Handle falsy url in the settings object (#10093: consistency with old signature)
  17006. // We also use the url parameter if available
  17007. s.url = ( ( url || s.url || location.href ) + "" )
  17008. .replace( rprotocol, location.protocol + "//" );
  17009. // Alias method option to type as per ticket #12004
  17010. s.type = options.method || options.type || s.method || s.type;
  17011. // Extract dataTypes list
  17012. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  17013. // A cross-domain request is in order when the origin doesn't match the current origin.
  17014. if ( s.crossDomain == null ) {
  17015. urlAnchor = document.createElement( "a" );
  17016. // Support: IE <=8 - 11, Edge 12 - 15
  17017. // IE throws exception on accessing the href property if url is malformed,
  17018. // e.g. http://example.com:80x/
  17019. try {
  17020. urlAnchor.href = s.url;
  17021. // Support: IE <=8 - 11 only
  17022. // Anchor's host property isn't correctly set when s.url is relative
  17023. urlAnchor.href = urlAnchor.href;
  17024. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  17025. urlAnchor.protocol + "//" + urlAnchor.host;
  17026. } catch ( e ) {
  17027. // If there is an error parsing the URL, assume it is crossDomain,
  17028. // it can be rejected by the transport if it is invalid
  17029. s.crossDomain = true;
  17030. }
  17031. }
  17032. // Convert data if not already a string
  17033. if ( s.data && s.processData && typeof s.data !== "string" ) {
  17034. s.data = jQuery.param( s.data, s.traditional );
  17035. }
  17036. // Apply prefilters
  17037. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  17038. // If request was aborted inside a prefilter, stop there
  17039. if ( completed ) {
  17040. return jqXHR;
  17041. }
  17042. // We can fire global events as of now if asked to
  17043. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  17044. fireGlobals = jQuery.event && s.global;
  17045. // Watch for a new set of requests
  17046. if ( fireGlobals && jQuery.active++ === 0 ) {
  17047. jQuery.event.trigger( "ajaxStart" );
  17048. }
  17049. // Uppercase the type
  17050. s.type = s.type.toUpperCase();
  17051. // Determine if request has content
  17052. s.hasContent = !rnoContent.test( s.type );
  17053. // Save the URL in case we're toying with the If-Modified-Since
  17054. // and/or If-None-Match header later on
  17055. // Remove hash to simplify url manipulation
  17056. cacheURL = s.url.replace( rhash, "" );
  17057. // More options handling for requests with no content
  17058. if ( !s.hasContent ) {
  17059. // Remember the hash so we can put it back
  17060. uncached = s.url.slice( cacheURL.length );
  17061. // If data is available and should be processed, append data to url
  17062. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  17063. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  17064. // #9682: remove data so that it's not used in an eventual retry
  17065. delete s.data;
  17066. }
  17067. // Add or update anti-cache param if needed
  17068. if ( s.cache === false ) {
  17069. cacheURL = cacheURL.replace( rantiCache, "$1" );
  17070. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  17071. }
  17072. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  17073. s.url = cacheURL + uncached;
  17074. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  17075. } else if ( s.data && s.processData &&
  17076. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  17077. s.data = s.data.replace( r20, "+" );
  17078. }
  17079. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  17080. if ( s.ifModified ) {
  17081. if ( jQuery.lastModified[ cacheURL ] ) {
  17082. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  17083. }
  17084. if ( jQuery.etag[ cacheURL ] ) {
  17085. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  17086. }
  17087. }
  17088. // Set the correct header, if data is being sent
  17089. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  17090. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  17091. }
  17092. // Set the Accepts header for the server, depending on the dataType
  17093. jqXHR.setRequestHeader(
  17094. "Accept",
  17095. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  17096. s.accepts[ s.dataTypes[ 0 ] ] +
  17097. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  17098. s.accepts[ "*" ]
  17099. );
  17100. // Check for headers option
  17101. for ( i in s.headers ) {
  17102. jqXHR.setRequestHeader( i, s.headers[ i ] );
  17103. }
  17104. // Allow custom headers/mimetypes and early abort
  17105. if ( s.beforeSend &&
  17106. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  17107. // Abort if not done already and return
  17108. return jqXHR.abort();
  17109. }
  17110. // Aborting is no longer a cancellation
  17111. strAbort = "abort";
  17112. // Install callbacks on deferreds
  17113. completeDeferred.add( s.complete );
  17114. jqXHR.done( s.success );
  17115. jqXHR.fail( s.error );
  17116. // Get transport
  17117. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  17118. // If no transport, we auto-abort
  17119. if ( !transport ) {
  17120. done( -1, "No Transport" );
  17121. } else {
  17122. jqXHR.readyState = 1;
  17123. // Send global event
  17124. if ( fireGlobals ) {
  17125. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  17126. }
  17127. // If request was aborted inside ajaxSend, stop there
  17128. if ( completed ) {
  17129. return jqXHR;
  17130. }
  17131. // Timeout
  17132. if ( s.async && s.timeout > 0 ) {
  17133. timeoutTimer = window.setTimeout( function() {
  17134. jqXHR.abort( "timeout" );
  17135. }, s.timeout );
  17136. }
  17137. try {
  17138. completed = false;
  17139. transport.send( requestHeaders, done );
  17140. } catch ( e ) {
  17141. // Rethrow post-completion exceptions
  17142. if ( completed ) {
  17143. throw e;
  17144. }
  17145. // Propagate others as results
  17146. done( -1, e );
  17147. }
  17148. }
  17149. // Callback for when everything is done
  17150. function done( status, nativeStatusText, responses, headers ) {
  17151. var isSuccess, success, error, response, modified,
  17152. statusText = nativeStatusText;
  17153. // Ignore repeat invocations
  17154. if ( completed ) {
  17155. return;
  17156. }
  17157. completed = true;
  17158. // Clear timeout if it exists
  17159. if ( timeoutTimer ) {
  17160. window.clearTimeout( timeoutTimer );
  17161. }
  17162. // Dereference transport for early garbage collection
  17163. // (no matter how long the jqXHR object will be used)
  17164. transport = undefined;
  17165. // Cache response headers
  17166. responseHeadersString = headers || "";
  17167. // Set readyState
  17168. jqXHR.readyState = status > 0 ? 4 : 0;
  17169. // Determine if successful
  17170. isSuccess = status >= 200 && status < 300 || status === 304;
  17171. // Get response data
  17172. if ( responses ) {
  17173. response = ajaxHandleResponses( s, jqXHR, responses );
  17174. }
  17175. // Convert no matter what (that way responseXXX fields are always set)
  17176. response = ajaxConvert( s, response, jqXHR, isSuccess );
  17177. // If successful, handle type chaining
  17178. if ( isSuccess ) {
  17179. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  17180. if ( s.ifModified ) {
  17181. modified = jqXHR.getResponseHeader( "Last-Modified" );
  17182. if ( modified ) {
  17183. jQuery.lastModified[ cacheURL ] = modified;
  17184. }
  17185. modified = jqXHR.getResponseHeader( "etag" );
  17186. if ( modified ) {
  17187. jQuery.etag[ cacheURL ] = modified;
  17188. }
  17189. }
  17190. // if no content
  17191. if ( status === 204 || s.type === "HEAD" ) {
  17192. statusText = "nocontent";
  17193. // if not modified
  17194. } else if ( status === 304 ) {
  17195. statusText = "notmodified";
  17196. // If we have data, let's convert it
  17197. } else {
  17198. statusText = response.state;
  17199. success = response.data;
  17200. error = response.error;
  17201. isSuccess = !error;
  17202. }
  17203. } else {
  17204. // Extract error from statusText and normalize for non-aborts
  17205. error = statusText;
  17206. if ( status || !statusText ) {
  17207. statusText = "error";
  17208. if ( status < 0 ) {
  17209. status = 0;
  17210. }
  17211. }
  17212. }
  17213. // Set data for the fake xhr object
  17214. jqXHR.status = status;
  17215. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  17216. // Success/Error
  17217. if ( isSuccess ) {
  17218. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  17219. } else {
  17220. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  17221. }
  17222. // Status-dependent callbacks
  17223. jqXHR.statusCode( statusCode );
  17224. statusCode = undefined;
  17225. if ( fireGlobals ) {
  17226. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  17227. [ jqXHR, s, isSuccess ? success : error ] );
  17228. }
  17229. // Complete
  17230. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  17231. if ( fireGlobals ) {
  17232. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  17233. // Handle the global AJAX counter
  17234. if ( !( --jQuery.active ) ) {
  17235. jQuery.event.trigger( "ajaxStop" );
  17236. }
  17237. }
  17238. }
  17239. return jqXHR;
  17240. },
  17241. getJSON: function( url, data, callback ) {
  17242. return jQuery.get( url, data, callback, "json" );
  17243. },
  17244. getScript: function( url, callback ) {
  17245. return jQuery.get( url, undefined, callback, "script" );
  17246. }
  17247. } );
  17248. jQuery.each( [ "get", "post" ], function( i, method ) {
  17249. jQuery[ method ] = function( url, data, callback, type ) {
  17250. // Shift arguments if data argument was omitted
  17251. if ( isFunction( data ) ) {
  17252. type = type || callback;
  17253. callback = data;
  17254. data = undefined;
  17255. }
  17256. // The url can be an options object (which then must have .url)
  17257. return jQuery.ajax( jQuery.extend( {
  17258. url: url,
  17259. type: method,
  17260. dataType: type,
  17261. data: data,
  17262. success: callback
  17263. }, jQuery.isPlainObject( url ) && url ) );
  17264. };
  17265. } );
  17266. jQuery._evalUrl = function( url, options ) {
  17267. return jQuery.ajax( {
  17268. url: url,
  17269. // Make this explicit, since user can override this through ajaxSetup (#11264)
  17270. type: "GET",
  17271. dataType: "script",
  17272. cache: true,
  17273. async: false,
  17274. global: false,
  17275. // Only evaluate the response if it is successful (gh-4126)
  17276. // dataFilter is not invoked for failure responses, so using it instead
  17277. // of the default converter is kludgy but it works.
  17278. converters: {
  17279. "text script": function() {}
  17280. },
  17281. dataFilter: function( response ) {
  17282. jQuery.globalEval( response, options );
  17283. }
  17284. } );
  17285. };
  17286. jQuery.fn.extend( {
  17287. wrapAll: function( html ) {
  17288. var wrap;
  17289. if ( this[ 0 ] ) {
  17290. if ( isFunction( html ) ) {
  17291. html = html.call( this[ 0 ] );
  17292. }
  17293. // The elements to wrap the target around
  17294. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  17295. if ( this[ 0 ].parentNode ) {
  17296. wrap.insertBefore( this[ 0 ] );
  17297. }
  17298. wrap.map( function() {
  17299. var elem = this;
  17300. while ( elem.firstElementChild ) {
  17301. elem = elem.firstElementChild;
  17302. }
  17303. return elem;
  17304. } ).append( this );
  17305. }
  17306. return this;
  17307. },
  17308. wrapInner: function( html ) {
  17309. if ( isFunction( html ) ) {
  17310. return this.each( function( i ) {
  17311. jQuery( this ).wrapInner( html.call( this, i ) );
  17312. } );
  17313. }
  17314. return this.each( function() {
  17315. var self = jQuery( this ),
  17316. contents = self.contents();
  17317. if ( contents.length ) {
  17318. contents.wrapAll( html );
  17319. } else {
  17320. self.append( html );
  17321. }
  17322. } );
  17323. },
  17324. wrap: function( html ) {
  17325. var htmlIsFunction = isFunction( html );
  17326. return this.each( function( i ) {
  17327. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  17328. } );
  17329. },
  17330. unwrap: function( selector ) {
  17331. this.parent( selector ).not( "body" ).each( function() {
  17332. jQuery( this ).replaceWith( this.childNodes );
  17333. } );
  17334. return this;
  17335. }
  17336. } );
  17337. jQuery.expr.pseudos.hidden = function( elem ) {
  17338. return !jQuery.expr.pseudos.visible( elem );
  17339. };
  17340. jQuery.expr.pseudos.visible = function( elem ) {
  17341. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  17342. };
  17343. jQuery.ajaxSettings.xhr = function() {
  17344. try {
  17345. return new window.XMLHttpRequest();
  17346. } catch ( e ) {}
  17347. };
  17348. var xhrSuccessStatus = {
  17349. // File protocol always yields status code 0, assume 200
  17350. 0: 200,
  17351. // Support: IE <=9 only
  17352. // #1450: sometimes IE returns 1223 when it should be 204
  17353. 1223: 204
  17354. },
  17355. xhrSupported = jQuery.ajaxSettings.xhr();
  17356. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  17357. support.ajax = xhrSupported = !!xhrSupported;
  17358. jQuery.ajaxTransport( function( options ) {
  17359. var callback, errorCallback;
  17360. // Cross domain only allowed if supported through XMLHttpRequest
  17361. if ( support.cors || xhrSupported && !options.crossDomain ) {
  17362. return {
  17363. send: function( headers, complete ) {
  17364. var i,
  17365. xhr = options.xhr();
  17366. xhr.open(
  17367. options.type,
  17368. options.url,
  17369. options.async,
  17370. options.username,
  17371. options.password
  17372. );
  17373. // Apply custom fields if provided
  17374. if ( options.xhrFields ) {
  17375. for ( i in options.xhrFields ) {
  17376. xhr[ i ] = options.xhrFields[ i ];
  17377. }
  17378. }
  17379. // Override mime type if needed
  17380. if ( options.mimeType && xhr.overrideMimeType ) {
  17381. xhr.overrideMimeType( options.mimeType );
  17382. }
  17383. // X-Requested-With header
  17384. // For cross-domain requests, seeing as conditions for a preflight are
  17385. // akin to a jigsaw puzzle, we simply never set it to be sure.
  17386. // (it can always be set on a per-request basis or even using ajaxSetup)
  17387. // For same-domain requests, won't change header if already provided.
  17388. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  17389. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  17390. }
  17391. // Set headers
  17392. for ( i in headers ) {
  17393. xhr.setRequestHeader( i, headers[ i ] );
  17394. }
  17395. // Callback
  17396. callback = function( type ) {
  17397. return function() {
  17398. if ( callback ) {
  17399. callback = errorCallback = xhr.onload =
  17400. xhr.onerror = xhr.onabort = xhr.ontimeout =
  17401. xhr.onreadystatechange = null;
  17402. if ( type === "abort" ) {
  17403. xhr.abort();
  17404. } else if ( type === "error" ) {
  17405. // Support: IE <=9 only
  17406. // On a manual native abort, IE9 throws
  17407. // errors on any property access that is not readyState
  17408. if ( typeof xhr.status !== "number" ) {
  17409. complete( 0, "error" );
  17410. } else {
  17411. complete(
  17412. // File: protocol always yields status 0; see #8605, #14207
  17413. xhr.status,
  17414. xhr.statusText
  17415. );
  17416. }
  17417. } else {
  17418. complete(
  17419. xhrSuccessStatus[ xhr.status ] || xhr.status,
  17420. xhr.statusText,
  17421. // Support: IE <=9 only
  17422. // IE9 has no XHR2 but throws on binary (trac-11426)
  17423. // For XHR2 non-text, let the caller handle it (gh-2498)
  17424. ( xhr.responseType || "text" ) !== "text" ||
  17425. typeof xhr.responseText !== "string" ?
  17426. { binary: xhr.response } :
  17427. { text: xhr.responseText },
  17428. xhr.getAllResponseHeaders()
  17429. );
  17430. }
  17431. }
  17432. };
  17433. };
  17434. // Listen to events
  17435. xhr.onload = callback();
  17436. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  17437. // Support: IE 9 only
  17438. // Use onreadystatechange to replace onabort
  17439. // to handle uncaught aborts
  17440. if ( xhr.onabort !== undefined ) {
  17441. xhr.onabort = errorCallback;
  17442. } else {
  17443. xhr.onreadystatechange = function() {
  17444. // Check readyState before timeout as it changes
  17445. if ( xhr.readyState === 4 ) {
  17446. // Allow onerror to be called first,
  17447. // but that will not handle a native abort
  17448. // Also, save errorCallback to a variable
  17449. // as xhr.onerror cannot be accessed
  17450. window.setTimeout( function() {
  17451. if ( callback ) {
  17452. errorCallback();
  17453. }
  17454. } );
  17455. }
  17456. };
  17457. }
  17458. // Create the abort callback
  17459. callback = callback( "abort" );
  17460. try {
  17461. // Do send the request (this may raise an exception)
  17462. xhr.send( options.hasContent && options.data || null );
  17463. } catch ( e ) {
  17464. // #14683: Only rethrow if this hasn't been notified as an error yet
  17465. if ( callback ) {
  17466. throw e;
  17467. }
  17468. }
  17469. },
  17470. abort: function() {
  17471. if ( callback ) {
  17472. callback();
  17473. }
  17474. }
  17475. };
  17476. }
  17477. } );
  17478. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  17479. jQuery.ajaxPrefilter( function( s ) {
  17480. if ( s.crossDomain ) {
  17481. s.contents.script = false;
  17482. }
  17483. } );
  17484. // Install script dataType
  17485. jQuery.ajaxSetup( {
  17486. accepts: {
  17487. script: "text/javascript, application/javascript, " +
  17488. "application/ecmascript, application/x-ecmascript"
  17489. },
  17490. contents: {
  17491. script: /\b(?:java|ecma)script\b/
  17492. },
  17493. converters: {
  17494. "text script": function( text ) {
  17495. jQuery.globalEval( text );
  17496. return text;
  17497. }
  17498. }
  17499. } );
  17500. // Handle cache's special case and crossDomain
  17501. jQuery.ajaxPrefilter( "script", function( s ) {
  17502. if ( s.cache === undefined ) {
  17503. s.cache = false;
  17504. }
  17505. if ( s.crossDomain ) {
  17506. s.type = "GET";
  17507. }
  17508. } );
  17509. // Bind script tag hack transport
  17510. jQuery.ajaxTransport( "script", function( s ) {
  17511. // This transport only deals with cross domain or forced-by-attrs requests
  17512. if ( s.crossDomain || s.scriptAttrs ) {
  17513. var script, callback;
  17514. return {
  17515. send: function( _, complete ) {
  17516. script = jQuery( "<script>" )
  17517. .attr( s.scriptAttrs || {} )
  17518. .prop( { charset: s.scriptCharset, src: s.url } )
  17519. .on( "load error", callback = function( evt ) {
  17520. script.remove();
  17521. callback = null;
  17522. if ( evt ) {
  17523. complete( evt.type === "error" ? 404 : 200, evt.type );
  17524. }
  17525. } );
  17526. // Use native DOM manipulation to avoid our domManip AJAX trickery
  17527. document.head.appendChild( script[ 0 ] );
  17528. },
  17529. abort: function() {
  17530. if ( callback ) {
  17531. callback();
  17532. }
  17533. }
  17534. };
  17535. }
  17536. } );
  17537. var oldCallbacks = [],
  17538. rjsonp = /(=)\?(?=&|$)|\?\?/;
  17539. // Default jsonp settings
  17540. jQuery.ajaxSetup( {
  17541. jsonp: "callback",
  17542. jsonpCallback: function() {
  17543. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  17544. this[ callback ] = true;
  17545. return callback;
  17546. }
  17547. } );
  17548. // Detect, normalize options and install callbacks for jsonp requests
  17549. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  17550. var callbackName, overwritten, responseContainer,
  17551. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  17552. "url" :
  17553. typeof s.data === "string" &&
  17554. ( s.contentType || "" )
  17555. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  17556. rjsonp.test( s.data ) && "data"
  17557. );
  17558. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  17559. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  17560. // Get callback name, remembering preexisting value associated with it
  17561. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  17562. s.jsonpCallback() :
  17563. s.jsonpCallback;
  17564. // Insert callback into url or form data
  17565. if ( jsonProp ) {
  17566. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  17567. } else if ( s.jsonp !== false ) {
  17568. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  17569. }
  17570. // Use data converter to retrieve json after script execution
  17571. s.converters[ "script json" ] = function() {
  17572. if ( !responseContainer ) {
  17573. jQuery.error( callbackName + " was not called" );
  17574. }
  17575. return responseContainer[ 0 ];
  17576. };
  17577. // Force json dataType
  17578. s.dataTypes[ 0 ] = "json";
  17579. // Install callback
  17580. overwritten = window[ callbackName ];
  17581. window[ callbackName ] = function() {
  17582. responseContainer = arguments;
  17583. };
  17584. // Clean-up function (fires after converters)
  17585. jqXHR.always( function() {
  17586. // If previous value didn't exist - remove it
  17587. if ( overwritten === undefined ) {
  17588. jQuery( window ).removeProp( callbackName );
  17589. // Otherwise restore preexisting value
  17590. } else {
  17591. window[ callbackName ] = overwritten;
  17592. }
  17593. // Save back as free
  17594. if ( s[ callbackName ] ) {
  17595. // Make sure that re-using the options doesn't screw things around
  17596. s.jsonpCallback = originalSettings.jsonpCallback;
  17597. // Save the callback name for future use
  17598. oldCallbacks.push( callbackName );
  17599. }
  17600. // Call if it was a function and we have a response
  17601. if ( responseContainer && isFunction( overwritten ) ) {
  17602. overwritten( responseContainer[ 0 ] );
  17603. }
  17604. responseContainer = overwritten = undefined;
  17605. } );
  17606. // Delegate to script
  17607. return "script";
  17608. }
  17609. } );
  17610. // Support: Safari 8 only
  17611. // In Safari 8 documents created via document.implementation.createHTMLDocument
  17612. // collapse sibling forms: the second one becomes a child of the first one.
  17613. // Because of that, this security measure has to be disabled in Safari 8.
  17614. // https://bugs.webkit.org/show_bug.cgi?id=137337
  17615. support.createHTMLDocument = ( function() {
  17616. var body = document.implementation.createHTMLDocument( "" ).body;
  17617. body.innerHTML = "<form></form><form></form>";
  17618. return body.childNodes.length === 2;
  17619. } )();
  17620. // Argument "data" should be string of html
  17621. // context (optional): If specified, the fragment will be created in this context,
  17622. // defaults to document
  17623. // keepScripts (optional): If true, will include scripts passed in the html string
  17624. jQuery.parseHTML = function( data, context, keepScripts ) {
  17625. if ( typeof data !== "string" ) {
  17626. return [];
  17627. }
  17628. if ( typeof context === "boolean" ) {
  17629. keepScripts = context;
  17630. context = false;
  17631. }
  17632. var base, parsed, scripts;
  17633. if ( !context ) {
  17634. // Stop scripts or inline event handlers from being executed immediately
  17635. // by using document.implementation
  17636. if ( support.createHTMLDocument ) {
  17637. context = document.implementation.createHTMLDocument( "" );
  17638. // Set the base href for the created document
  17639. // so any parsed elements with URLs
  17640. // are based on the document's URL (gh-2965)
  17641. base = context.createElement( "base" );
  17642. base.href = document.location.href;
  17643. context.head.appendChild( base );
  17644. } else {
  17645. context = document;
  17646. }
  17647. }
  17648. parsed = rsingleTag.exec( data );
  17649. scripts = !keepScripts && [];
  17650. // Single tag
  17651. if ( parsed ) {
  17652. return [ context.createElement( parsed[ 1 ] ) ];
  17653. }
  17654. parsed = buildFragment( [ data ], context, scripts );
  17655. if ( scripts && scripts.length ) {
  17656. jQuery( scripts ).remove();
  17657. }
  17658. return jQuery.merge( [], parsed.childNodes );
  17659. };
  17660. /**
  17661. * Load a url into a page
  17662. */
  17663. jQuery.fn.load = function( url, params, callback ) {
  17664. var selector, type, response,
  17665. self = this,
  17666. off = url.indexOf( " " );
  17667. if ( off > -1 ) {
  17668. selector = stripAndCollapse( url.slice( off ) );
  17669. url = url.slice( 0, off );
  17670. }
  17671. // If it's a function
  17672. if ( isFunction( params ) ) {
  17673. // We assume that it's the callback
  17674. callback = params;
  17675. params = undefined;
  17676. // Otherwise, build a param string
  17677. } else if ( params && typeof params === "object" ) {
  17678. type = "POST";
  17679. }
  17680. // If we have elements to modify, make the request
  17681. if ( self.length > 0 ) {
  17682. jQuery.ajax( {
  17683. url: url,
  17684. // If "type" variable is undefined, then "GET" method will be used.
  17685. // Make value of this field explicit since
  17686. // user can override it through ajaxSetup method
  17687. type: type || "GET",
  17688. dataType: "html",
  17689. data: params
  17690. } ).done( function( responseText ) {
  17691. // Save response for use in complete callback
  17692. response = arguments;
  17693. self.html( selector ?
  17694. // If a selector was specified, locate the right elements in a dummy div
  17695. // Exclude scripts to avoid IE 'Permission Denied' errors
  17696. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  17697. // Otherwise use the full result
  17698. responseText );
  17699. // If the request succeeds, this function gets "data", "status", "jqXHR"
  17700. // but they are ignored because response was set above.
  17701. // If it fails, this function gets "jqXHR", "status", "error"
  17702. } ).always( callback && function( jqXHR, status ) {
  17703. self.each( function() {
  17704. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  17705. } );
  17706. } );
  17707. }
  17708. return this;
  17709. };
  17710. // Attach a bunch of functions for handling common AJAX events
  17711. jQuery.each( [
  17712. "ajaxStart",
  17713. "ajaxStop",
  17714. "ajaxComplete",
  17715. "ajaxError",
  17716. "ajaxSuccess",
  17717. "ajaxSend"
  17718. ], function( i, type ) {
  17719. jQuery.fn[ type ] = function( fn ) {
  17720. return this.on( type, fn );
  17721. };
  17722. } );
  17723. jQuery.expr.pseudos.animated = function( elem ) {
  17724. return jQuery.grep( jQuery.timers, function( fn ) {
  17725. return elem === fn.elem;
  17726. } ).length;
  17727. };
  17728. jQuery.offset = {
  17729. setOffset: function( elem, options, i ) {
  17730. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  17731. position = jQuery.css( elem, "position" ),
  17732. curElem = jQuery( elem ),
  17733. props = {};
  17734. // Set position first, in-case top/left are set even on static elem
  17735. if ( position === "static" ) {
  17736. elem.style.position = "relative";
  17737. }
  17738. curOffset = curElem.offset();
  17739. curCSSTop = jQuery.css( elem, "top" );
  17740. curCSSLeft = jQuery.css( elem, "left" );
  17741. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  17742. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  17743. // Need to be able to calculate position if either
  17744. // top or left is auto and position is either absolute or fixed
  17745. if ( calculatePosition ) {
  17746. curPosition = curElem.position();
  17747. curTop = curPosition.top;
  17748. curLeft = curPosition.left;
  17749. } else {
  17750. curTop = parseFloat( curCSSTop ) || 0;
  17751. curLeft = parseFloat( curCSSLeft ) || 0;
  17752. }
  17753. if ( isFunction( options ) ) {
  17754. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  17755. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  17756. }
  17757. if ( options.top != null ) {
  17758. props.top = ( options.top - curOffset.top ) + curTop;
  17759. }
  17760. if ( options.left != null ) {
  17761. props.left = ( options.left - curOffset.left ) + curLeft;
  17762. }
  17763. if ( "using" in options ) {
  17764. options.using.call( elem, props );
  17765. } else {
  17766. curElem.css( props );
  17767. }
  17768. }
  17769. };
  17770. jQuery.fn.extend( {
  17771. // offset() relates an element's border box to the document origin
  17772. offset: function( options ) {
  17773. // Preserve chaining for setter
  17774. if ( arguments.length ) {
  17775. return options === undefined ?
  17776. this :
  17777. this.each( function( i ) {
  17778. jQuery.offset.setOffset( this, options, i );
  17779. } );
  17780. }
  17781. var rect, win,
  17782. elem = this[ 0 ];
  17783. if ( !elem ) {
  17784. return;
  17785. }
  17786. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  17787. // Support: IE <=11 only
  17788. // Running getBoundingClientRect on a
  17789. // disconnected node in IE throws an error
  17790. if ( !elem.getClientRects().length ) {
  17791. return { top: 0, left: 0 };
  17792. }
  17793. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  17794. rect = elem.getBoundingClientRect();
  17795. win = elem.ownerDocument.defaultView;
  17796. return {
  17797. top: rect.top + win.pageYOffset,
  17798. left: rect.left + win.pageXOffset
  17799. };
  17800. },
  17801. // position() relates an element's margin box to its offset parent's padding box
  17802. // This corresponds to the behavior of CSS absolute positioning
  17803. position: function() {
  17804. if ( !this[ 0 ] ) {
  17805. return;
  17806. }
  17807. var offsetParent, offset, doc,
  17808. elem = this[ 0 ],
  17809. parentOffset = { top: 0, left: 0 };
  17810. // position:fixed elements are offset from the viewport, which itself always has zero offset
  17811. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  17812. // Assume position:fixed implies availability of getBoundingClientRect
  17813. offset = elem.getBoundingClientRect();
  17814. } else {
  17815. offset = this.offset();
  17816. // Account for the *real* offset parent, which can be the document or its root element
  17817. // when a statically positioned element is identified
  17818. doc = elem.ownerDocument;
  17819. offsetParent = elem.offsetParent || doc.documentElement;
  17820. while ( offsetParent &&
  17821. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  17822. jQuery.css( offsetParent, "position" ) === "static" ) {
  17823. offsetParent = offsetParent.parentNode;
  17824. }
  17825. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  17826. // Incorporate borders into its offset, since they are outside its content origin
  17827. parentOffset = jQuery( offsetParent ).offset();
  17828. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  17829. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  17830. }
  17831. }
  17832. // Subtract parent offsets and element margins
  17833. return {
  17834. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  17835. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  17836. };
  17837. },
  17838. // This method will return documentElement in the following cases:
  17839. // 1) For the element inside the iframe without offsetParent, this method will return
  17840. // documentElement of the parent window
  17841. // 2) For the hidden or detached element
  17842. // 3) For body or html element, i.e. in case of the html node - it will return itself
  17843. //
  17844. // but those exceptions were never presented as a real life use-cases
  17845. // and might be considered as more preferable results.
  17846. //
  17847. // This logic, however, is not guaranteed and can change at any point in the future
  17848. offsetParent: function() {
  17849. return this.map( function() {
  17850. var offsetParent = this.offsetParent;
  17851. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  17852. offsetParent = offsetParent.offsetParent;
  17853. }
  17854. return offsetParent || documentElement;
  17855. } );
  17856. }
  17857. } );
  17858. // Create scrollLeft and scrollTop methods
  17859. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  17860. var top = "pageYOffset" === prop;
  17861. jQuery.fn[ method ] = function( val ) {
  17862. return access( this, function( elem, method, val ) {
  17863. // Coalesce documents and windows
  17864. var win;
  17865. if ( isWindow( elem ) ) {
  17866. win = elem;
  17867. } else if ( elem.nodeType === 9 ) {
  17868. win = elem.defaultView;
  17869. }
  17870. if ( val === undefined ) {
  17871. return win ? win[ prop ] : elem[ method ];
  17872. }
  17873. if ( win ) {
  17874. win.scrollTo(
  17875. !top ? val : win.pageXOffset,
  17876. top ? val : win.pageYOffset
  17877. );
  17878. } else {
  17879. elem[ method ] = val;
  17880. }
  17881. }, method, val, arguments.length );
  17882. };
  17883. } );
  17884. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  17885. // Add the top/left cssHooks using jQuery.fn.position
  17886. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  17887. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  17888. // getComputedStyle returns percent when specified for top/left/bottom/right;
  17889. // rather than make the css module depend on the offset module, just check for it here
  17890. jQuery.each( [ "top", "left" ], function( i, prop ) {
  17891. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  17892. function( elem, computed ) {
  17893. if ( computed ) {
  17894. computed = curCSS( elem, prop );
  17895. // If curCSS returns percentage, fallback to offset
  17896. return rnumnonpx.test( computed ) ?
  17897. jQuery( elem ).position()[ prop ] + "px" :
  17898. computed;
  17899. }
  17900. }
  17901. );
  17902. } );
  17903. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  17904. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  17905. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  17906. function( defaultExtra, funcName ) {
  17907. // Margin is only for outerHeight, outerWidth
  17908. jQuery.fn[ funcName ] = function( margin, value ) {
  17909. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  17910. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  17911. return access( this, function( elem, type, value ) {
  17912. var doc;
  17913. if ( isWindow( elem ) ) {
  17914. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  17915. return funcName.indexOf( "outer" ) === 0 ?
  17916. elem[ "inner" + name ] :
  17917. elem.document.documentElement[ "client" + name ];
  17918. }
  17919. // Get document width or height
  17920. if ( elem.nodeType === 9 ) {
  17921. doc = elem.documentElement;
  17922. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  17923. // whichever is greatest
  17924. return Math.max(
  17925. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  17926. elem.body[ "offset" + name ], doc[ "offset" + name ],
  17927. doc[ "client" + name ]
  17928. );
  17929. }
  17930. return value === undefined ?
  17931. // Get width or height on the element, requesting but not forcing parseFloat
  17932. jQuery.css( elem, type, extra ) :
  17933. // Set width or height on the element
  17934. jQuery.style( elem, type, value, extra );
  17935. }, type, chainable ? margin : undefined, chainable );
  17936. };
  17937. } );
  17938. } );
  17939. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  17940. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  17941. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  17942. function( i, name ) {
  17943. // Handle event binding
  17944. jQuery.fn[ name ] = function( data, fn ) {
  17945. return arguments.length > 0 ?
  17946. this.on( name, null, data, fn ) :
  17947. this.trigger( name );
  17948. };
  17949. } );
  17950. jQuery.fn.extend( {
  17951. hover: function( fnOver, fnOut ) {
  17952. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  17953. }
  17954. } );
  17955. jQuery.fn.extend( {
  17956. bind: function( types, data, fn ) {
  17957. return this.on( types, null, data, fn );
  17958. },
  17959. unbind: function( types, fn ) {
  17960. return this.off( types, null, fn );
  17961. },
  17962. delegate: function( selector, types, data, fn ) {
  17963. return this.on( types, selector, data, fn );
  17964. },
  17965. undelegate: function( selector, types, fn ) {
  17966. // ( namespace ) or ( selector, types [, fn] )
  17967. return arguments.length === 1 ?
  17968. this.off( selector, "**" ) :
  17969. this.off( types, selector || "**", fn );
  17970. }
  17971. } );
  17972. // Bind a function to a context, optionally partially applying any
  17973. // arguments.
  17974. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  17975. // However, it is not slated for removal any time soon
  17976. jQuery.proxy = function( fn, context ) {
  17977. var tmp, args, proxy;
  17978. if ( typeof context === "string" ) {
  17979. tmp = fn[ context ];
  17980. context = fn;
  17981. fn = tmp;
  17982. }
  17983. // Quick check to determine if target is callable, in the spec
  17984. // this throws a TypeError, but we will just return undefined.
  17985. if ( !isFunction( fn ) ) {
  17986. return undefined;
  17987. }
  17988. // Simulated bind
  17989. args = slice.call( arguments, 2 );
  17990. proxy = function() {
  17991. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  17992. };
  17993. // Set the guid of unique handler to the same of original handler, so it can be removed
  17994. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  17995. return proxy;
  17996. };
  17997. jQuery.holdReady = function( hold ) {
  17998. if ( hold ) {
  17999. jQuery.readyWait++;
  18000. } else {
  18001. jQuery.ready( true );
  18002. }
  18003. };
  18004. jQuery.isArray = Array.isArray;
  18005. jQuery.parseJSON = JSON.parse;
  18006. jQuery.nodeName = nodeName;
  18007. jQuery.isFunction = isFunction;
  18008. jQuery.isWindow = isWindow;
  18009. jQuery.camelCase = camelCase;
  18010. jQuery.type = toType;
  18011. jQuery.now = Date.now;
  18012. jQuery.isNumeric = function( obj ) {
  18013. // As of jQuery 3.0, isNumeric is limited to
  18014. // strings and numbers (primitives or objects)
  18015. // that can be coerced to finite numbers (gh-2662)
  18016. var type = jQuery.type( obj );
  18017. return ( type === "number" || type === "string" ) &&
  18018. // parseFloat NaNs numeric-cast false positives ("")
  18019. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  18020. // subtraction forces infinities to NaN
  18021. !isNaN( obj - parseFloat( obj ) );
  18022. };
  18023. // Register as a named AMD module, since jQuery can be concatenated with other
  18024. // files that may use define, but not via a proper concatenation script that
  18025. // understands anonymous AMD modules. A named AMD is safest and most robust
  18026. // way to register. Lowercase jquery is used because AMD module names are
  18027. // derived from file names, and jQuery is normally delivered in a lowercase
  18028. // file name. Do this after creating the global so that if an AMD module wants
  18029. // to call noConflict to hide this version of jQuery, it will work.
  18030. // Note that for maximum portability, libraries that are not jQuery should
  18031. // declare themselves as anonymous modules, and avoid setting a global if an
  18032. // AMD loader is present. jQuery is a special case. For more information, see
  18033. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  18034. if ( true ) {
  18035. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  18036. return jQuery;
  18037. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  18038. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  18039. }
  18040. var
  18041. // Map over jQuery in case of overwrite
  18042. _jQuery = window.jQuery,
  18043. // Map over the $ in case of overwrite
  18044. _$ = window.$;
  18045. jQuery.noConflict = function( deep ) {
  18046. if ( window.$ === jQuery ) {
  18047. window.$ = _$;
  18048. }
  18049. if ( deep && window.jQuery === jQuery ) {
  18050. window.jQuery = _jQuery;
  18051. }
  18052. return jQuery;
  18053. };
  18054. // Expose jQuery and $ identifiers, even in AMD
  18055. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  18056. // and CommonJS for browser emulators (#13566)
  18057. if ( !noGlobal ) {
  18058. window.jQuery = window.$ = jQuery;
  18059. }
  18060. return jQuery;
  18061. } );
  18062. /***/ }),
  18063. /***/ "./node_modules/laravel-echo/dist/echo.js":
  18064. /*!************************************************!*\
  18065. !*** ./node_modules/laravel-echo/dist/echo.js ***!
  18066. \************************************************/
  18067. /*! exports provided: default */
  18068. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  18069. "use strict";
  18070. __webpack_require__.r(__webpack_exports__);
  18071. var classCallCheck = function (instance, Constructor) {
  18072. if (!(instance instanceof Constructor)) {
  18073. throw new TypeError("Cannot call a class as a function");
  18074. }
  18075. };
  18076. var createClass = function () {
  18077. function defineProperties(target, props) {
  18078. for (var i = 0; i < props.length; i++) {
  18079. var descriptor = props[i];
  18080. descriptor.enumerable = descriptor.enumerable || false;
  18081. descriptor.configurable = true;
  18082. if ("value" in descriptor) descriptor.writable = true;
  18083. Object.defineProperty(target, descriptor.key, descriptor);
  18084. }
  18085. }
  18086. return function (Constructor, protoProps, staticProps) {
  18087. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  18088. if (staticProps) defineProperties(Constructor, staticProps);
  18089. return Constructor;
  18090. };
  18091. }();
  18092. var _extends = Object.assign || function (target) {
  18093. for (var i = 1; i < arguments.length; i++) {
  18094. var source = arguments[i];
  18095. for (var key in source) {
  18096. if (Object.prototype.hasOwnProperty.call(source, key)) {
  18097. target[key] = source[key];
  18098. }
  18099. }
  18100. }
  18101. return target;
  18102. };
  18103. var inherits = function (subClass, superClass) {
  18104. if (typeof superClass !== "function" && superClass !== null) {
  18105. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  18106. }
  18107. subClass.prototype = Object.create(superClass && superClass.prototype, {
  18108. constructor: {
  18109. value: subClass,
  18110. enumerable: false,
  18111. writable: true,
  18112. configurable: true
  18113. }
  18114. });
  18115. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  18116. };
  18117. var possibleConstructorReturn = function (self, call) {
  18118. if (!self) {
  18119. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  18120. }
  18121. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  18122. };
  18123. var Connector = function () {
  18124. /**
  18125. * Create a new class instance.
  18126. */
  18127. function Connector(options) {
  18128. classCallCheck(this, Connector);
  18129. /**
  18130. * Default connector options.
  18131. */
  18132. this._defaultOptions = {
  18133. auth: {
  18134. headers: {}
  18135. },
  18136. authEndpoint: '/broadcasting/auth',
  18137. broadcaster: 'pusher',
  18138. csrfToken: null,
  18139. host: null,
  18140. key: null,
  18141. namespace: 'App.Events'
  18142. };
  18143. this.setOptions(options);
  18144. this.connect();
  18145. }
  18146. /**
  18147. * Merge the custom options with the defaults.
  18148. */
  18149. createClass(Connector, [{
  18150. key: 'setOptions',
  18151. value: function setOptions(options) {
  18152. this.options = _extends(this._defaultOptions, options);
  18153. if (this.csrfToken()) {
  18154. this.options.auth.headers['X-CSRF-TOKEN'] = this.csrfToken();
  18155. }
  18156. return options;
  18157. }
  18158. /**
  18159. * Extract the CSRF token from the page.
  18160. */
  18161. }, {
  18162. key: 'csrfToken',
  18163. value: function csrfToken() {
  18164. var selector = void 0;
  18165. if (typeof window !== 'undefined' && window['Laravel'] && window['Laravel'].csrfToken) {
  18166. return window['Laravel'].csrfToken;
  18167. } else if (this.options.csrfToken) {
  18168. return this.options.csrfToken;
  18169. } else if (typeof document !== 'undefined' && typeof document.querySelector === 'function' && (selector = document.querySelector('meta[name="csrf-token"]'))) {
  18170. return selector.getAttribute('content');
  18171. }
  18172. return null;
  18173. }
  18174. }]);
  18175. return Connector;
  18176. }();
  18177. /**
  18178. * This class represents a basic channel.
  18179. */
  18180. var Channel = function () {
  18181. function Channel() {
  18182. classCallCheck(this, Channel);
  18183. }
  18184. createClass(Channel, [{
  18185. key: 'listenForWhisper',
  18186. /**
  18187. * Listen for a whisper event on the channel instance.
  18188. */
  18189. value: function listenForWhisper(event, callback) {
  18190. return this.listen('.client-' + event, callback);
  18191. }
  18192. /**
  18193. * Listen for an event on the channel instance.
  18194. */
  18195. }, {
  18196. key: 'notification',
  18197. value: function notification(callback) {
  18198. return this.listen('.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated', callback);
  18199. }
  18200. /**
  18201. * Stop listening for a whispser event on the channel instance.
  18202. */
  18203. }, {
  18204. key: 'stopListeningForWhisper',
  18205. value: function stopListeningForWhisper(event) {
  18206. return this.stopListening('.client-' + event);
  18207. }
  18208. }]);
  18209. return Channel;
  18210. }();
  18211. /**
  18212. * Event name formatter
  18213. */
  18214. var EventFormatter = function () {
  18215. /**
  18216. * Create a new class instance.
  18217. */
  18218. function EventFormatter(namespace) {
  18219. classCallCheck(this, EventFormatter);
  18220. this.setNamespace(namespace);
  18221. }
  18222. /**
  18223. * Format the given event name.
  18224. */
  18225. createClass(EventFormatter, [{
  18226. key: 'format',
  18227. value: function format(event) {
  18228. if (event.charAt(0) === '.' || event.charAt(0) === '\\') {
  18229. return event.substr(1);
  18230. } else if (this.namespace) {
  18231. event = this.namespace + '.' + event;
  18232. }
  18233. return event.replace(/\./g, '\\');
  18234. }
  18235. /**
  18236. * Set the event namespace.
  18237. */
  18238. }, {
  18239. key: 'setNamespace',
  18240. value: function setNamespace(value) {
  18241. this.namespace = value;
  18242. }
  18243. }]);
  18244. return EventFormatter;
  18245. }();
  18246. /**
  18247. * This class represents a Pusher channel.
  18248. */
  18249. var PusherChannel = function (_Channel) {
  18250. inherits(PusherChannel, _Channel);
  18251. /**
  18252. * Create a new class instance.
  18253. */
  18254. function PusherChannel(pusher, name, options) {
  18255. classCallCheck(this, PusherChannel);
  18256. var _this = possibleConstructorReturn(this, (PusherChannel.__proto__ || Object.getPrototypeOf(PusherChannel)).call(this));
  18257. _this.name = name;
  18258. _this.pusher = pusher;
  18259. _this.options = options;
  18260. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  18261. _this.subscribe();
  18262. return _this;
  18263. }
  18264. /**
  18265. * Subscribe to a Pusher channel.
  18266. */
  18267. createClass(PusherChannel, [{
  18268. key: 'subscribe',
  18269. value: function subscribe() {
  18270. this.subscription = this.pusher.subscribe(this.name);
  18271. }
  18272. /**
  18273. * Unsubscribe from a Pusher channel.
  18274. */
  18275. }, {
  18276. key: 'unsubscribe',
  18277. value: function unsubscribe() {
  18278. this.pusher.unsubscribe(this.name);
  18279. }
  18280. /**
  18281. * Listen for an event on the channel instance.
  18282. */
  18283. }, {
  18284. key: 'listen',
  18285. value: function listen(event, callback) {
  18286. this.on(this.eventFormatter.format(event), callback);
  18287. return this;
  18288. }
  18289. /**
  18290. * Stop listening for an event on the channel instance.
  18291. */
  18292. }, {
  18293. key: 'stopListening',
  18294. value: function stopListening(event) {
  18295. this.subscription.unbind(this.eventFormatter.format(event));
  18296. return this;
  18297. }
  18298. /**
  18299. * Bind a channel to an event.
  18300. */
  18301. }, {
  18302. key: 'on',
  18303. value: function on(event, callback) {
  18304. this.subscription.bind(event, callback);
  18305. return this;
  18306. }
  18307. }]);
  18308. return PusherChannel;
  18309. }(Channel);
  18310. /**
  18311. * This class represents a Pusher private channel.
  18312. */
  18313. var PusherPrivateChannel = function (_PusherChannel) {
  18314. inherits(PusherPrivateChannel, _PusherChannel);
  18315. function PusherPrivateChannel() {
  18316. classCallCheck(this, PusherPrivateChannel);
  18317. return possibleConstructorReturn(this, (PusherPrivateChannel.__proto__ || Object.getPrototypeOf(PusherPrivateChannel)).apply(this, arguments));
  18318. }
  18319. createClass(PusherPrivateChannel, [{
  18320. key: 'whisper',
  18321. /**
  18322. * Trigger client event on the channel.
  18323. */
  18324. value: function whisper(eventName, data) {
  18325. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  18326. return this;
  18327. }
  18328. }]);
  18329. return PusherPrivateChannel;
  18330. }(PusherChannel);
  18331. /**
  18332. * This class represents a Pusher presence channel.
  18333. */
  18334. var PusherPresenceChannel = function (_PusherChannel) {
  18335. inherits(PusherPresenceChannel, _PusherChannel);
  18336. function PusherPresenceChannel() {
  18337. classCallCheck(this, PusherPresenceChannel);
  18338. return possibleConstructorReturn(this, (PusherPresenceChannel.__proto__ || Object.getPrototypeOf(PusherPresenceChannel)).apply(this, arguments));
  18339. }
  18340. createClass(PusherPresenceChannel, [{
  18341. key: 'here',
  18342. /**
  18343. * Register a callback to be called anytime the member list changes.
  18344. */
  18345. value: function here(callback) {
  18346. this.on('pusher:subscription_succeeded', function (data) {
  18347. callback(Object.keys(data.members).map(function (k) {
  18348. return data.members[k];
  18349. }));
  18350. });
  18351. return this;
  18352. }
  18353. /**
  18354. * Listen for someone joining the channel.
  18355. */
  18356. }, {
  18357. key: 'joining',
  18358. value: function joining(callback) {
  18359. this.on('pusher:member_added', function (member) {
  18360. callback(member.info);
  18361. });
  18362. return this;
  18363. }
  18364. /**
  18365. * Listen for someone leaving the channel.
  18366. */
  18367. }, {
  18368. key: 'leaving',
  18369. value: function leaving(callback) {
  18370. this.on('pusher:member_removed', function (member) {
  18371. callback(member.info);
  18372. });
  18373. return this;
  18374. }
  18375. /**
  18376. * Trigger client event on the channel.
  18377. */
  18378. }, {
  18379. key: 'whisper',
  18380. value: function whisper(eventName, data) {
  18381. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  18382. return this;
  18383. }
  18384. }]);
  18385. return PusherPresenceChannel;
  18386. }(PusherChannel);
  18387. /**
  18388. * This class represents a Socket.io channel.
  18389. */
  18390. var SocketIoChannel = function (_Channel) {
  18391. inherits(SocketIoChannel, _Channel);
  18392. /**
  18393. * Create a new class instance.
  18394. */
  18395. function SocketIoChannel(socket, name, options) {
  18396. classCallCheck(this, SocketIoChannel);
  18397. /**
  18398. * The event callbacks applied to the channel.
  18399. */
  18400. var _this = possibleConstructorReturn(this, (SocketIoChannel.__proto__ || Object.getPrototypeOf(SocketIoChannel)).call(this));
  18401. _this.events = {};
  18402. _this.name = name;
  18403. _this.socket = socket;
  18404. _this.options = options;
  18405. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  18406. _this.subscribe();
  18407. _this.configureReconnector();
  18408. return _this;
  18409. }
  18410. /**
  18411. * Subscribe to a Socket.io channel.
  18412. */
  18413. createClass(SocketIoChannel, [{
  18414. key: 'subscribe',
  18415. value: function subscribe() {
  18416. this.socket.emit('subscribe', {
  18417. channel: this.name,
  18418. auth: this.options.auth || {}
  18419. });
  18420. }
  18421. /**
  18422. * Unsubscribe from channel and ubind event callbacks.
  18423. */
  18424. }, {
  18425. key: 'unsubscribe',
  18426. value: function unsubscribe() {
  18427. this.unbind();
  18428. this.socket.emit('unsubscribe', {
  18429. channel: this.name,
  18430. auth: this.options.auth || {}
  18431. });
  18432. }
  18433. /**
  18434. * Listen for an event on the channel instance.
  18435. */
  18436. }, {
  18437. key: 'listen',
  18438. value: function listen(event, callback) {
  18439. this.on(this.eventFormatter.format(event), callback);
  18440. return this;
  18441. }
  18442. /**
  18443. * Stop listening for an event on the channel instance.
  18444. */
  18445. }, {
  18446. key: 'stopListening',
  18447. value: function stopListening(event) {
  18448. var name = this.eventFormatter.format(event);
  18449. this.socket.removeListener(name);
  18450. delete this.events[name];
  18451. return this;
  18452. }
  18453. /**
  18454. * Bind the channel's socket to an event and store the callback.
  18455. */
  18456. }, {
  18457. key: 'on',
  18458. value: function on(event, callback) {
  18459. var _this2 = this;
  18460. var listener = function listener(channel, data) {
  18461. if (_this2.name == channel) {
  18462. callback(data);
  18463. }
  18464. };
  18465. this.socket.on(event, listener);
  18466. this.bind(event, listener);
  18467. }
  18468. /**
  18469. * Attach a 'reconnect' listener and bind the event.
  18470. */
  18471. }, {
  18472. key: 'configureReconnector',
  18473. value: function configureReconnector() {
  18474. var _this3 = this;
  18475. var listener = function listener() {
  18476. _this3.subscribe();
  18477. };
  18478. this.socket.on('reconnect', listener);
  18479. this.bind('reconnect', listener);
  18480. }
  18481. /**
  18482. * Bind the channel's socket to an event and store the callback.
  18483. */
  18484. }, {
  18485. key: 'bind',
  18486. value: function bind(event, callback) {
  18487. this.events[event] = this.events[event] || [];
  18488. this.events[event].push(callback);
  18489. }
  18490. /**
  18491. * Unbind the channel's socket from all stored event callbacks.
  18492. */
  18493. }, {
  18494. key: 'unbind',
  18495. value: function unbind() {
  18496. var _this4 = this;
  18497. Object.keys(this.events).forEach(function (event) {
  18498. _this4.events[event].forEach(function (callback) {
  18499. _this4.socket.removeListener(event, callback);
  18500. });
  18501. delete _this4.events[event];
  18502. });
  18503. }
  18504. }]);
  18505. return SocketIoChannel;
  18506. }(Channel);
  18507. /**
  18508. * This class represents a Socket.io presence channel.
  18509. */
  18510. var SocketIoPrivateChannel = function (_SocketIoChannel) {
  18511. inherits(SocketIoPrivateChannel, _SocketIoChannel);
  18512. function SocketIoPrivateChannel() {
  18513. classCallCheck(this, SocketIoPrivateChannel);
  18514. return possibleConstructorReturn(this, (SocketIoPrivateChannel.__proto__ || Object.getPrototypeOf(SocketIoPrivateChannel)).apply(this, arguments));
  18515. }
  18516. createClass(SocketIoPrivateChannel, [{
  18517. key: 'whisper',
  18518. /**
  18519. * Trigger client event on the channel.
  18520. */
  18521. value: function whisper(eventName, data) {
  18522. this.socket.emit('client event', {
  18523. channel: this.name,
  18524. event: 'client-' + eventName,
  18525. data: data
  18526. });
  18527. return this;
  18528. }
  18529. }]);
  18530. return SocketIoPrivateChannel;
  18531. }(SocketIoChannel);
  18532. /**
  18533. * This class represents a Socket.io presence channel.
  18534. */
  18535. var SocketIoPresenceChannel = function (_SocketIoPrivateChann) {
  18536. inherits(SocketIoPresenceChannel, _SocketIoPrivateChann);
  18537. function SocketIoPresenceChannel() {
  18538. classCallCheck(this, SocketIoPresenceChannel);
  18539. return possibleConstructorReturn(this, (SocketIoPresenceChannel.__proto__ || Object.getPrototypeOf(SocketIoPresenceChannel)).apply(this, arguments));
  18540. }
  18541. createClass(SocketIoPresenceChannel, [{
  18542. key: 'here',
  18543. /**
  18544. * Register a callback to be called anytime the member list changes.
  18545. */
  18546. value: function here(callback) {
  18547. this.on('presence:subscribed', function (members) {
  18548. callback(members.map(function (m) {
  18549. return m.user_info;
  18550. }));
  18551. });
  18552. return this;
  18553. }
  18554. /**
  18555. * Listen for someone joining the channel.
  18556. */
  18557. }, {
  18558. key: 'joining',
  18559. value: function joining(callback) {
  18560. this.on('presence:joining', function (member) {
  18561. return callback(member.user_info);
  18562. });
  18563. return this;
  18564. }
  18565. /**
  18566. * Listen for someone leaving the channel.
  18567. */
  18568. }, {
  18569. key: 'leaving',
  18570. value: function leaving(callback) {
  18571. this.on('presence:leaving', function (member) {
  18572. return callback(member.user_info);
  18573. });
  18574. return this;
  18575. }
  18576. }]);
  18577. return SocketIoPresenceChannel;
  18578. }(SocketIoPrivateChannel);
  18579. /**
  18580. * This class represents a null channel.
  18581. */
  18582. var NullChannel = function (_Channel) {
  18583. inherits(NullChannel, _Channel);
  18584. function NullChannel() {
  18585. classCallCheck(this, NullChannel);
  18586. return possibleConstructorReturn(this, (NullChannel.__proto__ || Object.getPrototypeOf(NullChannel)).apply(this, arguments));
  18587. }
  18588. createClass(NullChannel, [{
  18589. key: 'subscribe',
  18590. /**
  18591. * Subscribe to a channel.
  18592. */
  18593. value: function subscribe() {}
  18594. //
  18595. /**
  18596. * Unsubscribe from a channel.
  18597. */
  18598. }, {
  18599. key: 'unsubscribe',
  18600. value: function unsubscribe() {}
  18601. //
  18602. /**
  18603. * Listen for an event on the channel instance.
  18604. */
  18605. }, {
  18606. key: 'listen',
  18607. value: function listen(event, callback) {
  18608. return this;
  18609. }
  18610. /**
  18611. * Stop listening for an event on the channel instance.
  18612. */
  18613. }, {
  18614. key: 'stopListening',
  18615. value: function stopListening(event) {
  18616. return this;
  18617. }
  18618. /**
  18619. * Bind a channel to an event.
  18620. */
  18621. }, {
  18622. key: 'on',
  18623. value: function on(event, callback) {
  18624. return this;
  18625. }
  18626. }]);
  18627. return NullChannel;
  18628. }(Channel);
  18629. /**
  18630. * This class represents a null private channel.
  18631. */
  18632. var NullPrivateChannel = function (_NullChannel) {
  18633. inherits(NullPrivateChannel, _NullChannel);
  18634. function NullPrivateChannel() {
  18635. classCallCheck(this, NullPrivateChannel);
  18636. return possibleConstructorReturn(this, (NullPrivateChannel.__proto__ || Object.getPrototypeOf(NullPrivateChannel)).apply(this, arguments));
  18637. }
  18638. createClass(NullPrivateChannel, [{
  18639. key: 'whisper',
  18640. /**
  18641. * Trigger client event on the channel.
  18642. */
  18643. value: function whisper(eventName, data) {
  18644. return this;
  18645. }
  18646. }]);
  18647. return NullPrivateChannel;
  18648. }(NullChannel);
  18649. /**
  18650. * This class represents a null presence channel.
  18651. */
  18652. var NullPresenceChannel = function (_NullChannel) {
  18653. inherits(NullPresenceChannel, _NullChannel);
  18654. function NullPresenceChannel() {
  18655. classCallCheck(this, NullPresenceChannel);
  18656. return possibleConstructorReturn(this, (NullPresenceChannel.__proto__ || Object.getPrototypeOf(NullPresenceChannel)).apply(this, arguments));
  18657. }
  18658. createClass(NullPresenceChannel, [{
  18659. key: 'here',
  18660. /**
  18661. * Register a callback to be called anytime the member list changes.
  18662. */
  18663. value: function here(callback) {
  18664. return this;
  18665. }
  18666. /**
  18667. * Listen for someone joining the channel.
  18668. */
  18669. }, {
  18670. key: 'joining',
  18671. value: function joining(callback) {
  18672. return this;
  18673. }
  18674. /**
  18675. * Listen for someone leaving the channel.
  18676. */
  18677. }, {
  18678. key: 'leaving',
  18679. value: function leaving(callback) {
  18680. return this;
  18681. }
  18682. /**
  18683. * Trigger client event on the channel.
  18684. */
  18685. }, {
  18686. key: 'whisper',
  18687. value: function whisper(eventName, data) {
  18688. return this;
  18689. }
  18690. }]);
  18691. return NullPresenceChannel;
  18692. }(NullChannel);
  18693. /**
  18694. * This class creates a connector to Pusher.
  18695. */
  18696. var PusherConnector = function (_Connector) {
  18697. inherits(PusherConnector, _Connector);
  18698. function PusherConnector() {
  18699. classCallCheck(this, PusherConnector);
  18700. /**
  18701. * All of the subscribed channel names.
  18702. */
  18703. var _this = possibleConstructorReturn(this, (PusherConnector.__proto__ || Object.getPrototypeOf(PusherConnector)).apply(this, arguments));
  18704. _this.channels = {};
  18705. return _this;
  18706. }
  18707. /**
  18708. * Create a fresh Pusher connection.
  18709. */
  18710. createClass(PusherConnector, [{
  18711. key: 'connect',
  18712. value: function connect() {
  18713. if (typeof this.options.client !== 'undefined') {
  18714. this.pusher = this.options.client;
  18715. } else {
  18716. this.pusher = new Pusher(this.options.key, this.options);
  18717. }
  18718. }
  18719. /**
  18720. * Listen for an event on a channel instance.
  18721. */
  18722. }, {
  18723. key: 'listen',
  18724. value: function listen(name, event, callback) {
  18725. return this.channel(name).listen(event, callback);
  18726. }
  18727. /**
  18728. * Get a channel instance by name.
  18729. */
  18730. }, {
  18731. key: 'channel',
  18732. value: function channel(name) {
  18733. if (!this.channels[name]) {
  18734. this.channels[name] = new PusherChannel(this.pusher, name, this.options);
  18735. }
  18736. return this.channels[name];
  18737. }
  18738. /**
  18739. * Get a private channel instance by name.
  18740. */
  18741. }, {
  18742. key: 'privateChannel',
  18743. value: function privateChannel(name) {
  18744. if (!this.channels['private-' + name]) {
  18745. this.channels['private-' + name] = new PusherPrivateChannel(this.pusher, 'private-' + name, this.options);
  18746. }
  18747. return this.channels['private-' + name];
  18748. }
  18749. /**
  18750. * Get a presence channel instance by name.
  18751. */
  18752. }, {
  18753. key: 'presenceChannel',
  18754. value: function presenceChannel(name) {
  18755. if (!this.channels['presence-' + name]) {
  18756. this.channels['presence-' + name] = new PusherPresenceChannel(this.pusher, 'presence-' + name, this.options);
  18757. }
  18758. return this.channels['presence-' + name];
  18759. }
  18760. /**
  18761. * Leave the given channel, as well as its private and presence variants.
  18762. */
  18763. }, {
  18764. key: 'leave',
  18765. value: function leave(name) {
  18766. var _this2 = this;
  18767. var channels = [name, 'private-' + name, 'presence-' + name];
  18768. channels.forEach(function (name, index) {
  18769. _this2.leaveChannel(name);
  18770. });
  18771. }
  18772. /**
  18773. * Leave the given channel.
  18774. */
  18775. }, {
  18776. key: 'leaveChannel',
  18777. value: function leaveChannel(name) {
  18778. if (this.channels[name]) {
  18779. this.channels[name].unsubscribe();
  18780. delete this.channels[name];
  18781. }
  18782. }
  18783. /**
  18784. * Get the socket ID for the connection.
  18785. */
  18786. }, {
  18787. key: 'socketId',
  18788. value: function socketId() {
  18789. return this.pusher.connection.socket_id;
  18790. }
  18791. /**
  18792. * Disconnect Pusher connection.
  18793. */
  18794. }, {
  18795. key: 'disconnect',
  18796. value: function disconnect() {
  18797. this.pusher.disconnect();
  18798. }
  18799. }]);
  18800. return PusherConnector;
  18801. }(Connector);
  18802. /**
  18803. * This class creates a connnector to a Socket.io server.
  18804. */
  18805. var SocketIoConnector = function (_Connector) {
  18806. inherits(SocketIoConnector, _Connector);
  18807. function SocketIoConnector() {
  18808. classCallCheck(this, SocketIoConnector);
  18809. /**
  18810. * All of the subscribed channel names.
  18811. */
  18812. var _this = possibleConstructorReturn(this, (SocketIoConnector.__proto__ || Object.getPrototypeOf(SocketIoConnector)).apply(this, arguments));
  18813. _this.channels = {};
  18814. return _this;
  18815. }
  18816. /**
  18817. * Create a fresh Socket.io connection.
  18818. */
  18819. createClass(SocketIoConnector, [{
  18820. key: 'connect',
  18821. value: function connect() {
  18822. var io = this.getSocketIO();
  18823. this.socket = io(this.options.host, this.options);
  18824. return this.socket;
  18825. }
  18826. /**
  18827. * Get socket.io module from global scope or options.
  18828. */
  18829. }, {
  18830. key: 'getSocketIO',
  18831. value: function getSocketIO() {
  18832. if (typeof this.options.client !== 'undefined') {
  18833. return this.options.client;
  18834. }
  18835. if (typeof io !== 'undefined') {
  18836. return io;
  18837. }
  18838. throw new Error('Socket.io client not found. Should be globally available or passed via options.client');
  18839. }
  18840. /**
  18841. * Listen for an event on a channel instance.
  18842. */
  18843. }, {
  18844. key: 'listen',
  18845. value: function listen(name, event, callback) {
  18846. return this.channel(name).listen(event, callback);
  18847. }
  18848. /**
  18849. * Get a channel instance by name.
  18850. */
  18851. }, {
  18852. key: 'channel',
  18853. value: function channel(name) {
  18854. if (!this.channels[name]) {
  18855. this.channels[name] = new SocketIoChannel(this.socket, name, this.options);
  18856. }
  18857. return this.channels[name];
  18858. }
  18859. /**
  18860. * Get a private channel instance by name.
  18861. */
  18862. }, {
  18863. key: 'privateChannel',
  18864. value: function privateChannel(name) {
  18865. if (!this.channels['private-' + name]) {
  18866. this.channels['private-' + name] = new SocketIoPrivateChannel(this.socket, 'private-' + name, this.options);
  18867. }
  18868. return this.channels['private-' + name];
  18869. }
  18870. /**
  18871. * Get a presence channel instance by name.
  18872. */
  18873. }, {
  18874. key: 'presenceChannel',
  18875. value: function presenceChannel(name) {
  18876. if (!this.channels['presence-' + name]) {
  18877. this.channels['presence-' + name] = new SocketIoPresenceChannel(this.socket, 'presence-' + name, this.options);
  18878. }
  18879. return this.channels['presence-' + name];
  18880. }
  18881. /**
  18882. * Leave the given channel, as well as its private and presence variants.
  18883. */
  18884. }, {
  18885. key: 'leave',
  18886. value: function leave(name) {
  18887. var _this2 = this;
  18888. var channels = [name, 'private-' + name, 'presence-' + name];
  18889. channels.forEach(function (name) {
  18890. _this2.leaveChannel(name);
  18891. });
  18892. }
  18893. /**
  18894. * Leave the given channel.
  18895. */
  18896. }, {
  18897. key: 'leaveChannel',
  18898. value: function leaveChannel(name) {
  18899. if (this.channels[name]) {
  18900. this.channels[name].unsubscribe();
  18901. delete this.channels[name];
  18902. }
  18903. }
  18904. /**
  18905. * Get the socket ID for the connection.
  18906. */
  18907. }, {
  18908. key: 'socketId',
  18909. value: function socketId() {
  18910. return this.socket.id;
  18911. }
  18912. /**
  18913. * Disconnect Socketio connection.
  18914. */
  18915. }, {
  18916. key: 'disconnect',
  18917. value: function disconnect() {
  18918. this.socket.disconnect();
  18919. }
  18920. }]);
  18921. return SocketIoConnector;
  18922. }(Connector);
  18923. /**
  18924. * This class creates a null connector.
  18925. */
  18926. var NullConnector = function (_Connector) {
  18927. inherits(NullConnector, _Connector);
  18928. function NullConnector() {
  18929. classCallCheck(this, NullConnector);
  18930. /**
  18931. * All of the subscribed channel names.
  18932. */
  18933. var _this = possibleConstructorReturn(this, (NullConnector.__proto__ || Object.getPrototypeOf(NullConnector)).apply(this, arguments));
  18934. _this.channels = {};
  18935. return _this;
  18936. }
  18937. /**
  18938. * Create a fresh connection.
  18939. */
  18940. createClass(NullConnector, [{
  18941. key: 'connect',
  18942. value: function connect() {}
  18943. //
  18944. /**
  18945. * Listen for an event on a channel instance.
  18946. */
  18947. }, {
  18948. key: 'listen',
  18949. value: function listen(name, event, callback) {
  18950. return new NullChannel();
  18951. }
  18952. /**
  18953. * Get a channel instance by name.
  18954. */
  18955. }, {
  18956. key: 'channel',
  18957. value: function channel(name) {
  18958. return new NullChannel();
  18959. }
  18960. /**
  18961. * Get a private channel instance by name.
  18962. */
  18963. }, {
  18964. key: 'privateChannel',
  18965. value: function privateChannel(name) {
  18966. return new NullPrivateChannel();
  18967. }
  18968. /**
  18969. * Get a presence channel instance by name.
  18970. */
  18971. }, {
  18972. key: 'presenceChannel',
  18973. value: function presenceChannel(name) {
  18974. return new NullPresenceChannel();
  18975. }
  18976. /**
  18977. * Leave the given channel, as well as its private and presence variants.
  18978. */
  18979. }, {
  18980. key: 'leave',
  18981. value: function leave(name) {}
  18982. //
  18983. /**
  18984. * Leave the given channel.
  18985. */
  18986. }, {
  18987. key: 'leaveChannel',
  18988. value: function leaveChannel(name) {}
  18989. //
  18990. /**
  18991. * Get the socket ID for the connection.
  18992. */
  18993. }, {
  18994. key: 'socketId',
  18995. value: function socketId() {
  18996. return 'fake-socket-id';
  18997. }
  18998. /**
  18999. * Disconnect the connection.
  19000. */
  19001. }, {
  19002. key: 'disconnect',
  19003. value: function disconnect() {
  19004. //
  19005. }
  19006. }]);
  19007. return NullConnector;
  19008. }(Connector);
  19009. /**
  19010. * This class is the primary API for interacting with broadcasting.
  19011. */
  19012. var Echo = function () {
  19013. /**
  19014. * Create a new class instance.
  19015. */
  19016. function Echo(options) {
  19017. classCallCheck(this, Echo);
  19018. this.options = options;
  19019. this.connect();
  19020. if (!this.options.withoutInterceptors) {
  19021. this.registerInterceptors();
  19022. }
  19023. }
  19024. /**
  19025. * Get a channel instance by name.
  19026. */
  19027. createClass(Echo, [{
  19028. key: 'channel',
  19029. value: function channel(_channel) {
  19030. return this.connector.channel(_channel);
  19031. }
  19032. /**
  19033. * Create a new connection.
  19034. */
  19035. }, {
  19036. key: 'connect',
  19037. value: function connect() {
  19038. if (this.options.broadcaster == 'pusher') {
  19039. this.connector = new PusherConnector(this.options);
  19040. } else if (this.options.broadcaster == 'socket.io') {
  19041. this.connector = new SocketIoConnector(this.options);
  19042. } else if (this.options.broadcaster == 'null') {
  19043. this.connector = new NullConnector(this.options);
  19044. } else if (typeof this.options.broadcaster == 'function') {
  19045. this.connector = new this.options.broadcaster(this.options);
  19046. }
  19047. }
  19048. /**
  19049. * Disconnect from the Echo server.
  19050. */
  19051. }, {
  19052. key: 'disconnect',
  19053. value: function disconnect() {
  19054. this.connector.disconnect();
  19055. }
  19056. /**
  19057. * Get a presence channel instance by name.
  19058. */
  19059. }, {
  19060. key: 'join',
  19061. value: function join(channel) {
  19062. return this.connector.presenceChannel(channel);
  19063. }
  19064. /**
  19065. * Leave the given channel, as well as its private and presence variants.
  19066. */
  19067. }, {
  19068. key: 'leave',
  19069. value: function leave(channel) {
  19070. this.connector.leave(channel);
  19071. }
  19072. /**
  19073. * Leave the given channel.
  19074. */
  19075. }, {
  19076. key: 'leaveChannel',
  19077. value: function leaveChannel(channel) {
  19078. this.connector.leaveChannel(channel);
  19079. }
  19080. /**
  19081. * Listen for an event on a channel instance.
  19082. */
  19083. }, {
  19084. key: 'listen',
  19085. value: function listen(channel, event, callback) {
  19086. return this.connector.listen(channel, event, callback);
  19087. }
  19088. /**
  19089. * Get a private channel instance by name.
  19090. */
  19091. }, {
  19092. key: 'private',
  19093. value: function _private(channel) {
  19094. return this.connector.privateChannel(channel);
  19095. }
  19096. /**
  19097. * Get the Socket ID for the connection.
  19098. */
  19099. }, {
  19100. key: 'socketId',
  19101. value: function socketId() {
  19102. return this.connector.socketId();
  19103. }
  19104. /**
  19105. * Register 3rd party request interceptiors. These are used to automatically
  19106. * send a connections socket id to a Laravel app with a X-Socket-Id header.
  19107. */
  19108. }, {
  19109. key: 'registerInterceptors',
  19110. value: function registerInterceptors() {
  19111. if (typeof Vue === 'function' && Vue.http) {
  19112. this.registerVueRequestInterceptor();
  19113. }
  19114. if (typeof axios === 'function') {
  19115. this.registerAxiosRequestInterceptor();
  19116. }
  19117. if (typeof jQuery === 'function') {
  19118. this.registerjQueryAjaxSetup();
  19119. }
  19120. }
  19121. /**
  19122. * Register a Vue HTTP interceptor to add the X-Socket-ID header.
  19123. */
  19124. }, {
  19125. key: 'registerVueRequestInterceptor',
  19126. value: function registerVueRequestInterceptor() {
  19127. var _this = this;
  19128. Vue.http.interceptors.push(function (request, next) {
  19129. if (_this.socketId()) {
  19130. request.headers.set('X-Socket-ID', _this.socketId());
  19131. }
  19132. next();
  19133. });
  19134. }
  19135. /**
  19136. * Register an Axios HTTP interceptor to add the X-Socket-ID header.
  19137. */
  19138. }, {
  19139. key: 'registerAxiosRequestInterceptor',
  19140. value: function registerAxiosRequestInterceptor() {
  19141. var _this2 = this;
  19142. axios.interceptors.request.use(function (config) {
  19143. if (_this2.socketId()) {
  19144. config.headers['X-Socket-Id'] = _this2.socketId();
  19145. }
  19146. return config;
  19147. });
  19148. }
  19149. /**
  19150. * Register jQuery AjaxPrefilter to add the X-Socket-ID header.
  19151. */
  19152. }, {
  19153. key: 'registerjQueryAjaxSetup',
  19154. value: function registerjQueryAjaxSetup() {
  19155. var _this3 = this;
  19156. if (typeof jQuery.ajax != 'undefined') {
  19157. jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {
  19158. if (_this3.socketId()) {
  19159. xhr.setRequestHeader('X-Socket-Id', _this3.socketId());
  19160. }
  19161. });
  19162. }
  19163. }
  19164. }]);
  19165. return Echo;
  19166. }();
  19167. /* harmony default export */ __webpack_exports__["default"] = (Echo);
  19168. /***/ }),
  19169. /***/ "./node_modules/lodash/lodash.js":
  19170. /*!***************************************!*\
  19171. !*** ./node_modules/lodash/lodash.js ***!
  19172. \***************************************/
  19173. /*! no static exports found */
  19174. /***/ (function(module, exports, __webpack_require__) {
  19175. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  19176. * @license
  19177. * Lodash <https://lodash.com/>
  19178. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  19179. * Released under MIT license <https://lodash.com/license>
  19180. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  19181. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  19182. */
  19183. ;(function() {
  19184. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  19185. var undefined;
  19186. /** Used as the semantic version number. */
  19187. var VERSION = '4.17.15';
  19188. /** Used as the size to enable large array optimizations. */
  19189. var LARGE_ARRAY_SIZE = 200;
  19190. /** Error message constants. */
  19191. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  19192. FUNC_ERROR_TEXT = 'Expected a function';
  19193. /** Used to stand-in for `undefined` hash values. */
  19194. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  19195. /** Used as the maximum memoize cache size. */
  19196. var MAX_MEMOIZE_SIZE = 500;
  19197. /** Used as the internal argument placeholder. */
  19198. var PLACEHOLDER = '__lodash_placeholder__';
  19199. /** Used to compose bitmasks for cloning. */
  19200. var CLONE_DEEP_FLAG = 1,
  19201. CLONE_FLAT_FLAG = 2,
  19202. CLONE_SYMBOLS_FLAG = 4;
  19203. /** Used to compose bitmasks for value comparisons. */
  19204. var COMPARE_PARTIAL_FLAG = 1,
  19205. COMPARE_UNORDERED_FLAG = 2;
  19206. /** Used to compose bitmasks for function metadata. */
  19207. var WRAP_BIND_FLAG = 1,
  19208. WRAP_BIND_KEY_FLAG = 2,
  19209. WRAP_CURRY_BOUND_FLAG = 4,
  19210. WRAP_CURRY_FLAG = 8,
  19211. WRAP_CURRY_RIGHT_FLAG = 16,
  19212. WRAP_PARTIAL_FLAG = 32,
  19213. WRAP_PARTIAL_RIGHT_FLAG = 64,
  19214. WRAP_ARY_FLAG = 128,
  19215. WRAP_REARG_FLAG = 256,
  19216. WRAP_FLIP_FLAG = 512;
  19217. /** Used as default options for `_.truncate`. */
  19218. var DEFAULT_TRUNC_LENGTH = 30,
  19219. DEFAULT_TRUNC_OMISSION = '...';
  19220. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  19221. var HOT_COUNT = 800,
  19222. HOT_SPAN = 16;
  19223. /** Used to indicate the type of lazy iteratees. */
  19224. var LAZY_FILTER_FLAG = 1,
  19225. LAZY_MAP_FLAG = 2,
  19226. LAZY_WHILE_FLAG = 3;
  19227. /** Used as references for various `Number` constants. */
  19228. var INFINITY = 1 / 0,
  19229. MAX_SAFE_INTEGER = 9007199254740991,
  19230. MAX_INTEGER = 1.7976931348623157e+308,
  19231. NAN = 0 / 0;
  19232. /** Used as references for the maximum length and index of an array. */
  19233. var MAX_ARRAY_LENGTH = 4294967295,
  19234. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  19235. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  19236. /** Used to associate wrap methods with their bit flags. */
  19237. var wrapFlags = [
  19238. ['ary', WRAP_ARY_FLAG],
  19239. ['bind', WRAP_BIND_FLAG],
  19240. ['bindKey', WRAP_BIND_KEY_FLAG],
  19241. ['curry', WRAP_CURRY_FLAG],
  19242. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  19243. ['flip', WRAP_FLIP_FLAG],
  19244. ['partial', WRAP_PARTIAL_FLAG],
  19245. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  19246. ['rearg', WRAP_REARG_FLAG]
  19247. ];
  19248. /** `Object#toString` result references. */
  19249. var argsTag = '[object Arguments]',
  19250. arrayTag = '[object Array]',
  19251. asyncTag = '[object AsyncFunction]',
  19252. boolTag = '[object Boolean]',
  19253. dateTag = '[object Date]',
  19254. domExcTag = '[object DOMException]',
  19255. errorTag = '[object Error]',
  19256. funcTag = '[object Function]',
  19257. genTag = '[object GeneratorFunction]',
  19258. mapTag = '[object Map]',
  19259. numberTag = '[object Number]',
  19260. nullTag = '[object Null]',
  19261. objectTag = '[object Object]',
  19262. promiseTag = '[object Promise]',
  19263. proxyTag = '[object Proxy]',
  19264. regexpTag = '[object RegExp]',
  19265. setTag = '[object Set]',
  19266. stringTag = '[object String]',
  19267. symbolTag = '[object Symbol]',
  19268. undefinedTag = '[object Undefined]',
  19269. weakMapTag = '[object WeakMap]',
  19270. weakSetTag = '[object WeakSet]';
  19271. var arrayBufferTag = '[object ArrayBuffer]',
  19272. dataViewTag = '[object DataView]',
  19273. float32Tag = '[object Float32Array]',
  19274. float64Tag = '[object Float64Array]',
  19275. int8Tag = '[object Int8Array]',
  19276. int16Tag = '[object Int16Array]',
  19277. int32Tag = '[object Int32Array]',
  19278. uint8Tag = '[object Uint8Array]',
  19279. uint8ClampedTag = '[object Uint8ClampedArray]',
  19280. uint16Tag = '[object Uint16Array]',
  19281. uint32Tag = '[object Uint32Array]';
  19282. /** Used to match empty string literals in compiled template source. */
  19283. var reEmptyStringLeading = /\b__p \+= '';/g,
  19284. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  19285. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  19286. /** Used to match HTML entities and HTML characters. */
  19287. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  19288. reUnescapedHtml = /[&<>"']/g,
  19289. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  19290. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  19291. /** Used to match template delimiters. */
  19292. var reEscape = /<%-([\s\S]+?)%>/g,
  19293. reEvaluate = /<%([\s\S]+?)%>/g,
  19294. reInterpolate = /<%=([\s\S]+?)%>/g;
  19295. /** Used to match property names within property paths. */
  19296. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  19297. reIsPlainProp = /^\w*$/,
  19298. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  19299. /**
  19300. * Used to match `RegExp`
  19301. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  19302. */
  19303. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  19304. reHasRegExpChar = RegExp(reRegExpChar.source);
  19305. /** Used to match leading and trailing whitespace. */
  19306. var reTrim = /^\s+|\s+$/g,
  19307. reTrimStart = /^\s+/,
  19308. reTrimEnd = /\s+$/;
  19309. /** Used to match wrap detail comments. */
  19310. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  19311. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  19312. reSplitDetails = /,? & /;
  19313. /** Used to match words composed of alphanumeric characters. */
  19314. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  19315. /** Used to match backslashes in property paths. */
  19316. var reEscapeChar = /\\(\\)?/g;
  19317. /**
  19318. * Used to match
  19319. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  19320. */
  19321. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  19322. /** Used to match `RegExp` flags from their coerced string values. */
  19323. var reFlags = /\w*$/;
  19324. /** Used to detect bad signed hexadecimal string values. */
  19325. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  19326. /** Used to detect binary string values. */
  19327. var reIsBinary = /^0b[01]+$/i;
  19328. /** Used to detect host constructors (Safari). */
  19329. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  19330. /** Used to detect octal string values. */
  19331. var reIsOctal = /^0o[0-7]+$/i;
  19332. /** Used to detect unsigned integer values. */
  19333. var reIsUint = /^(?:0|[1-9]\d*)$/;
  19334. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  19335. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  19336. /** Used to ensure capturing order of template delimiters. */
  19337. var reNoMatch = /($^)/;
  19338. /** Used to match unescaped characters in compiled string literals. */
  19339. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  19340. /** Used to compose unicode character classes. */
  19341. var rsAstralRange = '\\ud800-\\udfff',
  19342. rsComboMarksRange = '\\u0300-\\u036f',
  19343. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  19344. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  19345. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  19346. rsDingbatRange = '\\u2700-\\u27bf',
  19347. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  19348. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  19349. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  19350. rsPunctuationRange = '\\u2000-\\u206f',
  19351. 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',
  19352. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  19353. rsVarRange = '\\ufe0e\\ufe0f',
  19354. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  19355. /** Used to compose unicode capture groups. */
  19356. var rsApos = "['\u2019]",
  19357. rsAstral = '[' + rsAstralRange + ']',
  19358. rsBreak = '[' + rsBreakRange + ']',
  19359. rsCombo = '[' + rsComboRange + ']',
  19360. rsDigits = '\\d+',
  19361. rsDingbat = '[' + rsDingbatRange + ']',
  19362. rsLower = '[' + rsLowerRange + ']',
  19363. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  19364. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  19365. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  19366. rsNonAstral = '[^' + rsAstralRange + ']',
  19367. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  19368. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  19369. rsUpper = '[' + rsUpperRange + ']',
  19370. rsZWJ = '\\u200d';
  19371. /** Used to compose unicode regexes. */
  19372. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  19373. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  19374. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  19375. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  19376. reOptMod = rsModifier + '?',
  19377. rsOptVar = '[' + rsVarRange + ']?',
  19378. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  19379. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  19380. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  19381. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  19382. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  19383. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  19384. /** Used to match apostrophes. */
  19385. var reApos = RegExp(rsApos, 'g');
  19386. /**
  19387. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  19388. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  19389. */
  19390. var reComboMark = RegExp(rsCombo, 'g');
  19391. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  19392. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  19393. /** Used to match complex or compound words. */
  19394. var reUnicodeWord = RegExp([
  19395. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  19396. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  19397. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  19398. rsUpper + '+' + rsOptContrUpper,
  19399. rsOrdUpper,
  19400. rsOrdLower,
  19401. rsDigits,
  19402. rsEmoji
  19403. ].join('|'), 'g');
  19404. /** 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/). */
  19405. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  19406. /** Used to detect strings that need a more robust regexp to match words. */
  19407. 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 ]/;
  19408. /** Used to assign default `context` object properties. */
  19409. var contextProps = [
  19410. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  19411. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  19412. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  19413. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  19414. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  19415. ];
  19416. /** Used to make template sourceURLs easier to identify. */
  19417. var templateCounter = -1;
  19418. /** Used to identify `toStringTag` values of typed arrays. */
  19419. var typedArrayTags = {};
  19420. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  19421. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  19422. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  19423. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  19424. typedArrayTags[uint32Tag] = true;
  19425. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  19426. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  19427. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  19428. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  19429. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  19430. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  19431. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  19432. typedArrayTags[weakMapTag] = false;
  19433. /** Used to identify `toStringTag` values supported by `_.clone`. */
  19434. var cloneableTags = {};
  19435. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  19436. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  19437. cloneableTags[boolTag] = cloneableTags[dateTag] =
  19438. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  19439. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  19440. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  19441. cloneableTags[numberTag] = cloneableTags[objectTag] =
  19442. cloneableTags[regexpTag] = cloneableTags[setTag] =
  19443. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  19444. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  19445. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  19446. cloneableTags[errorTag] = cloneableTags[funcTag] =
  19447. cloneableTags[weakMapTag] = false;
  19448. /** Used to map Latin Unicode letters to basic Latin letters. */
  19449. var deburredLetters = {
  19450. // Latin-1 Supplement block.
  19451. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  19452. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  19453. '\xc7': 'C', '\xe7': 'c',
  19454. '\xd0': 'D', '\xf0': 'd',
  19455. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  19456. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  19457. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  19458. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  19459. '\xd1': 'N', '\xf1': 'n',
  19460. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  19461. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  19462. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  19463. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  19464. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  19465. '\xc6': 'Ae', '\xe6': 'ae',
  19466. '\xde': 'Th', '\xfe': 'th',
  19467. '\xdf': 'ss',
  19468. // Latin Extended-A block.
  19469. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  19470. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  19471. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  19472. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  19473. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  19474. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  19475. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  19476. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  19477. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  19478. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  19479. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  19480. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  19481. '\u0134': 'J', '\u0135': 'j',
  19482. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  19483. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  19484. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  19485. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  19486. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  19487. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  19488. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  19489. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  19490. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  19491. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  19492. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  19493. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  19494. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  19495. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  19496. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  19497. '\u0174': 'W', '\u0175': 'w',
  19498. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  19499. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  19500. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  19501. '\u0132': 'IJ', '\u0133': 'ij',
  19502. '\u0152': 'Oe', '\u0153': 'oe',
  19503. '\u0149': "'n", '\u017f': 's'
  19504. };
  19505. /** Used to map characters to HTML entities. */
  19506. var htmlEscapes = {
  19507. '&': '&amp;',
  19508. '<': '&lt;',
  19509. '>': '&gt;',
  19510. '"': '&quot;',
  19511. "'": '&#39;'
  19512. };
  19513. /** Used to map HTML entities to characters. */
  19514. var htmlUnescapes = {
  19515. '&amp;': '&',
  19516. '&lt;': '<',
  19517. '&gt;': '>',
  19518. '&quot;': '"',
  19519. '&#39;': "'"
  19520. };
  19521. /** Used to escape characters for inclusion in compiled string literals. */
  19522. var stringEscapes = {
  19523. '\\': '\\',
  19524. "'": "'",
  19525. '\n': 'n',
  19526. '\r': 'r',
  19527. '\u2028': 'u2028',
  19528. '\u2029': 'u2029'
  19529. };
  19530. /** Built-in method references without a dependency on `root`. */
  19531. var freeParseFloat = parseFloat,
  19532. freeParseInt = parseInt;
  19533. /** Detect free variable `global` from Node.js. */
  19534. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  19535. /** Detect free variable `self`. */
  19536. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  19537. /** Used as a reference to the global object. */
  19538. var root = freeGlobal || freeSelf || Function('return this')();
  19539. /** Detect free variable `exports`. */
  19540. var freeExports = true && exports && !exports.nodeType && exports;
  19541. /** Detect free variable `module`. */
  19542. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  19543. /** Detect the popular CommonJS extension `module.exports`. */
  19544. var moduleExports = freeModule && freeModule.exports === freeExports;
  19545. /** Detect free variable `process` from Node.js. */
  19546. var freeProcess = moduleExports && freeGlobal.process;
  19547. /** Used to access faster Node.js helpers. */
  19548. var nodeUtil = (function() {
  19549. try {
  19550. // Use `util.types` for Node.js 10+.
  19551. var types = freeModule && freeModule.require && freeModule.require('util').types;
  19552. if (types) {
  19553. return types;
  19554. }
  19555. // Legacy `process.binding('util')` for Node.js < 10.
  19556. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  19557. } catch (e) {}
  19558. }());
  19559. /* Node.js helper references. */
  19560. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  19561. nodeIsDate = nodeUtil && nodeUtil.isDate,
  19562. nodeIsMap = nodeUtil && nodeUtil.isMap,
  19563. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  19564. nodeIsSet = nodeUtil && nodeUtil.isSet,
  19565. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  19566. /*--------------------------------------------------------------------------*/
  19567. /**
  19568. * A faster alternative to `Function#apply`, this function invokes `func`
  19569. * with the `this` binding of `thisArg` and the arguments of `args`.
  19570. *
  19571. * @private
  19572. * @param {Function} func The function to invoke.
  19573. * @param {*} thisArg The `this` binding of `func`.
  19574. * @param {Array} args The arguments to invoke `func` with.
  19575. * @returns {*} Returns the result of `func`.
  19576. */
  19577. function apply(func, thisArg, args) {
  19578. switch (args.length) {
  19579. case 0: return func.call(thisArg);
  19580. case 1: return func.call(thisArg, args[0]);
  19581. case 2: return func.call(thisArg, args[0], args[1]);
  19582. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  19583. }
  19584. return func.apply(thisArg, args);
  19585. }
  19586. /**
  19587. * A specialized version of `baseAggregator` for arrays.
  19588. *
  19589. * @private
  19590. * @param {Array} [array] The array to iterate over.
  19591. * @param {Function} setter The function to set `accumulator` values.
  19592. * @param {Function} iteratee The iteratee to transform keys.
  19593. * @param {Object} accumulator The initial aggregated object.
  19594. * @returns {Function} Returns `accumulator`.
  19595. */
  19596. function arrayAggregator(array, setter, iteratee, accumulator) {
  19597. var index = -1,
  19598. length = array == null ? 0 : array.length;
  19599. while (++index < length) {
  19600. var value = array[index];
  19601. setter(accumulator, value, iteratee(value), array);
  19602. }
  19603. return accumulator;
  19604. }
  19605. /**
  19606. * A specialized version of `_.forEach` for arrays without support for
  19607. * iteratee shorthands.
  19608. *
  19609. * @private
  19610. * @param {Array} [array] The array to iterate over.
  19611. * @param {Function} iteratee The function invoked per iteration.
  19612. * @returns {Array} Returns `array`.
  19613. */
  19614. function arrayEach(array, iteratee) {
  19615. var index = -1,
  19616. length = array == null ? 0 : array.length;
  19617. while (++index < length) {
  19618. if (iteratee(array[index], index, array) === false) {
  19619. break;
  19620. }
  19621. }
  19622. return array;
  19623. }
  19624. /**
  19625. * A specialized version of `_.forEachRight` for arrays without support for
  19626. * iteratee shorthands.
  19627. *
  19628. * @private
  19629. * @param {Array} [array] The array to iterate over.
  19630. * @param {Function} iteratee The function invoked per iteration.
  19631. * @returns {Array} Returns `array`.
  19632. */
  19633. function arrayEachRight(array, iteratee) {
  19634. var length = array == null ? 0 : array.length;
  19635. while (length--) {
  19636. if (iteratee(array[length], length, array) === false) {
  19637. break;
  19638. }
  19639. }
  19640. return array;
  19641. }
  19642. /**
  19643. * A specialized version of `_.every` for arrays without support for
  19644. * iteratee shorthands.
  19645. *
  19646. * @private
  19647. * @param {Array} [array] The array to iterate over.
  19648. * @param {Function} predicate The function invoked per iteration.
  19649. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  19650. * else `false`.
  19651. */
  19652. function arrayEvery(array, predicate) {
  19653. var index = -1,
  19654. length = array == null ? 0 : array.length;
  19655. while (++index < length) {
  19656. if (!predicate(array[index], index, array)) {
  19657. return false;
  19658. }
  19659. }
  19660. return true;
  19661. }
  19662. /**
  19663. * A specialized version of `_.filter` for arrays without support for
  19664. * iteratee shorthands.
  19665. *
  19666. * @private
  19667. * @param {Array} [array] The array to iterate over.
  19668. * @param {Function} predicate The function invoked per iteration.
  19669. * @returns {Array} Returns the new filtered array.
  19670. */
  19671. function arrayFilter(array, predicate) {
  19672. var index = -1,
  19673. length = array == null ? 0 : array.length,
  19674. resIndex = 0,
  19675. result = [];
  19676. while (++index < length) {
  19677. var value = array[index];
  19678. if (predicate(value, index, array)) {
  19679. result[resIndex++] = value;
  19680. }
  19681. }
  19682. return result;
  19683. }
  19684. /**
  19685. * A specialized version of `_.includes` for arrays without support for
  19686. * specifying an index to search from.
  19687. *
  19688. * @private
  19689. * @param {Array} [array] The array to inspect.
  19690. * @param {*} target The value to search for.
  19691. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  19692. */
  19693. function arrayIncludes(array, value) {
  19694. var length = array == null ? 0 : array.length;
  19695. return !!length && baseIndexOf(array, value, 0) > -1;
  19696. }
  19697. /**
  19698. * This function is like `arrayIncludes` except that it accepts a comparator.
  19699. *
  19700. * @private
  19701. * @param {Array} [array] The array to inspect.
  19702. * @param {*} target The value to search for.
  19703. * @param {Function} comparator The comparator invoked per element.
  19704. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  19705. */
  19706. function arrayIncludesWith(array, value, comparator) {
  19707. var index = -1,
  19708. length = array == null ? 0 : array.length;
  19709. while (++index < length) {
  19710. if (comparator(value, array[index])) {
  19711. return true;
  19712. }
  19713. }
  19714. return false;
  19715. }
  19716. /**
  19717. * A specialized version of `_.map` for arrays without support for iteratee
  19718. * shorthands.
  19719. *
  19720. * @private
  19721. * @param {Array} [array] The array to iterate over.
  19722. * @param {Function} iteratee The function invoked per iteration.
  19723. * @returns {Array} Returns the new mapped array.
  19724. */
  19725. function arrayMap(array, iteratee) {
  19726. var index = -1,
  19727. length = array == null ? 0 : array.length,
  19728. result = Array(length);
  19729. while (++index < length) {
  19730. result[index] = iteratee(array[index], index, array);
  19731. }
  19732. return result;
  19733. }
  19734. /**
  19735. * Appends the elements of `values` to `array`.
  19736. *
  19737. * @private
  19738. * @param {Array} array The array to modify.
  19739. * @param {Array} values The values to append.
  19740. * @returns {Array} Returns `array`.
  19741. */
  19742. function arrayPush(array, values) {
  19743. var index = -1,
  19744. length = values.length,
  19745. offset = array.length;
  19746. while (++index < length) {
  19747. array[offset + index] = values[index];
  19748. }
  19749. return array;
  19750. }
  19751. /**
  19752. * A specialized version of `_.reduce` for arrays without support for
  19753. * iteratee shorthands.
  19754. *
  19755. * @private
  19756. * @param {Array} [array] The array to iterate over.
  19757. * @param {Function} iteratee The function invoked per iteration.
  19758. * @param {*} [accumulator] The initial value.
  19759. * @param {boolean} [initAccum] Specify using the first element of `array` as
  19760. * the initial value.
  19761. * @returns {*} Returns the accumulated value.
  19762. */
  19763. function arrayReduce(array, iteratee, accumulator, initAccum) {
  19764. var index = -1,
  19765. length = array == null ? 0 : array.length;
  19766. if (initAccum && length) {
  19767. accumulator = array[++index];
  19768. }
  19769. while (++index < length) {
  19770. accumulator = iteratee(accumulator, array[index], index, array);
  19771. }
  19772. return accumulator;
  19773. }
  19774. /**
  19775. * A specialized version of `_.reduceRight` for arrays without support for
  19776. * iteratee shorthands.
  19777. *
  19778. * @private
  19779. * @param {Array} [array] The array to iterate over.
  19780. * @param {Function} iteratee The function invoked per iteration.
  19781. * @param {*} [accumulator] The initial value.
  19782. * @param {boolean} [initAccum] Specify using the last element of `array` as
  19783. * the initial value.
  19784. * @returns {*} Returns the accumulated value.
  19785. */
  19786. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  19787. var length = array == null ? 0 : array.length;
  19788. if (initAccum && length) {
  19789. accumulator = array[--length];
  19790. }
  19791. while (length--) {
  19792. accumulator = iteratee(accumulator, array[length], length, array);
  19793. }
  19794. return accumulator;
  19795. }
  19796. /**
  19797. * A specialized version of `_.some` for arrays without support for iteratee
  19798. * shorthands.
  19799. *
  19800. * @private
  19801. * @param {Array} [array] The array to iterate over.
  19802. * @param {Function} predicate The function invoked per iteration.
  19803. * @returns {boolean} Returns `true` if any element passes the predicate check,
  19804. * else `false`.
  19805. */
  19806. function arraySome(array, predicate) {
  19807. var index = -1,
  19808. length = array == null ? 0 : array.length;
  19809. while (++index < length) {
  19810. if (predicate(array[index], index, array)) {
  19811. return true;
  19812. }
  19813. }
  19814. return false;
  19815. }
  19816. /**
  19817. * Gets the size of an ASCII `string`.
  19818. *
  19819. * @private
  19820. * @param {string} string The string inspect.
  19821. * @returns {number} Returns the string size.
  19822. */
  19823. var asciiSize = baseProperty('length');
  19824. /**
  19825. * Converts an ASCII `string` to an array.
  19826. *
  19827. * @private
  19828. * @param {string} string The string to convert.
  19829. * @returns {Array} Returns the converted array.
  19830. */
  19831. function asciiToArray(string) {
  19832. return string.split('');
  19833. }
  19834. /**
  19835. * Splits an ASCII `string` into an array of its words.
  19836. *
  19837. * @private
  19838. * @param {string} The string to inspect.
  19839. * @returns {Array} Returns the words of `string`.
  19840. */
  19841. function asciiWords(string) {
  19842. return string.match(reAsciiWord) || [];
  19843. }
  19844. /**
  19845. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  19846. * without support for iteratee shorthands, which iterates over `collection`
  19847. * using `eachFunc`.
  19848. *
  19849. * @private
  19850. * @param {Array|Object} collection The collection to inspect.
  19851. * @param {Function} predicate The function invoked per iteration.
  19852. * @param {Function} eachFunc The function to iterate over `collection`.
  19853. * @returns {*} Returns the found element or its key, else `undefined`.
  19854. */
  19855. function baseFindKey(collection, predicate, eachFunc) {
  19856. var result;
  19857. eachFunc(collection, function(value, key, collection) {
  19858. if (predicate(value, key, collection)) {
  19859. result = key;
  19860. return false;
  19861. }
  19862. });
  19863. return result;
  19864. }
  19865. /**
  19866. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  19867. * support for iteratee shorthands.
  19868. *
  19869. * @private
  19870. * @param {Array} array The array to inspect.
  19871. * @param {Function} predicate The function invoked per iteration.
  19872. * @param {number} fromIndex The index to search from.
  19873. * @param {boolean} [fromRight] Specify iterating from right to left.
  19874. * @returns {number} Returns the index of the matched value, else `-1`.
  19875. */
  19876. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  19877. var length = array.length,
  19878. index = fromIndex + (fromRight ? 1 : -1);
  19879. while ((fromRight ? index-- : ++index < length)) {
  19880. if (predicate(array[index], index, array)) {
  19881. return index;
  19882. }
  19883. }
  19884. return -1;
  19885. }
  19886. /**
  19887. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  19888. *
  19889. * @private
  19890. * @param {Array} array The array to inspect.
  19891. * @param {*} value The value to search for.
  19892. * @param {number} fromIndex The index to search from.
  19893. * @returns {number} Returns the index of the matched value, else `-1`.
  19894. */
  19895. function baseIndexOf(array, value, fromIndex) {
  19896. return value === value
  19897. ? strictIndexOf(array, value, fromIndex)
  19898. : baseFindIndex(array, baseIsNaN, fromIndex);
  19899. }
  19900. /**
  19901. * This function is like `baseIndexOf` except that it accepts a comparator.
  19902. *
  19903. * @private
  19904. * @param {Array} array The array to inspect.
  19905. * @param {*} value The value to search for.
  19906. * @param {number} fromIndex The index to search from.
  19907. * @param {Function} comparator The comparator invoked per element.
  19908. * @returns {number} Returns the index of the matched value, else `-1`.
  19909. */
  19910. function baseIndexOfWith(array, value, fromIndex, comparator) {
  19911. var index = fromIndex - 1,
  19912. length = array.length;
  19913. while (++index < length) {
  19914. if (comparator(array[index], value)) {
  19915. return index;
  19916. }
  19917. }
  19918. return -1;
  19919. }
  19920. /**
  19921. * The base implementation of `_.isNaN` without support for number objects.
  19922. *
  19923. * @private
  19924. * @param {*} value The value to check.
  19925. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  19926. */
  19927. function baseIsNaN(value) {
  19928. return value !== value;
  19929. }
  19930. /**
  19931. * The base implementation of `_.mean` and `_.meanBy` without support for
  19932. * iteratee shorthands.
  19933. *
  19934. * @private
  19935. * @param {Array} array The array to iterate over.
  19936. * @param {Function} iteratee The function invoked per iteration.
  19937. * @returns {number} Returns the mean.
  19938. */
  19939. function baseMean(array, iteratee) {
  19940. var length = array == null ? 0 : array.length;
  19941. return length ? (baseSum(array, iteratee) / length) : NAN;
  19942. }
  19943. /**
  19944. * The base implementation of `_.property` without support for deep paths.
  19945. *
  19946. * @private
  19947. * @param {string} key The key of the property to get.
  19948. * @returns {Function} Returns the new accessor function.
  19949. */
  19950. function baseProperty(key) {
  19951. return function(object) {
  19952. return object == null ? undefined : object[key];
  19953. };
  19954. }
  19955. /**
  19956. * The base implementation of `_.propertyOf` without support for deep paths.
  19957. *
  19958. * @private
  19959. * @param {Object} object The object to query.
  19960. * @returns {Function} Returns the new accessor function.
  19961. */
  19962. function basePropertyOf(object) {
  19963. return function(key) {
  19964. return object == null ? undefined : object[key];
  19965. };
  19966. }
  19967. /**
  19968. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  19969. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  19970. *
  19971. * @private
  19972. * @param {Array|Object} collection The collection to iterate over.
  19973. * @param {Function} iteratee The function invoked per iteration.
  19974. * @param {*} accumulator The initial value.
  19975. * @param {boolean} initAccum Specify using the first or last element of
  19976. * `collection` as the initial value.
  19977. * @param {Function} eachFunc The function to iterate over `collection`.
  19978. * @returns {*} Returns the accumulated value.
  19979. */
  19980. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  19981. eachFunc(collection, function(value, index, collection) {
  19982. accumulator = initAccum
  19983. ? (initAccum = false, value)
  19984. : iteratee(accumulator, value, index, collection);
  19985. });
  19986. return accumulator;
  19987. }
  19988. /**
  19989. * The base implementation of `_.sortBy` which uses `comparer` to define the
  19990. * sort order of `array` and replaces criteria objects with their corresponding
  19991. * values.
  19992. *
  19993. * @private
  19994. * @param {Array} array The array to sort.
  19995. * @param {Function} comparer The function to define sort order.
  19996. * @returns {Array} Returns `array`.
  19997. */
  19998. function baseSortBy(array, comparer) {
  19999. var length = array.length;
  20000. array.sort(comparer);
  20001. while (length--) {
  20002. array[length] = array[length].value;
  20003. }
  20004. return array;
  20005. }
  20006. /**
  20007. * The base implementation of `_.sum` and `_.sumBy` without support for
  20008. * iteratee shorthands.
  20009. *
  20010. * @private
  20011. * @param {Array} array The array to iterate over.
  20012. * @param {Function} iteratee The function invoked per iteration.
  20013. * @returns {number} Returns the sum.
  20014. */
  20015. function baseSum(array, iteratee) {
  20016. var result,
  20017. index = -1,
  20018. length = array.length;
  20019. while (++index < length) {
  20020. var current = iteratee(array[index]);
  20021. if (current !== undefined) {
  20022. result = result === undefined ? current : (result + current);
  20023. }
  20024. }
  20025. return result;
  20026. }
  20027. /**
  20028. * The base implementation of `_.times` without support for iteratee shorthands
  20029. * or max array length checks.
  20030. *
  20031. * @private
  20032. * @param {number} n The number of times to invoke `iteratee`.
  20033. * @param {Function} iteratee The function invoked per iteration.
  20034. * @returns {Array} Returns the array of results.
  20035. */
  20036. function baseTimes(n, iteratee) {
  20037. var index = -1,
  20038. result = Array(n);
  20039. while (++index < n) {
  20040. result[index] = iteratee(index);
  20041. }
  20042. return result;
  20043. }
  20044. /**
  20045. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  20046. * of key-value pairs for `object` corresponding to the property names of `props`.
  20047. *
  20048. * @private
  20049. * @param {Object} object The object to query.
  20050. * @param {Array} props The property names to get values for.
  20051. * @returns {Object} Returns the key-value pairs.
  20052. */
  20053. function baseToPairs(object, props) {
  20054. return arrayMap(props, function(key) {
  20055. return [key, object[key]];
  20056. });
  20057. }
  20058. /**
  20059. * The base implementation of `_.unary` without support for storing metadata.
  20060. *
  20061. * @private
  20062. * @param {Function} func The function to cap arguments for.
  20063. * @returns {Function} Returns the new capped function.
  20064. */
  20065. function baseUnary(func) {
  20066. return function(value) {
  20067. return func(value);
  20068. };
  20069. }
  20070. /**
  20071. * The base implementation of `_.values` and `_.valuesIn` which creates an
  20072. * array of `object` property values corresponding to the property names
  20073. * of `props`.
  20074. *
  20075. * @private
  20076. * @param {Object} object The object to query.
  20077. * @param {Array} props The property names to get values for.
  20078. * @returns {Object} Returns the array of property values.
  20079. */
  20080. function baseValues(object, props) {
  20081. return arrayMap(props, function(key) {
  20082. return object[key];
  20083. });
  20084. }
  20085. /**
  20086. * Checks if a `cache` value for `key` exists.
  20087. *
  20088. * @private
  20089. * @param {Object} cache The cache to query.
  20090. * @param {string} key The key of the entry to check.
  20091. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20092. */
  20093. function cacheHas(cache, key) {
  20094. return cache.has(key);
  20095. }
  20096. /**
  20097. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  20098. * that is not found in the character symbols.
  20099. *
  20100. * @private
  20101. * @param {Array} strSymbols The string symbols to inspect.
  20102. * @param {Array} chrSymbols The character symbols to find.
  20103. * @returns {number} Returns the index of the first unmatched string symbol.
  20104. */
  20105. function charsStartIndex(strSymbols, chrSymbols) {
  20106. var index = -1,
  20107. length = strSymbols.length;
  20108. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  20109. return index;
  20110. }
  20111. /**
  20112. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  20113. * that is not found in the character symbols.
  20114. *
  20115. * @private
  20116. * @param {Array} strSymbols The string symbols to inspect.
  20117. * @param {Array} chrSymbols The character symbols to find.
  20118. * @returns {number} Returns the index of the last unmatched string symbol.
  20119. */
  20120. function charsEndIndex(strSymbols, chrSymbols) {
  20121. var index = strSymbols.length;
  20122. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  20123. return index;
  20124. }
  20125. /**
  20126. * Gets the number of `placeholder` occurrences in `array`.
  20127. *
  20128. * @private
  20129. * @param {Array} array The array to inspect.
  20130. * @param {*} placeholder The placeholder to search for.
  20131. * @returns {number} Returns the placeholder count.
  20132. */
  20133. function countHolders(array, placeholder) {
  20134. var length = array.length,
  20135. result = 0;
  20136. while (length--) {
  20137. if (array[length] === placeholder) {
  20138. ++result;
  20139. }
  20140. }
  20141. return result;
  20142. }
  20143. /**
  20144. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  20145. * letters to basic Latin letters.
  20146. *
  20147. * @private
  20148. * @param {string} letter The matched letter to deburr.
  20149. * @returns {string} Returns the deburred letter.
  20150. */
  20151. var deburrLetter = basePropertyOf(deburredLetters);
  20152. /**
  20153. * Used by `_.escape` to convert characters to HTML entities.
  20154. *
  20155. * @private
  20156. * @param {string} chr The matched character to escape.
  20157. * @returns {string} Returns the escaped character.
  20158. */
  20159. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  20160. /**
  20161. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  20162. *
  20163. * @private
  20164. * @param {string} chr The matched character to escape.
  20165. * @returns {string} Returns the escaped character.
  20166. */
  20167. function escapeStringChar(chr) {
  20168. return '\\' + stringEscapes[chr];
  20169. }
  20170. /**
  20171. * Gets the value at `key` of `object`.
  20172. *
  20173. * @private
  20174. * @param {Object} [object] The object to query.
  20175. * @param {string} key The key of the property to get.
  20176. * @returns {*} Returns the property value.
  20177. */
  20178. function getValue(object, key) {
  20179. return object == null ? undefined : object[key];
  20180. }
  20181. /**
  20182. * Checks if `string` contains Unicode symbols.
  20183. *
  20184. * @private
  20185. * @param {string} string The string to inspect.
  20186. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  20187. */
  20188. function hasUnicode(string) {
  20189. return reHasUnicode.test(string);
  20190. }
  20191. /**
  20192. * Checks if `string` contains a word composed of Unicode symbols.
  20193. *
  20194. * @private
  20195. * @param {string} string The string to inspect.
  20196. * @returns {boolean} Returns `true` if a word is found, else `false`.
  20197. */
  20198. function hasUnicodeWord(string) {
  20199. return reHasUnicodeWord.test(string);
  20200. }
  20201. /**
  20202. * Converts `iterator` to an array.
  20203. *
  20204. * @private
  20205. * @param {Object} iterator The iterator to convert.
  20206. * @returns {Array} Returns the converted array.
  20207. */
  20208. function iteratorToArray(iterator) {
  20209. var data,
  20210. result = [];
  20211. while (!(data = iterator.next()).done) {
  20212. result.push(data.value);
  20213. }
  20214. return result;
  20215. }
  20216. /**
  20217. * Converts `map` to its key-value pairs.
  20218. *
  20219. * @private
  20220. * @param {Object} map The map to convert.
  20221. * @returns {Array} Returns the key-value pairs.
  20222. */
  20223. function mapToArray(map) {
  20224. var index = -1,
  20225. result = Array(map.size);
  20226. map.forEach(function(value, key) {
  20227. result[++index] = [key, value];
  20228. });
  20229. return result;
  20230. }
  20231. /**
  20232. * Creates a unary function that invokes `func` with its argument transformed.
  20233. *
  20234. * @private
  20235. * @param {Function} func The function to wrap.
  20236. * @param {Function} transform The argument transform.
  20237. * @returns {Function} Returns the new function.
  20238. */
  20239. function overArg(func, transform) {
  20240. return function(arg) {
  20241. return func(transform(arg));
  20242. };
  20243. }
  20244. /**
  20245. * Replaces all `placeholder` elements in `array` with an internal placeholder
  20246. * and returns an array of their indexes.
  20247. *
  20248. * @private
  20249. * @param {Array} array The array to modify.
  20250. * @param {*} placeholder The placeholder to replace.
  20251. * @returns {Array} Returns the new array of placeholder indexes.
  20252. */
  20253. function replaceHolders(array, placeholder) {
  20254. var index = -1,
  20255. length = array.length,
  20256. resIndex = 0,
  20257. result = [];
  20258. while (++index < length) {
  20259. var value = array[index];
  20260. if (value === placeholder || value === PLACEHOLDER) {
  20261. array[index] = PLACEHOLDER;
  20262. result[resIndex++] = index;
  20263. }
  20264. }
  20265. return result;
  20266. }
  20267. /**
  20268. * Converts `set` to an array of its values.
  20269. *
  20270. * @private
  20271. * @param {Object} set The set to convert.
  20272. * @returns {Array} Returns the values.
  20273. */
  20274. function setToArray(set) {
  20275. var index = -1,
  20276. result = Array(set.size);
  20277. set.forEach(function(value) {
  20278. result[++index] = value;
  20279. });
  20280. return result;
  20281. }
  20282. /**
  20283. * Converts `set` to its value-value pairs.
  20284. *
  20285. * @private
  20286. * @param {Object} set The set to convert.
  20287. * @returns {Array} Returns the value-value pairs.
  20288. */
  20289. function setToPairs(set) {
  20290. var index = -1,
  20291. result = Array(set.size);
  20292. set.forEach(function(value) {
  20293. result[++index] = [value, value];
  20294. });
  20295. return result;
  20296. }
  20297. /**
  20298. * A specialized version of `_.indexOf` which performs strict equality
  20299. * comparisons of values, i.e. `===`.
  20300. *
  20301. * @private
  20302. * @param {Array} array The array to inspect.
  20303. * @param {*} value The value to search for.
  20304. * @param {number} fromIndex The index to search from.
  20305. * @returns {number} Returns the index of the matched value, else `-1`.
  20306. */
  20307. function strictIndexOf(array, value, fromIndex) {
  20308. var index = fromIndex - 1,
  20309. length = array.length;
  20310. while (++index < length) {
  20311. if (array[index] === value) {
  20312. return index;
  20313. }
  20314. }
  20315. return -1;
  20316. }
  20317. /**
  20318. * A specialized version of `_.lastIndexOf` which performs strict equality
  20319. * comparisons of values, i.e. `===`.
  20320. *
  20321. * @private
  20322. * @param {Array} array The array to inspect.
  20323. * @param {*} value The value to search for.
  20324. * @param {number} fromIndex The index to search from.
  20325. * @returns {number} Returns the index of the matched value, else `-1`.
  20326. */
  20327. function strictLastIndexOf(array, value, fromIndex) {
  20328. var index = fromIndex + 1;
  20329. while (index--) {
  20330. if (array[index] === value) {
  20331. return index;
  20332. }
  20333. }
  20334. return index;
  20335. }
  20336. /**
  20337. * Gets the number of symbols in `string`.
  20338. *
  20339. * @private
  20340. * @param {string} string The string to inspect.
  20341. * @returns {number} Returns the string size.
  20342. */
  20343. function stringSize(string) {
  20344. return hasUnicode(string)
  20345. ? unicodeSize(string)
  20346. : asciiSize(string);
  20347. }
  20348. /**
  20349. * Converts `string` to an array.
  20350. *
  20351. * @private
  20352. * @param {string} string The string to convert.
  20353. * @returns {Array} Returns the converted array.
  20354. */
  20355. function stringToArray(string) {
  20356. return hasUnicode(string)
  20357. ? unicodeToArray(string)
  20358. : asciiToArray(string);
  20359. }
  20360. /**
  20361. * Used by `_.unescape` to convert HTML entities to characters.
  20362. *
  20363. * @private
  20364. * @param {string} chr The matched character to unescape.
  20365. * @returns {string} Returns the unescaped character.
  20366. */
  20367. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  20368. /**
  20369. * Gets the size of a Unicode `string`.
  20370. *
  20371. * @private
  20372. * @param {string} string The string inspect.
  20373. * @returns {number} Returns the string size.
  20374. */
  20375. function unicodeSize(string) {
  20376. var result = reUnicode.lastIndex = 0;
  20377. while (reUnicode.test(string)) {
  20378. ++result;
  20379. }
  20380. return result;
  20381. }
  20382. /**
  20383. * Converts a Unicode `string` to an array.
  20384. *
  20385. * @private
  20386. * @param {string} string The string to convert.
  20387. * @returns {Array} Returns the converted array.
  20388. */
  20389. function unicodeToArray(string) {
  20390. return string.match(reUnicode) || [];
  20391. }
  20392. /**
  20393. * Splits a Unicode `string` into an array of its words.
  20394. *
  20395. * @private
  20396. * @param {string} The string to inspect.
  20397. * @returns {Array} Returns the words of `string`.
  20398. */
  20399. function unicodeWords(string) {
  20400. return string.match(reUnicodeWord) || [];
  20401. }
  20402. /*--------------------------------------------------------------------------*/
  20403. /**
  20404. * Create a new pristine `lodash` function using the `context` object.
  20405. *
  20406. * @static
  20407. * @memberOf _
  20408. * @since 1.1.0
  20409. * @category Util
  20410. * @param {Object} [context=root] The context object.
  20411. * @returns {Function} Returns a new `lodash` function.
  20412. * @example
  20413. *
  20414. * _.mixin({ 'foo': _.constant('foo') });
  20415. *
  20416. * var lodash = _.runInContext();
  20417. * lodash.mixin({ 'bar': lodash.constant('bar') });
  20418. *
  20419. * _.isFunction(_.foo);
  20420. * // => true
  20421. * _.isFunction(_.bar);
  20422. * // => false
  20423. *
  20424. * lodash.isFunction(lodash.foo);
  20425. * // => false
  20426. * lodash.isFunction(lodash.bar);
  20427. * // => true
  20428. *
  20429. * // Create a suped-up `defer` in Node.js.
  20430. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  20431. */
  20432. var runInContext = (function runInContext(context) {
  20433. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  20434. /** Built-in constructor references. */
  20435. var Array = context.Array,
  20436. Date = context.Date,
  20437. Error = context.Error,
  20438. Function = context.Function,
  20439. Math = context.Math,
  20440. Object = context.Object,
  20441. RegExp = context.RegExp,
  20442. String = context.String,
  20443. TypeError = context.TypeError;
  20444. /** Used for built-in method references. */
  20445. var arrayProto = Array.prototype,
  20446. funcProto = Function.prototype,
  20447. objectProto = Object.prototype;
  20448. /** Used to detect overreaching core-js shims. */
  20449. var coreJsData = context['__core-js_shared__'];
  20450. /** Used to resolve the decompiled source of functions. */
  20451. var funcToString = funcProto.toString;
  20452. /** Used to check objects for own properties. */
  20453. var hasOwnProperty = objectProto.hasOwnProperty;
  20454. /** Used to generate unique IDs. */
  20455. var idCounter = 0;
  20456. /** Used to detect methods masquerading as native. */
  20457. var maskSrcKey = (function() {
  20458. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  20459. return uid ? ('Symbol(src)_1.' + uid) : '';
  20460. }());
  20461. /**
  20462. * Used to resolve the
  20463. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  20464. * of values.
  20465. */
  20466. var nativeObjectToString = objectProto.toString;
  20467. /** Used to infer the `Object` constructor. */
  20468. var objectCtorString = funcToString.call(Object);
  20469. /** Used to restore the original `_` reference in `_.noConflict`. */
  20470. var oldDash = root._;
  20471. /** Used to detect if a method is native. */
  20472. var reIsNative = RegExp('^' +
  20473. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  20474. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  20475. );
  20476. /** Built-in value references. */
  20477. var Buffer = moduleExports ? context.Buffer : undefined,
  20478. Symbol = context.Symbol,
  20479. Uint8Array = context.Uint8Array,
  20480. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  20481. getPrototype = overArg(Object.getPrototypeOf, Object),
  20482. objectCreate = Object.create,
  20483. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  20484. splice = arrayProto.splice,
  20485. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  20486. symIterator = Symbol ? Symbol.iterator : undefined,
  20487. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  20488. var defineProperty = (function() {
  20489. try {
  20490. var func = getNative(Object, 'defineProperty');
  20491. func({}, '', {});
  20492. return func;
  20493. } catch (e) {}
  20494. }());
  20495. /** Mocked built-ins. */
  20496. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  20497. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  20498. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  20499. /* Built-in method references for those with the same name as other `lodash` methods. */
  20500. var nativeCeil = Math.ceil,
  20501. nativeFloor = Math.floor,
  20502. nativeGetSymbols = Object.getOwnPropertySymbols,
  20503. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  20504. nativeIsFinite = context.isFinite,
  20505. nativeJoin = arrayProto.join,
  20506. nativeKeys = overArg(Object.keys, Object),
  20507. nativeMax = Math.max,
  20508. nativeMin = Math.min,
  20509. nativeNow = Date.now,
  20510. nativeParseInt = context.parseInt,
  20511. nativeRandom = Math.random,
  20512. nativeReverse = arrayProto.reverse;
  20513. /* Built-in method references that are verified to be native. */
  20514. var DataView = getNative(context, 'DataView'),
  20515. Map = getNative(context, 'Map'),
  20516. Promise = getNative(context, 'Promise'),
  20517. Set = getNative(context, 'Set'),
  20518. WeakMap = getNative(context, 'WeakMap'),
  20519. nativeCreate = getNative(Object, 'create');
  20520. /** Used to store function metadata. */
  20521. var metaMap = WeakMap && new WeakMap;
  20522. /** Used to lookup unminified function names. */
  20523. var realNames = {};
  20524. /** Used to detect maps, sets, and weakmaps. */
  20525. var dataViewCtorString = toSource(DataView),
  20526. mapCtorString = toSource(Map),
  20527. promiseCtorString = toSource(Promise),
  20528. setCtorString = toSource(Set),
  20529. weakMapCtorString = toSource(WeakMap);
  20530. /** Used to convert symbols to primitives and strings. */
  20531. var symbolProto = Symbol ? Symbol.prototype : undefined,
  20532. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  20533. symbolToString = symbolProto ? symbolProto.toString : undefined;
  20534. /*------------------------------------------------------------------------*/
  20535. /**
  20536. * Creates a `lodash` object which wraps `value` to enable implicit method
  20537. * chain sequences. Methods that operate on and return arrays, collections,
  20538. * and functions can be chained together. Methods that retrieve a single value
  20539. * or may return a primitive value will automatically end the chain sequence
  20540. * and return the unwrapped value. Otherwise, the value must be unwrapped
  20541. * with `_#value`.
  20542. *
  20543. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  20544. * enabled using `_.chain`.
  20545. *
  20546. * The execution of chained methods is lazy, that is, it's deferred until
  20547. * `_#value` is implicitly or explicitly called.
  20548. *
  20549. * Lazy evaluation allows several methods to support shortcut fusion.
  20550. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  20551. * the creation of intermediate arrays and can greatly reduce the number of
  20552. * iteratee executions. Sections of a chain sequence qualify for shortcut
  20553. * fusion if the section is applied to an array and iteratees accept only
  20554. * one argument. The heuristic for whether a section qualifies for shortcut
  20555. * fusion is subject to change.
  20556. *
  20557. * Chaining is supported in custom builds as long as the `_#value` method is
  20558. * directly or indirectly included in the build.
  20559. *
  20560. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  20561. *
  20562. * The wrapper `Array` methods are:
  20563. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  20564. *
  20565. * The wrapper `String` methods are:
  20566. * `replace` and `split`
  20567. *
  20568. * The wrapper methods that support shortcut fusion are:
  20569. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  20570. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  20571. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  20572. *
  20573. * The chainable wrapper methods are:
  20574. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  20575. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  20576. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  20577. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  20578. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  20579. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  20580. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  20581. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  20582. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  20583. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  20584. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  20585. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  20586. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  20587. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  20588. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  20589. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  20590. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  20591. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  20592. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  20593. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  20594. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  20595. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  20596. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  20597. * `zipObject`, `zipObjectDeep`, and `zipWith`
  20598. *
  20599. * The wrapper methods that are **not** chainable by default are:
  20600. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  20601. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  20602. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  20603. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  20604. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  20605. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  20606. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  20607. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  20608. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  20609. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  20610. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  20611. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  20612. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  20613. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  20614. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  20615. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  20616. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  20617. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  20618. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  20619. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  20620. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  20621. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  20622. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  20623. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  20624. * `upperFirst`, `value`, and `words`
  20625. *
  20626. * @name _
  20627. * @constructor
  20628. * @category Seq
  20629. * @param {*} value The value to wrap in a `lodash` instance.
  20630. * @returns {Object} Returns the new `lodash` wrapper instance.
  20631. * @example
  20632. *
  20633. * function square(n) {
  20634. * return n * n;
  20635. * }
  20636. *
  20637. * var wrapped = _([1, 2, 3]);
  20638. *
  20639. * // Returns an unwrapped value.
  20640. * wrapped.reduce(_.add);
  20641. * // => 6
  20642. *
  20643. * // Returns a wrapped value.
  20644. * var squares = wrapped.map(square);
  20645. *
  20646. * _.isArray(squares);
  20647. * // => false
  20648. *
  20649. * _.isArray(squares.value());
  20650. * // => true
  20651. */
  20652. function lodash(value) {
  20653. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  20654. if (value instanceof LodashWrapper) {
  20655. return value;
  20656. }
  20657. if (hasOwnProperty.call(value, '__wrapped__')) {
  20658. return wrapperClone(value);
  20659. }
  20660. }
  20661. return new LodashWrapper(value);
  20662. }
  20663. /**
  20664. * The base implementation of `_.create` without support for assigning
  20665. * properties to the created object.
  20666. *
  20667. * @private
  20668. * @param {Object} proto The object to inherit from.
  20669. * @returns {Object} Returns the new object.
  20670. */
  20671. var baseCreate = (function() {
  20672. function object() {}
  20673. return function(proto) {
  20674. if (!isObject(proto)) {
  20675. return {};
  20676. }
  20677. if (objectCreate) {
  20678. return objectCreate(proto);
  20679. }
  20680. object.prototype = proto;
  20681. var result = new object;
  20682. object.prototype = undefined;
  20683. return result;
  20684. };
  20685. }());
  20686. /**
  20687. * The function whose prototype chain sequence wrappers inherit from.
  20688. *
  20689. * @private
  20690. */
  20691. function baseLodash() {
  20692. // No operation performed.
  20693. }
  20694. /**
  20695. * The base constructor for creating `lodash` wrapper objects.
  20696. *
  20697. * @private
  20698. * @param {*} value The value to wrap.
  20699. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  20700. */
  20701. function LodashWrapper(value, chainAll) {
  20702. this.__wrapped__ = value;
  20703. this.__actions__ = [];
  20704. this.__chain__ = !!chainAll;
  20705. this.__index__ = 0;
  20706. this.__values__ = undefined;
  20707. }
  20708. /**
  20709. * By default, the template delimiters used by lodash are like those in
  20710. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  20711. * following template settings to use alternative delimiters.
  20712. *
  20713. * @static
  20714. * @memberOf _
  20715. * @type {Object}
  20716. */
  20717. lodash.templateSettings = {
  20718. /**
  20719. * Used to detect `data` property values to be HTML-escaped.
  20720. *
  20721. * @memberOf _.templateSettings
  20722. * @type {RegExp}
  20723. */
  20724. 'escape': reEscape,
  20725. /**
  20726. * Used to detect code to be evaluated.
  20727. *
  20728. * @memberOf _.templateSettings
  20729. * @type {RegExp}
  20730. */
  20731. 'evaluate': reEvaluate,
  20732. /**
  20733. * Used to detect `data` property values to inject.
  20734. *
  20735. * @memberOf _.templateSettings
  20736. * @type {RegExp}
  20737. */
  20738. 'interpolate': reInterpolate,
  20739. /**
  20740. * Used to reference the data object in the template text.
  20741. *
  20742. * @memberOf _.templateSettings
  20743. * @type {string}
  20744. */
  20745. 'variable': '',
  20746. /**
  20747. * Used to import variables into the compiled template.
  20748. *
  20749. * @memberOf _.templateSettings
  20750. * @type {Object}
  20751. */
  20752. 'imports': {
  20753. /**
  20754. * A reference to the `lodash` function.
  20755. *
  20756. * @memberOf _.templateSettings.imports
  20757. * @type {Function}
  20758. */
  20759. '_': lodash
  20760. }
  20761. };
  20762. // Ensure wrappers are instances of `baseLodash`.
  20763. lodash.prototype = baseLodash.prototype;
  20764. lodash.prototype.constructor = lodash;
  20765. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  20766. LodashWrapper.prototype.constructor = LodashWrapper;
  20767. /*------------------------------------------------------------------------*/
  20768. /**
  20769. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  20770. *
  20771. * @private
  20772. * @constructor
  20773. * @param {*} value The value to wrap.
  20774. */
  20775. function LazyWrapper(value) {
  20776. this.__wrapped__ = value;
  20777. this.__actions__ = [];
  20778. this.__dir__ = 1;
  20779. this.__filtered__ = false;
  20780. this.__iteratees__ = [];
  20781. this.__takeCount__ = MAX_ARRAY_LENGTH;
  20782. this.__views__ = [];
  20783. }
  20784. /**
  20785. * Creates a clone of the lazy wrapper object.
  20786. *
  20787. * @private
  20788. * @name clone
  20789. * @memberOf LazyWrapper
  20790. * @returns {Object} Returns the cloned `LazyWrapper` object.
  20791. */
  20792. function lazyClone() {
  20793. var result = new LazyWrapper(this.__wrapped__);
  20794. result.__actions__ = copyArray(this.__actions__);
  20795. result.__dir__ = this.__dir__;
  20796. result.__filtered__ = this.__filtered__;
  20797. result.__iteratees__ = copyArray(this.__iteratees__);
  20798. result.__takeCount__ = this.__takeCount__;
  20799. result.__views__ = copyArray(this.__views__);
  20800. return result;
  20801. }
  20802. /**
  20803. * Reverses the direction of lazy iteration.
  20804. *
  20805. * @private
  20806. * @name reverse
  20807. * @memberOf LazyWrapper
  20808. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  20809. */
  20810. function lazyReverse() {
  20811. if (this.__filtered__) {
  20812. var result = new LazyWrapper(this);
  20813. result.__dir__ = -1;
  20814. result.__filtered__ = true;
  20815. } else {
  20816. result = this.clone();
  20817. result.__dir__ *= -1;
  20818. }
  20819. return result;
  20820. }
  20821. /**
  20822. * Extracts the unwrapped value from its lazy wrapper.
  20823. *
  20824. * @private
  20825. * @name value
  20826. * @memberOf LazyWrapper
  20827. * @returns {*} Returns the unwrapped value.
  20828. */
  20829. function lazyValue() {
  20830. var array = this.__wrapped__.value(),
  20831. dir = this.__dir__,
  20832. isArr = isArray(array),
  20833. isRight = dir < 0,
  20834. arrLength = isArr ? array.length : 0,
  20835. view = getView(0, arrLength, this.__views__),
  20836. start = view.start,
  20837. end = view.end,
  20838. length = end - start,
  20839. index = isRight ? end : (start - 1),
  20840. iteratees = this.__iteratees__,
  20841. iterLength = iteratees.length,
  20842. resIndex = 0,
  20843. takeCount = nativeMin(length, this.__takeCount__);
  20844. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  20845. return baseWrapperValue(array, this.__actions__);
  20846. }
  20847. var result = [];
  20848. outer:
  20849. while (length-- && resIndex < takeCount) {
  20850. index += dir;
  20851. var iterIndex = -1,
  20852. value = array[index];
  20853. while (++iterIndex < iterLength) {
  20854. var data = iteratees[iterIndex],
  20855. iteratee = data.iteratee,
  20856. type = data.type,
  20857. computed = iteratee(value);
  20858. if (type == LAZY_MAP_FLAG) {
  20859. value = computed;
  20860. } else if (!computed) {
  20861. if (type == LAZY_FILTER_FLAG) {
  20862. continue outer;
  20863. } else {
  20864. break outer;
  20865. }
  20866. }
  20867. }
  20868. result[resIndex++] = value;
  20869. }
  20870. return result;
  20871. }
  20872. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  20873. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  20874. LazyWrapper.prototype.constructor = LazyWrapper;
  20875. /*------------------------------------------------------------------------*/
  20876. /**
  20877. * Creates a hash object.
  20878. *
  20879. * @private
  20880. * @constructor
  20881. * @param {Array} [entries] The key-value pairs to cache.
  20882. */
  20883. function Hash(entries) {
  20884. var index = -1,
  20885. length = entries == null ? 0 : entries.length;
  20886. this.clear();
  20887. while (++index < length) {
  20888. var entry = entries[index];
  20889. this.set(entry[0], entry[1]);
  20890. }
  20891. }
  20892. /**
  20893. * Removes all key-value entries from the hash.
  20894. *
  20895. * @private
  20896. * @name clear
  20897. * @memberOf Hash
  20898. */
  20899. function hashClear() {
  20900. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  20901. this.size = 0;
  20902. }
  20903. /**
  20904. * Removes `key` and its value from the hash.
  20905. *
  20906. * @private
  20907. * @name delete
  20908. * @memberOf Hash
  20909. * @param {Object} hash The hash to modify.
  20910. * @param {string} key The key of the value to remove.
  20911. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20912. */
  20913. function hashDelete(key) {
  20914. var result = this.has(key) && delete this.__data__[key];
  20915. this.size -= result ? 1 : 0;
  20916. return result;
  20917. }
  20918. /**
  20919. * Gets the hash value for `key`.
  20920. *
  20921. * @private
  20922. * @name get
  20923. * @memberOf Hash
  20924. * @param {string} key The key of the value to get.
  20925. * @returns {*} Returns the entry value.
  20926. */
  20927. function hashGet(key) {
  20928. var data = this.__data__;
  20929. if (nativeCreate) {
  20930. var result = data[key];
  20931. return result === HASH_UNDEFINED ? undefined : result;
  20932. }
  20933. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  20934. }
  20935. /**
  20936. * Checks if a hash value for `key` exists.
  20937. *
  20938. * @private
  20939. * @name has
  20940. * @memberOf Hash
  20941. * @param {string} key The key of the entry to check.
  20942. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20943. */
  20944. function hashHas(key) {
  20945. var data = this.__data__;
  20946. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  20947. }
  20948. /**
  20949. * Sets the hash `key` to `value`.
  20950. *
  20951. * @private
  20952. * @name set
  20953. * @memberOf Hash
  20954. * @param {string} key The key of the value to set.
  20955. * @param {*} value The value to set.
  20956. * @returns {Object} Returns the hash instance.
  20957. */
  20958. function hashSet(key, value) {
  20959. var data = this.__data__;
  20960. this.size += this.has(key) ? 0 : 1;
  20961. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  20962. return this;
  20963. }
  20964. // Add methods to `Hash`.
  20965. Hash.prototype.clear = hashClear;
  20966. Hash.prototype['delete'] = hashDelete;
  20967. Hash.prototype.get = hashGet;
  20968. Hash.prototype.has = hashHas;
  20969. Hash.prototype.set = hashSet;
  20970. /*------------------------------------------------------------------------*/
  20971. /**
  20972. * Creates an list cache object.
  20973. *
  20974. * @private
  20975. * @constructor
  20976. * @param {Array} [entries] The key-value pairs to cache.
  20977. */
  20978. function ListCache(entries) {
  20979. var index = -1,
  20980. length = entries == null ? 0 : entries.length;
  20981. this.clear();
  20982. while (++index < length) {
  20983. var entry = entries[index];
  20984. this.set(entry[0], entry[1]);
  20985. }
  20986. }
  20987. /**
  20988. * Removes all key-value entries from the list cache.
  20989. *
  20990. * @private
  20991. * @name clear
  20992. * @memberOf ListCache
  20993. */
  20994. function listCacheClear() {
  20995. this.__data__ = [];
  20996. this.size = 0;
  20997. }
  20998. /**
  20999. * Removes `key` and its value from the list cache.
  21000. *
  21001. * @private
  21002. * @name delete
  21003. * @memberOf ListCache
  21004. * @param {string} key The key of the value to remove.
  21005. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  21006. */
  21007. function listCacheDelete(key) {
  21008. var data = this.__data__,
  21009. index = assocIndexOf(data, key);
  21010. if (index < 0) {
  21011. return false;
  21012. }
  21013. var lastIndex = data.length - 1;
  21014. if (index == lastIndex) {
  21015. data.pop();
  21016. } else {
  21017. splice.call(data, index, 1);
  21018. }
  21019. --this.size;
  21020. return true;
  21021. }
  21022. /**
  21023. * Gets the list cache value for `key`.
  21024. *
  21025. * @private
  21026. * @name get
  21027. * @memberOf ListCache
  21028. * @param {string} key The key of the value to get.
  21029. * @returns {*} Returns the entry value.
  21030. */
  21031. function listCacheGet(key) {
  21032. var data = this.__data__,
  21033. index = assocIndexOf(data, key);
  21034. return index < 0 ? undefined : data[index][1];
  21035. }
  21036. /**
  21037. * Checks if a list cache value for `key` exists.
  21038. *
  21039. * @private
  21040. * @name has
  21041. * @memberOf ListCache
  21042. * @param {string} key The key of the entry to check.
  21043. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  21044. */
  21045. function listCacheHas(key) {
  21046. return assocIndexOf(this.__data__, key) > -1;
  21047. }
  21048. /**
  21049. * Sets the list cache `key` to `value`.
  21050. *
  21051. * @private
  21052. * @name set
  21053. * @memberOf ListCache
  21054. * @param {string} key The key of the value to set.
  21055. * @param {*} value The value to set.
  21056. * @returns {Object} Returns the list cache instance.
  21057. */
  21058. function listCacheSet(key, value) {
  21059. var data = this.__data__,
  21060. index = assocIndexOf(data, key);
  21061. if (index < 0) {
  21062. ++this.size;
  21063. data.push([key, value]);
  21064. } else {
  21065. data[index][1] = value;
  21066. }
  21067. return this;
  21068. }
  21069. // Add methods to `ListCache`.
  21070. ListCache.prototype.clear = listCacheClear;
  21071. ListCache.prototype['delete'] = listCacheDelete;
  21072. ListCache.prototype.get = listCacheGet;
  21073. ListCache.prototype.has = listCacheHas;
  21074. ListCache.prototype.set = listCacheSet;
  21075. /*------------------------------------------------------------------------*/
  21076. /**
  21077. * Creates a map cache object to store key-value pairs.
  21078. *
  21079. * @private
  21080. * @constructor
  21081. * @param {Array} [entries] The key-value pairs to cache.
  21082. */
  21083. function MapCache(entries) {
  21084. var index = -1,
  21085. length = entries == null ? 0 : entries.length;
  21086. this.clear();
  21087. while (++index < length) {
  21088. var entry = entries[index];
  21089. this.set(entry[0], entry[1]);
  21090. }
  21091. }
  21092. /**
  21093. * Removes all key-value entries from the map.
  21094. *
  21095. * @private
  21096. * @name clear
  21097. * @memberOf MapCache
  21098. */
  21099. function mapCacheClear() {
  21100. this.size = 0;
  21101. this.__data__ = {
  21102. 'hash': new Hash,
  21103. 'map': new (Map || ListCache),
  21104. 'string': new Hash
  21105. };
  21106. }
  21107. /**
  21108. * Removes `key` and its value from the map.
  21109. *
  21110. * @private
  21111. * @name delete
  21112. * @memberOf MapCache
  21113. * @param {string} key The key of the value to remove.
  21114. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  21115. */
  21116. function mapCacheDelete(key) {
  21117. var result = getMapData(this, key)['delete'](key);
  21118. this.size -= result ? 1 : 0;
  21119. return result;
  21120. }
  21121. /**
  21122. * Gets the map value for `key`.
  21123. *
  21124. * @private
  21125. * @name get
  21126. * @memberOf MapCache
  21127. * @param {string} key The key of the value to get.
  21128. * @returns {*} Returns the entry value.
  21129. */
  21130. function mapCacheGet(key) {
  21131. return getMapData(this, key).get(key);
  21132. }
  21133. /**
  21134. * Checks if a map value for `key` exists.
  21135. *
  21136. * @private
  21137. * @name has
  21138. * @memberOf MapCache
  21139. * @param {string} key The key of the entry to check.
  21140. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  21141. */
  21142. function mapCacheHas(key) {
  21143. return getMapData(this, key).has(key);
  21144. }
  21145. /**
  21146. * Sets the map `key` to `value`.
  21147. *
  21148. * @private
  21149. * @name set
  21150. * @memberOf MapCache
  21151. * @param {string} key The key of the value to set.
  21152. * @param {*} value The value to set.
  21153. * @returns {Object} Returns the map cache instance.
  21154. */
  21155. function mapCacheSet(key, value) {
  21156. var data = getMapData(this, key),
  21157. size = data.size;
  21158. data.set(key, value);
  21159. this.size += data.size == size ? 0 : 1;
  21160. return this;
  21161. }
  21162. // Add methods to `MapCache`.
  21163. MapCache.prototype.clear = mapCacheClear;
  21164. MapCache.prototype['delete'] = mapCacheDelete;
  21165. MapCache.prototype.get = mapCacheGet;
  21166. MapCache.prototype.has = mapCacheHas;
  21167. MapCache.prototype.set = mapCacheSet;
  21168. /*------------------------------------------------------------------------*/
  21169. /**
  21170. *
  21171. * Creates an array cache object to store unique values.
  21172. *
  21173. * @private
  21174. * @constructor
  21175. * @param {Array} [values] The values to cache.
  21176. */
  21177. function SetCache(values) {
  21178. var index = -1,
  21179. length = values == null ? 0 : values.length;
  21180. this.__data__ = new MapCache;
  21181. while (++index < length) {
  21182. this.add(values[index]);
  21183. }
  21184. }
  21185. /**
  21186. * Adds `value` to the array cache.
  21187. *
  21188. * @private
  21189. * @name add
  21190. * @memberOf SetCache
  21191. * @alias push
  21192. * @param {*} value The value to cache.
  21193. * @returns {Object} Returns the cache instance.
  21194. */
  21195. function setCacheAdd(value) {
  21196. this.__data__.set(value, HASH_UNDEFINED);
  21197. return this;
  21198. }
  21199. /**
  21200. * Checks if `value` is in the array cache.
  21201. *
  21202. * @private
  21203. * @name has
  21204. * @memberOf SetCache
  21205. * @param {*} value The value to search for.
  21206. * @returns {number} Returns `true` if `value` is found, else `false`.
  21207. */
  21208. function setCacheHas(value) {
  21209. return this.__data__.has(value);
  21210. }
  21211. // Add methods to `SetCache`.
  21212. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  21213. SetCache.prototype.has = setCacheHas;
  21214. /*------------------------------------------------------------------------*/
  21215. /**
  21216. * Creates a stack cache object to store key-value pairs.
  21217. *
  21218. * @private
  21219. * @constructor
  21220. * @param {Array} [entries] The key-value pairs to cache.
  21221. */
  21222. function Stack(entries) {
  21223. var data = this.__data__ = new ListCache(entries);
  21224. this.size = data.size;
  21225. }
  21226. /**
  21227. * Removes all key-value entries from the stack.
  21228. *
  21229. * @private
  21230. * @name clear
  21231. * @memberOf Stack
  21232. */
  21233. function stackClear() {
  21234. this.__data__ = new ListCache;
  21235. this.size = 0;
  21236. }
  21237. /**
  21238. * Removes `key` and its value from the stack.
  21239. *
  21240. * @private
  21241. * @name delete
  21242. * @memberOf Stack
  21243. * @param {string} key The key of the value to remove.
  21244. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  21245. */
  21246. function stackDelete(key) {
  21247. var data = this.__data__,
  21248. result = data['delete'](key);
  21249. this.size = data.size;
  21250. return result;
  21251. }
  21252. /**
  21253. * Gets the stack value for `key`.
  21254. *
  21255. * @private
  21256. * @name get
  21257. * @memberOf Stack
  21258. * @param {string} key The key of the value to get.
  21259. * @returns {*} Returns the entry value.
  21260. */
  21261. function stackGet(key) {
  21262. return this.__data__.get(key);
  21263. }
  21264. /**
  21265. * Checks if a stack value for `key` exists.
  21266. *
  21267. * @private
  21268. * @name has
  21269. * @memberOf Stack
  21270. * @param {string} key The key of the entry to check.
  21271. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  21272. */
  21273. function stackHas(key) {
  21274. return this.__data__.has(key);
  21275. }
  21276. /**
  21277. * Sets the stack `key` to `value`.
  21278. *
  21279. * @private
  21280. * @name set
  21281. * @memberOf Stack
  21282. * @param {string} key The key of the value to set.
  21283. * @param {*} value The value to set.
  21284. * @returns {Object} Returns the stack cache instance.
  21285. */
  21286. function stackSet(key, value) {
  21287. var data = this.__data__;
  21288. if (data instanceof ListCache) {
  21289. var pairs = data.__data__;
  21290. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  21291. pairs.push([key, value]);
  21292. this.size = ++data.size;
  21293. return this;
  21294. }
  21295. data = this.__data__ = new MapCache(pairs);
  21296. }
  21297. data.set(key, value);
  21298. this.size = data.size;
  21299. return this;
  21300. }
  21301. // Add methods to `Stack`.
  21302. Stack.prototype.clear = stackClear;
  21303. Stack.prototype['delete'] = stackDelete;
  21304. Stack.prototype.get = stackGet;
  21305. Stack.prototype.has = stackHas;
  21306. Stack.prototype.set = stackSet;
  21307. /*------------------------------------------------------------------------*/
  21308. /**
  21309. * Creates an array of the enumerable property names of the array-like `value`.
  21310. *
  21311. * @private
  21312. * @param {*} value The value to query.
  21313. * @param {boolean} inherited Specify returning inherited property names.
  21314. * @returns {Array} Returns the array of property names.
  21315. */
  21316. function arrayLikeKeys(value, inherited) {
  21317. var isArr = isArray(value),
  21318. isArg = !isArr && isArguments(value),
  21319. isBuff = !isArr && !isArg && isBuffer(value),
  21320. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  21321. skipIndexes = isArr || isArg || isBuff || isType,
  21322. result = skipIndexes ? baseTimes(value.length, String) : [],
  21323. length = result.length;
  21324. for (var key in value) {
  21325. if ((inherited || hasOwnProperty.call(value, key)) &&
  21326. !(skipIndexes && (
  21327. // Safari 9 has enumerable `arguments.length` in strict mode.
  21328. key == 'length' ||
  21329. // Node.js 0.10 has enumerable non-index properties on buffers.
  21330. (isBuff && (key == 'offset' || key == 'parent')) ||
  21331. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  21332. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  21333. // Skip index properties.
  21334. isIndex(key, length)
  21335. ))) {
  21336. result.push(key);
  21337. }
  21338. }
  21339. return result;
  21340. }
  21341. /**
  21342. * A specialized version of `_.sample` for arrays.
  21343. *
  21344. * @private
  21345. * @param {Array} array The array to sample.
  21346. * @returns {*} Returns the random element.
  21347. */
  21348. function arraySample(array) {
  21349. var length = array.length;
  21350. return length ? array[baseRandom(0, length - 1)] : undefined;
  21351. }
  21352. /**
  21353. * A specialized version of `_.sampleSize` for arrays.
  21354. *
  21355. * @private
  21356. * @param {Array} array The array to sample.
  21357. * @param {number} n The number of elements to sample.
  21358. * @returns {Array} Returns the random elements.
  21359. */
  21360. function arraySampleSize(array, n) {
  21361. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  21362. }
  21363. /**
  21364. * A specialized version of `_.shuffle` for arrays.
  21365. *
  21366. * @private
  21367. * @param {Array} array The array to shuffle.
  21368. * @returns {Array} Returns the new shuffled array.
  21369. */
  21370. function arrayShuffle(array) {
  21371. return shuffleSelf(copyArray(array));
  21372. }
  21373. /**
  21374. * This function is like `assignValue` except that it doesn't assign
  21375. * `undefined` values.
  21376. *
  21377. * @private
  21378. * @param {Object} object The object to modify.
  21379. * @param {string} key The key of the property to assign.
  21380. * @param {*} value The value to assign.
  21381. */
  21382. function assignMergeValue(object, key, value) {
  21383. if ((value !== undefined && !eq(object[key], value)) ||
  21384. (value === undefined && !(key in object))) {
  21385. baseAssignValue(object, key, value);
  21386. }
  21387. }
  21388. /**
  21389. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  21390. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  21391. * for equality comparisons.
  21392. *
  21393. * @private
  21394. * @param {Object} object The object to modify.
  21395. * @param {string} key The key of the property to assign.
  21396. * @param {*} value The value to assign.
  21397. */
  21398. function assignValue(object, key, value) {
  21399. var objValue = object[key];
  21400. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  21401. (value === undefined && !(key in object))) {
  21402. baseAssignValue(object, key, value);
  21403. }
  21404. }
  21405. /**
  21406. * Gets the index at which the `key` is found in `array` of key-value pairs.
  21407. *
  21408. * @private
  21409. * @param {Array} array The array to inspect.
  21410. * @param {*} key The key to search for.
  21411. * @returns {number} Returns the index of the matched value, else `-1`.
  21412. */
  21413. function assocIndexOf(array, key) {
  21414. var length = array.length;
  21415. while (length--) {
  21416. if (eq(array[length][0], key)) {
  21417. return length;
  21418. }
  21419. }
  21420. return -1;
  21421. }
  21422. /**
  21423. * Aggregates elements of `collection` on `accumulator` with keys transformed
  21424. * by `iteratee` and values set by `setter`.
  21425. *
  21426. * @private
  21427. * @param {Array|Object} collection The collection to iterate over.
  21428. * @param {Function} setter The function to set `accumulator` values.
  21429. * @param {Function} iteratee The iteratee to transform keys.
  21430. * @param {Object} accumulator The initial aggregated object.
  21431. * @returns {Function} Returns `accumulator`.
  21432. */
  21433. function baseAggregator(collection, setter, iteratee, accumulator) {
  21434. baseEach(collection, function(value, key, collection) {
  21435. setter(accumulator, value, iteratee(value), collection);
  21436. });
  21437. return accumulator;
  21438. }
  21439. /**
  21440. * The base implementation of `_.assign` without support for multiple sources
  21441. * or `customizer` functions.
  21442. *
  21443. * @private
  21444. * @param {Object} object The destination object.
  21445. * @param {Object} source The source object.
  21446. * @returns {Object} Returns `object`.
  21447. */
  21448. function baseAssign(object, source) {
  21449. return object && copyObject(source, keys(source), object);
  21450. }
  21451. /**
  21452. * The base implementation of `_.assignIn` without support for multiple sources
  21453. * or `customizer` functions.
  21454. *
  21455. * @private
  21456. * @param {Object} object The destination object.
  21457. * @param {Object} source The source object.
  21458. * @returns {Object} Returns `object`.
  21459. */
  21460. function baseAssignIn(object, source) {
  21461. return object && copyObject(source, keysIn(source), object);
  21462. }
  21463. /**
  21464. * The base implementation of `assignValue` and `assignMergeValue` without
  21465. * value checks.
  21466. *
  21467. * @private
  21468. * @param {Object} object The object to modify.
  21469. * @param {string} key The key of the property to assign.
  21470. * @param {*} value The value to assign.
  21471. */
  21472. function baseAssignValue(object, key, value) {
  21473. if (key == '__proto__' && defineProperty) {
  21474. defineProperty(object, key, {
  21475. 'configurable': true,
  21476. 'enumerable': true,
  21477. 'value': value,
  21478. 'writable': true
  21479. });
  21480. } else {
  21481. object[key] = value;
  21482. }
  21483. }
  21484. /**
  21485. * The base implementation of `_.at` without support for individual paths.
  21486. *
  21487. * @private
  21488. * @param {Object} object The object to iterate over.
  21489. * @param {string[]} paths The property paths to pick.
  21490. * @returns {Array} Returns the picked elements.
  21491. */
  21492. function baseAt(object, paths) {
  21493. var index = -1,
  21494. length = paths.length,
  21495. result = Array(length),
  21496. skip = object == null;
  21497. while (++index < length) {
  21498. result[index] = skip ? undefined : get(object, paths[index]);
  21499. }
  21500. return result;
  21501. }
  21502. /**
  21503. * The base implementation of `_.clamp` which doesn't coerce arguments.
  21504. *
  21505. * @private
  21506. * @param {number} number The number to clamp.
  21507. * @param {number} [lower] The lower bound.
  21508. * @param {number} upper The upper bound.
  21509. * @returns {number} Returns the clamped number.
  21510. */
  21511. function baseClamp(number, lower, upper) {
  21512. if (number === number) {
  21513. if (upper !== undefined) {
  21514. number = number <= upper ? number : upper;
  21515. }
  21516. if (lower !== undefined) {
  21517. number = number >= lower ? number : lower;
  21518. }
  21519. }
  21520. return number;
  21521. }
  21522. /**
  21523. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  21524. * traversed objects.
  21525. *
  21526. * @private
  21527. * @param {*} value The value to clone.
  21528. * @param {boolean} bitmask The bitmask flags.
  21529. * 1 - Deep clone
  21530. * 2 - Flatten inherited properties
  21531. * 4 - Clone symbols
  21532. * @param {Function} [customizer] The function to customize cloning.
  21533. * @param {string} [key] The key of `value`.
  21534. * @param {Object} [object] The parent object of `value`.
  21535. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  21536. * @returns {*} Returns the cloned value.
  21537. */
  21538. function baseClone(value, bitmask, customizer, key, object, stack) {
  21539. var result,
  21540. isDeep = bitmask & CLONE_DEEP_FLAG,
  21541. isFlat = bitmask & CLONE_FLAT_FLAG,
  21542. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  21543. if (customizer) {
  21544. result = object ? customizer(value, key, object, stack) : customizer(value);
  21545. }
  21546. if (result !== undefined) {
  21547. return result;
  21548. }
  21549. if (!isObject(value)) {
  21550. return value;
  21551. }
  21552. var isArr = isArray(value);
  21553. if (isArr) {
  21554. result = initCloneArray(value);
  21555. if (!isDeep) {
  21556. return copyArray(value, result);
  21557. }
  21558. } else {
  21559. var tag = getTag(value),
  21560. isFunc = tag == funcTag || tag == genTag;
  21561. if (isBuffer(value)) {
  21562. return cloneBuffer(value, isDeep);
  21563. }
  21564. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  21565. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  21566. if (!isDeep) {
  21567. return isFlat
  21568. ? copySymbolsIn(value, baseAssignIn(result, value))
  21569. : copySymbols(value, baseAssign(result, value));
  21570. }
  21571. } else {
  21572. if (!cloneableTags[tag]) {
  21573. return object ? value : {};
  21574. }
  21575. result = initCloneByTag(value, tag, isDeep);
  21576. }
  21577. }
  21578. // Check for circular references and return its corresponding clone.
  21579. stack || (stack = new Stack);
  21580. var stacked = stack.get(value);
  21581. if (stacked) {
  21582. return stacked;
  21583. }
  21584. stack.set(value, result);
  21585. if (isSet(value)) {
  21586. value.forEach(function(subValue) {
  21587. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  21588. });
  21589. } else if (isMap(value)) {
  21590. value.forEach(function(subValue, key) {
  21591. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  21592. });
  21593. }
  21594. var keysFunc = isFull
  21595. ? (isFlat ? getAllKeysIn : getAllKeys)
  21596. : (isFlat ? keysIn : keys);
  21597. var props = isArr ? undefined : keysFunc(value);
  21598. arrayEach(props || value, function(subValue, key) {
  21599. if (props) {
  21600. key = subValue;
  21601. subValue = value[key];
  21602. }
  21603. // Recursively populate clone (susceptible to call stack limits).
  21604. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  21605. });
  21606. return result;
  21607. }
  21608. /**
  21609. * The base implementation of `_.conforms` which doesn't clone `source`.
  21610. *
  21611. * @private
  21612. * @param {Object} source The object of property predicates to conform to.
  21613. * @returns {Function} Returns the new spec function.
  21614. */
  21615. function baseConforms(source) {
  21616. var props = keys(source);
  21617. return function(object) {
  21618. return baseConformsTo(object, source, props);
  21619. };
  21620. }
  21621. /**
  21622. * The base implementation of `_.conformsTo` which accepts `props` to check.
  21623. *
  21624. * @private
  21625. * @param {Object} object The object to inspect.
  21626. * @param {Object} source The object of property predicates to conform to.
  21627. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  21628. */
  21629. function baseConformsTo(object, source, props) {
  21630. var length = props.length;
  21631. if (object == null) {
  21632. return !length;
  21633. }
  21634. object = Object(object);
  21635. while (length--) {
  21636. var key = props[length],
  21637. predicate = source[key],
  21638. value = object[key];
  21639. if ((value === undefined && !(key in object)) || !predicate(value)) {
  21640. return false;
  21641. }
  21642. }
  21643. return true;
  21644. }
  21645. /**
  21646. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  21647. * to provide to `func`.
  21648. *
  21649. * @private
  21650. * @param {Function} func The function to delay.
  21651. * @param {number} wait The number of milliseconds to delay invocation.
  21652. * @param {Array} args The arguments to provide to `func`.
  21653. * @returns {number|Object} Returns the timer id or timeout object.
  21654. */
  21655. function baseDelay(func, wait, args) {
  21656. if (typeof func != 'function') {
  21657. throw new TypeError(FUNC_ERROR_TEXT);
  21658. }
  21659. return setTimeout(function() { func.apply(undefined, args); }, wait);
  21660. }
  21661. /**
  21662. * The base implementation of methods like `_.difference` without support
  21663. * for excluding multiple arrays or iteratee shorthands.
  21664. *
  21665. * @private
  21666. * @param {Array} array The array to inspect.
  21667. * @param {Array} values The values to exclude.
  21668. * @param {Function} [iteratee] The iteratee invoked per element.
  21669. * @param {Function} [comparator] The comparator invoked per element.
  21670. * @returns {Array} Returns the new array of filtered values.
  21671. */
  21672. function baseDifference(array, values, iteratee, comparator) {
  21673. var index = -1,
  21674. includes = arrayIncludes,
  21675. isCommon = true,
  21676. length = array.length,
  21677. result = [],
  21678. valuesLength = values.length;
  21679. if (!length) {
  21680. return result;
  21681. }
  21682. if (iteratee) {
  21683. values = arrayMap(values, baseUnary(iteratee));
  21684. }
  21685. if (comparator) {
  21686. includes = arrayIncludesWith;
  21687. isCommon = false;
  21688. }
  21689. else if (values.length >= LARGE_ARRAY_SIZE) {
  21690. includes = cacheHas;
  21691. isCommon = false;
  21692. values = new SetCache(values);
  21693. }
  21694. outer:
  21695. while (++index < length) {
  21696. var value = array[index],
  21697. computed = iteratee == null ? value : iteratee(value);
  21698. value = (comparator || value !== 0) ? value : 0;
  21699. if (isCommon && computed === computed) {
  21700. var valuesIndex = valuesLength;
  21701. while (valuesIndex--) {
  21702. if (values[valuesIndex] === computed) {
  21703. continue outer;
  21704. }
  21705. }
  21706. result.push(value);
  21707. }
  21708. else if (!includes(values, computed, comparator)) {
  21709. result.push(value);
  21710. }
  21711. }
  21712. return result;
  21713. }
  21714. /**
  21715. * The base implementation of `_.forEach` without support for iteratee shorthands.
  21716. *
  21717. * @private
  21718. * @param {Array|Object} collection The collection to iterate over.
  21719. * @param {Function} iteratee The function invoked per iteration.
  21720. * @returns {Array|Object} Returns `collection`.
  21721. */
  21722. var baseEach = createBaseEach(baseForOwn);
  21723. /**
  21724. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  21725. *
  21726. * @private
  21727. * @param {Array|Object} collection The collection to iterate over.
  21728. * @param {Function} iteratee The function invoked per iteration.
  21729. * @returns {Array|Object} Returns `collection`.
  21730. */
  21731. var baseEachRight = createBaseEach(baseForOwnRight, true);
  21732. /**
  21733. * The base implementation of `_.every` without support for iteratee shorthands.
  21734. *
  21735. * @private
  21736. * @param {Array|Object} collection The collection to iterate over.
  21737. * @param {Function} predicate The function invoked per iteration.
  21738. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  21739. * else `false`
  21740. */
  21741. function baseEvery(collection, predicate) {
  21742. var result = true;
  21743. baseEach(collection, function(value, index, collection) {
  21744. result = !!predicate(value, index, collection);
  21745. return result;
  21746. });
  21747. return result;
  21748. }
  21749. /**
  21750. * The base implementation of methods like `_.max` and `_.min` which accepts a
  21751. * `comparator` to determine the extremum value.
  21752. *
  21753. * @private
  21754. * @param {Array} array The array to iterate over.
  21755. * @param {Function} iteratee The iteratee invoked per iteration.
  21756. * @param {Function} comparator The comparator used to compare values.
  21757. * @returns {*} Returns the extremum value.
  21758. */
  21759. function baseExtremum(array, iteratee, comparator) {
  21760. var index = -1,
  21761. length = array.length;
  21762. while (++index < length) {
  21763. var value = array[index],
  21764. current = iteratee(value);
  21765. if (current != null && (computed === undefined
  21766. ? (current === current && !isSymbol(current))
  21767. : comparator(current, computed)
  21768. )) {
  21769. var computed = current,
  21770. result = value;
  21771. }
  21772. }
  21773. return result;
  21774. }
  21775. /**
  21776. * The base implementation of `_.fill` without an iteratee call guard.
  21777. *
  21778. * @private
  21779. * @param {Array} array The array to fill.
  21780. * @param {*} value The value to fill `array` with.
  21781. * @param {number} [start=0] The start position.
  21782. * @param {number} [end=array.length] The end position.
  21783. * @returns {Array} Returns `array`.
  21784. */
  21785. function baseFill(array, value, start, end) {
  21786. var length = array.length;
  21787. start = toInteger(start);
  21788. if (start < 0) {
  21789. start = -start > length ? 0 : (length + start);
  21790. }
  21791. end = (end === undefined || end > length) ? length : toInteger(end);
  21792. if (end < 0) {
  21793. end += length;
  21794. }
  21795. end = start > end ? 0 : toLength(end);
  21796. while (start < end) {
  21797. array[start++] = value;
  21798. }
  21799. return array;
  21800. }
  21801. /**
  21802. * The base implementation of `_.filter` without support for iteratee shorthands.
  21803. *
  21804. * @private
  21805. * @param {Array|Object} collection The collection to iterate over.
  21806. * @param {Function} predicate The function invoked per iteration.
  21807. * @returns {Array} Returns the new filtered array.
  21808. */
  21809. function baseFilter(collection, predicate) {
  21810. var result = [];
  21811. baseEach(collection, function(value, index, collection) {
  21812. if (predicate(value, index, collection)) {
  21813. result.push(value);
  21814. }
  21815. });
  21816. return result;
  21817. }
  21818. /**
  21819. * The base implementation of `_.flatten` with support for restricting flattening.
  21820. *
  21821. * @private
  21822. * @param {Array} array The array to flatten.
  21823. * @param {number} depth The maximum recursion depth.
  21824. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  21825. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  21826. * @param {Array} [result=[]] The initial result value.
  21827. * @returns {Array} Returns the new flattened array.
  21828. */
  21829. function baseFlatten(array, depth, predicate, isStrict, result) {
  21830. var index = -1,
  21831. length = array.length;
  21832. predicate || (predicate = isFlattenable);
  21833. result || (result = []);
  21834. while (++index < length) {
  21835. var value = array[index];
  21836. if (depth > 0 && predicate(value)) {
  21837. if (depth > 1) {
  21838. // Recursively flatten arrays (susceptible to call stack limits).
  21839. baseFlatten(value, depth - 1, predicate, isStrict, result);
  21840. } else {
  21841. arrayPush(result, value);
  21842. }
  21843. } else if (!isStrict) {
  21844. result[result.length] = value;
  21845. }
  21846. }
  21847. return result;
  21848. }
  21849. /**
  21850. * The base implementation of `baseForOwn` which iterates over `object`
  21851. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  21852. * Iteratee functions may exit iteration early by explicitly returning `false`.
  21853. *
  21854. * @private
  21855. * @param {Object} object The object to iterate over.
  21856. * @param {Function} iteratee The function invoked per iteration.
  21857. * @param {Function} keysFunc The function to get the keys of `object`.
  21858. * @returns {Object} Returns `object`.
  21859. */
  21860. var baseFor = createBaseFor();
  21861. /**
  21862. * This function is like `baseFor` except that it iterates over properties
  21863. * in the opposite order.
  21864. *
  21865. * @private
  21866. * @param {Object} object The object to iterate over.
  21867. * @param {Function} iteratee The function invoked per iteration.
  21868. * @param {Function} keysFunc The function to get the keys of `object`.
  21869. * @returns {Object} Returns `object`.
  21870. */
  21871. var baseForRight = createBaseFor(true);
  21872. /**
  21873. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  21874. *
  21875. * @private
  21876. * @param {Object} object The object to iterate over.
  21877. * @param {Function} iteratee The function invoked per iteration.
  21878. * @returns {Object} Returns `object`.
  21879. */
  21880. function baseForOwn(object, iteratee) {
  21881. return object && baseFor(object, iteratee, keys);
  21882. }
  21883. /**
  21884. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  21885. *
  21886. * @private
  21887. * @param {Object} object The object to iterate over.
  21888. * @param {Function} iteratee The function invoked per iteration.
  21889. * @returns {Object} Returns `object`.
  21890. */
  21891. function baseForOwnRight(object, iteratee) {
  21892. return object && baseForRight(object, iteratee, keys);
  21893. }
  21894. /**
  21895. * The base implementation of `_.functions` which creates an array of
  21896. * `object` function property names filtered from `props`.
  21897. *
  21898. * @private
  21899. * @param {Object} object The object to inspect.
  21900. * @param {Array} props The property names to filter.
  21901. * @returns {Array} Returns the function names.
  21902. */
  21903. function baseFunctions(object, props) {
  21904. return arrayFilter(props, function(key) {
  21905. return isFunction(object[key]);
  21906. });
  21907. }
  21908. /**
  21909. * The base implementation of `_.get` without support for default values.
  21910. *
  21911. * @private
  21912. * @param {Object} object The object to query.
  21913. * @param {Array|string} path The path of the property to get.
  21914. * @returns {*} Returns the resolved value.
  21915. */
  21916. function baseGet(object, path) {
  21917. path = castPath(path, object);
  21918. var index = 0,
  21919. length = path.length;
  21920. while (object != null && index < length) {
  21921. object = object[toKey(path[index++])];
  21922. }
  21923. return (index && index == length) ? object : undefined;
  21924. }
  21925. /**
  21926. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  21927. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  21928. * symbols of `object`.
  21929. *
  21930. * @private
  21931. * @param {Object} object The object to query.
  21932. * @param {Function} keysFunc The function to get the keys of `object`.
  21933. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  21934. * @returns {Array} Returns the array of property names and symbols.
  21935. */
  21936. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  21937. var result = keysFunc(object);
  21938. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  21939. }
  21940. /**
  21941. * The base implementation of `getTag` without fallbacks for buggy environments.
  21942. *
  21943. * @private
  21944. * @param {*} value The value to query.
  21945. * @returns {string} Returns the `toStringTag`.
  21946. */
  21947. function baseGetTag(value) {
  21948. if (value == null) {
  21949. return value === undefined ? undefinedTag : nullTag;
  21950. }
  21951. return (symToStringTag && symToStringTag in Object(value))
  21952. ? getRawTag(value)
  21953. : objectToString(value);
  21954. }
  21955. /**
  21956. * The base implementation of `_.gt` which doesn't coerce arguments.
  21957. *
  21958. * @private
  21959. * @param {*} value The value to compare.
  21960. * @param {*} other The other value to compare.
  21961. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  21962. * else `false`.
  21963. */
  21964. function baseGt(value, other) {
  21965. return value > other;
  21966. }
  21967. /**
  21968. * The base implementation of `_.has` without support for deep paths.
  21969. *
  21970. * @private
  21971. * @param {Object} [object] The object to query.
  21972. * @param {Array|string} key The key to check.
  21973. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21974. */
  21975. function baseHas(object, key) {
  21976. return object != null && hasOwnProperty.call(object, key);
  21977. }
  21978. /**
  21979. * The base implementation of `_.hasIn` without support for deep paths.
  21980. *
  21981. * @private
  21982. * @param {Object} [object] The object to query.
  21983. * @param {Array|string} key The key to check.
  21984. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21985. */
  21986. function baseHasIn(object, key) {
  21987. return object != null && key in Object(object);
  21988. }
  21989. /**
  21990. * The base implementation of `_.inRange` which doesn't coerce arguments.
  21991. *
  21992. * @private
  21993. * @param {number} number The number to check.
  21994. * @param {number} start The start of the range.
  21995. * @param {number} end The end of the range.
  21996. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  21997. */
  21998. function baseInRange(number, start, end) {
  21999. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  22000. }
  22001. /**
  22002. * The base implementation of methods like `_.intersection`, without support
  22003. * for iteratee shorthands, that accepts an array of arrays to inspect.
  22004. *
  22005. * @private
  22006. * @param {Array} arrays The arrays to inspect.
  22007. * @param {Function} [iteratee] The iteratee invoked per element.
  22008. * @param {Function} [comparator] The comparator invoked per element.
  22009. * @returns {Array} Returns the new array of shared values.
  22010. */
  22011. function baseIntersection(arrays, iteratee, comparator) {
  22012. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  22013. length = arrays[0].length,
  22014. othLength = arrays.length,
  22015. othIndex = othLength,
  22016. caches = Array(othLength),
  22017. maxLength = Infinity,
  22018. result = [];
  22019. while (othIndex--) {
  22020. var array = arrays[othIndex];
  22021. if (othIndex && iteratee) {
  22022. array = arrayMap(array, baseUnary(iteratee));
  22023. }
  22024. maxLength = nativeMin(array.length, maxLength);
  22025. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  22026. ? new SetCache(othIndex && array)
  22027. : undefined;
  22028. }
  22029. array = arrays[0];
  22030. var index = -1,
  22031. seen = caches[0];
  22032. outer:
  22033. while (++index < length && result.length < maxLength) {
  22034. var value = array[index],
  22035. computed = iteratee ? iteratee(value) : value;
  22036. value = (comparator || value !== 0) ? value : 0;
  22037. if (!(seen
  22038. ? cacheHas(seen, computed)
  22039. : includes(result, computed, comparator)
  22040. )) {
  22041. othIndex = othLength;
  22042. while (--othIndex) {
  22043. var cache = caches[othIndex];
  22044. if (!(cache
  22045. ? cacheHas(cache, computed)
  22046. : includes(arrays[othIndex], computed, comparator))
  22047. ) {
  22048. continue outer;
  22049. }
  22050. }
  22051. if (seen) {
  22052. seen.push(computed);
  22053. }
  22054. result.push(value);
  22055. }
  22056. }
  22057. return result;
  22058. }
  22059. /**
  22060. * The base implementation of `_.invert` and `_.invertBy` which inverts
  22061. * `object` with values transformed by `iteratee` and set by `setter`.
  22062. *
  22063. * @private
  22064. * @param {Object} object The object to iterate over.
  22065. * @param {Function} setter The function to set `accumulator` values.
  22066. * @param {Function} iteratee The iteratee to transform values.
  22067. * @param {Object} accumulator The initial inverted object.
  22068. * @returns {Function} Returns `accumulator`.
  22069. */
  22070. function baseInverter(object, setter, iteratee, accumulator) {
  22071. baseForOwn(object, function(value, key, object) {
  22072. setter(accumulator, iteratee(value), key, object);
  22073. });
  22074. return accumulator;
  22075. }
  22076. /**
  22077. * The base implementation of `_.invoke` without support for individual
  22078. * method arguments.
  22079. *
  22080. * @private
  22081. * @param {Object} object The object to query.
  22082. * @param {Array|string} path The path of the method to invoke.
  22083. * @param {Array} args The arguments to invoke the method with.
  22084. * @returns {*} Returns the result of the invoked method.
  22085. */
  22086. function baseInvoke(object, path, args) {
  22087. path = castPath(path, object);
  22088. object = parent(object, path);
  22089. var func = object == null ? object : object[toKey(last(path))];
  22090. return func == null ? undefined : apply(func, object, args);
  22091. }
  22092. /**
  22093. * The base implementation of `_.isArguments`.
  22094. *
  22095. * @private
  22096. * @param {*} value The value to check.
  22097. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  22098. */
  22099. function baseIsArguments(value) {
  22100. return isObjectLike(value) && baseGetTag(value) == argsTag;
  22101. }
  22102. /**
  22103. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  22104. *
  22105. * @private
  22106. * @param {*} value The value to check.
  22107. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  22108. */
  22109. function baseIsArrayBuffer(value) {
  22110. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  22111. }
  22112. /**
  22113. * The base implementation of `_.isDate` without Node.js optimizations.
  22114. *
  22115. * @private
  22116. * @param {*} value The value to check.
  22117. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  22118. */
  22119. function baseIsDate(value) {
  22120. return isObjectLike(value) && baseGetTag(value) == dateTag;
  22121. }
  22122. /**
  22123. * The base implementation of `_.isEqual` which supports partial comparisons
  22124. * and tracks traversed objects.
  22125. *
  22126. * @private
  22127. * @param {*} value The value to compare.
  22128. * @param {*} other The other value to compare.
  22129. * @param {boolean} bitmask The bitmask flags.
  22130. * 1 - Unordered comparison
  22131. * 2 - Partial comparison
  22132. * @param {Function} [customizer] The function to customize comparisons.
  22133. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  22134. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  22135. */
  22136. function baseIsEqual(value, other, bitmask, customizer, stack) {
  22137. if (value === other) {
  22138. return true;
  22139. }
  22140. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  22141. return value !== value && other !== other;
  22142. }
  22143. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  22144. }
  22145. /**
  22146. * A specialized version of `baseIsEqual` for arrays and objects which performs
  22147. * deep comparisons and tracks traversed objects enabling objects with circular
  22148. * references to be compared.
  22149. *
  22150. * @private
  22151. * @param {Object} object The object to compare.
  22152. * @param {Object} other The other object to compare.
  22153. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  22154. * @param {Function} customizer The function to customize comparisons.
  22155. * @param {Function} equalFunc The function to determine equivalents of values.
  22156. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  22157. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  22158. */
  22159. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  22160. var objIsArr = isArray(object),
  22161. othIsArr = isArray(other),
  22162. objTag = objIsArr ? arrayTag : getTag(object),
  22163. othTag = othIsArr ? arrayTag : getTag(other);
  22164. objTag = objTag == argsTag ? objectTag : objTag;
  22165. othTag = othTag == argsTag ? objectTag : othTag;
  22166. var objIsObj = objTag == objectTag,
  22167. othIsObj = othTag == objectTag,
  22168. isSameTag = objTag == othTag;
  22169. if (isSameTag && isBuffer(object)) {
  22170. if (!isBuffer(other)) {
  22171. return false;
  22172. }
  22173. objIsArr = true;
  22174. objIsObj = false;
  22175. }
  22176. if (isSameTag && !objIsObj) {
  22177. stack || (stack = new Stack);
  22178. return (objIsArr || isTypedArray(object))
  22179. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  22180. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  22181. }
  22182. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  22183. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  22184. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  22185. if (objIsWrapped || othIsWrapped) {
  22186. var objUnwrapped = objIsWrapped ? object.value() : object,
  22187. othUnwrapped = othIsWrapped ? other.value() : other;
  22188. stack || (stack = new Stack);
  22189. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  22190. }
  22191. }
  22192. if (!isSameTag) {
  22193. return false;
  22194. }
  22195. stack || (stack = new Stack);
  22196. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  22197. }
  22198. /**
  22199. * The base implementation of `_.isMap` without Node.js optimizations.
  22200. *
  22201. * @private
  22202. * @param {*} value The value to check.
  22203. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  22204. */
  22205. function baseIsMap(value) {
  22206. return isObjectLike(value) && getTag(value) == mapTag;
  22207. }
  22208. /**
  22209. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  22210. *
  22211. * @private
  22212. * @param {Object} object The object to inspect.
  22213. * @param {Object} source The object of property values to match.
  22214. * @param {Array} matchData The property names, values, and compare flags to match.
  22215. * @param {Function} [customizer] The function to customize comparisons.
  22216. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  22217. */
  22218. function baseIsMatch(object, source, matchData, customizer) {
  22219. var index = matchData.length,
  22220. length = index,
  22221. noCustomizer = !customizer;
  22222. if (object == null) {
  22223. return !length;
  22224. }
  22225. object = Object(object);
  22226. while (index--) {
  22227. var data = matchData[index];
  22228. if ((noCustomizer && data[2])
  22229. ? data[1] !== object[data[0]]
  22230. : !(data[0] in object)
  22231. ) {
  22232. return false;
  22233. }
  22234. }
  22235. while (++index < length) {
  22236. data = matchData[index];
  22237. var key = data[0],
  22238. objValue = object[key],
  22239. srcValue = data[1];
  22240. if (noCustomizer && data[2]) {
  22241. if (objValue === undefined && !(key in object)) {
  22242. return false;
  22243. }
  22244. } else {
  22245. var stack = new Stack;
  22246. if (customizer) {
  22247. var result = customizer(objValue, srcValue, key, object, source, stack);
  22248. }
  22249. if (!(result === undefined
  22250. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  22251. : result
  22252. )) {
  22253. return false;
  22254. }
  22255. }
  22256. }
  22257. return true;
  22258. }
  22259. /**
  22260. * The base implementation of `_.isNative` without bad shim checks.
  22261. *
  22262. * @private
  22263. * @param {*} value The value to check.
  22264. * @returns {boolean} Returns `true` if `value` is a native function,
  22265. * else `false`.
  22266. */
  22267. function baseIsNative(value) {
  22268. if (!isObject(value) || isMasked(value)) {
  22269. return false;
  22270. }
  22271. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  22272. return pattern.test(toSource(value));
  22273. }
  22274. /**
  22275. * The base implementation of `_.isRegExp` without Node.js optimizations.
  22276. *
  22277. * @private
  22278. * @param {*} value The value to check.
  22279. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  22280. */
  22281. function baseIsRegExp(value) {
  22282. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  22283. }
  22284. /**
  22285. * The base implementation of `_.isSet` without Node.js optimizations.
  22286. *
  22287. * @private
  22288. * @param {*} value The value to check.
  22289. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  22290. */
  22291. function baseIsSet(value) {
  22292. return isObjectLike(value) && getTag(value) == setTag;
  22293. }
  22294. /**
  22295. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  22296. *
  22297. * @private
  22298. * @param {*} value The value to check.
  22299. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  22300. */
  22301. function baseIsTypedArray(value) {
  22302. return isObjectLike(value) &&
  22303. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  22304. }
  22305. /**
  22306. * The base implementation of `_.iteratee`.
  22307. *
  22308. * @private
  22309. * @param {*} [value=_.identity] The value to convert to an iteratee.
  22310. * @returns {Function} Returns the iteratee.
  22311. */
  22312. function baseIteratee(value) {
  22313. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  22314. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  22315. if (typeof value == 'function') {
  22316. return value;
  22317. }
  22318. if (value == null) {
  22319. return identity;
  22320. }
  22321. if (typeof value == 'object') {
  22322. return isArray(value)
  22323. ? baseMatchesProperty(value[0], value[1])
  22324. : baseMatches(value);
  22325. }
  22326. return property(value);
  22327. }
  22328. /**
  22329. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  22330. *
  22331. * @private
  22332. * @param {Object} object The object to query.
  22333. * @returns {Array} Returns the array of property names.
  22334. */
  22335. function baseKeys(object) {
  22336. if (!isPrototype(object)) {
  22337. return nativeKeys(object);
  22338. }
  22339. var result = [];
  22340. for (var key in Object(object)) {
  22341. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  22342. result.push(key);
  22343. }
  22344. }
  22345. return result;
  22346. }
  22347. /**
  22348. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  22349. *
  22350. * @private
  22351. * @param {Object} object The object to query.
  22352. * @returns {Array} Returns the array of property names.
  22353. */
  22354. function baseKeysIn(object) {
  22355. if (!isObject(object)) {
  22356. return nativeKeysIn(object);
  22357. }
  22358. var isProto = isPrototype(object),
  22359. result = [];
  22360. for (var key in object) {
  22361. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  22362. result.push(key);
  22363. }
  22364. }
  22365. return result;
  22366. }
  22367. /**
  22368. * The base implementation of `_.lt` which doesn't coerce arguments.
  22369. *
  22370. * @private
  22371. * @param {*} value The value to compare.
  22372. * @param {*} other The other value to compare.
  22373. * @returns {boolean} Returns `true` if `value` is less than `other`,
  22374. * else `false`.
  22375. */
  22376. function baseLt(value, other) {
  22377. return value < other;
  22378. }
  22379. /**
  22380. * The base implementation of `_.map` without support for iteratee shorthands.
  22381. *
  22382. * @private
  22383. * @param {Array|Object} collection The collection to iterate over.
  22384. * @param {Function} iteratee The function invoked per iteration.
  22385. * @returns {Array} Returns the new mapped array.
  22386. */
  22387. function baseMap(collection, iteratee) {
  22388. var index = -1,
  22389. result = isArrayLike(collection) ? Array(collection.length) : [];
  22390. baseEach(collection, function(value, key, collection) {
  22391. result[++index] = iteratee(value, key, collection);
  22392. });
  22393. return result;
  22394. }
  22395. /**
  22396. * The base implementation of `_.matches` which doesn't clone `source`.
  22397. *
  22398. * @private
  22399. * @param {Object} source The object of property values to match.
  22400. * @returns {Function} Returns the new spec function.
  22401. */
  22402. function baseMatches(source) {
  22403. var matchData = getMatchData(source);
  22404. if (matchData.length == 1 && matchData[0][2]) {
  22405. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  22406. }
  22407. return function(object) {
  22408. return object === source || baseIsMatch(object, source, matchData);
  22409. };
  22410. }
  22411. /**
  22412. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  22413. *
  22414. * @private
  22415. * @param {string} path The path of the property to get.
  22416. * @param {*} srcValue The value to match.
  22417. * @returns {Function} Returns the new spec function.
  22418. */
  22419. function baseMatchesProperty(path, srcValue) {
  22420. if (isKey(path) && isStrictComparable(srcValue)) {
  22421. return matchesStrictComparable(toKey(path), srcValue);
  22422. }
  22423. return function(object) {
  22424. var objValue = get(object, path);
  22425. return (objValue === undefined && objValue === srcValue)
  22426. ? hasIn(object, path)
  22427. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  22428. };
  22429. }
  22430. /**
  22431. * The base implementation of `_.merge` without support for multiple sources.
  22432. *
  22433. * @private
  22434. * @param {Object} object The destination object.
  22435. * @param {Object} source The source object.
  22436. * @param {number} srcIndex The index of `source`.
  22437. * @param {Function} [customizer] The function to customize merged values.
  22438. * @param {Object} [stack] Tracks traversed source values and their merged
  22439. * counterparts.
  22440. */
  22441. function baseMerge(object, source, srcIndex, customizer, stack) {
  22442. if (object === source) {
  22443. return;
  22444. }
  22445. baseFor(source, function(srcValue, key) {
  22446. stack || (stack = new Stack);
  22447. if (isObject(srcValue)) {
  22448. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  22449. }
  22450. else {
  22451. var newValue = customizer
  22452. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  22453. : undefined;
  22454. if (newValue === undefined) {
  22455. newValue = srcValue;
  22456. }
  22457. assignMergeValue(object, key, newValue);
  22458. }
  22459. }, keysIn);
  22460. }
  22461. /**
  22462. * A specialized version of `baseMerge` for arrays and objects which performs
  22463. * deep merges and tracks traversed objects enabling objects with circular
  22464. * references to be merged.
  22465. *
  22466. * @private
  22467. * @param {Object} object The destination object.
  22468. * @param {Object} source The source object.
  22469. * @param {string} key The key of the value to merge.
  22470. * @param {number} srcIndex The index of `source`.
  22471. * @param {Function} mergeFunc The function to merge values.
  22472. * @param {Function} [customizer] The function to customize assigned values.
  22473. * @param {Object} [stack] Tracks traversed source values and their merged
  22474. * counterparts.
  22475. */
  22476. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  22477. var objValue = safeGet(object, key),
  22478. srcValue = safeGet(source, key),
  22479. stacked = stack.get(srcValue);
  22480. if (stacked) {
  22481. assignMergeValue(object, key, stacked);
  22482. return;
  22483. }
  22484. var newValue = customizer
  22485. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  22486. : undefined;
  22487. var isCommon = newValue === undefined;
  22488. if (isCommon) {
  22489. var isArr = isArray(srcValue),
  22490. isBuff = !isArr && isBuffer(srcValue),
  22491. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  22492. newValue = srcValue;
  22493. if (isArr || isBuff || isTyped) {
  22494. if (isArray(objValue)) {
  22495. newValue = objValue;
  22496. }
  22497. else if (isArrayLikeObject(objValue)) {
  22498. newValue = copyArray(objValue);
  22499. }
  22500. else if (isBuff) {
  22501. isCommon = false;
  22502. newValue = cloneBuffer(srcValue, true);
  22503. }
  22504. else if (isTyped) {
  22505. isCommon = false;
  22506. newValue = cloneTypedArray(srcValue, true);
  22507. }
  22508. else {
  22509. newValue = [];
  22510. }
  22511. }
  22512. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  22513. newValue = objValue;
  22514. if (isArguments(objValue)) {
  22515. newValue = toPlainObject(objValue);
  22516. }
  22517. else if (!isObject(objValue) || isFunction(objValue)) {
  22518. newValue = initCloneObject(srcValue);
  22519. }
  22520. }
  22521. else {
  22522. isCommon = false;
  22523. }
  22524. }
  22525. if (isCommon) {
  22526. // Recursively merge objects and arrays (susceptible to call stack limits).
  22527. stack.set(srcValue, newValue);
  22528. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  22529. stack['delete'](srcValue);
  22530. }
  22531. assignMergeValue(object, key, newValue);
  22532. }
  22533. /**
  22534. * The base implementation of `_.nth` which doesn't coerce arguments.
  22535. *
  22536. * @private
  22537. * @param {Array} array The array to query.
  22538. * @param {number} n The index of the element to return.
  22539. * @returns {*} Returns the nth element of `array`.
  22540. */
  22541. function baseNth(array, n) {
  22542. var length = array.length;
  22543. if (!length) {
  22544. return;
  22545. }
  22546. n += n < 0 ? length : 0;
  22547. return isIndex(n, length) ? array[n] : undefined;
  22548. }
  22549. /**
  22550. * The base implementation of `_.orderBy` without param guards.
  22551. *
  22552. * @private
  22553. * @param {Array|Object} collection The collection to iterate over.
  22554. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  22555. * @param {string[]} orders The sort orders of `iteratees`.
  22556. * @returns {Array} Returns the new sorted array.
  22557. */
  22558. function baseOrderBy(collection, iteratees, orders) {
  22559. var index = -1;
  22560. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  22561. var result = baseMap(collection, function(value, key, collection) {
  22562. var criteria = arrayMap(iteratees, function(iteratee) {
  22563. return iteratee(value);
  22564. });
  22565. return { 'criteria': criteria, 'index': ++index, 'value': value };
  22566. });
  22567. return baseSortBy(result, function(object, other) {
  22568. return compareMultiple(object, other, orders);
  22569. });
  22570. }
  22571. /**
  22572. * The base implementation of `_.pick` without support for individual
  22573. * property identifiers.
  22574. *
  22575. * @private
  22576. * @param {Object} object The source object.
  22577. * @param {string[]} paths The property paths to pick.
  22578. * @returns {Object} Returns the new object.
  22579. */
  22580. function basePick(object, paths) {
  22581. return basePickBy(object, paths, function(value, path) {
  22582. return hasIn(object, path);
  22583. });
  22584. }
  22585. /**
  22586. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  22587. *
  22588. * @private
  22589. * @param {Object} object The source object.
  22590. * @param {string[]} paths The property paths to pick.
  22591. * @param {Function} predicate The function invoked per property.
  22592. * @returns {Object} Returns the new object.
  22593. */
  22594. function basePickBy(object, paths, predicate) {
  22595. var index = -1,
  22596. length = paths.length,
  22597. result = {};
  22598. while (++index < length) {
  22599. var path = paths[index],
  22600. value = baseGet(object, path);
  22601. if (predicate(value, path)) {
  22602. baseSet(result, castPath(path, object), value);
  22603. }
  22604. }
  22605. return result;
  22606. }
  22607. /**
  22608. * A specialized version of `baseProperty` which supports deep paths.
  22609. *
  22610. * @private
  22611. * @param {Array|string} path The path of the property to get.
  22612. * @returns {Function} Returns the new accessor function.
  22613. */
  22614. function basePropertyDeep(path) {
  22615. return function(object) {
  22616. return baseGet(object, path);
  22617. };
  22618. }
  22619. /**
  22620. * The base implementation of `_.pullAllBy` without support for iteratee
  22621. * shorthands.
  22622. *
  22623. * @private
  22624. * @param {Array} array The array to modify.
  22625. * @param {Array} values The values to remove.
  22626. * @param {Function} [iteratee] The iteratee invoked per element.
  22627. * @param {Function} [comparator] The comparator invoked per element.
  22628. * @returns {Array} Returns `array`.
  22629. */
  22630. function basePullAll(array, values, iteratee, comparator) {
  22631. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  22632. index = -1,
  22633. length = values.length,
  22634. seen = array;
  22635. if (array === values) {
  22636. values = copyArray(values);
  22637. }
  22638. if (iteratee) {
  22639. seen = arrayMap(array, baseUnary(iteratee));
  22640. }
  22641. while (++index < length) {
  22642. var fromIndex = 0,
  22643. value = values[index],
  22644. computed = iteratee ? iteratee(value) : value;
  22645. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  22646. if (seen !== array) {
  22647. splice.call(seen, fromIndex, 1);
  22648. }
  22649. splice.call(array, fromIndex, 1);
  22650. }
  22651. }
  22652. return array;
  22653. }
  22654. /**
  22655. * The base implementation of `_.pullAt` without support for individual
  22656. * indexes or capturing the removed elements.
  22657. *
  22658. * @private
  22659. * @param {Array} array The array to modify.
  22660. * @param {number[]} indexes The indexes of elements to remove.
  22661. * @returns {Array} Returns `array`.
  22662. */
  22663. function basePullAt(array, indexes) {
  22664. var length = array ? indexes.length : 0,
  22665. lastIndex = length - 1;
  22666. while (length--) {
  22667. var index = indexes[length];
  22668. if (length == lastIndex || index !== previous) {
  22669. var previous = index;
  22670. if (isIndex(index)) {
  22671. splice.call(array, index, 1);
  22672. } else {
  22673. baseUnset(array, index);
  22674. }
  22675. }
  22676. }
  22677. return array;
  22678. }
  22679. /**
  22680. * The base implementation of `_.random` without support for returning
  22681. * floating-point numbers.
  22682. *
  22683. * @private
  22684. * @param {number} lower The lower bound.
  22685. * @param {number} upper The upper bound.
  22686. * @returns {number} Returns the random number.
  22687. */
  22688. function baseRandom(lower, upper) {
  22689. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  22690. }
  22691. /**
  22692. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  22693. * coerce arguments.
  22694. *
  22695. * @private
  22696. * @param {number} start The start of the range.
  22697. * @param {number} end The end of the range.
  22698. * @param {number} step The value to increment or decrement by.
  22699. * @param {boolean} [fromRight] Specify iterating from right to left.
  22700. * @returns {Array} Returns the range of numbers.
  22701. */
  22702. function baseRange(start, end, step, fromRight) {
  22703. var index = -1,
  22704. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  22705. result = Array(length);
  22706. while (length--) {
  22707. result[fromRight ? length : ++index] = start;
  22708. start += step;
  22709. }
  22710. return result;
  22711. }
  22712. /**
  22713. * The base implementation of `_.repeat` which doesn't coerce arguments.
  22714. *
  22715. * @private
  22716. * @param {string} string The string to repeat.
  22717. * @param {number} n The number of times to repeat the string.
  22718. * @returns {string} Returns the repeated string.
  22719. */
  22720. function baseRepeat(string, n) {
  22721. var result = '';
  22722. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  22723. return result;
  22724. }
  22725. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  22726. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  22727. do {
  22728. if (n % 2) {
  22729. result += string;
  22730. }
  22731. n = nativeFloor(n / 2);
  22732. if (n) {
  22733. string += string;
  22734. }
  22735. } while (n);
  22736. return result;
  22737. }
  22738. /**
  22739. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  22740. *
  22741. * @private
  22742. * @param {Function} func The function to apply a rest parameter to.
  22743. * @param {number} [start=func.length-1] The start position of the rest parameter.
  22744. * @returns {Function} Returns the new function.
  22745. */
  22746. function baseRest(func, start) {
  22747. return setToString(overRest(func, start, identity), func + '');
  22748. }
  22749. /**
  22750. * The base implementation of `_.sample`.
  22751. *
  22752. * @private
  22753. * @param {Array|Object} collection The collection to sample.
  22754. * @returns {*} Returns the random element.
  22755. */
  22756. function baseSample(collection) {
  22757. return arraySample(values(collection));
  22758. }
  22759. /**
  22760. * The base implementation of `_.sampleSize` without param guards.
  22761. *
  22762. * @private
  22763. * @param {Array|Object} collection The collection to sample.
  22764. * @param {number} n The number of elements to sample.
  22765. * @returns {Array} Returns the random elements.
  22766. */
  22767. function baseSampleSize(collection, n) {
  22768. var array = values(collection);
  22769. return shuffleSelf(array, baseClamp(n, 0, array.length));
  22770. }
  22771. /**
  22772. * The base implementation of `_.set`.
  22773. *
  22774. * @private
  22775. * @param {Object} object The object to modify.
  22776. * @param {Array|string} path The path of the property to set.
  22777. * @param {*} value The value to set.
  22778. * @param {Function} [customizer] The function to customize path creation.
  22779. * @returns {Object} Returns `object`.
  22780. */
  22781. function baseSet(object, path, value, customizer) {
  22782. if (!isObject(object)) {
  22783. return object;
  22784. }
  22785. path = castPath(path, object);
  22786. var index = -1,
  22787. length = path.length,
  22788. lastIndex = length - 1,
  22789. nested = object;
  22790. while (nested != null && ++index < length) {
  22791. var key = toKey(path[index]),
  22792. newValue = value;
  22793. if (index != lastIndex) {
  22794. var objValue = nested[key];
  22795. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  22796. if (newValue === undefined) {
  22797. newValue = isObject(objValue)
  22798. ? objValue
  22799. : (isIndex(path[index + 1]) ? [] : {});
  22800. }
  22801. }
  22802. assignValue(nested, key, newValue);
  22803. nested = nested[key];
  22804. }
  22805. return object;
  22806. }
  22807. /**
  22808. * The base implementation of `setData` without support for hot loop shorting.
  22809. *
  22810. * @private
  22811. * @param {Function} func The function to associate metadata with.
  22812. * @param {*} data The metadata.
  22813. * @returns {Function} Returns `func`.
  22814. */
  22815. var baseSetData = !metaMap ? identity : function(func, data) {
  22816. metaMap.set(func, data);
  22817. return func;
  22818. };
  22819. /**
  22820. * The base implementation of `setToString` without support for hot loop shorting.
  22821. *
  22822. * @private
  22823. * @param {Function} func The function to modify.
  22824. * @param {Function} string The `toString` result.
  22825. * @returns {Function} Returns `func`.
  22826. */
  22827. var baseSetToString = !defineProperty ? identity : function(func, string) {
  22828. return defineProperty(func, 'toString', {
  22829. 'configurable': true,
  22830. 'enumerable': false,
  22831. 'value': constant(string),
  22832. 'writable': true
  22833. });
  22834. };
  22835. /**
  22836. * The base implementation of `_.shuffle`.
  22837. *
  22838. * @private
  22839. * @param {Array|Object} collection The collection to shuffle.
  22840. * @returns {Array} Returns the new shuffled array.
  22841. */
  22842. function baseShuffle(collection) {
  22843. return shuffleSelf(values(collection));
  22844. }
  22845. /**
  22846. * The base implementation of `_.slice` without an iteratee call guard.
  22847. *
  22848. * @private
  22849. * @param {Array} array The array to slice.
  22850. * @param {number} [start=0] The start position.
  22851. * @param {number} [end=array.length] The end position.
  22852. * @returns {Array} Returns the slice of `array`.
  22853. */
  22854. function baseSlice(array, start, end) {
  22855. var index = -1,
  22856. length = array.length;
  22857. if (start < 0) {
  22858. start = -start > length ? 0 : (length + start);
  22859. }
  22860. end = end > length ? length : end;
  22861. if (end < 0) {
  22862. end += length;
  22863. }
  22864. length = start > end ? 0 : ((end - start) >>> 0);
  22865. start >>>= 0;
  22866. var result = Array(length);
  22867. while (++index < length) {
  22868. result[index] = array[index + start];
  22869. }
  22870. return result;
  22871. }
  22872. /**
  22873. * The base implementation of `_.some` without support for iteratee shorthands.
  22874. *
  22875. * @private
  22876. * @param {Array|Object} collection The collection to iterate over.
  22877. * @param {Function} predicate The function invoked per iteration.
  22878. * @returns {boolean} Returns `true` if any element passes the predicate check,
  22879. * else `false`.
  22880. */
  22881. function baseSome(collection, predicate) {
  22882. var result;
  22883. baseEach(collection, function(value, index, collection) {
  22884. result = predicate(value, index, collection);
  22885. return !result;
  22886. });
  22887. return !!result;
  22888. }
  22889. /**
  22890. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  22891. * performs a binary search of `array` to determine the index at which `value`
  22892. * should be inserted into `array` in order to maintain its sort order.
  22893. *
  22894. * @private
  22895. * @param {Array} array The sorted array to inspect.
  22896. * @param {*} value The value to evaluate.
  22897. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22898. * @returns {number} Returns the index at which `value` should be inserted
  22899. * into `array`.
  22900. */
  22901. function baseSortedIndex(array, value, retHighest) {
  22902. var low = 0,
  22903. high = array == null ? low : array.length;
  22904. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  22905. while (low < high) {
  22906. var mid = (low + high) >>> 1,
  22907. computed = array[mid];
  22908. if (computed !== null && !isSymbol(computed) &&
  22909. (retHighest ? (computed <= value) : (computed < value))) {
  22910. low = mid + 1;
  22911. } else {
  22912. high = mid;
  22913. }
  22914. }
  22915. return high;
  22916. }
  22917. return baseSortedIndexBy(array, value, identity, retHighest);
  22918. }
  22919. /**
  22920. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  22921. * which invokes `iteratee` for `value` and each element of `array` to compute
  22922. * their sort ranking. The iteratee is invoked with one argument; (value).
  22923. *
  22924. * @private
  22925. * @param {Array} array The sorted array to inspect.
  22926. * @param {*} value The value to evaluate.
  22927. * @param {Function} iteratee The iteratee invoked per element.
  22928. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22929. * @returns {number} Returns the index at which `value` should be inserted
  22930. * into `array`.
  22931. */
  22932. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  22933. value = iteratee(value);
  22934. var low = 0,
  22935. high = array == null ? 0 : array.length,
  22936. valIsNaN = value !== value,
  22937. valIsNull = value === null,
  22938. valIsSymbol = isSymbol(value),
  22939. valIsUndefined = value === undefined;
  22940. while (low < high) {
  22941. var mid = nativeFloor((low + high) / 2),
  22942. computed = iteratee(array[mid]),
  22943. othIsDefined = computed !== undefined,
  22944. othIsNull = computed === null,
  22945. othIsReflexive = computed === computed,
  22946. othIsSymbol = isSymbol(computed);
  22947. if (valIsNaN) {
  22948. var setLow = retHighest || othIsReflexive;
  22949. } else if (valIsUndefined) {
  22950. setLow = othIsReflexive && (retHighest || othIsDefined);
  22951. } else if (valIsNull) {
  22952. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  22953. } else if (valIsSymbol) {
  22954. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  22955. } else if (othIsNull || othIsSymbol) {
  22956. setLow = false;
  22957. } else {
  22958. setLow = retHighest ? (computed <= value) : (computed < value);
  22959. }
  22960. if (setLow) {
  22961. low = mid + 1;
  22962. } else {
  22963. high = mid;
  22964. }
  22965. }
  22966. return nativeMin(high, MAX_ARRAY_INDEX);
  22967. }
  22968. /**
  22969. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  22970. * support for iteratee shorthands.
  22971. *
  22972. * @private
  22973. * @param {Array} array The array to inspect.
  22974. * @param {Function} [iteratee] The iteratee invoked per element.
  22975. * @returns {Array} Returns the new duplicate free array.
  22976. */
  22977. function baseSortedUniq(array, iteratee) {
  22978. var index = -1,
  22979. length = array.length,
  22980. resIndex = 0,
  22981. result = [];
  22982. while (++index < length) {
  22983. var value = array[index],
  22984. computed = iteratee ? iteratee(value) : value;
  22985. if (!index || !eq(computed, seen)) {
  22986. var seen = computed;
  22987. result[resIndex++] = value === 0 ? 0 : value;
  22988. }
  22989. }
  22990. return result;
  22991. }
  22992. /**
  22993. * The base implementation of `_.toNumber` which doesn't ensure correct
  22994. * conversions of binary, hexadecimal, or octal string values.
  22995. *
  22996. * @private
  22997. * @param {*} value The value to process.
  22998. * @returns {number} Returns the number.
  22999. */
  23000. function baseToNumber(value) {
  23001. if (typeof value == 'number') {
  23002. return value;
  23003. }
  23004. if (isSymbol(value)) {
  23005. return NAN;
  23006. }
  23007. return +value;
  23008. }
  23009. /**
  23010. * The base implementation of `_.toString` which doesn't convert nullish
  23011. * values to empty strings.
  23012. *
  23013. * @private
  23014. * @param {*} value The value to process.
  23015. * @returns {string} Returns the string.
  23016. */
  23017. function baseToString(value) {
  23018. // Exit early for strings to avoid a performance hit in some environments.
  23019. if (typeof value == 'string') {
  23020. return value;
  23021. }
  23022. if (isArray(value)) {
  23023. // Recursively convert values (susceptible to call stack limits).
  23024. return arrayMap(value, baseToString) + '';
  23025. }
  23026. if (isSymbol(value)) {
  23027. return symbolToString ? symbolToString.call(value) : '';
  23028. }
  23029. var result = (value + '');
  23030. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  23031. }
  23032. /**
  23033. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  23034. *
  23035. * @private
  23036. * @param {Array} array The array to inspect.
  23037. * @param {Function} [iteratee] The iteratee invoked per element.
  23038. * @param {Function} [comparator] The comparator invoked per element.
  23039. * @returns {Array} Returns the new duplicate free array.
  23040. */
  23041. function baseUniq(array, iteratee, comparator) {
  23042. var index = -1,
  23043. includes = arrayIncludes,
  23044. length = array.length,
  23045. isCommon = true,
  23046. result = [],
  23047. seen = result;
  23048. if (comparator) {
  23049. isCommon = false;
  23050. includes = arrayIncludesWith;
  23051. }
  23052. else if (length >= LARGE_ARRAY_SIZE) {
  23053. var set = iteratee ? null : createSet(array);
  23054. if (set) {
  23055. return setToArray(set);
  23056. }
  23057. isCommon = false;
  23058. includes = cacheHas;
  23059. seen = new SetCache;
  23060. }
  23061. else {
  23062. seen = iteratee ? [] : result;
  23063. }
  23064. outer:
  23065. while (++index < length) {
  23066. var value = array[index],
  23067. computed = iteratee ? iteratee(value) : value;
  23068. value = (comparator || value !== 0) ? value : 0;
  23069. if (isCommon && computed === computed) {
  23070. var seenIndex = seen.length;
  23071. while (seenIndex--) {
  23072. if (seen[seenIndex] === computed) {
  23073. continue outer;
  23074. }
  23075. }
  23076. if (iteratee) {
  23077. seen.push(computed);
  23078. }
  23079. result.push(value);
  23080. }
  23081. else if (!includes(seen, computed, comparator)) {
  23082. if (seen !== result) {
  23083. seen.push(computed);
  23084. }
  23085. result.push(value);
  23086. }
  23087. }
  23088. return result;
  23089. }
  23090. /**
  23091. * The base implementation of `_.unset`.
  23092. *
  23093. * @private
  23094. * @param {Object} object The object to modify.
  23095. * @param {Array|string} path The property path to unset.
  23096. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  23097. */
  23098. function baseUnset(object, path) {
  23099. path = castPath(path, object);
  23100. object = parent(object, path);
  23101. return object == null || delete object[toKey(last(path))];
  23102. }
  23103. /**
  23104. * The base implementation of `_.update`.
  23105. *
  23106. * @private
  23107. * @param {Object} object The object to modify.
  23108. * @param {Array|string} path The path of the property to update.
  23109. * @param {Function} updater The function to produce the updated value.
  23110. * @param {Function} [customizer] The function to customize path creation.
  23111. * @returns {Object} Returns `object`.
  23112. */
  23113. function baseUpdate(object, path, updater, customizer) {
  23114. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  23115. }
  23116. /**
  23117. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  23118. * without support for iteratee shorthands.
  23119. *
  23120. * @private
  23121. * @param {Array} array The array to query.
  23122. * @param {Function} predicate The function invoked per iteration.
  23123. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  23124. * @param {boolean} [fromRight] Specify iterating from right to left.
  23125. * @returns {Array} Returns the slice of `array`.
  23126. */
  23127. function baseWhile(array, predicate, isDrop, fromRight) {
  23128. var length = array.length,
  23129. index = fromRight ? length : -1;
  23130. while ((fromRight ? index-- : ++index < length) &&
  23131. predicate(array[index], index, array)) {}
  23132. return isDrop
  23133. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  23134. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  23135. }
  23136. /**
  23137. * The base implementation of `wrapperValue` which returns the result of
  23138. * performing a sequence of actions on the unwrapped `value`, where each
  23139. * successive action is supplied the return value of the previous.
  23140. *
  23141. * @private
  23142. * @param {*} value The unwrapped value.
  23143. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  23144. * @returns {*} Returns the resolved value.
  23145. */
  23146. function baseWrapperValue(value, actions) {
  23147. var result = value;
  23148. if (result instanceof LazyWrapper) {
  23149. result = result.value();
  23150. }
  23151. return arrayReduce(actions, function(result, action) {
  23152. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  23153. }, result);
  23154. }
  23155. /**
  23156. * The base implementation of methods like `_.xor`, without support for
  23157. * iteratee shorthands, that accepts an array of arrays to inspect.
  23158. *
  23159. * @private
  23160. * @param {Array} arrays The arrays to inspect.
  23161. * @param {Function} [iteratee] The iteratee invoked per element.
  23162. * @param {Function} [comparator] The comparator invoked per element.
  23163. * @returns {Array} Returns the new array of values.
  23164. */
  23165. function baseXor(arrays, iteratee, comparator) {
  23166. var length = arrays.length;
  23167. if (length < 2) {
  23168. return length ? baseUniq(arrays[0]) : [];
  23169. }
  23170. var index = -1,
  23171. result = Array(length);
  23172. while (++index < length) {
  23173. var array = arrays[index],
  23174. othIndex = -1;
  23175. while (++othIndex < length) {
  23176. if (othIndex != index) {
  23177. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  23178. }
  23179. }
  23180. }
  23181. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  23182. }
  23183. /**
  23184. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  23185. *
  23186. * @private
  23187. * @param {Array} props The property identifiers.
  23188. * @param {Array} values The property values.
  23189. * @param {Function} assignFunc The function to assign values.
  23190. * @returns {Object} Returns the new object.
  23191. */
  23192. function baseZipObject(props, values, assignFunc) {
  23193. var index = -1,
  23194. length = props.length,
  23195. valsLength = values.length,
  23196. result = {};
  23197. while (++index < length) {
  23198. var value = index < valsLength ? values[index] : undefined;
  23199. assignFunc(result, props[index], value);
  23200. }
  23201. return result;
  23202. }
  23203. /**
  23204. * Casts `value` to an empty array if it's not an array like object.
  23205. *
  23206. * @private
  23207. * @param {*} value The value to inspect.
  23208. * @returns {Array|Object} Returns the cast array-like object.
  23209. */
  23210. function castArrayLikeObject(value) {
  23211. return isArrayLikeObject(value) ? value : [];
  23212. }
  23213. /**
  23214. * Casts `value` to `identity` if it's not a function.
  23215. *
  23216. * @private
  23217. * @param {*} value The value to inspect.
  23218. * @returns {Function} Returns cast function.
  23219. */
  23220. function castFunction(value) {
  23221. return typeof value == 'function' ? value : identity;
  23222. }
  23223. /**
  23224. * Casts `value` to a path array if it's not one.
  23225. *
  23226. * @private
  23227. * @param {*} value The value to inspect.
  23228. * @param {Object} [object] The object to query keys on.
  23229. * @returns {Array} Returns the cast property path array.
  23230. */
  23231. function castPath(value, object) {
  23232. if (isArray(value)) {
  23233. return value;
  23234. }
  23235. return isKey(value, object) ? [value] : stringToPath(toString(value));
  23236. }
  23237. /**
  23238. * A `baseRest` alias which can be replaced with `identity` by module
  23239. * replacement plugins.
  23240. *
  23241. * @private
  23242. * @type {Function}
  23243. * @param {Function} func The function to apply a rest parameter to.
  23244. * @returns {Function} Returns the new function.
  23245. */
  23246. var castRest = baseRest;
  23247. /**
  23248. * Casts `array` to a slice if it's needed.
  23249. *
  23250. * @private
  23251. * @param {Array} array The array to inspect.
  23252. * @param {number} start The start position.
  23253. * @param {number} [end=array.length] The end position.
  23254. * @returns {Array} Returns the cast slice.
  23255. */
  23256. function castSlice(array, start, end) {
  23257. var length = array.length;
  23258. end = end === undefined ? length : end;
  23259. return (!start && end >= length) ? array : baseSlice(array, start, end);
  23260. }
  23261. /**
  23262. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  23263. *
  23264. * @private
  23265. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  23266. */
  23267. var clearTimeout = ctxClearTimeout || function(id) {
  23268. return root.clearTimeout(id);
  23269. };
  23270. /**
  23271. * Creates a clone of `buffer`.
  23272. *
  23273. * @private
  23274. * @param {Buffer} buffer The buffer to clone.
  23275. * @param {boolean} [isDeep] Specify a deep clone.
  23276. * @returns {Buffer} Returns the cloned buffer.
  23277. */
  23278. function cloneBuffer(buffer, isDeep) {
  23279. if (isDeep) {
  23280. return buffer.slice();
  23281. }
  23282. var length = buffer.length,
  23283. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  23284. buffer.copy(result);
  23285. return result;
  23286. }
  23287. /**
  23288. * Creates a clone of `arrayBuffer`.
  23289. *
  23290. * @private
  23291. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  23292. * @returns {ArrayBuffer} Returns the cloned array buffer.
  23293. */
  23294. function cloneArrayBuffer(arrayBuffer) {
  23295. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  23296. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  23297. return result;
  23298. }
  23299. /**
  23300. * Creates a clone of `dataView`.
  23301. *
  23302. * @private
  23303. * @param {Object} dataView The data view to clone.
  23304. * @param {boolean} [isDeep] Specify a deep clone.
  23305. * @returns {Object} Returns the cloned data view.
  23306. */
  23307. function cloneDataView(dataView, isDeep) {
  23308. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  23309. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  23310. }
  23311. /**
  23312. * Creates a clone of `regexp`.
  23313. *
  23314. * @private
  23315. * @param {Object} regexp The regexp to clone.
  23316. * @returns {Object} Returns the cloned regexp.
  23317. */
  23318. function cloneRegExp(regexp) {
  23319. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  23320. result.lastIndex = regexp.lastIndex;
  23321. return result;
  23322. }
  23323. /**
  23324. * Creates a clone of the `symbol` object.
  23325. *
  23326. * @private
  23327. * @param {Object} symbol The symbol object to clone.
  23328. * @returns {Object} Returns the cloned symbol object.
  23329. */
  23330. function cloneSymbol(symbol) {
  23331. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  23332. }
  23333. /**
  23334. * Creates a clone of `typedArray`.
  23335. *
  23336. * @private
  23337. * @param {Object} typedArray The typed array to clone.
  23338. * @param {boolean} [isDeep] Specify a deep clone.
  23339. * @returns {Object} Returns the cloned typed array.
  23340. */
  23341. function cloneTypedArray(typedArray, isDeep) {
  23342. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  23343. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  23344. }
  23345. /**
  23346. * Compares values to sort them in ascending order.
  23347. *
  23348. * @private
  23349. * @param {*} value The value to compare.
  23350. * @param {*} other The other value to compare.
  23351. * @returns {number} Returns the sort order indicator for `value`.
  23352. */
  23353. function compareAscending(value, other) {
  23354. if (value !== other) {
  23355. var valIsDefined = value !== undefined,
  23356. valIsNull = value === null,
  23357. valIsReflexive = value === value,
  23358. valIsSymbol = isSymbol(value);
  23359. var othIsDefined = other !== undefined,
  23360. othIsNull = other === null,
  23361. othIsReflexive = other === other,
  23362. othIsSymbol = isSymbol(other);
  23363. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  23364. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  23365. (valIsNull && othIsDefined && othIsReflexive) ||
  23366. (!valIsDefined && othIsReflexive) ||
  23367. !valIsReflexive) {
  23368. return 1;
  23369. }
  23370. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  23371. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  23372. (othIsNull && valIsDefined && valIsReflexive) ||
  23373. (!othIsDefined && valIsReflexive) ||
  23374. !othIsReflexive) {
  23375. return -1;
  23376. }
  23377. }
  23378. return 0;
  23379. }
  23380. /**
  23381. * Used by `_.orderBy` to compare multiple properties of a value to another
  23382. * and stable sort them.
  23383. *
  23384. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  23385. * specify an order of "desc" for descending or "asc" for ascending sort order
  23386. * of corresponding values.
  23387. *
  23388. * @private
  23389. * @param {Object} object The object to compare.
  23390. * @param {Object} other The other object to compare.
  23391. * @param {boolean[]|string[]} orders The order to sort by for each property.
  23392. * @returns {number} Returns the sort order indicator for `object`.
  23393. */
  23394. function compareMultiple(object, other, orders) {
  23395. var index = -1,
  23396. objCriteria = object.criteria,
  23397. othCriteria = other.criteria,
  23398. length = objCriteria.length,
  23399. ordersLength = orders.length;
  23400. while (++index < length) {
  23401. var result = compareAscending(objCriteria[index], othCriteria[index]);
  23402. if (result) {
  23403. if (index >= ordersLength) {
  23404. return result;
  23405. }
  23406. var order = orders[index];
  23407. return result * (order == 'desc' ? -1 : 1);
  23408. }
  23409. }
  23410. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  23411. // that causes it, under certain circumstances, to provide the same value for
  23412. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  23413. // for more details.
  23414. //
  23415. // This also ensures a stable sort in V8 and other engines.
  23416. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  23417. return object.index - other.index;
  23418. }
  23419. /**
  23420. * Creates an array that is the composition of partially applied arguments,
  23421. * placeholders, and provided arguments into a single array of arguments.
  23422. *
  23423. * @private
  23424. * @param {Array} args The provided arguments.
  23425. * @param {Array} partials The arguments to prepend to those provided.
  23426. * @param {Array} holders The `partials` placeholder indexes.
  23427. * @params {boolean} [isCurried] Specify composing for a curried function.
  23428. * @returns {Array} Returns the new array of composed arguments.
  23429. */
  23430. function composeArgs(args, partials, holders, isCurried) {
  23431. var argsIndex = -1,
  23432. argsLength = args.length,
  23433. holdersLength = holders.length,
  23434. leftIndex = -1,
  23435. leftLength = partials.length,
  23436. rangeLength = nativeMax(argsLength - holdersLength, 0),
  23437. result = Array(leftLength + rangeLength),
  23438. isUncurried = !isCurried;
  23439. while (++leftIndex < leftLength) {
  23440. result[leftIndex] = partials[leftIndex];
  23441. }
  23442. while (++argsIndex < holdersLength) {
  23443. if (isUncurried || argsIndex < argsLength) {
  23444. result[holders[argsIndex]] = args[argsIndex];
  23445. }
  23446. }
  23447. while (rangeLength--) {
  23448. result[leftIndex++] = args[argsIndex++];
  23449. }
  23450. return result;
  23451. }
  23452. /**
  23453. * This function is like `composeArgs` except that the arguments composition
  23454. * is tailored for `_.partialRight`.
  23455. *
  23456. * @private
  23457. * @param {Array} args The provided arguments.
  23458. * @param {Array} partials The arguments to append to those provided.
  23459. * @param {Array} holders The `partials` placeholder indexes.
  23460. * @params {boolean} [isCurried] Specify composing for a curried function.
  23461. * @returns {Array} Returns the new array of composed arguments.
  23462. */
  23463. function composeArgsRight(args, partials, holders, isCurried) {
  23464. var argsIndex = -1,
  23465. argsLength = args.length,
  23466. holdersIndex = -1,
  23467. holdersLength = holders.length,
  23468. rightIndex = -1,
  23469. rightLength = partials.length,
  23470. rangeLength = nativeMax(argsLength - holdersLength, 0),
  23471. result = Array(rangeLength + rightLength),
  23472. isUncurried = !isCurried;
  23473. while (++argsIndex < rangeLength) {
  23474. result[argsIndex] = args[argsIndex];
  23475. }
  23476. var offset = argsIndex;
  23477. while (++rightIndex < rightLength) {
  23478. result[offset + rightIndex] = partials[rightIndex];
  23479. }
  23480. while (++holdersIndex < holdersLength) {
  23481. if (isUncurried || argsIndex < argsLength) {
  23482. result[offset + holders[holdersIndex]] = args[argsIndex++];
  23483. }
  23484. }
  23485. return result;
  23486. }
  23487. /**
  23488. * Copies the values of `source` to `array`.
  23489. *
  23490. * @private
  23491. * @param {Array} source The array to copy values from.
  23492. * @param {Array} [array=[]] The array to copy values to.
  23493. * @returns {Array} Returns `array`.
  23494. */
  23495. function copyArray(source, array) {
  23496. var index = -1,
  23497. length = source.length;
  23498. array || (array = Array(length));
  23499. while (++index < length) {
  23500. array[index] = source[index];
  23501. }
  23502. return array;
  23503. }
  23504. /**
  23505. * Copies properties of `source` to `object`.
  23506. *
  23507. * @private
  23508. * @param {Object} source The object to copy properties from.
  23509. * @param {Array} props The property identifiers to copy.
  23510. * @param {Object} [object={}] The object to copy properties to.
  23511. * @param {Function} [customizer] The function to customize copied values.
  23512. * @returns {Object} Returns `object`.
  23513. */
  23514. function copyObject(source, props, object, customizer) {
  23515. var isNew = !object;
  23516. object || (object = {});
  23517. var index = -1,
  23518. length = props.length;
  23519. while (++index < length) {
  23520. var key = props[index];
  23521. var newValue = customizer
  23522. ? customizer(object[key], source[key], key, object, source)
  23523. : undefined;
  23524. if (newValue === undefined) {
  23525. newValue = source[key];
  23526. }
  23527. if (isNew) {
  23528. baseAssignValue(object, key, newValue);
  23529. } else {
  23530. assignValue(object, key, newValue);
  23531. }
  23532. }
  23533. return object;
  23534. }
  23535. /**
  23536. * Copies own symbols of `source` to `object`.
  23537. *
  23538. * @private
  23539. * @param {Object} source The object to copy symbols from.
  23540. * @param {Object} [object={}] The object to copy symbols to.
  23541. * @returns {Object} Returns `object`.
  23542. */
  23543. function copySymbols(source, object) {
  23544. return copyObject(source, getSymbols(source), object);
  23545. }
  23546. /**
  23547. * Copies own and inherited symbols of `source` to `object`.
  23548. *
  23549. * @private
  23550. * @param {Object} source The object to copy symbols from.
  23551. * @param {Object} [object={}] The object to copy symbols to.
  23552. * @returns {Object} Returns `object`.
  23553. */
  23554. function copySymbolsIn(source, object) {
  23555. return copyObject(source, getSymbolsIn(source), object);
  23556. }
  23557. /**
  23558. * Creates a function like `_.groupBy`.
  23559. *
  23560. * @private
  23561. * @param {Function} setter The function to set accumulator values.
  23562. * @param {Function} [initializer] The accumulator object initializer.
  23563. * @returns {Function} Returns the new aggregator function.
  23564. */
  23565. function createAggregator(setter, initializer) {
  23566. return function(collection, iteratee) {
  23567. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  23568. accumulator = initializer ? initializer() : {};
  23569. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  23570. };
  23571. }
  23572. /**
  23573. * Creates a function like `_.assign`.
  23574. *
  23575. * @private
  23576. * @param {Function} assigner The function to assign values.
  23577. * @returns {Function} Returns the new assigner function.
  23578. */
  23579. function createAssigner(assigner) {
  23580. return baseRest(function(object, sources) {
  23581. var index = -1,
  23582. length = sources.length,
  23583. customizer = length > 1 ? sources[length - 1] : undefined,
  23584. guard = length > 2 ? sources[2] : undefined;
  23585. customizer = (assigner.length > 3 && typeof customizer == 'function')
  23586. ? (length--, customizer)
  23587. : undefined;
  23588. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  23589. customizer = length < 3 ? undefined : customizer;
  23590. length = 1;
  23591. }
  23592. object = Object(object);
  23593. while (++index < length) {
  23594. var source = sources[index];
  23595. if (source) {
  23596. assigner(object, source, index, customizer);
  23597. }
  23598. }
  23599. return object;
  23600. });
  23601. }
  23602. /**
  23603. * Creates a `baseEach` or `baseEachRight` function.
  23604. *
  23605. * @private
  23606. * @param {Function} eachFunc The function to iterate over a collection.
  23607. * @param {boolean} [fromRight] Specify iterating from right to left.
  23608. * @returns {Function} Returns the new base function.
  23609. */
  23610. function createBaseEach(eachFunc, fromRight) {
  23611. return function(collection, iteratee) {
  23612. if (collection == null) {
  23613. return collection;
  23614. }
  23615. if (!isArrayLike(collection)) {
  23616. return eachFunc(collection, iteratee);
  23617. }
  23618. var length = collection.length,
  23619. index = fromRight ? length : -1,
  23620. iterable = Object(collection);
  23621. while ((fromRight ? index-- : ++index < length)) {
  23622. if (iteratee(iterable[index], index, iterable) === false) {
  23623. break;
  23624. }
  23625. }
  23626. return collection;
  23627. };
  23628. }
  23629. /**
  23630. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  23631. *
  23632. * @private
  23633. * @param {boolean} [fromRight] Specify iterating from right to left.
  23634. * @returns {Function} Returns the new base function.
  23635. */
  23636. function createBaseFor(fromRight) {
  23637. return function(object, iteratee, keysFunc) {
  23638. var index = -1,
  23639. iterable = Object(object),
  23640. props = keysFunc(object),
  23641. length = props.length;
  23642. while (length--) {
  23643. var key = props[fromRight ? length : ++index];
  23644. if (iteratee(iterable[key], key, iterable) === false) {
  23645. break;
  23646. }
  23647. }
  23648. return object;
  23649. };
  23650. }
  23651. /**
  23652. * Creates a function that wraps `func` to invoke it with the optional `this`
  23653. * binding of `thisArg`.
  23654. *
  23655. * @private
  23656. * @param {Function} func The function to wrap.
  23657. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23658. * @param {*} [thisArg] The `this` binding of `func`.
  23659. * @returns {Function} Returns the new wrapped function.
  23660. */
  23661. function createBind(func, bitmask, thisArg) {
  23662. var isBind = bitmask & WRAP_BIND_FLAG,
  23663. Ctor = createCtor(func);
  23664. function wrapper() {
  23665. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23666. return fn.apply(isBind ? thisArg : this, arguments);
  23667. }
  23668. return wrapper;
  23669. }
  23670. /**
  23671. * Creates a function like `_.lowerFirst`.
  23672. *
  23673. * @private
  23674. * @param {string} methodName The name of the `String` case method to use.
  23675. * @returns {Function} Returns the new case function.
  23676. */
  23677. function createCaseFirst(methodName) {
  23678. return function(string) {
  23679. string = toString(string);
  23680. var strSymbols = hasUnicode(string)
  23681. ? stringToArray(string)
  23682. : undefined;
  23683. var chr = strSymbols
  23684. ? strSymbols[0]
  23685. : string.charAt(0);
  23686. var trailing = strSymbols
  23687. ? castSlice(strSymbols, 1).join('')
  23688. : string.slice(1);
  23689. return chr[methodName]() + trailing;
  23690. };
  23691. }
  23692. /**
  23693. * Creates a function like `_.camelCase`.
  23694. *
  23695. * @private
  23696. * @param {Function} callback The function to combine each word.
  23697. * @returns {Function} Returns the new compounder function.
  23698. */
  23699. function createCompounder(callback) {
  23700. return function(string) {
  23701. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  23702. };
  23703. }
  23704. /**
  23705. * Creates a function that produces an instance of `Ctor` regardless of
  23706. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  23707. *
  23708. * @private
  23709. * @param {Function} Ctor The constructor to wrap.
  23710. * @returns {Function} Returns the new wrapped function.
  23711. */
  23712. function createCtor(Ctor) {
  23713. return function() {
  23714. // Use a `switch` statement to work with class constructors. See
  23715. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  23716. // for more details.
  23717. var args = arguments;
  23718. switch (args.length) {
  23719. case 0: return new Ctor;
  23720. case 1: return new Ctor(args[0]);
  23721. case 2: return new Ctor(args[0], args[1]);
  23722. case 3: return new Ctor(args[0], args[1], args[2]);
  23723. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  23724. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  23725. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  23726. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  23727. }
  23728. var thisBinding = baseCreate(Ctor.prototype),
  23729. result = Ctor.apply(thisBinding, args);
  23730. // Mimic the constructor's `return` behavior.
  23731. // See https://es5.github.io/#x13.2.2 for more details.
  23732. return isObject(result) ? result : thisBinding;
  23733. };
  23734. }
  23735. /**
  23736. * Creates a function that wraps `func` to enable currying.
  23737. *
  23738. * @private
  23739. * @param {Function} func The function to wrap.
  23740. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23741. * @param {number} arity The arity of `func`.
  23742. * @returns {Function} Returns the new wrapped function.
  23743. */
  23744. function createCurry(func, bitmask, arity) {
  23745. var Ctor = createCtor(func);
  23746. function wrapper() {
  23747. var length = arguments.length,
  23748. args = Array(length),
  23749. index = length,
  23750. placeholder = getHolder(wrapper);
  23751. while (index--) {
  23752. args[index] = arguments[index];
  23753. }
  23754. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  23755. ? []
  23756. : replaceHolders(args, placeholder);
  23757. length -= holders.length;
  23758. if (length < arity) {
  23759. return createRecurry(
  23760. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  23761. args, holders, undefined, undefined, arity - length);
  23762. }
  23763. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23764. return apply(fn, this, args);
  23765. }
  23766. return wrapper;
  23767. }
  23768. /**
  23769. * Creates a `_.find` or `_.findLast` function.
  23770. *
  23771. * @private
  23772. * @param {Function} findIndexFunc The function to find the collection index.
  23773. * @returns {Function} Returns the new find function.
  23774. */
  23775. function createFind(findIndexFunc) {
  23776. return function(collection, predicate, fromIndex) {
  23777. var iterable = Object(collection);
  23778. if (!isArrayLike(collection)) {
  23779. var iteratee = getIteratee(predicate, 3);
  23780. collection = keys(collection);
  23781. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  23782. }
  23783. var index = findIndexFunc(collection, predicate, fromIndex);
  23784. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  23785. };
  23786. }
  23787. /**
  23788. * Creates a `_.flow` or `_.flowRight` function.
  23789. *
  23790. * @private
  23791. * @param {boolean} [fromRight] Specify iterating from right to left.
  23792. * @returns {Function} Returns the new flow function.
  23793. */
  23794. function createFlow(fromRight) {
  23795. return flatRest(function(funcs) {
  23796. var length = funcs.length,
  23797. index = length,
  23798. prereq = LodashWrapper.prototype.thru;
  23799. if (fromRight) {
  23800. funcs.reverse();
  23801. }
  23802. while (index--) {
  23803. var func = funcs[index];
  23804. if (typeof func != 'function') {
  23805. throw new TypeError(FUNC_ERROR_TEXT);
  23806. }
  23807. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  23808. var wrapper = new LodashWrapper([], true);
  23809. }
  23810. }
  23811. index = wrapper ? index : length;
  23812. while (++index < length) {
  23813. func = funcs[index];
  23814. var funcName = getFuncName(func),
  23815. data = funcName == 'wrapper' ? getData(func) : undefined;
  23816. if (data && isLaziable(data[0]) &&
  23817. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  23818. !data[4].length && data[9] == 1
  23819. ) {
  23820. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  23821. } else {
  23822. wrapper = (func.length == 1 && isLaziable(func))
  23823. ? wrapper[funcName]()
  23824. : wrapper.thru(func);
  23825. }
  23826. }
  23827. return function() {
  23828. var args = arguments,
  23829. value = args[0];
  23830. if (wrapper && args.length == 1 && isArray(value)) {
  23831. return wrapper.plant(value).value();
  23832. }
  23833. var index = 0,
  23834. result = length ? funcs[index].apply(this, args) : value;
  23835. while (++index < length) {
  23836. result = funcs[index].call(this, result);
  23837. }
  23838. return result;
  23839. };
  23840. });
  23841. }
  23842. /**
  23843. * Creates a function that wraps `func` to invoke it with optional `this`
  23844. * binding of `thisArg`, partial application, and currying.
  23845. *
  23846. * @private
  23847. * @param {Function|string} func The function or method name to wrap.
  23848. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23849. * @param {*} [thisArg] The `this` binding of `func`.
  23850. * @param {Array} [partials] The arguments to prepend to those provided to
  23851. * the new function.
  23852. * @param {Array} [holders] The `partials` placeholder indexes.
  23853. * @param {Array} [partialsRight] The arguments to append to those provided
  23854. * to the new function.
  23855. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  23856. * @param {Array} [argPos] The argument positions of the new function.
  23857. * @param {number} [ary] The arity cap of `func`.
  23858. * @param {number} [arity] The arity of `func`.
  23859. * @returns {Function} Returns the new wrapped function.
  23860. */
  23861. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  23862. var isAry = bitmask & WRAP_ARY_FLAG,
  23863. isBind = bitmask & WRAP_BIND_FLAG,
  23864. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  23865. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  23866. isFlip = bitmask & WRAP_FLIP_FLAG,
  23867. Ctor = isBindKey ? undefined : createCtor(func);
  23868. function wrapper() {
  23869. var length = arguments.length,
  23870. args = Array(length),
  23871. index = length;
  23872. while (index--) {
  23873. args[index] = arguments[index];
  23874. }
  23875. if (isCurried) {
  23876. var placeholder = getHolder(wrapper),
  23877. holdersCount = countHolders(args, placeholder);
  23878. }
  23879. if (partials) {
  23880. args = composeArgs(args, partials, holders, isCurried);
  23881. }
  23882. if (partialsRight) {
  23883. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  23884. }
  23885. length -= holdersCount;
  23886. if (isCurried && length < arity) {
  23887. var newHolders = replaceHolders(args, placeholder);
  23888. return createRecurry(
  23889. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  23890. args, newHolders, argPos, ary, arity - length
  23891. );
  23892. }
  23893. var thisBinding = isBind ? thisArg : this,
  23894. fn = isBindKey ? thisBinding[func] : func;
  23895. length = args.length;
  23896. if (argPos) {
  23897. args = reorder(args, argPos);
  23898. } else if (isFlip && length > 1) {
  23899. args.reverse();
  23900. }
  23901. if (isAry && ary < length) {
  23902. args.length = ary;
  23903. }
  23904. if (this && this !== root && this instanceof wrapper) {
  23905. fn = Ctor || createCtor(fn);
  23906. }
  23907. return fn.apply(thisBinding, args);
  23908. }
  23909. return wrapper;
  23910. }
  23911. /**
  23912. * Creates a function like `_.invertBy`.
  23913. *
  23914. * @private
  23915. * @param {Function} setter The function to set accumulator values.
  23916. * @param {Function} toIteratee The function to resolve iteratees.
  23917. * @returns {Function} Returns the new inverter function.
  23918. */
  23919. function createInverter(setter, toIteratee) {
  23920. return function(object, iteratee) {
  23921. return baseInverter(object, setter, toIteratee(iteratee), {});
  23922. };
  23923. }
  23924. /**
  23925. * Creates a function that performs a mathematical operation on two values.
  23926. *
  23927. * @private
  23928. * @param {Function} operator The function to perform the operation.
  23929. * @param {number} [defaultValue] The value used for `undefined` arguments.
  23930. * @returns {Function} Returns the new mathematical operation function.
  23931. */
  23932. function createMathOperation(operator, defaultValue) {
  23933. return function(value, other) {
  23934. var result;
  23935. if (value === undefined && other === undefined) {
  23936. return defaultValue;
  23937. }
  23938. if (value !== undefined) {
  23939. result = value;
  23940. }
  23941. if (other !== undefined) {
  23942. if (result === undefined) {
  23943. return other;
  23944. }
  23945. if (typeof value == 'string' || typeof other == 'string') {
  23946. value = baseToString(value);
  23947. other = baseToString(other);
  23948. } else {
  23949. value = baseToNumber(value);
  23950. other = baseToNumber(other);
  23951. }
  23952. result = operator(value, other);
  23953. }
  23954. return result;
  23955. };
  23956. }
  23957. /**
  23958. * Creates a function like `_.over`.
  23959. *
  23960. * @private
  23961. * @param {Function} arrayFunc The function to iterate over iteratees.
  23962. * @returns {Function} Returns the new over function.
  23963. */
  23964. function createOver(arrayFunc) {
  23965. return flatRest(function(iteratees) {
  23966. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  23967. return baseRest(function(args) {
  23968. var thisArg = this;
  23969. return arrayFunc(iteratees, function(iteratee) {
  23970. return apply(iteratee, thisArg, args);
  23971. });
  23972. });
  23973. });
  23974. }
  23975. /**
  23976. * Creates the padding for `string` based on `length`. The `chars` string
  23977. * is truncated if the number of characters exceeds `length`.
  23978. *
  23979. * @private
  23980. * @param {number} length The padding length.
  23981. * @param {string} [chars=' '] The string used as padding.
  23982. * @returns {string} Returns the padding for `string`.
  23983. */
  23984. function createPadding(length, chars) {
  23985. chars = chars === undefined ? ' ' : baseToString(chars);
  23986. var charsLength = chars.length;
  23987. if (charsLength < 2) {
  23988. return charsLength ? baseRepeat(chars, length) : chars;
  23989. }
  23990. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  23991. return hasUnicode(chars)
  23992. ? castSlice(stringToArray(result), 0, length).join('')
  23993. : result.slice(0, length);
  23994. }
  23995. /**
  23996. * Creates a function that wraps `func` to invoke it with the `this` binding
  23997. * of `thisArg` and `partials` prepended to the arguments it receives.
  23998. *
  23999. * @private
  24000. * @param {Function} func The function to wrap.
  24001. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24002. * @param {*} thisArg The `this` binding of `func`.
  24003. * @param {Array} partials The arguments to prepend to those provided to
  24004. * the new function.
  24005. * @returns {Function} Returns the new wrapped function.
  24006. */
  24007. function createPartial(func, bitmask, thisArg, partials) {
  24008. var isBind = bitmask & WRAP_BIND_FLAG,
  24009. Ctor = createCtor(func);
  24010. function wrapper() {
  24011. var argsIndex = -1,
  24012. argsLength = arguments.length,
  24013. leftIndex = -1,
  24014. leftLength = partials.length,
  24015. args = Array(leftLength + argsLength),
  24016. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  24017. while (++leftIndex < leftLength) {
  24018. args[leftIndex] = partials[leftIndex];
  24019. }
  24020. while (argsLength--) {
  24021. args[leftIndex++] = arguments[++argsIndex];
  24022. }
  24023. return apply(fn, isBind ? thisArg : this, args);
  24024. }
  24025. return wrapper;
  24026. }
  24027. /**
  24028. * Creates a `_.range` or `_.rangeRight` function.
  24029. *
  24030. * @private
  24031. * @param {boolean} [fromRight] Specify iterating from right to left.
  24032. * @returns {Function} Returns the new range function.
  24033. */
  24034. function createRange(fromRight) {
  24035. return function(start, end, step) {
  24036. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  24037. end = step = undefined;
  24038. }
  24039. // Ensure the sign of `-0` is preserved.
  24040. start = toFinite(start);
  24041. if (end === undefined) {
  24042. end = start;
  24043. start = 0;
  24044. } else {
  24045. end = toFinite(end);
  24046. }
  24047. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  24048. return baseRange(start, end, step, fromRight);
  24049. };
  24050. }
  24051. /**
  24052. * Creates a function that performs a relational operation on two values.
  24053. *
  24054. * @private
  24055. * @param {Function} operator The function to perform the operation.
  24056. * @returns {Function} Returns the new relational operation function.
  24057. */
  24058. function createRelationalOperation(operator) {
  24059. return function(value, other) {
  24060. if (!(typeof value == 'string' && typeof other == 'string')) {
  24061. value = toNumber(value);
  24062. other = toNumber(other);
  24063. }
  24064. return operator(value, other);
  24065. };
  24066. }
  24067. /**
  24068. * Creates a function that wraps `func` to continue currying.
  24069. *
  24070. * @private
  24071. * @param {Function} func The function to wrap.
  24072. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24073. * @param {Function} wrapFunc The function to create the `func` wrapper.
  24074. * @param {*} placeholder The placeholder value.
  24075. * @param {*} [thisArg] The `this` binding of `func`.
  24076. * @param {Array} [partials] The arguments to prepend to those provided to
  24077. * the new function.
  24078. * @param {Array} [holders] The `partials` placeholder indexes.
  24079. * @param {Array} [argPos] The argument positions of the new function.
  24080. * @param {number} [ary] The arity cap of `func`.
  24081. * @param {number} [arity] The arity of `func`.
  24082. * @returns {Function} Returns the new wrapped function.
  24083. */
  24084. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  24085. var isCurry = bitmask & WRAP_CURRY_FLAG,
  24086. newHolders = isCurry ? holders : undefined,
  24087. newHoldersRight = isCurry ? undefined : holders,
  24088. newPartials = isCurry ? partials : undefined,
  24089. newPartialsRight = isCurry ? undefined : partials;
  24090. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  24091. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  24092. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  24093. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  24094. }
  24095. var newData = [
  24096. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  24097. newHoldersRight, argPos, ary, arity
  24098. ];
  24099. var result = wrapFunc.apply(undefined, newData);
  24100. if (isLaziable(func)) {
  24101. setData(result, newData);
  24102. }
  24103. result.placeholder = placeholder;
  24104. return setWrapToString(result, func, bitmask);
  24105. }
  24106. /**
  24107. * Creates a function like `_.round`.
  24108. *
  24109. * @private
  24110. * @param {string} methodName The name of the `Math` method to use when rounding.
  24111. * @returns {Function} Returns the new round function.
  24112. */
  24113. function createRound(methodName) {
  24114. var func = Math[methodName];
  24115. return function(number, precision) {
  24116. number = toNumber(number);
  24117. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  24118. if (precision && nativeIsFinite(number)) {
  24119. // Shift with exponential notation to avoid floating-point issues.
  24120. // See [MDN](https://mdn.io/round#Examples) for more details.
  24121. var pair = (toString(number) + 'e').split('e'),
  24122. value = func(pair[0] + 'e' + (+pair[1] + precision));
  24123. pair = (toString(value) + 'e').split('e');
  24124. return +(pair[0] + 'e' + (+pair[1] - precision));
  24125. }
  24126. return func(number);
  24127. };
  24128. }
  24129. /**
  24130. * Creates a set object of `values`.
  24131. *
  24132. * @private
  24133. * @param {Array} values The values to add to the set.
  24134. * @returns {Object} Returns the new set.
  24135. */
  24136. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  24137. return new Set(values);
  24138. };
  24139. /**
  24140. * Creates a `_.toPairs` or `_.toPairsIn` function.
  24141. *
  24142. * @private
  24143. * @param {Function} keysFunc The function to get the keys of a given object.
  24144. * @returns {Function} Returns the new pairs function.
  24145. */
  24146. function createToPairs(keysFunc) {
  24147. return function(object) {
  24148. var tag = getTag(object);
  24149. if (tag == mapTag) {
  24150. return mapToArray(object);
  24151. }
  24152. if (tag == setTag) {
  24153. return setToPairs(object);
  24154. }
  24155. return baseToPairs(object, keysFunc(object));
  24156. };
  24157. }
  24158. /**
  24159. * Creates a function that either curries or invokes `func` with optional
  24160. * `this` binding and partially applied arguments.
  24161. *
  24162. * @private
  24163. * @param {Function|string} func The function or method name to wrap.
  24164. * @param {number} bitmask The bitmask flags.
  24165. * 1 - `_.bind`
  24166. * 2 - `_.bindKey`
  24167. * 4 - `_.curry` or `_.curryRight` of a bound function
  24168. * 8 - `_.curry`
  24169. * 16 - `_.curryRight`
  24170. * 32 - `_.partial`
  24171. * 64 - `_.partialRight`
  24172. * 128 - `_.rearg`
  24173. * 256 - `_.ary`
  24174. * 512 - `_.flip`
  24175. * @param {*} [thisArg] The `this` binding of `func`.
  24176. * @param {Array} [partials] The arguments to be partially applied.
  24177. * @param {Array} [holders] The `partials` placeholder indexes.
  24178. * @param {Array} [argPos] The argument positions of the new function.
  24179. * @param {number} [ary] The arity cap of `func`.
  24180. * @param {number} [arity] The arity of `func`.
  24181. * @returns {Function} Returns the new wrapped function.
  24182. */
  24183. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  24184. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  24185. if (!isBindKey && typeof func != 'function') {
  24186. throw new TypeError(FUNC_ERROR_TEXT);
  24187. }
  24188. var length = partials ? partials.length : 0;
  24189. if (!length) {
  24190. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  24191. partials = holders = undefined;
  24192. }
  24193. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  24194. arity = arity === undefined ? arity : toInteger(arity);
  24195. length -= holders ? holders.length : 0;
  24196. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  24197. var partialsRight = partials,
  24198. holdersRight = holders;
  24199. partials = holders = undefined;
  24200. }
  24201. var data = isBindKey ? undefined : getData(func);
  24202. var newData = [
  24203. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  24204. argPos, ary, arity
  24205. ];
  24206. if (data) {
  24207. mergeData(newData, data);
  24208. }
  24209. func = newData[0];
  24210. bitmask = newData[1];
  24211. thisArg = newData[2];
  24212. partials = newData[3];
  24213. holders = newData[4];
  24214. arity = newData[9] = newData[9] === undefined
  24215. ? (isBindKey ? 0 : func.length)
  24216. : nativeMax(newData[9] - length, 0);
  24217. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  24218. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  24219. }
  24220. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  24221. var result = createBind(func, bitmask, thisArg);
  24222. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  24223. result = createCurry(func, bitmask, arity);
  24224. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  24225. result = createPartial(func, bitmask, thisArg, partials);
  24226. } else {
  24227. result = createHybrid.apply(undefined, newData);
  24228. }
  24229. var setter = data ? baseSetData : setData;
  24230. return setWrapToString(setter(result, newData), func, bitmask);
  24231. }
  24232. /**
  24233. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  24234. * of source objects to the destination object for all destination properties
  24235. * that resolve to `undefined`.
  24236. *
  24237. * @private
  24238. * @param {*} objValue The destination value.
  24239. * @param {*} srcValue The source value.
  24240. * @param {string} key The key of the property to assign.
  24241. * @param {Object} object The parent object of `objValue`.
  24242. * @returns {*} Returns the value to assign.
  24243. */
  24244. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  24245. if (objValue === undefined ||
  24246. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  24247. return srcValue;
  24248. }
  24249. return objValue;
  24250. }
  24251. /**
  24252. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  24253. * objects into destination objects that are passed thru.
  24254. *
  24255. * @private
  24256. * @param {*} objValue The destination value.
  24257. * @param {*} srcValue The source value.
  24258. * @param {string} key The key of the property to merge.
  24259. * @param {Object} object The parent object of `objValue`.
  24260. * @param {Object} source The parent object of `srcValue`.
  24261. * @param {Object} [stack] Tracks traversed source values and their merged
  24262. * counterparts.
  24263. * @returns {*} Returns the value to assign.
  24264. */
  24265. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  24266. if (isObject(objValue) && isObject(srcValue)) {
  24267. // Recursively merge objects and arrays (susceptible to call stack limits).
  24268. stack.set(srcValue, objValue);
  24269. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  24270. stack['delete'](srcValue);
  24271. }
  24272. return objValue;
  24273. }
  24274. /**
  24275. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  24276. * objects.
  24277. *
  24278. * @private
  24279. * @param {*} value The value to inspect.
  24280. * @param {string} key The key of the property to inspect.
  24281. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  24282. */
  24283. function customOmitClone(value) {
  24284. return isPlainObject(value) ? undefined : value;
  24285. }
  24286. /**
  24287. * A specialized version of `baseIsEqualDeep` for arrays with support for
  24288. * partial deep comparisons.
  24289. *
  24290. * @private
  24291. * @param {Array} array The array to compare.
  24292. * @param {Array} other The other array to compare.
  24293. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  24294. * @param {Function} customizer The function to customize comparisons.
  24295. * @param {Function} equalFunc The function to determine equivalents of values.
  24296. * @param {Object} stack Tracks traversed `array` and `other` objects.
  24297. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  24298. */
  24299. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  24300. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  24301. arrLength = array.length,
  24302. othLength = other.length;
  24303. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  24304. return false;
  24305. }
  24306. // Assume cyclic values are equal.
  24307. var stacked = stack.get(array);
  24308. if (stacked && stack.get(other)) {
  24309. return stacked == other;
  24310. }
  24311. var index = -1,
  24312. result = true,
  24313. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  24314. stack.set(array, other);
  24315. stack.set(other, array);
  24316. // Ignore non-index properties.
  24317. while (++index < arrLength) {
  24318. var arrValue = array[index],
  24319. othValue = other[index];
  24320. if (customizer) {
  24321. var compared = isPartial
  24322. ? customizer(othValue, arrValue, index, other, array, stack)
  24323. : customizer(arrValue, othValue, index, array, other, stack);
  24324. }
  24325. if (compared !== undefined) {
  24326. if (compared) {
  24327. continue;
  24328. }
  24329. result = false;
  24330. break;
  24331. }
  24332. // Recursively compare arrays (susceptible to call stack limits).
  24333. if (seen) {
  24334. if (!arraySome(other, function(othValue, othIndex) {
  24335. if (!cacheHas(seen, othIndex) &&
  24336. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  24337. return seen.push(othIndex);
  24338. }
  24339. })) {
  24340. result = false;
  24341. break;
  24342. }
  24343. } else if (!(
  24344. arrValue === othValue ||
  24345. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  24346. )) {
  24347. result = false;
  24348. break;
  24349. }
  24350. }
  24351. stack['delete'](array);
  24352. stack['delete'](other);
  24353. return result;
  24354. }
  24355. /**
  24356. * A specialized version of `baseIsEqualDeep` for comparing objects of
  24357. * the same `toStringTag`.
  24358. *
  24359. * **Note:** This function only supports comparing values with tags of
  24360. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  24361. *
  24362. * @private
  24363. * @param {Object} object The object to compare.
  24364. * @param {Object} other The other object to compare.
  24365. * @param {string} tag The `toStringTag` of the objects to compare.
  24366. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  24367. * @param {Function} customizer The function to customize comparisons.
  24368. * @param {Function} equalFunc The function to determine equivalents of values.
  24369. * @param {Object} stack Tracks traversed `object` and `other` objects.
  24370. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  24371. */
  24372. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  24373. switch (tag) {
  24374. case dataViewTag:
  24375. if ((object.byteLength != other.byteLength) ||
  24376. (object.byteOffset != other.byteOffset)) {
  24377. return false;
  24378. }
  24379. object = object.buffer;
  24380. other = other.buffer;
  24381. case arrayBufferTag:
  24382. if ((object.byteLength != other.byteLength) ||
  24383. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  24384. return false;
  24385. }
  24386. return true;
  24387. case boolTag:
  24388. case dateTag:
  24389. case numberTag:
  24390. // Coerce booleans to `1` or `0` and dates to milliseconds.
  24391. // Invalid dates are coerced to `NaN`.
  24392. return eq(+object, +other);
  24393. case errorTag:
  24394. return object.name == other.name && object.message == other.message;
  24395. case regexpTag:
  24396. case stringTag:
  24397. // Coerce regexes to strings and treat strings, primitives and objects,
  24398. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  24399. // for more details.
  24400. return object == (other + '');
  24401. case mapTag:
  24402. var convert = mapToArray;
  24403. case setTag:
  24404. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  24405. convert || (convert = setToArray);
  24406. if (object.size != other.size && !isPartial) {
  24407. return false;
  24408. }
  24409. // Assume cyclic values are equal.
  24410. var stacked = stack.get(object);
  24411. if (stacked) {
  24412. return stacked == other;
  24413. }
  24414. bitmask |= COMPARE_UNORDERED_FLAG;
  24415. // Recursively compare objects (susceptible to call stack limits).
  24416. stack.set(object, other);
  24417. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  24418. stack['delete'](object);
  24419. return result;
  24420. case symbolTag:
  24421. if (symbolValueOf) {
  24422. return symbolValueOf.call(object) == symbolValueOf.call(other);
  24423. }
  24424. }
  24425. return false;
  24426. }
  24427. /**
  24428. * A specialized version of `baseIsEqualDeep` for objects with support for
  24429. * partial deep comparisons.
  24430. *
  24431. * @private
  24432. * @param {Object} object The object to compare.
  24433. * @param {Object} other The other object to compare.
  24434. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  24435. * @param {Function} customizer The function to customize comparisons.
  24436. * @param {Function} equalFunc The function to determine equivalents of values.
  24437. * @param {Object} stack Tracks traversed `object` and `other` objects.
  24438. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  24439. */
  24440. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  24441. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  24442. objProps = getAllKeys(object),
  24443. objLength = objProps.length,
  24444. othProps = getAllKeys(other),
  24445. othLength = othProps.length;
  24446. if (objLength != othLength && !isPartial) {
  24447. return false;
  24448. }
  24449. var index = objLength;
  24450. while (index--) {
  24451. var key = objProps[index];
  24452. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  24453. return false;
  24454. }
  24455. }
  24456. // Assume cyclic values are equal.
  24457. var stacked = stack.get(object);
  24458. if (stacked && stack.get(other)) {
  24459. return stacked == other;
  24460. }
  24461. var result = true;
  24462. stack.set(object, other);
  24463. stack.set(other, object);
  24464. var skipCtor = isPartial;
  24465. while (++index < objLength) {
  24466. key = objProps[index];
  24467. var objValue = object[key],
  24468. othValue = other[key];
  24469. if (customizer) {
  24470. var compared = isPartial
  24471. ? customizer(othValue, objValue, key, other, object, stack)
  24472. : customizer(objValue, othValue, key, object, other, stack);
  24473. }
  24474. // Recursively compare objects (susceptible to call stack limits).
  24475. if (!(compared === undefined
  24476. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  24477. : compared
  24478. )) {
  24479. result = false;
  24480. break;
  24481. }
  24482. skipCtor || (skipCtor = key == 'constructor');
  24483. }
  24484. if (result && !skipCtor) {
  24485. var objCtor = object.constructor,
  24486. othCtor = other.constructor;
  24487. // Non `Object` object instances with different constructors are not equal.
  24488. if (objCtor != othCtor &&
  24489. ('constructor' in object && 'constructor' in other) &&
  24490. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  24491. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  24492. result = false;
  24493. }
  24494. }
  24495. stack['delete'](object);
  24496. stack['delete'](other);
  24497. return result;
  24498. }
  24499. /**
  24500. * A specialized version of `baseRest` which flattens the rest array.
  24501. *
  24502. * @private
  24503. * @param {Function} func The function to apply a rest parameter to.
  24504. * @returns {Function} Returns the new function.
  24505. */
  24506. function flatRest(func) {
  24507. return setToString(overRest(func, undefined, flatten), func + '');
  24508. }
  24509. /**
  24510. * Creates an array of own enumerable property names and symbols of `object`.
  24511. *
  24512. * @private
  24513. * @param {Object} object The object to query.
  24514. * @returns {Array} Returns the array of property names and symbols.
  24515. */
  24516. function getAllKeys(object) {
  24517. return baseGetAllKeys(object, keys, getSymbols);
  24518. }
  24519. /**
  24520. * Creates an array of own and inherited enumerable property names and
  24521. * symbols of `object`.
  24522. *
  24523. * @private
  24524. * @param {Object} object The object to query.
  24525. * @returns {Array} Returns the array of property names and symbols.
  24526. */
  24527. function getAllKeysIn(object) {
  24528. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  24529. }
  24530. /**
  24531. * Gets metadata for `func`.
  24532. *
  24533. * @private
  24534. * @param {Function} func The function to query.
  24535. * @returns {*} Returns the metadata for `func`.
  24536. */
  24537. var getData = !metaMap ? noop : function(func) {
  24538. return metaMap.get(func);
  24539. };
  24540. /**
  24541. * Gets the name of `func`.
  24542. *
  24543. * @private
  24544. * @param {Function} func The function to query.
  24545. * @returns {string} Returns the function name.
  24546. */
  24547. function getFuncName(func) {
  24548. var result = (func.name + ''),
  24549. array = realNames[result],
  24550. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  24551. while (length--) {
  24552. var data = array[length],
  24553. otherFunc = data.func;
  24554. if (otherFunc == null || otherFunc == func) {
  24555. return data.name;
  24556. }
  24557. }
  24558. return result;
  24559. }
  24560. /**
  24561. * Gets the argument placeholder value for `func`.
  24562. *
  24563. * @private
  24564. * @param {Function} func The function to inspect.
  24565. * @returns {*} Returns the placeholder value.
  24566. */
  24567. function getHolder(func) {
  24568. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  24569. return object.placeholder;
  24570. }
  24571. /**
  24572. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  24573. * this function returns the custom method, otherwise it returns `baseIteratee`.
  24574. * If arguments are provided, the chosen function is invoked with them and
  24575. * its result is returned.
  24576. *
  24577. * @private
  24578. * @param {*} [value] The value to convert to an iteratee.
  24579. * @param {number} [arity] The arity of the created iteratee.
  24580. * @returns {Function} Returns the chosen function or its result.
  24581. */
  24582. function getIteratee() {
  24583. var result = lodash.iteratee || iteratee;
  24584. result = result === iteratee ? baseIteratee : result;
  24585. return arguments.length ? result(arguments[0], arguments[1]) : result;
  24586. }
  24587. /**
  24588. * Gets the data for `map`.
  24589. *
  24590. * @private
  24591. * @param {Object} map The map to query.
  24592. * @param {string} key The reference key.
  24593. * @returns {*} Returns the map data.
  24594. */
  24595. function getMapData(map, key) {
  24596. var data = map.__data__;
  24597. return isKeyable(key)
  24598. ? data[typeof key == 'string' ? 'string' : 'hash']
  24599. : data.map;
  24600. }
  24601. /**
  24602. * Gets the property names, values, and compare flags of `object`.
  24603. *
  24604. * @private
  24605. * @param {Object} object The object to query.
  24606. * @returns {Array} Returns the match data of `object`.
  24607. */
  24608. function getMatchData(object) {
  24609. var result = keys(object),
  24610. length = result.length;
  24611. while (length--) {
  24612. var key = result[length],
  24613. value = object[key];
  24614. result[length] = [key, value, isStrictComparable(value)];
  24615. }
  24616. return result;
  24617. }
  24618. /**
  24619. * Gets the native function at `key` of `object`.
  24620. *
  24621. * @private
  24622. * @param {Object} object The object to query.
  24623. * @param {string} key The key of the method to get.
  24624. * @returns {*} Returns the function if it's native, else `undefined`.
  24625. */
  24626. function getNative(object, key) {
  24627. var value = getValue(object, key);
  24628. return baseIsNative(value) ? value : undefined;
  24629. }
  24630. /**
  24631. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  24632. *
  24633. * @private
  24634. * @param {*} value The value to query.
  24635. * @returns {string} Returns the raw `toStringTag`.
  24636. */
  24637. function getRawTag(value) {
  24638. var isOwn = hasOwnProperty.call(value, symToStringTag),
  24639. tag = value[symToStringTag];
  24640. try {
  24641. value[symToStringTag] = undefined;
  24642. var unmasked = true;
  24643. } catch (e) {}
  24644. var result = nativeObjectToString.call(value);
  24645. if (unmasked) {
  24646. if (isOwn) {
  24647. value[symToStringTag] = tag;
  24648. } else {
  24649. delete value[symToStringTag];
  24650. }
  24651. }
  24652. return result;
  24653. }
  24654. /**
  24655. * Creates an array of the own enumerable symbols of `object`.
  24656. *
  24657. * @private
  24658. * @param {Object} object The object to query.
  24659. * @returns {Array} Returns the array of symbols.
  24660. */
  24661. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  24662. if (object == null) {
  24663. return [];
  24664. }
  24665. object = Object(object);
  24666. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  24667. return propertyIsEnumerable.call(object, symbol);
  24668. });
  24669. };
  24670. /**
  24671. * Creates an array of the own and inherited enumerable symbols of `object`.
  24672. *
  24673. * @private
  24674. * @param {Object} object The object to query.
  24675. * @returns {Array} Returns the array of symbols.
  24676. */
  24677. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  24678. var result = [];
  24679. while (object) {
  24680. arrayPush(result, getSymbols(object));
  24681. object = getPrototype(object);
  24682. }
  24683. return result;
  24684. };
  24685. /**
  24686. * Gets the `toStringTag` of `value`.
  24687. *
  24688. * @private
  24689. * @param {*} value The value to query.
  24690. * @returns {string} Returns the `toStringTag`.
  24691. */
  24692. var getTag = baseGetTag;
  24693. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  24694. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  24695. (Map && getTag(new Map) != mapTag) ||
  24696. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  24697. (Set && getTag(new Set) != setTag) ||
  24698. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  24699. getTag = function(value) {
  24700. var result = baseGetTag(value),
  24701. Ctor = result == objectTag ? value.constructor : undefined,
  24702. ctorString = Ctor ? toSource(Ctor) : '';
  24703. if (ctorString) {
  24704. switch (ctorString) {
  24705. case dataViewCtorString: return dataViewTag;
  24706. case mapCtorString: return mapTag;
  24707. case promiseCtorString: return promiseTag;
  24708. case setCtorString: return setTag;
  24709. case weakMapCtorString: return weakMapTag;
  24710. }
  24711. }
  24712. return result;
  24713. };
  24714. }
  24715. /**
  24716. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  24717. *
  24718. * @private
  24719. * @param {number} start The start of the view.
  24720. * @param {number} end The end of the view.
  24721. * @param {Array} transforms The transformations to apply to the view.
  24722. * @returns {Object} Returns an object containing the `start` and `end`
  24723. * positions of the view.
  24724. */
  24725. function getView(start, end, transforms) {
  24726. var index = -1,
  24727. length = transforms.length;
  24728. while (++index < length) {
  24729. var data = transforms[index],
  24730. size = data.size;
  24731. switch (data.type) {
  24732. case 'drop': start += size; break;
  24733. case 'dropRight': end -= size; break;
  24734. case 'take': end = nativeMin(end, start + size); break;
  24735. case 'takeRight': start = nativeMax(start, end - size); break;
  24736. }
  24737. }
  24738. return { 'start': start, 'end': end };
  24739. }
  24740. /**
  24741. * Extracts wrapper details from the `source` body comment.
  24742. *
  24743. * @private
  24744. * @param {string} source The source to inspect.
  24745. * @returns {Array} Returns the wrapper details.
  24746. */
  24747. function getWrapDetails(source) {
  24748. var match = source.match(reWrapDetails);
  24749. return match ? match[1].split(reSplitDetails) : [];
  24750. }
  24751. /**
  24752. * Checks if `path` exists on `object`.
  24753. *
  24754. * @private
  24755. * @param {Object} object The object to query.
  24756. * @param {Array|string} path The path to check.
  24757. * @param {Function} hasFunc The function to check properties.
  24758. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  24759. */
  24760. function hasPath(object, path, hasFunc) {
  24761. path = castPath(path, object);
  24762. var index = -1,
  24763. length = path.length,
  24764. result = false;
  24765. while (++index < length) {
  24766. var key = toKey(path[index]);
  24767. if (!(result = object != null && hasFunc(object, key))) {
  24768. break;
  24769. }
  24770. object = object[key];
  24771. }
  24772. if (result || ++index != length) {
  24773. return result;
  24774. }
  24775. length = object == null ? 0 : object.length;
  24776. return !!length && isLength(length) && isIndex(key, length) &&
  24777. (isArray(object) || isArguments(object));
  24778. }
  24779. /**
  24780. * Initializes an array clone.
  24781. *
  24782. * @private
  24783. * @param {Array} array The array to clone.
  24784. * @returns {Array} Returns the initialized clone.
  24785. */
  24786. function initCloneArray(array) {
  24787. var length = array.length,
  24788. result = new array.constructor(length);
  24789. // Add properties assigned by `RegExp#exec`.
  24790. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  24791. result.index = array.index;
  24792. result.input = array.input;
  24793. }
  24794. return result;
  24795. }
  24796. /**
  24797. * Initializes an object clone.
  24798. *
  24799. * @private
  24800. * @param {Object} object The object to clone.
  24801. * @returns {Object} Returns the initialized clone.
  24802. */
  24803. function initCloneObject(object) {
  24804. return (typeof object.constructor == 'function' && !isPrototype(object))
  24805. ? baseCreate(getPrototype(object))
  24806. : {};
  24807. }
  24808. /**
  24809. * Initializes an object clone based on its `toStringTag`.
  24810. *
  24811. * **Note:** This function only supports cloning values with tags of
  24812. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  24813. *
  24814. * @private
  24815. * @param {Object} object The object to clone.
  24816. * @param {string} tag The `toStringTag` of the object to clone.
  24817. * @param {boolean} [isDeep] Specify a deep clone.
  24818. * @returns {Object} Returns the initialized clone.
  24819. */
  24820. function initCloneByTag(object, tag, isDeep) {
  24821. var Ctor = object.constructor;
  24822. switch (tag) {
  24823. case arrayBufferTag:
  24824. return cloneArrayBuffer(object);
  24825. case boolTag:
  24826. case dateTag:
  24827. return new Ctor(+object);
  24828. case dataViewTag:
  24829. return cloneDataView(object, isDeep);
  24830. case float32Tag: case float64Tag:
  24831. case int8Tag: case int16Tag: case int32Tag:
  24832. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  24833. return cloneTypedArray(object, isDeep);
  24834. case mapTag:
  24835. return new Ctor;
  24836. case numberTag:
  24837. case stringTag:
  24838. return new Ctor(object);
  24839. case regexpTag:
  24840. return cloneRegExp(object);
  24841. case setTag:
  24842. return new Ctor;
  24843. case symbolTag:
  24844. return cloneSymbol(object);
  24845. }
  24846. }
  24847. /**
  24848. * Inserts wrapper `details` in a comment at the top of the `source` body.
  24849. *
  24850. * @private
  24851. * @param {string} source The source to modify.
  24852. * @returns {Array} details The details to insert.
  24853. * @returns {string} Returns the modified source.
  24854. */
  24855. function insertWrapDetails(source, details) {
  24856. var length = details.length;
  24857. if (!length) {
  24858. return source;
  24859. }
  24860. var lastIndex = length - 1;
  24861. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  24862. details = details.join(length > 2 ? ', ' : ' ');
  24863. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  24864. }
  24865. /**
  24866. * Checks if `value` is a flattenable `arguments` object or array.
  24867. *
  24868. * @private
  24869. * @param {*} value The value to check.
  24870. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  24871. */
  24872. function isFlattenable(value) {
  24873. return isArray(value) || isArguments(value) ||
  24874. !!(spreadableSymbol && value && value[spreadableSymbol]);
  24875. }
  24876. /**
  24877. * Checks if `value` is a valid array-like index.
  24878. *
  24879. * @private
  24880. * @param {*} value The value to check.
  24881. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  24882. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  24883. */
  24884. function isIndex(value, length) {
  24885. var type = typeof value;
  24886. length = length == null ? MAX_SAFE_INTEGER : length;
  24887. return !!length &&
  24888. (type == 'number' ||
  24889. (type != 'symbol' && reIsUint.test(value))) &&
  24890. (value > -1 && value % 1 == 0 && value < length);
  24891. }
  24892. /**
  24893. * Checks if the given arguments are from an iteratee call.
  24894. *
  24895. * @private
  24896. * @param {*} value The potential iteratee value argument.
  24897. * @param {*} index The potential iteratee index or key argument.
  24898. * @param {*} object The potential iteratee object argument.
  24899. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  24900. * else `false`.
  24901. */
  24902. function isIterateeCall(value, index, object) {
  24903. if (!isObject(object)) {
  24904. return false;
  24905. }
  24906. var type = typeof index;
  24907. if (type == 'number'
  24908. ? (isArrayLike(object) && isIndex(index, object.length))
  24909. : (type == 'string' && index in object)
  24910. ) {
  24911. return eq(object[index], value);
  24912. }
  24913. return false;
  24914. }
  24915. /**
  24916. * Checks if `value` is a property name and not a property path.
  24917. *
  24918. * @private
  24919. * @param {*} value The value to check.
  24920. * @param {Object} [object] The object to query keys on.
  24921. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  24922. */
  24923. function isKey(value, object) {
  24924. if (isArray(value)) {
  24925. return false;
  24926. }
  24927. var type = typeof value;
  24928. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  24929. value == null || isSymbol(value)) {
  24930. return true;
  24931. }
  24932. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  24933. (object != null && value in Object(object));
  24934. }
  24935. /**
  24936. * Checks if `value` is suitable for use as unique object key.
  24937. *
  24938. * @private
  24939. * @param {*} value The value to check.
  24940. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  24941. */
  24942. function isKeyable(value) {
  24943. var type = typeof value;
  24944. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  24945. ? (value !== '__proto__')
  24946. : (value === null);
  24947. }
  24948. /**
  24949. * Checks if `func` has a lazy counterpart.
  24950. *
  24951. * @private
  24952. * @param {Function} func The function to check.
  24953. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  24954. * else `false`.
  24955. */
  24956. function isLaziable(func) {
  24957. var funcName = getFuncName(func),
  24958. other = lodash[funcName];
  24959. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  24960. return false;
  24961. }
  24962. if (func === other) {
  24963. return true;
  24964. }
  24965. var data = getData(other);
  24966. return !!data && func === data[0];
  24967. }
  24968. /**
  24969. * Checks if `func` has its source masked.
  24970. *
  24971. * @private
  24972. * @param {Function} func The function to check.
  24973. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  24974. */
  24975. function isMasked(func) {
  24976. return !!maskSrcKey && (maskSrcKey in func);
  24977. }
  24978. /**
  24979. * Checks if `func` is capable of being masked.
  24980. *
  24981. * @private
  24982. * @param {*} value The value to check.
  24983. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  24984. */
  24985. var isMaskable = coreJsData ? isFunction : stubFalse;
  24986. /**
  24987. * Checks if `value` is likely a prototype object.
  24988. *
  24989. * @private
  24990. * @param {*} value The value to check.
  24991. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  24992. */
  24993. function isPrototype(value) {
  24994. var Ctor = value && value.constructor,
  24995. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  24996. return value === proto;
  24997. }
  24998. /**
  24999. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  25000. *
  25001. * @private
  25002. * @param {*} value The value to check.
  25003. * @returns {boolean} Returns `true` if `value` if suitable for strict
  25004. * equality comparisons, else `false`.
  25005. */
  25006. function isStrictComparable(value) {
  25007. return value === value && !isObject(value);
  25008. }
  25009. /**
  25010. * A specialized version of `matchesProperty` for source values suitable
  25011. * for strict equality comparisons, i.e. `===`.
  25012. *
  25013. * @private
  25014. * @param {string} key The key of the property to get.
  25015. * @param {*} srcValue The value to match.
  25016. * @returns {Function} Returns the new spec function.
  25017. */
  25018. function matchesStrictComparable(key, srcValue) {
  25019. return function(object) {
  25020. if (object == null) {
  25021. return false;
  25022. }
  25023. return object[key] === srcValue &&
  25024. (srcValue !== undefined || (key in Object(object)));
  25025. };
  25026. }
  25027. /**
  25028. * A specialized version of `_.memoize` which clears the memoized function's
  25029. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  25030. *
  25031. * @private
  25032. * @param {Function} func The function to have its output memoized.
  25033. * @returns {Function} Returns the new memoized function.
  25034. */
  25035. function memoizeCapped(func) {
  25036. var result = memoize(func, function(key) {
  25037. if (cache.size === MAX_MEMOIZE_SIZE) {
  25038. cache.clear();
  25039. }
  25040. return key;
  25041. });
  25042. var cache = result.cache;
  25043. return result;
  25044. }
  25045. /**
  25046. * Merges the function metadata of `source` into `data`.
  25047. *
  25048. * Merging metadata reduces the number of wrappers used to invoke a function.
  25049. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  25050. * may be applied regardless of execution order. Methods like `_.ary` and
  25051. * `_.rearg` modify function arguments, making the order in which they are
  25052. * executed important, preventing the merging of metadata. However, we make
  25053. * an exception for a safe combined case where curried functions have `_.ary`
  25054. * and or `_.rearg` applied.
  25055. *
  25056. * @private
  25057. * @param {Array} data The destination metadata.
  25058. * @param {Array} source The source metadata.
  25059. * @returns {Array} Returns `data`.
  25060. */
  25061. function mergeData(data, source) {
  25062. var bitmask = data[1],
  25063. srcBitmask = source[1],
  25064. newBitmask = bitmask | srcBitmask,
  25065. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  25066. var isCombo =
  25067. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  25068. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  25069. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  25070. // Exit early if metadata can't be merged.
  25071. if (!(isCommon || isCombo)) {
  25072. return data;
  25073. }
  25074. // Use source `thisArg` if available.
  25075. if (srcBitmask & WRAP_BIND_FLAG) {
  25076. data[2] = source[2];
  25077. // Set when currying a bound function.
  25078. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  25079. }
  25080. // Compose partial arguments.
  25081. var value = source[3];
  25082. if (value) {
  25083. var partials = data[3];
  25084. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  25085. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  25086. }
  25087. // Compose partial right arguments.
  25088. value = source[5];
  25089. if (value) {
  25090. partials = data[5];
  25091. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  25092. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  25093. }
  25094. // Use source `argPos` if available.
  25095. value = source[7];
  25096. if (value) {
  25097. data[7] = value;
  25098. }
  25099. // Use source `ary` if it's smaller.
  25100. if (srcBitmask & WRAP_ARY_FLAG) {
  25101. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  25102. }
  25103. // Use source `arity` if one is not provided.
  25104. if (data[9] == null) {
  25105. data[9] = source[9];
  25106. }
  25107. // Use source `func` and merge bitmasks.
  25108. data[0] = source[0];
  25109. data[1] = newBitmask;
  25110. return data;
  25111. }
  25112. /**
  25113. * This function is like
  25114. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  25115. * except that it includes inherited enumerable properties.
  25116. *
  25117. * @private
  25118. * @param {Object} object The object to query.
  25119. * @returns {Array} Returns the array of property names.
  25120. */
  25121. function nativeKeysIn(object) {
  25122. var result = [];
  25123. if (object != null) {
  25124. for (var key in Object(object)) {
  25125. result.push(key);
  25126. }
  25127. }
  25128. return result;
  25129. }
  25130. /**
  25131. * Converts `value` to a string using `Object.prototype.toString`.
  25132. *
  25133. * @private
  25134. * @param {*} value The value to convert.
  25135. * @returns {string} Returns the converted string.
  25136. */
  25137. function objectToString(value) {
  25138. return nativeObjectToString.call(value);
  25139. }
  25140. /**
  25141. * A specialized version of `baseRest` which transforms the rest array.
  25142. *
  25143. * @private
  25144. * @param {Function} func The function to apply a rest parameter to.
  25145. * @param {number} [start=func.length-1] The start position of the rest parameter.
  25146. * @param {Function} transform The rest array transform.
  25147. * @returns {Function} Returns the new function.
  25148. */
  25149. function overRest(func, start, transform) {
  25150. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  25151. return function() {
  25152. var args = arguments,
  25153. index = -1,
  25154. length = nativeMax(args.length - start, 0),
  25155. array = Array(length);
  25156. while (++index < length) {
  25157. array[index] = args[start + index];
  25158. }
  25159. index = -1;
  25160. var otherArgs = Array(start + 1);
  25161. while (++index < start) {
  25162. otherArgs[index] = args[index];
  25163. }
  25164. otherArgs[start] = transform(array);
  25165. return apply(func, this, otherArgs);
  25166. };
  25167. }
  25168. /**
  25169. * Gets the parent value at `path` of `object`.
  25170. *
  25171. * @private
  25172. * @param {Object} object The object to query.
  25173. * @param {Array} path The path to get the parent value of.
  25174. * @returns {*} Returns the parent value.
  25175. */
  25176. function parent(object, path) {
  25177. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  25178. }
  25179. /**
  25180. * Reorder `array` according to the specified indexes where the element at
  25181. * the first index is assigned as the first element, the element at
  25182. * the second index is assigned as the second element, and so on.
  25183. *
  25184. * @private
  25185. * @param {Array} array The array to reorder.
  25186. * @param {Array} indexes The arranged array indexes.
  25187. * @returns {Array} Returns `array`.
  25188. */
  25189. function reorder(array, indexes) {
  25190. var arrLength = array.length,
  25191. length = nativeMin(indexes.length, arrLength),
  25192. oldArray = copyArray(array);
  25193. while (length--) {
  25194. var index = indexes[length];
  25195. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  25196. }
  25197. return array;
  25198. }
  25199. /**
  25200. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  25201. *
  25202. * @private
  25203. * @param {Object} object The object to query.
  25204. * @param {string} key The key of the property to get.
  25205. * @returns {*} Returns the property value.
  25206. */
  25207. function safeGet(object, key) {
  25208. if (key === 'constructor' && typeof object[key] === 'function') {
  25209. return;
  25210. }
  25211. if (key == '__proto__') {
  25212. return;
  25213. }
  25214. return object[key];
  25215. }
  25216. /**
  25217. * Sets metadata for `func`.
  25218. *
  25219. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  25220. * period of time, it will trip its breaker and transition to an identity
  25221. * function to avoid garbage collection pauses in V8. See
  25222. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  25223. * for more details.
  25224. *
  25225. * @private
  25226. * @param {Function} func The function to associate metadata with.
  25227. * @param {*} data The metadata.
  25228. * @returns {Function} Returns `func`.
  25229. */
  25230. var setData = shortOut(baseSetData);
  25231. /**
  25232. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  25233. *
  25234. * @private
  25235. * @param {Function} func The function to delay.
  25236. * @param {number} wait The number of milliseconds to delay invocation.
  25237. * @returns {number|Object} Returns the timer id or timeout object.
  25238. */
  25239. var setTimeout = ctxSetTimeout || function(func, wait) {
  25240. return root.setTimeout(func, wait);
  25241. };
  25242. /**
  25243. * Sets the `toString` method of `func` to return `string`.
  25244. *
  25245. * @private
  25246. * @param {Function} func The function to modify.
  25247. * @param {Function} string The `toString` result.
  25248. * @returns {Function} Returns `func`.
  25249. */
  25250. var setToString = shortOut(baseSetToString);
  25251. /**
  25252. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  25253. * with wrapper details in a comment at the top of the source body.
  25254. *
  25255. * @private
  25256. * @param {Function} wrapper The function to modify.
  25257. * @param {Function} reference The reference function.
  25258. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  25259. * @returns {Function} Returns `wrapper`.
  25260. */
  25261. function setWrapToString(wrapper, reference, bitmask) {
  25262. var source = (reference + '');
  25263. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  25264. }
  25265. /**
  25266. * Creates a function that'll short out and invoke `identity` instead
  25267. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  25268. * milliseconds.
  25269. *
  25270. * @private
  25271. * @param {Function} func The function to restrict.
  25272. * @returns {Function} Returns the new shortable function.
  25273. */
  25274. function shortOut(func) {
  25275. var count = 0,
  25276. lastCalled = 0;
  25277. return function() {
  25278. var stamp = nativeNow(),
  25279. remaining = HOT_SPAN - (stamp - lastCalled);
  25280. lastCalled = stamp;
  25281. if (remaining > 0) {
  25282. if (++count >= HOT_COUNT) {
  25283. return arguments[0];
  25284. }
  25285. } else {
  25286. count = 0;
  25287. }
  25288. return func.apply(undefined, arguments);
  25289. };
  25290. }
  25291. /**
  25292. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  25293. *
  25294. * @private
  25295. * @param {Array} array The array to shuffle.
  25296. * @param {number} [size=array.length] The size of `array`.
  25297. * @returns {Array} Returns `array`.
  25298. */
  25299. function shuffleSelf(array, size) {
  25300. var index = -1,
  25301. length = array.length,
  25302. lastIndex = length - 1;
  25303. size = size === undefined ? length : size;
  25304. while (++index < size) {
  25305. var rand = baseRandom(index, lastIndex),
  25306. value = array[rand];
  25307. array[rand] = array[index];
  25308. array[index] = value;
  25309. }
  25310. array.length = size;
  25311. return array;
  25312. }
  25313. /**
  25314. * Converts `string` to a property path array.
  25315. *
  25316. * @private
  25317. * @param {string} string The string to convert.
  25318. * @returns {Array} Returns the property path array.
  25319. */
  25320. var stringToPath = memoizeCapped(function(string) {
  25321. var result = [];
  25322. if (string.charCodeAt(0) === 46 /* . */) {
  25323. result.push('');
  25324. }
  25325. string.replace(rePropName, function(match, number, quote, subString) {
  25326. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  25327. });
  25328. return result;
  25329. });
  25330. /**
  25331. * Converts `value` to a string key if it's not a string or symbol.
  25332. *
  25333. * @private
  25334. * @param {*} value The value to inspect.
  25335. * @returns {string|symbol} Returns the key.
  25336. */
  25337. function toKey(value) {
  25338. if (typeof value == 'string' || isSymbol(value)) {
  25339. return value;
  25340. }
  25341. var result = (value + '');
  25342. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  25343. }
  25344. /**
  25345. * Converts `func` to its source code.
  25346. *
  25347. * @private
  25348. * @param {Function} func The function to convert.
  25349. * @returns {string} Returns the source code.
  25350. */
  25351. function toSource(func) {
  25352. if (func != null) {
  25353. try {
  25354. return funcToString.call(func);
  25355. } catch (e) {}
  25356. try {
  25357. return (func + '');
  25358. } catch (e) {}
  25359. }
  25360. return '';
  25361. }
  25362. /**
  25363. * Updates wrapper `details` based on `bitmask` flags.
  25364. *
  25365. * @private
  25366. * @returns {Array} details The details to modify.
  25367. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  25368. * @returns {Array} Returns `details`.
  25369. */
  25370. function updateWrapDetails(details, bitmask) {
  25371. arrayEach(wrapFlags, function(pair) {
  25372. var value = '_.' + pair[0];
  25373. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  25374. details.push(value);
  25375. }
  25376. });
  25377. return details.sort();
  25378. }
  25379. /**
  25380. * Creates a clone of `wrapper`.
  25381. *
  25382. * @private
  25383. * @param {Object} wrapper The wrapper to clone.
  25384. * @returns {Object} Returns the cloned wrapper.
  25385. */
  25386. function wrapperClone(wrapper) {
  25387. if (wrapper instanceof LazyWrapper) {
  25388. return wrapper.clone();
  25389. }
  25390. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  25391. result.__actions__ = copyArray(wrapper.__actions__);
  25392. result.__index__ = wrapper.__index__;
  25393. result.__values__ = wrapper.__values__;
  25394. return result;
  25395. }
  25396. /*------------------------------------------------------------------------*/
  25397. /**
  25398. * Creates an array of elements split into groups the length of `size`.
  25399. * If `array` can't be split evenly, the final chunk will be the remaining
  25400. * elements.
  25401. *
  25402. * @static
  25403. * @memberOf _
  25404. * @since 3.0.0
  25405. * @category Array
  25406. * @param {Array} array The array to process.
  25407. * @param {number} [size=1] The length of each chunk
  25408. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25409. * @returns {Array} Returns the new array of chunks.
  25410. * @example
  25411. *
  25412. * _.chunk(['a', 'b', 'c', 'd'], 2);
  25413. * // => [['a', 'b'], ['c', 'd']]
  25414. *
  25415. * _.chunk(['a', 'b', 'c', 'd'], 3);
  25416. * // => [['a', 'b', 'c'], ['d']]
  25417. */
  25418. function chunk(array, size, guard) {
  25419. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  25420. size = 1;
  25421. } else {
  25422. size = nativeMax(toInteger(size), 0);
  25423. }
  25424. var length = array == null ? 0 : array.length;
  25425. if (!length || size < 1) {
  25426. return [];
  25427. }
  25428. var index = 0,
  25429. resIndex = 0,
  25430. result = Array(nativeCeil(length / size));
  25431. while (index < length) {
  25432. result[resIndex++] = baseSlice(array, index, (index += size));
  25433. }
  25434. return result;
  25435. }
  25436. /**
  25437. * Creates an array with all falsey values removed. The values `false`, `null`,
  25438. * `0`, `""`, `undefined`, and `NaN` are falsey.
  25439. *
  25440. * @static
  25441. * @memberOf _
  25442. * @since 0.1.0
  25443. * @category Array
  25444. * @param {Array} array The array to compact.
  25445. * @returns {Array} Returns the new array of filtered values.
  25446. * @example
  25447. *
  25448. * _.compact([0, 1, false, 2, '', 3]);
  25449. * // => [1, 2, 3]
  25450. */
  25451. function compact(array) {
  25452. var index = -1,
  25453. length = array == null ? 0 : array.length,
  25454. resIndex = 0,
  25455. result = [];
  25456. while (++index < length) {
  25457. var value = array[index];
  25458. if (value) {
  25459. result[resIndex++] = value;
  25460. }
  25461. }
  25462. return result;
  25463. }
  25464. /**
  25465. * Creates a new array concatenating `array` with any additional arrays
  25466. * and/or values.
  25467. *
  25468. * @static
  25469. * @memberOf _
  25470. * @since 4.0.0
  25471. * @category Array
  25472. * @param {Array} array The array to concatenate.
  25473. * @param {...*} [values] The values to concatenate.
  25474. * @returns {Array} Returns the new concatenated array.
  25475. * @example
  25476. *
  25477. * var array = [1];
  25478. * var other = _.concat(array, 2, [3], [[4]]);
  25479. *
  25480. * console.log(other);
  25481. * // => [1, 2, 3, [4]]
  25482. *
  25483. * console.log(array);
  25484. * // => [1]
  25485. */
  25486. function concat() {
  25487. var length = arguments.length;
  25488. if (!length) {
  25489. return [];
  25490. }
  25491. var args = Array(length - 1),
  25492. array = arguments[0],
  25493. index = length;
  25494. while (index--) {
  25495. args[index - 1] = arguments[index];
  25496. }
  25497. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  25498. }
  25499. /**
  25500. * Creates an array of `array` values not included in the other given arrays
  25501. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25502. * for equality comparisons. The order and references of result values are
  25503. * determined by the first array.
  25504. *
  25505. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  25506. *
  25507. * @static
  25508. * @memberOf _
  25509. * @since 0.1.0
  25510. * @category Array
  25511. * @param {Array} array The array to inspect.
  25512. * @param {...Array} [values] The values to exclude.
  25513. * @returns {Array} Returns the new array of filtered values.
  25514. * @see _.without, _.xor
  25515. * @example
  25516. *
  25517. * _.difference([2, 1], [2, 3]);
  25518. * // => [1]
  25519. */
  25520. var difference = baseRest(function(array, values) {
  25521. return isArrayLikeObject(array)
  25522. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  25523. : [];
  25524. });
  25525. /**
  25526. * This method is like `_.difference` except that it accepts `iteratee` which
  25527. * is invoked for each element of `array` and `values` to generate the criterion
  25528. * by which they're compared. The order and references of result values are
  25529. * determined by the first array. The iteratee is invoked with one argument:
  25530. * (value).
  25531. *
  25532. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  25533. *
  25534. * @static
  25535. * @memberOf _
  25536. * @since 4.0.0
  25537. * @category Array
  25538. * @param {Array} array The array to inspect.
  25539. * @param {...Array} [values] The values to exclude.
  25540. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25541. * @returns {Array} Returns the new array of filtered values.
  25542. * @example
  25543. *
  25544. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  25545. * // => [1.2]
  25546. *
  25547. * // The `_.property` iteratee shorthand.
  25548. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  25549. * // => [{ 'x': 2 }]
  25550. */
  25551. var differenceBy = baseRest(function(array, values) {
  25552. var iteratee = last(values);
  25553. if (isArrayLikeObject(iteratee)) {
  25554. iteratee = undefined;
  25555. }
  25556. return isArrayLikeObject(array)
  25557. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  25558. : [];
  25559. });
  25560. /**
  25561. * This method is like `_.difference` except that it accepts `comparator`
  25562. * which is invoked to compare elements of `array` to `values`. The order and
  25563. * references of result values are determined by the first array. The comparator
  25564. * is invoked with two arguments: (arrVal, othVal).
  25565. *
  25566. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  25567. *
  25568. * @static
  25569. * @memberOf _
  25570. * @since 4.0.0
  25571. * @category Array
  25572. * @param {Array} array The array to inspect.
  25573. * @param {...Array} [values] The values to exclude.
  25574. * @param {Function} [comparator] The comparator invoked per element.
  25575. * @returns {Array} Returns the new array of filtered values.
  25576. * @example
  25577. *
  25578. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25579. *
  25580. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  25581. * // => [{ 'x': 2, 'y': 1 }]
  25582. */
  25583. var differenceWith = baseRest(function(array, values) {
  25584. var comparator = last(values);
  25585. if (isArrayLikeObject(comparator)) {
  25586. comparator = undefined;
  25587. }
  25588. return isArrayLikeObject(array)
  25589. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  25590. : [];
  25591. });
  25592. /**
  25593. * Creates a slice of `array` with `n` elements dropped from the beginning.
  25594. *
  25595. * @static
  25596. * @memberOf _
  25597. * @since 0.5.0
  25598. * @category Array
  25599. * @param {Array} array The array to query.
  25600. * @param {number} [n=1] The number of elements to drop.
  25601. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25602. * @returns {Array} Returns the slice of `array`.
  25603. * @example
  25604. *
  25605. * _.drop([1, 2, 3]);
  25606. * // => [2, 3]
  25607. *
  25608. * _.drop([1, 2, 3], 2);
  25609. * // => [3]
  25610. *
  25611. * _.drop([1, 2, 3], 5);
  25612. * // => []
  25613. *
  25614. * _.drop([1, 2, 3], 0);
  25615. * // => [1, 2, 3]
  25616. */
  25617. function drop(array, n, guard) {
  25618. var length = array == null ? 0 : array.length;
  25619. if (!length) {
  25620. return [];
  25621. }
  25622. n = (guard || n === undefined) ? 1 : toInteger(n);
  25623. return baseSlice(array, n < 0 ? 0 : n, length);
  25624. }
  25625. /**
  25626. * Creates a slice of `array` with `n` elements dropped from the end.
  25627. *
  25628. * @static
  25629. * @memberOf _
  25630. * @since 3.0.0
  25631. * @category Array
  25632. * @param {Array} array The array to query.
  25633. * @param {number} [n=1] The number of elements to drop.
  25634. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25635. * @returns {Array} Returns the slice of `array`.
  25636. * @example
  25637. *
  25638. * _.dropRight([1, 2, 3]);
  25639. * // => [1, 2]
  25640. *
  25641. * _.dropRight([1, 2, 3], 2);
  25642. * // => [1]
  25643. *
  25644. * _.dropRight([1, 2, 3], 5);
  25645. * // => []
  25646. *
  25647. * _.dropRight([1, 2, 3], 0);
  25648. * // => [1, 2, 3]
  25649. */
  25650. function dropRight(array, n, guard) {
  25651. var length = array == null ? 0 : array.length;
  25652. if (!length) {
  25653. return [];
  25654. }
  25655. n = (guard || n === undefined) ? 1 : toInteger(n);
  25656. n = length - n;
  25657. return baseSlice(array, 0, n < 0 ? 0 : n);
  25658. }
  25659. /**
  25660. * Creates a slice of `array` excluding elements dropped from the end.
  25661. * Elements are dropped until `predicate` returns falsey. The predicate is
  25662. * invoked with three arguments: (value, index, array).
  25663. *
  25664. * @static
  25665. * @memberOf _
  25666. * @since 3.0.0
  25667. * @category Array
  25668. * @param {Array} array The array to query.
  25669. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25670. * @returns {Array} Returns the slice of `array`.
  25671. * @example
  25672. *
  25673. * var users = [
  25674. * { 'user': 'barney', 'active': true },
  25675. * { 'user': 'fred', 'active': false },
  25676. * { 'user': 'pebbles', 'active': false }
  25677. * ];
  25678. *
  25679. * _.dropRightWhile(users, function(o) { return !o.active; });
  25680. * // => objects for ['barney']
  25681. *
  25682. * // The `_.matches` iteratee shorthand.
  25683. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  25684. * // => objects for ['barney', 'fred']
  25685. *
  25686. * // The `_.matchesProperty` iteratee shorthand.
  25687. * _.dropRightWhile(users, ['active', false]);
  25688. * // => objects for ['barney']
  25689. *
  25690. * // The `_.property` iteratee shorthand.
  25691. * _.dropRightWhile(users, 'active');
  25692. * // => objects for ['barney', 'fred', 'pebbles']
  25693. */
  25694. function dropRightWhile(array, predicate) {
  25695. return (array && array.length)
  25696. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  25697. : [];
  25698. }
  25699. /**
  25700. * Creates a slice of `array` excluding elements dropped from the beginning.
  25701. * Elements are dropped until `predicate` returns falsey. The predicate is
  25702. * invoked with three arguments: (value, index, array).
  25703. *
  25704. * @static
  25705. * @memberOf _
  25706. * @since 3.0.0
  25707. * @category Array
  25708. * @param {Array} array The array to query.
  25709. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25710. * @returns {Array} Returns the slice of `array`.
  25711. * @example
  25712. *
  25713. * var users = [
  25714. * { 'user': 'barney', 'active': false },
  25715. * { 'user': 'fred', 'active': false },
  25716. * { 'user': 'pebbles', 'active': true }
  25717. * ];
  25718. *
  25719. * _.dropWhile(users, function(o) { return !o.active; });
  25720. * // => objects for ['pebbles']
  25721. *
  25722. * // The `_.matches` iteratee shorthand.
  25723. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  25724. * // => objects for ['fred', 'pebbles']
  25725. *
  25726. * // The `_.matchesProperty` iteratee shorthand.
  25727. * _.dropWhile(users, ['active', false]);
  25728. * // => objects for ['pebbles']
  25729. *
  25730. * // The `_.property` iteratee shorthand.
  25731. * _.dropWhile(users, 'active');
  25732. * // => objects for ['barney', 'fred', 'pebbles']
  25733. */
  25734. function dropWhile(array, predicate) {
  25735. return (array && array.length)
  25736. ? baseWhile(array, getIteratee(predicate, 3), true)
  25737. : [];
  25738. }
  25739. /**
  25740. * Fills elements of `array` with `value` from `start` up to, but not
  25741. * including, `end`.
  25742. *
  25743. * **Note:** This method mutates `array`.
  25744. *
  25745. * @static
  25746. * @memberOf _
  25747. * @since 3.2.0
  25748. * @category Array
  25749. * @param {Array} array The array to fill.
  25750. * @param {*} value The value to fill `array` with.
  25751. * @param {number} [start=0] The start position.
  25752. * @param {number} [end=array.length] The end position.
  25753. * @returns {Array} Returns `array`.
  25754. * @example
  25755. *
  25756. * var array = [1, 2, 3];
  25757. *
  25758. * _.fill(array, 'a');
  25759. * console.log(array);
  25760. * // => ['a', 'a', 'a']
  25761. *
  25762. * _.fill(Array(3), 2);
  25763. * // => [2, 2, 2]
  25764. *
  25765. * _.fill([4, 6, 8, 10], '*', 1, 3);
  25766. * // => [4, '*', '*', 10]
  25767. */
  25768. function fill(array, value, start, end) {
  25769. var length = array == null ? 0 : array.length;
  25770. if (!length) {
  25771. return [];
  25772. }
  25773. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  25774. start = 0;
  25775. end = length;
  25776. }
  25777. return baseFill(array, value, start, end);
  25778. }
  25779. /**
  25780. * This method is like `_.find` except that it returns the index of the first
  25781. * element `predicate` returns truthy for instead of the element itself.
  25782. *
  25783. * @static
  25784. * @memberOf _
  25785. * @since 1.1.0
  25786. * @category Array
  25787. * @param {Array} array The array to inspect.
  25788. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25789. * @param {number} [fromIndex=0] The index to search from.
  25790. * @returns {number} Returns the index of the found element, else `-1`.
  25791. * @example
  25792. *
  25793. * var users = [
  25794. * { 'user': 'barney', 'active': false },
  25795. * { 'user': 'fred', 'active': false },
  25796. * { 'user': 'pebbles', 'active': true }
  25797. * ];
  25798. *
  25799. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  25800. * // => 0
  25801. *
  25802. * // The `_.matches` iteratee shorthand.
  25803. * _.findIndex(users, { 'user': 'fred', 'active': false });
  25804. * // => 1
  25805. *
  25806. * // The `_.matchesProperty` iteratee shorthand.
  25807. * _.findIndex(users, ['active', false]);
  25808. * // => 0
  25809. *
  25810. * // The `_.property` iteratee shorthand.
  25811. * _.findIndex(users, 'active');
  25812. * // => 2
  25813. */
  25814. function findIndex(array, predicate, fromIndex) {
  25815. var length = array == null ? 0 : array.length;
  25816. if (!length) {
  25817. return -1;
  25818. }
  25819. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25820. if (index < 0) {
  25821. index = nativeMax(length + index, 0);
  25822. }
  25823. return baseFindIndex(array, getIteratee(predicate, 3), index);
  25824. }
  25825. /**
  25826. * This method is like `_.findIndex` except that it iterates over elements
  25827. * of `collection` from right to left.
  25828. *
  25829. * @static
  25830. * @memberOf _
  25831. * @since 2.0.0
  25832. * @category Array
  25833. * @param {Array} array The array to inspect.
  25834. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25835. * @param {number} [fromIndex=array.length-1] The index to search from.
  25836. * @returns {number} Returns the index of the found element, else `-1`.
  25837. * @example
  25838. *
  25839. * var users = [
  25840. * { 'user': 'barney', 'active': true },
  25841. * { 'user': 'fred', 'active': false },
  25842. * { 'user': 'pebbles', 'active': false }
  25843. * ];
  25844. *
  25845. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  25846. * // => 2
  25847. *
  25848. * // The `_.matches` iteratee shorthand.
  25849. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  25850. * // => 0
  25851. *
  25852. * // The `_.matchesProperty` iteratee shorthand.
  25853. * _.findLastIndex(users, ['active', false]);
  25854. * // => 2
  25855. *
  25856. * // The `_.property` iteratee shorthand.
  25857. * _.findLastIndex(users, 'active');
  25858. * // => 0
  25859. */
  25860. function findLastIndex(array, predicate, fromIndex) {
  25861. var length = array == null ? 0 : array.length;
  25862. if (!length) {
  25863. return -1;
  25864. }
  25865. var index = length - 1;
  25866. if (fromIndex !== undefined) {
  25867. index = toInteger(fromIndex);
  25868. index = fromIndex < 0
  25869. ? nativeMax(length + index, 0)
  25870. : nativeMin(index, length - 1);
  25871. }
  25872. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  25873. }
  25874. /**
  25875. * Flattens `array` a single level deep.
  25876. *
  25877. * @static
  25878. * @memberOf _
  25879. * @since 0.1.0
  25880. * @category Array
  25881. * @param {Array} array The array to flatten.
  25882. * @returns {Array} Returns the new flattened array.
  25883. * @example
  25884. *
  25885. * _.flatten([1, [2, [3, [4]], 5]]);
  25886. * // => [1, 2, [3, [4]], 5]
  25887. */
  25888. function flatten(array) {
  25889. var length = array == null ? 0 : array.length;
  25890. return length ? baseFlatten(array, 1) : [];
  25891. }
  25892. /**
  25893. * Recursively flattens `array`.
  25894. *
  25895. * @static
  25896. * @memberOf _
  25897. * @since 3.0.0
  25898. * @category Array
  25899. * @param {Array} array The array to flatten.
  25900. * @returns {Array} Returns the new flattened array.
  25901. * @example
  25902. *
  25903. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  25904. * // => [1, 2, 3, 4, 5]
  25905. */
  25906. function flattenDeep(array) {
  25907. var length = array == null ? 0 : array.length;
  25908. return length ? baseFlatten(array, INFINITY) : [];
  25909. }
  25910. /**
  25911. * Recursively flatten `array` up to `depth` times.
  25912. *
  25913. * @static
  25914. * @memberOf _
  25915. * @since 4.4.0
  25916. * @category Array
  25917. * @param {Array} array The array to flatten.
  25918. * @param {number} [depth=1] The maximum recursion depth.
  25919. * @returns {Array} Returns the new flattened array.
  25920. * @example
  25921. *
  25922. * var array = [1, [2, [3, [4]], 5]];
  25923. *
  25924. * _.flattenDepth(array, 1);
  25925. * // => [1, 2, [3, [4]], 5]
  25926. *
  25927. * _.flattenDepth(array, 2);
  25928. * // => [1, 2, 3, [4], 5]
  25929. */
  25930. function flattenDepth(array, depth) {
  25931. var length = array == null ? 0 : array.length;
  25932. if (!length) {
  25933. return [];
  25934. }
  25935. depth = depth === undefined ? 1 : toInteger(depth);
  25936. return baseFlatten(array, depth);
  25937. }
  25938. /**
  25939. * The inverse of `_.toPairs`; this method returns an object composed
  25940. * from key-value `pairs`.
  25941. *
  25942. * @static
  25943. * @memberOf _
  25944. * @since 4.0.0
  25945. * @category Array
  25946. * @param {Array} pairs The key-value pairs.
  25947. * @returns {Object} Returns the new object.
  25948. * @example
  25949. *
  25950. * _.fromPairs([['a', 1], ['b', 2]]);
  25951. * // => { 'a': 1, 'b': 2 }
  25952. */
  25953. function fromPairs(pairs) {
  25954. var index = -1,
  25955. length = pairs == null ? 0 : pairs.length,
  25956. result = {};
  25957. while (++index < length) {
  25958. var pair = pairs[index];
  25959. result[pair[0]] = pair[1];
  25960. }
  25961. return result;
  25962. }
  25963. /**
  25964. * Gets the first element of `array`.
  25965. *
  25966. * @static
  25967. * @memberOf _
  25968. * @since 0.1.0
  25969. * @alias first
  25970. * @category Array
  25971. * @param {Array} array The array to query.
  25972. * @returns {*} Returns the first element of `array`.
  25973. * @example
  25974. *
  25975. * _.head([1, 2, 3]);
  25976. * // => 1
  25977. *
  25978. * _.head([]);
  25979. * // => undefined
  25980. */
  25981. function head(array) {
  25982. return (array && array.length) ? array[0] : undefined;
  25983. }
  25984. /**
  25985. * Gets the index at which the first occurrence of `value` is found in `array`
  25986. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25987. * for equality comparisons. If `fromIndex` is negative, it's used as the
  25988. * offset from the end of `array`.
  25989. *
  25990. * @static
  25991. * @memberOf _
  25992. * @since 0.1.0
  25993. * @category Array
  25994. * @param {Array} array The array to inspect.
  25995. * @param {*} value The value to search for.
  25996. * @param {number} [fromIndex=0] The index to search from.
  25997. * @returns {number} Returns the index of the matched value, else `-1`.
  25998. * @example
  25999. *
  26000. * _.indexOf([1, 2, 1, 2], 2);
  26001. * // => 1
  26002. *
  26003. * // Search from the `fromIndex`.
  26004. * _.indexOf([1, 2, 1, 2], 2, 2);
  26005. * // => 3
  26006. */
  26007. function indexOf(array, value, fromIndex) {
  26008. var length = array == null ? 0 : array.length;
  26009. if (!length) {
  26010. return -1;
  26011. }
  26012. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  26013. if (index < 0) {
  26014. index = nativeMax(length + index, 0);
  26015. }
  26016. return baseIndexOf(array, value, index);
  26017. }
  26018. /**
  26019. * Gets all but the last element of `array`.
  26020. *
  26021. * @static
  26022. * @memberOf _
  26023. * @since 0.1.0
  26024. * @category Array
  26025. * @param {Array} array The array to query.
  26026. * @returns {Array} Returns the slice of `array`.
  26027. * @example
  26028. *
  26029. * _.initial([1, 2, 3]);
  26030. * // => [1, 2]
  26031. */
  26032. function initial(array) {
  26033. var length = array == null ? 0 : array.length;
  26034. return length ? baseSlice(array, 0, -1) : [];
  26035. }
  26036. /**
  26037. * Creates an array of unique values that are included in all given arrays
  26038. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26039. * for equality comparisons. The order and references of result values are
  26040. * determined by the first array.
  26041. *
  26042. * @static
  26043. * @memberOf _
  26044. * @since 0.1.0
  26045. * @category Array
  26046. * @param {...Array} [arrays] The arrays to inspect.
  26047. * @returns {Array} Returns the new array of intersecting values.
  26048. * @example
  26049. *
  26050. * _.intersection([2, 1], [2, 3]);
  26051. * // => [2]
  26052. */
  26053. var intersection = baseRest(function(arrays) {
  26054. var mapped = arrayMap(arrays, castArrayLikeObject);
  26055. return (mapped.length && mapped[0] === arrays[0])
  26056. ? baseIntersection(mapped)
  26057. : [];
  26058. });
  26059. /**
  26060. * This method is like `_.intersection` except that it accepts `iteratee`
  26061. * which is invoked for each element of each `arrays` to generate the criterion
  26062. * by which they're compared. The order and references of result values are
  26063. * determined by the first array. The iteratee is invoked with one argument:
  26064. * (value).
  26065. *
  26066. * @static
  26067. * @memberOf _
  26068. * @since 4.0.0
  26069. * @category Array
  26070. * @param {...Array} [arrays] The arrays to inspect.
  26071. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26072. * @returns {Array} Returns the new array of intersecting values.
  26073. * @example
  26074. *
  26075. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  26076. * // => [2.1]
  26077. *
  26078. * // The `_.property` iteratee shorthand.
  26079. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26080. * // => [{ 'x': 1 }]
  26081. */
  26082. var intersectionBy = baseRest(function(arrays) {
  26083. var iteratee = last(arrays),
  26084. mapped = arrayMap(arrays, castArrayLikeObject);
  26085. if (iteratee === last(mapped)) {
  26086. iteratee = undefined;
  26087. } else {
  26088. mapped.pop();
  26089. }
  26090. return (mapped.length && mapped[0] === arrays[0])
  26091. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  26092. : [];
  26093. });
  26094. /**
  26095. * This method is like `_.intersection` except that it accepts `comparator`
  26096. * which is invoked to compare elements of `arrays`. The order and references
  26097. * of result values are determined by the first array. The comparator is
  26098. * invoked with two arguments: (arrVal, othVal).
  26099. *
  26100. * @static
  26101. * @memberOf _
  26102. * @since 4.0.0
  26103. * @category Array
  26104. * @param {...Array} [arrays] The arrays to inspect.
  26105. * @param {Function} [comparator] The comparator invoked per element.
  26106. * @returns {Array} Returns the new array of intersecting values.
  26107. * @example
  26108. *
  26109. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26110. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26111. *
  26112. * _.intersectionWith(objects, others, _.isEqual);
  26113. * // => [{ 'x': 1, 'y': 2 }]
  26114. */
  26115. var intersectionWith = baseRest(function(arrays) {
  26116. var comparator = last(arrays),
  26117. mapped = arrayMap(arrays, castArrayLikeObject);
  26118. comparator = typeof comparator == 'function' ? comparator : undefined;
  26119. if (comparator) {
  26120. mapped.pop();
  26121. }
  26122. return (mapped.length && mapped[0] === arrays[0])
  26123. ? baseIntersection(mapped, undefined, comparator)
  26124. : [];
  26125. });
  26126. /**
  26127. * Converts all elements in `array` into a string separated by `separator`.
  26128. *
  26129. * @static
  26130. * @memberOf _
  26131. * @since 4.0.0
  26132. * @category Array
  26133. * @param {Array} array The array to convert.
  26134. * @param {string} [separator=','] The element separator.
  26135. * @returns {string} Returns the joined string.
  26136. * @example
  26137. *
  26138. * _.join(['a', 'b', 'c'], '~');
  26139. * // => 'a~b~c'
  26140. */
  26141. function join(array, separator) {
  26142. return array == null ? '' : nativeJoin.call(array, separator);
  26143. }
  26144. /**
  26145. * Gets the last element of `array`.
  26146. *
  26147. * @static
  26148. * @memberOf _
  26149. * @since 0.1.0
  26150. * @category Array
  26151. * @param {Array} array The array to query.
  26152. * @returns {*} Returns the last element of `array`.
  26153. * @example
  26154. *
  26155. * _.last([1, 2, 3]);
  26156. * // => 3
  26157. */
  26158. function last(array) {
  26159. var length = array == null ? 0 : array.length;
  26160. return length ? array[length - 1] : undefined;
  26161. }
  26162. /**
  26163. * This method is like `_.indexOf` except that it iterates over elements of
  26164. * `array` from right to left.
  26165. *
  26166. * @static
  26167. * @memberOf _
  26168. * @since 0.1.0
  26169. * @category Array
  26170. * @param {Array} array The array to inspect.
  26171. * @param {*} value The value to search for.
  26172. * @param {number} [fromIndex=array.length-1] The index to search from.
  26173. * @returns {number} Returns the index of the matched value, else `-1`.
  26174. * @example
  26175. *
  26176. * _.lastIndexOf([1, 2, 1, 2], 2);
  26177. * // => 3
  26178. *
  26179. * // Search from the `fromIndex`.
  26180. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  26181. * // => 1
  26182. */
  26183. function lastIndexOf(array, value, fromIndex) {
  26184. var length = array == null ? 0 : array.length;
  26185. if (!length) {
  26186. return -1;
  26187. }
  26188. var index = length;
  26189. if (fromIndex !== undefined) {
  26190. index = toInteger(fromIndex);
  26191. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  26192. }
  26193. return value === value
  26194. ? strictLastIndexOf(array, value, index)
  26195. : baseFindIndex(array, baseIsNaN, index, true);
  26196. }
  26197. /**
  26198. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  26199. * element from the end is returned.
  26200. *
  26201. * @static
  26202. * @memberOf _
  26203. * @since 4.11.0
  26204. * @category Array
  26205. * @param {Array} array The array to query.
  26206. * @param {number} [n=0] The index of the element to return.
  26207. * @returns {*} Returns the nth element of `array`.
  26208. * @example
  26209. *
  26210. * var array = ['a', 'b', 'c', 'd'];
  26211. *
  26212. * _.nth(array, 1);
  26213. * // => 'b'
  26214. *
  26215. * _.nth(array, -2);
  26216. * // => 'c';
  26217. */
  26218. function nth(array, n) {
  26219. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  26220. }
  26221. /**
  26222. * Removes all given values from `array` using
  26223. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26224. * for equality comparisons.
  26225. *
  26226. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  26227. * to remove elements from an array by predicate.
  26228. *
  26229. * @static
  26230. * @memberOf _
  26231. * @since 2.0.0
  26232. * @category Array
  26233. * @param {Array} array The array to modify.
  26234. * @param {...*} [values] The values to remove.
  26235. * @returns {Array} Returns `array`.
  26236. * @example
  26237. *
  26238. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  26239. *
  26240. * _.pull(array, 'a', 'c');
  26241. * console.log(array);
  26242. * // => ['b', 'b']
  26243. */
  26244. var pull = baseRest(pullAll);
  26245. /**
  26246. * This method is like `_.pull` except that it accepts an array of values to remove.
  26247. *
  26248. * **Note:** Unlike `_.difference`, this method mutates `array`.
  26249. *
  26250. * @static
  26251. * @memberOf _
  26252. * @since 4.0.0
  26253. * @category Array
  26254. * @param {Array} array The array to modify.
  26255. * @param {Array} values The values to remove.
  26256. * @returns {Array} Returns `array`.
  26257. * @example
  26258. *
  26259. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  26260. *
  26261. * _.pullAll(array, ['a', 'c']);
  26262. * console.log(array);
  26263. * // => ['b', 'b']
  26264. */
  26265. function pullAll(array, values) {
  26266. return (array && array.length && values && values.length)
  26267. ? basePullAll(array, values)
  26268. : array;
  26269. }
  26270. /**
  26271. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  26272. * invoked for each element of `array` and `values` to generate the criterion
  26273. * by which they're compared. The iteratee is invoked with one argument: (value).
  26274. *
  26275. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  26276. *
  26277. * @static
  26278. * @memberOf _
  26279. * @since 4.0.0
  26280. * @category Array
  26281. * @param {Array} array The array to modify.
  26282. * @param {Array} values The values to remove.
  26283. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26284. * @returns {Array} Returns `array`.
  26285. * @example
  26286. *
  26287. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  26288. *
  26289. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  26290. * console.log(array);
  26291. * // => [{ 'x': 2 }]
  26292. */
  26293. function pullAllBy(array, values, iteratee) {
  26294. return (array && array.length && values && values.length)
  26295. ? basePullAll(array, values, getIteratee(iteratee, 2))
  26296. : array;
  26297. }
  26298. /**
  26299. * This method is like `_.pullAll` except that it accepts `comparator` which
  26300. * is invoked to compare elements of `array` to `values`. The comparator is
  26301. * invoked with two arguments: (arrVal, othVal).
  26302. *
  26303. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  26304. *
  26305. * @static
  26306. * @memberOf _
  26307. * @since 4.6.0
  26308. * @category Array
  26309. * @param {Array} array The array to modify.
  26310. * @param {Array} values The values to remove.
  26311. * @param {Function} [comparator] The comparator invoked per element.
  26312. * @returns {Array} Returns `array`.
  26313. * @example
  26314. *
  26315. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  26316. *
  26317. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  26318. * console.log(array);
  26319. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  26320. */
  26321. function pullAllWith(array, values, comparator) {
  26322. return (array && array.length && values && values.length)
  26323. ? basePullAll(array, values, undefined, comparator)
  26324. : array;
  26325. }
  26326. /**
  26327. * Removes elements from `array` corresponding to `indexes` and returns an
  26328. * array of removed elements.
  26329. *
  26330. * **Note:** Unlike `_.at`, this method mutates `array`.
  26331. *
  26332. * @static
  26333. * @memberOf _
  26334. * @since 3.0.0
  26335. * @category Array
  26336. * @param {Array} array The array to modify.
  26337. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  26338. * @returns {Array} Returns the new array of removed elements.
  26339. * @example
  26340. *
  26341. * var array = ['a', 'b', 'c', 'd'];
  26342. * var pulled = _.pullAt(array, [1, 3]);
  26343. *
  26344. * console.log(array);
  26345. * // => ['a', 'c']
  26346. *
  26347. * console.log(pulled);
  26348. * // => ['b', 'd']
  26349. */
  26350. var pullAt = flatRest(function(array, indexes) {
  26351. var length = array == null ? 0 : array.length,
  26352. result = baseAt(array, indexes);
  26353. basePullAt(array, arrayMap(indexes, function(index) {
  26354. return isIndex(index, length) ? +index : index;
  26355. }).sort(compareAscending));
  26356. return result;
  26357. });
  26358. /**
  26359. * Removes all elements from `array` that `predicate` returns truthy for
  26360. * and returns an array of the removed elements. The predicate is invoked
  26361. * with three arguments: (value, index, array).
  26362. *
  26363. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  26364. * to pull elements from an array by value.
  26365. *
  26366. * @static
  26367. * @memberOf _
  26368. * @since 2.0.0
  26369. * @category Array
  26370. * @param {Array} array The array to modify.
  26371. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26372. * @returns {Array} Returns the new array of removed elements.
  26373. * @example
  26374. *
  26375. * var array = [1, 2, 3, 4];
  26376. * var evens = _.remove(array, function(n) {
  26377. * return n % 2 == 0;
  26378. * });
  26379. *
  26380. * console.log(array);
  26381. * // => [1, 3]
  26382. *
  26383. * console.log(evens);
  26384. * // => [2, 4]
  26385. */
  26386. function remove(array, predicate) {
  26387. var result = [];
  26388. if (!(array && array.length)) {
  26389. return result;
  26390. }
  26391. var index = -1,
  26392. indexes = [],
  26393. length = array.length;
  26394. predicate = getIteratee(predicate, 3);
  26395. while (++index < length) {
  26396. var value = array[index];
  26397. if (predicate(value, index, array)) {
  26398. result.push(value);
  26399. indexes.push(index);
  26400. }
  26401. }
  26402. basePullAt(array, indexes);
  26403. return result;
  26404. }
  26405. /**
  26406. * Reverses `array` so that the first element becomes the last, the second
  26407. * element becomes the second to last, and so on.
  26408. *
  26409. * **Note:** This method mutates `array` and is based on
  26410. * [`Array#reverse`](https://mdn.io/Array/reverse).
  26411. *
  26412. * @static
  26413. * @memberOf _
  26414. * @since 4.0.0
  26415. * @category Array
  26416. * @param {Array} array The array to modify.
  26417. * @returns {Array} Returns `array`.
  26418. * @example
  26419. *
  26420. * var array = [1, 2, 3];
  26421. *
  26422. * _.reverse(array);
  26423. * // => [3, 2, 1]
  26424. *
  26425. * console.log(array);
  26426. * // => [3, 2, 1]
  26427. */
  26428. function reverse(array) {
  26429. return array == null ? array : nativeReverse.call(array);
  26430. }
  26431. /**
  26432. * Creates a slice of `array` from `start` up to, but not including, `end`.
  26433. *
  26434. * **Note:** This method is used instead of
  26435. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  26436. * returned.
  26437. *
  26438. * @static
  26439. * @memberOf _
  26440. * @since 3.0.0
  26441. * @category Array
  26442. * @param {Array} array The array to slice.
  26443. * @param {number} [start=0] The start position.
  26444. * @param {number} [end=array.length] The end position.
  26445. * @returns {Array} Returns the slice of `array`.
  26446. */
  26447. function slice(array, start, end) {
  26448. var length = array == null ? 0 : array.length;
  26449. if (!length) {
  26450. return [];
  26451. }
  26452. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  26453. start = 0;
  26454. end = length;
  26455. }
  26456. else {
  26457. start = start == null ? 0 : toInteger(start);
  26458. end = end === undefined ? length : toInteger(end);
  26459. }
  26460. return baseSlice(array, start, end);
  26461. }
  26462. /**
  26463. * Uses a binary search to determine the lowest index at which `value`
  26464. * should be inserted into `array` in order to maintain its sort order.
  26465. *
  26466. * @static
  26467. * @memberOf _
  26468. * @since 0.1.0
  26469. * @category Array
  26470. * @param {Array} array The sorted array to inspect.
  26471. * @param {*} value The value to evaluate.
  26472. * @returns {number} Returns the index at which `value` should be inserted
  26473. * into `array`.
  26474. * @example
  26475. *
  26476. * _.sortedIndex([30, 50], 40);
  26477. * // => 1
  26478. */
  26479. function sortedIndex(array, value) {
  26480. return baseSortedIndex(array, value);
  26481. }
  26482. /**
  26483. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  26484. * which is invoked for `value` and each element of `array` to compute their
  26485. * sort ranking. The iteratee is invoked with one argument: (value).
  26486. *
  26487. * @static
  26488. * @memberOf _
  26489. * @since 4.0.0
  26490. * @category Array
  26491. * @param {Array} array The sorted array to inspect.
  26492. * @param {*} value The value to evaluate.
  26493. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26494. * @returns {number} Returns the index at which `value` should be inserted
  26495. * into `array`.
  26496. * @example
  26497. *
  26498. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  26499. *
  26500. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  26501. * // => 0
  26502. *
  26503. * // The `_.property` iteratee shorthand.
  26504. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  26505. * // => 0
  26506. */
  26507. function sortedIndexBy(array, value, iteratee) {
  26508. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  26509. }
  26510. /**
  26511. * This method is like `_.indexOf` except that it performs a binary
  26512. * search on a sorted `array`.
  26513. *
  26514. * @static
  26515. * @memberOf _
  26516. * @since 4.0.0
  26517. * @category Array
  26518. * @param {Array} array The array to inspect.
  26519. * @param {*} value The value to search for.
  26520. * @returns {number} Returns the index of the matched value, else `-1`.
  26521. * @example
  26522. *
  26523. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  26524. * // => 1
  26525. */
  26526. function sortedIndexOf(array, value) {
  26527. var length = array == null ? 0 : array.length;
  26528. if (length) {
  26529. var index = baseSortedIndex(array, value);
  26530. if (index < length && eq(array[index], value)) {
  26531. return index;
  26532. }
  26533. }
  26534. return -1;
  26535. }
  26536. /**
  26537. * This method is like `_.sortedIndex` except that it returns the highest
  26538. * index at which `value` should be inserted into `array` in order to
  26539. * maintain its sort order.
  26540. *
  26541. * @static
  26542. * @memberOf _
  26543. * @since 3.0.0
  26544. * @category Array
  26545. * @param {Array} array The sorted array to inspect.
  26546. * @param {*} value The value to evaluate.
  26547. * @returns {number} Returns the index at which `value` should be inserted
  26548. * into `array`.
  26549. * @example
  26550. *
  26551. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  26552. * // => 4
  26553. */
  26554. function sortedLastIndex(array, value) {
  26555. return baseSortedIndex(array, value, true);
  26556. }
  26557. /**
  26558. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  26559. * which is invoked for `value` and each element of `array` to compute their
  26560. * sort ranking. The iteratee is invoked with one argument: (value).
  26561. *
  26562. * @static
  26563. * @memberOf _
  26564. * @since 4.0.0
  26565. * @category Array
  26566. * @param {Array} array The sorted array to inspect.
  26567. * @param {*} value The value to evaluate.
  26568. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26569. * @returns {number} Returns the index at which `value` should be inserted
  26570. * into `array`.
  26571. * @example
  26572. *
  26573. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  26574. *
  26575. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  26576. * // => 1
  26577. *
  26578. * // The `_.property` iteratee shorthand.
  26579. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  26580. * // => 1
  26581. */
  26582. function sortedLastIndexBy(array, value, iteratee) {
  26583. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  26584. }
  26585. /**
  26586. * This method is like `_.lastIndexOf` except that it performs a binary
  26587. * search on a sorted `array`.
  26588. *
  26589. * @static
  26590. * @memberOf _
  26591. * @since 4.0.0
  26592. * @category Array
  26593. * @param {Array} array The array to inspect.
  26594. * @param {*} value The value to search for.
  26595. * @returns {number} Returns the index of the matched value, else `-1`.
  26596. * @example
  26597. *
  26598. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  26599. * // => 3
  26600. */
  26601. function sortedLastIndexOf(array, value) {
  26602. var length = array == null ? 0 : array.length;
  26603. if (length) {
  26604. var index = baseSortedIndex(array, value, true) - 1;
  26605. if (eq(array[index], value)) {
  26606. return index;
  26607. }
  26608. }
  26609. return -1;
  26610. }
  26611. /**
  26612. * This method is like `_.uniq` except that it's designed and optimized
  26613. * for sorted arrays.
  26614. *
  26615. * @static
  26616. * @memberOf _
  26617. * @since 4.0.0
  26618. * @category Array
  26619. * @param {Array} array The array to inspect.
  26620. * @returns {Array} Returns the new duplicate free array.
  26621. * @example
  26622. *
  26623. * _.sortedUniq([1, 1, 2]);
  26624. * // => [1, 2]
  26625. */
  26626. function sortedUniq(array) {
  26627. return (array && array.length)
  26628. ? baseSortedUniq(array)
  26629. : [];
  26630. }
  26631. /**
  26632. * This method is like `_.uniqBy` except that it's designed and optimized
  26633. * for sorted arrays.
  26634. *
  26635. * @static
  26636. * @memberOf _
  26637. * @since 4.0.0
  26638. * @category Array
  26639. * @param {Array} array The array to inspect.
  26640. * @param {Function} [iteratee] The iteratee invoked per element.
  26641. * @returns {Array} Returns the new duplicate free array.
  26642. * @example
  26643. *
  26644. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  26645. * // => [1.1, 2.3]
  26646. */
  26647. function sortedUniqBy(array, iteratee) {
  26648. return (array && array.length)
  26649. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  26650. : [];
  26651. }
  26652. /**
  26653. * Gets all but the first element of `array`.
  26654. *
  26655. * @static
  26656. * @memberOf _
  26657. * @since 4.0.0
  26658. * @category Array
  26659. * @param {Array} array The array to query.
  26660. * @returns {Array} Returns the slice of `array`.
  26661. * @example
  26662. *
  26663. * _.tail([1, 2, 3]);
  26664. * // => [2, 3]
  26665. */
  26666. function tail(array) {
  26667. var length = array == null ? 0 : array.length;
  26668. return length ? baseSlice(array, 1, length) : [];
  26669. }
  26670. /**
  26671. * Creates a slice of `array` with `n` elements taken from the beginning.
  26672. *
  26673. * @static
  26674. * @memberOf _
  26675. * @since 0.1.0
  26676. * @category Array
  26677. * @param {Array} array The array to query.
  26678. * @param {number} [n=1] The number of elements to take.
  26679. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26680. * @returns {Array} Returns the slice of `array`.
  26681. * @example
  26682. *
  26683. * _.take([1, 2, 3]);
  26684. * // => [1]
  26685. *
  26686. * _.take([1, 2, 3], 2);
  26687. * // => [1, 2]
  26688. *
  26689. * _.take([1, 2, 3], 5);
  26690. * // => [1, 2, 3]
  26691. *
  26692. * _.take([1, 2, 3], 0);
  26693. * // => []
  26694. */
  26695. function take(array, n, guard) {
  26696. if (!(array && array.length)) {
  26697. return [];
  26698. }
  26699. n = (guard || n === undefined) ? 1 : toInteger(n);
  26700. return baseSlice(array, 0, n < 0 ? 0 : n);
  26701. }
  26702. /**
  26703. * Creates a slice of `array` with `n` elements taken from the end.
  26704. *
  26705. * @static
  26706. * @memberOf _
  26707. * @since 3.0.0
  26708. * @category Array
  26709. * @param {Array} array The array to query.
  26710. * @param {number} [n=1] The number of elements to take.
  26711. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26712. * @returns {Array} Returns the slice of `array`.
  26713. * @example
  26714. *
  26715. * _.takeRight([1, 2, 3]);
  26716. * // => [3]
  26717. *
  26718. * _.takeRight([1, 2, 3], 2);
  26719. * // => [2, 3]
  26720. *
  26721. * _.takeRight([1, 2, 3], 5);
  26722. * // => [1, 2, 3]
  26723. *
  26724. * _.takeRight([1, 2, 3], 0);
  26725. * // => []
  26726. */
  26727. function takeRight(array, n, guard) {
  26728. var length = array == null ? 0 : array.length;
  26729. if (!length) {
  26730. return [];
  26731. }
  26732. n = (guard || n === undefined) ? 1 : toInteger(n);
  26733. n = length - n;
  26734. return baseSlice(array, n < 0 ? 0 : n, length);
  26735. }
  26736. /**
  26737. * Creates a slice of `array` with elements taken from the end. Elements are
  26738. * taken until `predicate` returns falsey. The predicate is invoked with
  26739. * three arguments: (value, index, array).
  26740. *
  26741. * @static
  26742. * @memberOf _
  26743. * @since 3.0.0
  26744. * @category Array
  26745. * @param {Array} array The array to query.
  26746. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26747. * @returns {Array} Returns the slice of `array`.
  26748. * @example
  26749. *
  26750. * var users = [
  26751. * { 'user': 'barney', 'active': true },
  26752. * { 'user': 'fred', 'active': false },
  26753. * { 'user': 'pebbles', 'active': false }
  26754. * ];
  26755. *
  26756. * _.takeRightWhile(users, function(o) { return !o.active; });
  26757. * // => objects for ['fred', 'pebbles']
  26758. *
  26759. * // The `_.matches` iteratee shorthand.
  26760. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  26761. * // => objects for ['pebbles']
  26762. *
  26763. * // The `_.matchesProperty` iteratee shorthand.
  26764. * _.takeRightWhile(users, ['active', false]);
  26765. * // => objects for ['fred', 'pebbles']
  26766. *
  26767. * // The `_.property` iteratee shorthand.
  26768. * _.takeRightWhile(users, 'active');
  26769. * // => []
  26770. */
  26771. function takeRightWhile(array, predicate) {
  26772. return (array && array.length)
  26773. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  26774. : [];
  26775. }
  26776. /**
  26777. * Creates a slice of `array` with elements taken from the beginning. Elements
  26778. * are taken until `predicate` returns falsey. The predicate is invoked with
  26779. * three arguments: (value, index, array).
  26780. *
  26781. * @static
  26782. * @memberOf _
  26783. * @since 3.0.0
  26784. * @category Array
  26785. * @param {Array} array The array to query.
  26786. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26787. * @returns {Array} Returns the slice of `array`.
  26788. * @example
  26789. *
  26790. * var users = [
  26791. * { 'user': 'barney', 'active': false },
  26792. * { 'user': 'fred', 'active': false },
  26793. * { 'user': 'pebbles', 'active': true }
  26794. * ];
  26795. *
  26796. * _.takeWhile(users, function(o) { return !o.active; });
  26797. * // => objects for ['barney', 'fred']
  26798. *
  26799. * // The `_.matches` iteratee shorthand.
  26800. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  26801. * // => objects for ['barney']
  26802. *
  26803. * // The `_.matchesProperty` iteratee shorthand.
  26804. * _.takeWhile(users, ['active', false]);
  26805. * // => objects for ['barney', 'fred']
  26806. *
  26807. * // The `_.property` iteratee shorthand.
  26808. * _.takeWhile(users, 'active');
  26809. * // => []
  26810. */
  26811. function takeWhile(array, predicate) {
  26812. return (array && array.length)
  26813. ? baseWhile(array, getIteratee(predicate, 3))
  26814. : [];
  26815. }
  26816. /**
  26817. * Creates an array of unique values, in order, from all given arrays using
  26818. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26819. * for equality comparisons.
  26820. *
  26821. * @static
  26822. * @memberOf _
  26823. * @since 0.1.0
  26824. * @category Array
  26825. * @param {...Array} [arrays] The arrays to inspect.
  26826. * @returns {Array} Returns the new array of combined values.
  26827. * @example
  26828. *
  26829. * _.union([2], [1, 2]);
  26830. * // => [2, 1]
  26831. */
  26832. var union = baseRest(function(arrays) {
  26833. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  26834. });
  26835. /**
  26836. * This method is like `_.union` except that it accepts `iteratee` which is
  26837. * invoked for each element of each `arrays` to generate the criterion by
  26838. * which uniqueness is computed. Result values are chosen from the first
  26839. * array in which the value occurs. The iteratee is invoked with one argument:
  26840. * (value).
  26841. *
  26842. * @static
  26843. * @memberOf _
  26844. * @since 4.0.0
  26845. * @category Array
  26846. * @param {...Array} [arrays] The arrays to inspect.
  26847. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26848. * @returns {Array} Returns the new array of combined values.
  26849. * @example
  26850. *
  26851. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  26852. * // => [2.1, 1.2]
  26853. *
  26854. * // The `_.property` iteratee shorthand.
  26855. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26856. * // => [{ 'x': 1 }, { 'x': 2 }]
  26857. */
  26858. var unionBy = baseRest(function(arrays) {
  26859. var iteratee = last(arrays);
  26860. if (isArrayLikeObject(iteratee)) {
  26861. iteratee = undefined;
  26862. }
  26863. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  26864. });
  26865. /**
  26866. * This method is like `_.union` except that it accepts `comparator` which
  26867. * is invoked to compare elements of `arrays`. Result values are chosen from
  26868. * the first array in which the value occurs. The comparator is invoked
  26869. * with two arguments: (arrVal, othVal).
  26870. *
  26871. * @static
  26872. * @memberOf _
  26873. * @since 4.0.0
  26874. * @category Array
  26875. * @param {...Array} [arrays] The arrays to inspect.
  26876. * @param {Function} [comparator] The comparator invoked per element.
  26877. * @returns {Array} Returns the new array of combined values.
  26878. * @example
  26879. *
  26880. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26881. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26882. *
  26883. * _.unionWith(objects, others, _.isEqual);
  26884. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26885. */
  26886. var unionWith = baseRest(function(arrays) {
  26887. var comparator = last(arrays);
  26888. comparator = typeof comparator == 'function' ? comparator : undefined;
  26889. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  26890. });
  26891. /**
  26892. * Creates a duplicate-free version of an array, using
  26893. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26894. * for equality comparisons, in which only the first occurrence of each element
  26895. * is kept. The order of result values is determined by the order they occur
  26896. * in the array.
  26897. *
  26898. * @static
  26899. * @memberOf _
  26900. * @since 0.1.0
  26901. * @category Array
  26902. * @param {Array} array The array to inspect.
  26903. * @returns {Array} Returns the new duplicate free array.
  26904. * @example
  26905. *
  26906. * _.uniq([2, 1, 2]);
  26907. * // => [2, 1]
  26908. */
  26909. function uniq(array) {
  26910. return (array && array.length) ? baseUniq(array) : [];
  26911. }
  26912. /**
  26913. * This method is like `_.uniq` except that it accepts `iteratee` which is
  26914. * invoked for each element in `array` to generate the criterion by which
  26915. * uniqueness is computed. The order of result values is determined by the
  26916. * order they occur in the array. The iteratee is invoked with one argument:
  26917. * (value).
  26918. *
  26919. * @static
  26920. * @memberOf _
  26921. * @since 4.0.0
  26922. * @category Array
  26923. * @param {Array} array The array to inspect.
  26924. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26925. * @returns {Array} Returns the new duplicate free array.
  26926. * @example
  26927. *
  26928. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  26929. * // => [2.1, 1.2]
  26930. *
  26931. * // The `_.property` iteratee shorthand.
  26932. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  26933. * // => [{ 'x': 1 }, { 'x': 2 }]
  26934. */
  26935. function uniqBy(array, iteratee) {
  26936. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  26937. }
  26938. /**
  26939. * This method is like `_.uniq` except that it accepts `comparator` which
  26940. * is invoked to compare elements of `array`. The order of result values is
  26941. * determined by the order they occur in the array.The comparator is invoked
  26942. * with two arguments: (arrVal, othVal).
  26943. *
  26944. * @static
  26945. * @memberOf _
  26946. * @since 4.0.0
  26947. * @category Array
  26948. * @param {Array} array The array to inspect.
  26949. * @param {Function} [comparator] The comparator invoked per element.
  26950. * @returns {Array} Returns the new duplicate free array.
  26951. * @example
  26952. *
  26953. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26954. *
  26955. * _.uniqWith(objects, _.isEqual);
  26956. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  26957. */
  26958. function uniqWith(array, comparator) {
  26959. comparator = typeof comparator == 'function' ? comparator : undefined;
  26960. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  26961. }
  26962. /**
  26963. * This method is like `_.zip` except that it accepts an array of grouped
  26964. * elements and creates an array regrouping the elements to their pre-zip
  26965. * configuration.
  26966. *
  26967. * @static
  26968. * @memberOf _
  26969. * @since 1.2.0
  26970. * @category Array
  26971. * @param {Array} array The array of grouped elements to process.
  26972. * @returns {Array} Returns the new array of regrouped elements.
  26973. * @example
  26974. *
  26975. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  26976. * // => [['a', 1, true], ['b', 2, false]]
  26977. *
  26978. * _.unzip(zipped);
  26979. * // => [['a', 'b'], [1, 2], [true, false]]
  26980. */
  26981. function unzip(array) {
  26982. if (!(array && array.length)) {
  26983. return [];
  26984. }
  26985. var length = 0;
  26986. array = arrayFilter(array, function(group) {
  26987. if (isArrayLikeObject(group)) {
  26988. length = nativeMax(group.length, length);
  26989. return true;
  26990. }
  26991. });
  26992. return baseTimes(length, function(index) {
  26993. return arrayMap(array, baseProperty(index));
  26994. });
  26995. }
  26996. /**
  26997. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  26998. * how regrouped values should be combined. The iteratee is invoked with the
  26999. * elements of each group: (...group).
  27000. *
  27001. * @static
  27002. * @memberOf _
  27003. * @since 3.8.0
  27004. * @category Array
  27005. * @param {Array} array The array of grouped elements to process.
  27006. * @param {Function} [iteratee=_.identity] The function to combine
  27007. * regrouped values.
  27008. * @returns {Array} Returns the new array of regrouped elements.
  27009. * @example
  27010. *
  27011. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  27012. * // => [[1, 10, 100], [2, 20, 200]]
  27013. *
  27014. * _.unzipWith(zipped, _.add);
  27015. * // => [3, 30, 300]
  27016. */
  27017. function unzipWith(array, iteratee) {
  27018. if (!(array && array.length)) {
  27019. return [];
  27020. }
  27021. var result = unzip(array);
  27022. if (iteratee == null) {
  27023. return result;
  27024. }
  27025. return arrayMap(result, function(group) {
  27026. return apply(iteratee, undefined, group);
  27027. });
  27028. }
  27029. /**
  27030. * Creates an array excluding all given values using
  27031. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  27032. * for equality comparisons.
  27033. *
  27034. * **Note:** Unlike `_.pull`, this method returns a new array.
  27035. *
  27036. * @static
  27037. * @memberOf _
  27038. * @since 0.1.0
  27039. * @category Array
  27040. * @param {Array} array The array to inspect.
  27041. * @param {...*} [values] The values to exclude.
  27042. * @returns {Array} Returns the new array of filtered values.
  27043. * @see _.difference, _.xor
  27044. * @example
  27045. *
  27046. * _.without([2, 1, 2, 3], 1, 2);
  27047. * // => [3]
  27048. */
  27049. var without = baseRest(function(array, values) {
  27050. return isArrayLikeObject(array)
  27051. ? baseDifference(array, values)
  27052. : [];
  27053. });
  27054. /**
  27055. * Creates an array of unique values that is the
  27056. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  27057. * of the given arrays. The order of result values is determined by the order
  27058. * they occur in the arrays.
  27059. *
  27060. * @static
  27061. * @memberOf _
  27062. * @since 2.4.0
  27063. * @category Array
  27064. * @param {...Array} [arrays] The arrays to inspect.
  27065. * @returns {Array} Returns the new array of filtered values.
  27066. * @see _.difference, _.without
  27067. * @example
  27068. *
  27069. * _.xor([2, 1], [2, 3]);
  27070. * // => [1, 3]
  27071. */
  27072. var xor = baseRest(function(arrays) {
  27073. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  27074. });
  27075. /**
  27076. * This method is like `_.xor` except that it accepts `iteratee` which is
  27077. * invoked for each element of each `arrays` to generate the criterion by
  27078. * which by which they're compared. The order of result values is determined
  27079. * by the order they occur in the arrays. The iteratee is invoked with one
  27080. * argument: (value).
  27081. *
  27082. * @static
  27083. * @memberOf _
  27084. * @since 4.0.0
  27085. * @category Array
  27086. * @param {...Array} [arrays] The arrays to inspect.
  27087. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  27088. * @returns {Array} Returns the new array of filtered values.
  27089. * @example
  27090. *
  27091. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  27092. * // => [1.2, 3.4]
  27093. *
  27094. * // The `_.property` iteratee shorthand.
  27095. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  27096. * // => [{ 'x': 2 }]
  27097. */
  27098. var xorBy = baseRest(function(arrays) {
  27099. var iteratee = last(arrays);
  27100. if (isArrayLikeObject(iteratee)) {
  27101. iteratee = undefined;
  27102. }
  27103. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  27104. });
  27105. /**
  27106. * This method is like `_.xor` except that it accepts `comparator` which is
  27107. * invoked to compare elements of `arrays`. The order of result values is
  27108. * determined by the order they occur in the arrays. The comparator is invoked
  27109. * with two arguments: (arrVal, othVal).
  27110. *
  27111. * @static
  27112. * @memberOf _
  27113. * @since 4.0.0
  27114. * @category Array
  27115. * @param {...Array} [arrays] The arrays to inspect.
  27116. * @param {Function} [comparator] The comparator invoked per element.
  27117. * @returns {Array} Returns the new array of filtered values.
  27118. * @example
  27119. *
  27120. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  27121. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  27122. *
  27123. * _.xorWith(objects, others, _.isEqual);
  27124. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  27125. */
  27126. var xorWith = baseRest(function(arrays) {
  27127. var comparator = last(arrays);
  27128. comparator = typeof comparator == 'function' ? comparator : undefined;
  27129. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  27130. });
  27131. /**
  27132. * Creates an array of grouped elements, the first of which contains the
  27133. * first elements of the given arrays, the second of which contains the
  27134. * second elements of the given arrays, and so on.
  27135. *
  27136. * @static
  27137. * @memberOf _
  27138. * @since 0.1.0
  27139. * @category Array
  27140. * @param {...Array} [arrays] The arrays to process.
  27141. * @returns {Array} Returns the new array of grouped elements.
  27142. * @example
  27143. *
  27144. * _.zip(['a', 'b'], [1, 2], [true, false]);
  27145. * // => [['a', 1, true], ['b', 2, false]]
  27146. */
  27147. var zip = baseRest(unzip);
  27148. /**
  27149. * This method is like `_.fromPairs` except that it accepts two arrays,
  27150. * one of property identifiers and one of corresponding values.
  27151. *
  27152. * @static
  27153. * @memberOf _
  27154. * @since 0.4.0
  27155. * @category Array
  27156. * @param {Array} [props=[]] The property identifiers.
  27157. * @param {Array} [values=[]] The property values.
  27158. * @returns {Object} Returns the new object.
  27159. * @example
  27160. *
  27161. * _.zipObject(['a', 'b'], [1, 2]);
  27162. * // => { 'a': 1, 'b': 2 }
  27163. */
  27164. function zipObject(props, values) {
  27165. return baseZipObject(props || [], values || [], assignValue);
  27166. }
  27167. /**
  27168. * This method is like `_.zipObject` except that it supports property paths.
  27169. *
  27170. * @static
  27171. * @memberOf _
  27172. * @since 4.1.0
  27173. * @category Array
  27174. * @param {Array} [props=[]] The property identifiers.
  27175. * @param {Array} [values=[]] The property values.
  27176. * @returns {Object} Returns the new object.
  27177. * @example
  27178. *
  27179. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  27180. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  27181. */
  27182. function zipObjectDeep(props, values) {
  27183. return baseZipObject(props || [], values || [], baseSet);
  27184. }
  27185. /**
  27186. * This method is like `_.zip` except that it accepts `iteratee` to specify
  27187. * how grouped values should be combined. The iteratee is invoked with the
  27188. * elements of each group: (...group).
  27189. *
  27190. * @static
  27191. * @memberOf _
  27192. * @since 3.8.0
  27193. * @category Array
  27194. * @param {...Array} [arrays] The arrays to process.
  27195. * @param {Function} [iteratee=_.identity] The function to combine
  27196. * grouped values.
  27197. * @returns {Array} Returns the new array of grouped elements.
  27198. * @example
  27199. *
  27200. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  27201. * return a + b + c;
  27202. * });
  27203. * // => [111, 222]
  27204. */
  27205. var zipWith = baseRest(function(arrays) {
  27206. var length = arrays.length,
  27207. iteratee = length > 1 ? arrays[length - 1] : undefined;
  27208. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  27209. return unzipWith(arrays, iteratee);
  27210. });
  27211. /*------------------------------------------------------------------------*/
  27212. /**
  27213. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  27214. * chain sequences enabled. The result of such sequences must be unwrapped
  27215. * with `_#value`.
  27216. *
  27217. * @static
  27218. * @memberOf _
  27219. * @since 1.3.0
  27220. * @category Seq
  27221. * @param {*} value The value to wrap.
  27222. * @returns {Object} Returns the new `lodash` wrapper instance.
  27223. * @example
  27224. *
  27225. * var users = [
  27226. * { 'user': 'barney', 'age': 36 },
  27227. * { 'user': 'fred', 'age': 40 },
  27228. * { 'user': 'pebbles', 'age': 1 }
  27229. * ];
  27230. *
  27231. * var youngest = _
  27232. * .chain(users)
  27233. * .sortBy('age')
  27234. * .map(function(o) {
  27235. * return o.user + ' is ' + o.age;
  27236. * })
  27237. * .head()
  27238. * .value();
  27239. * // => 'pebbles is 1'
  27240. */
  27241. function chain(value) {
  27242. var result = lodash(value);
  27243. result.__chain__ = true;
  27244. return result;
  27245. }
  27246. /**
  27247. * This method invokes `interceptor` and returns `value`. The interceptor
  27248. * is invoked with one argument; (value). The purpose of this method is to
  27249. * "tap into" a method chain sequence in order to modify intermediate results.
  27250. *
  27251. * @static
  27252. * @memberOf _
  27253. * @since 0.1.0
  27254. * @category Seq
  27255. * @param {*} value The value to provide to `interceptor`.
  27256. * @param {Function} interceptor The function to invoke.
  27257. * @returns {*} Returns `value`.
  27258. * @example
  27259. *
  27260. * _([1, 2, 3])
  27261. * .tap(function(array) {
  27262. * // Mutate input array.
  27263. * array.pop();
  27264. * })
  27265. * .reverse()
  27266. * .value();
  27267. * // => [2, 1]
  27268. */
  27269. function tap(value, interceptor) {
  27270. interceptor(value);
  27271. return value;
  27272. }
  27273. /**
  27274. * This method is like `_.tap` except that it returns the result of `interceptor`.
  27275. * The purpose of this method is to "pass thru" values replacing intermediate
  27276. * results in a method chain sequence.
  27277. *
  27278. * @static
  27279. * @memberOf _
  27280. * @since 3.0.0
  27281. * @category Seq
  27282. * @param {*} value The value to provide to `interceptor`.
  27283. * @param {Function} interceptor The function to invoke.
  27284. * @returns {*} Returns the result of `interceptor`.
  27285. * @example
  27286. *
  27287. * _(' abc ')
  27288. * .chain()
  27289. * .trim()
  27290. * .thru(function(value) {
  27291. * return [value];
  27292. * })
  27293. * .value();
  27294. * // => ['abc']
  27295. */
  27296. function thru(value, interceptor) {
  27297. return interceptor(value);
  27298. }
  27299. /**
  27300. * This method is the wrapper version of `_.at`.
  27301. *
  27302. * @name at
  27303. * @memberOf _
  27304. * @since 1.0.0
  27305. * @category Seq
  27306. * @param {...(string|string[])} [paths] The property paths to pick.
  27307. * @returns {Object} Returns the new `lodash` wrapper instance.
  27308. * @example
  27309. *
  27310. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  27311. *
  27312. * _(object).at(['a[0].b.c', 'a[1]']).value();
  27313. * // => [3, 4]
  27314. */
  27315. var wrapperAt = flatRest(function(paths) {
  27316. var length = paths.length,
  27317. start = length ? paths[0] : 0,
  27318. value = this.__wrapped__,
  27319. interceptor = function(object) { return baseAt(object, paths); };
  27320. if (length > 1 || this.__actions__.length ||
  27321. !(value instanceof LazyWrapper) || !isIndex(start)) {
  27322. return this.thru(interceptor);
  27323. }
  27324. value = value.slice(start, +start + (length ? 1 : 0));
  27325. value.__actions__.push({
  27326. 'func': thru,
  27327. 'args': [interceptor],
  27328. 'thisArg': undefined
  27329. });
  27330. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  27331. if (length && !array.length) {
  27332. array.push(undefined);
  27333. }
  27334. return array;
  27335. });
  27336. });
  27337. /**
  27338. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  27339. *
  27340. * @name chain
  27341. * @memberOf _
  27342. * @since 0.1.0
  27343. * @category Seq
  27344. * @returns {Object} Returns the new `lodash` wrapper instance.
  27345. * @example
  27346. *
  27347. * var users = [
  27348. * { 'user': 'barney', 'age': 36 },
  27349. * { 'user': 'fred', 'age': 40 }
  27350. * ];
  27351. *
  27352. * // A sequence without explicit chaining.
  27353. * _(users).head();
  27354. * // => { 'user': 'barney', 'age': 36 }
  27355. *
  27356. * // A sequence with explicit chaining.
  27357. * _(users)
  27358. * .chain()
  27359. * .head()
  27360. * .pick('user')
  27361. * .value();
  27362. * // => { 'user': 'barney' }
  27363. */
  27364. function wrapperChain() {
  27365. return chain(this);
  27366. }
  27367. /**
  27368. * Executes the chain sequence and returns the wrapped result.
  27369. *
  27370. * @name commit
  27371. * @memberOf _
  27372. * @since 3.2.0
  27373. * @category Seq
  27374. * @returns {Object} Returns the new `lodash` wrapper instance.
  27375. * @example
  27376. *
  27377. * var array = [1, 2];
  27378. * var wrapped = _(array).push(3);
  27379. *
  27380. * console.log(array);
  27381. * // => [1, 2]
  27382. *
  27383. * wrapped = wrapped.commit();
  27384. * console.log(array);
  27385. * // => [1, 2, 3]
  27386. *
  27387. * wrapped.last();
  27388. * // => 3
  27389. *
  27390. * console.log(array);
  27391. * // => [1, 2, 3]
  27392. */
  27393. function wrapperCommit() {
  27394. return new LodashWrapper(this.value(), this.__chain__);
  27395. }
  27396. /**
  27397. * Gets the next value on a wrapped object following the
  27398. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  27399. *
  27400. * @name next
  27401. * @memberOf _
  27402. * @since 4.0.0
  27403. * @category Seq
  27404. * @returns {Object} Returns the next iterator value.
  27405. * @example
  27406. *
  27407. * var wrapped = _([1, 2]);
  27408. *
  27409. * wrapped.next();
  27410. * // => { 'done': false, 'value': 1 }
  27411. *
  27412. * wrapped.next();
  27413. * // => { 'done': false, 'value': 2 }
  27414. *
  27415. * wrapped.next();
  27416. * // => { 'done': true, 'value': undefined }
  27417. */
  27418. function wrapperNext() {
  27419. if (this.__values__ === undefined) {
  27420. this.__values__ = toArray(this.value());
  27421. }
  27422. var done = this.__index__ >= this.__values__.length,
  27423. value = done ? undefined : this.__values__[this.__index__++];
  27424. return { 'done': done, 'value': value };
  27425. }
  27426. /**
  27427. * Enables the wrapper to be iterable.
  27428. *
  27429. * @name Symbol.iterator
  27430. * @memberOf _
  27431. * @since 4.0.0
  27432. * @category Seq
  27433. * @returns {Object} Returns the wrapper object.
  27434. * @example
  27435. *
  27436. * var wrapped = _([1, 2]);
  27437. *
  27438. * wrapped[Symbol.iterator]() === wrapped;
  27439. * // => true
  27440. *
  27441. * Array.from(wrapped);
  27442. * // => [1, 2]
  27443. */
  27444. function wrapperToIterator() {
  27445. return this;
  27446. }
  27447. /**
  27448. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  27449. *
  27450. * @name plant
  27451. * @memberOf _
  27452. * @since 3.2.0
  27453. * @category Seq
  27454. * @param {*} value The value to plant.
  27455. * @returns {Object} Returns the new `lodash` wrapper instance.
  27456. * @example
  27457. *
  27458. * function square(n) {
  27459. * return n * n;
  27460. * }
  27461. *
  27462. * var wrapped = _([1, 2]).map(square);
  27463. * var other = wrapped.plant([3, 4]);
  27464. *
  27465. * other.value();
  27466. * // => [9, 16]
  27467. *
  27468. * wrapped.value();
  27469. * // => [1, 4]
  27470. */
  27471. function wrapperPlant(value) {
  27472. var result,
  27473. parent = this;
  27474. while (parent instanceof baseLodash) {
  27475. var clone = wrapperClone(parent);
  27476. clone.__index__ = 0;
  27477. clone.__values__ = undefined;
  27478. if (result) {
  27479. previous.__wrapped__ = clone;
  27480. } else {
  27481. result = clone;
  27482. }
  27483. var previous = clone;
  27484. parent = parent.__wrapped__;
  27485. }
  27486. previous.__wrapped__ = value;
  27487. return result;
  27488. }
  27489. /**
  27490. * This method is the wrapper version of `_.reverse`.
  27491. *
  27492. * **Note:** This method mutates the wrapped array.
  27493. *
  27494. * @name reverse
  27495. * @memberOf _
  27496. * @since 0.1.0
  27497. * @category Seq
  27498. * @returns {Object} Returns the new `lodash` wrapper instance.
  27499. * @example
  27500. *
  27501. * var array = [1, 2, 3];
  27502. *
  27503. * _(array).reverse().value()
  27504. * // => [3, 2, 1]
  27505. *
  27506. * console.log(array);
  27507. * // => [3, 2, 1]
  27508. */
  27509. function wrapperReverse() {
  27510. var value = this.__wrapped__;
  27511. if (value instanceof LazyWrapper) {
  27512. var wrapped = value;
  27513. if (this.__actions__.length) {
  27514. wrapped = new LazyWrapper(this);
  27515. }
  27516. wrapped = wrapped.reverse();
  27517. wrapped.__actions__.push({
  27518. 'func': thru,
  27519. 'args': [reverse],
  27520. 'thisArg': undefined
  27521. });
  27522. return new LodashWrapper(wrapped, this.__chain__);
  27523. }
  27524. return this.thru(reverse);
  27525. }
  27526. /**
  27527. * Executes the chain sequence to resolve the unwrapped value.
  27528. *
  27529. * @name value
  27530. * @memberOf _
  27531. * @since 0.1.0
  27532. * @alias toJSON, valueOf
  27533. * @category Seq
  27534. * @returns {*} Returns the resolved unwrapped value.
  27535. * @example
  27536. *
  27537. * _([1, 2, 3]).value();
  27538. * // => [1, 2, 3]
  27539. */
  27540. function wrapperValue() {
  27541. return baseWrapperValue(this.__wrapped__, this.__actions__);
  27542. }
  27543. /*------------------------------------------------------------------------*/
  27544. /**
  27545. * Creates an object composed of keys generated from the results of running
  27546. * each element of `collection` thru `iteratee`. The corresponding value of
  27547. * each key is the number of times the key was returned by `iteratee`. The
  27548. * iteratee is invoked with one argument: (value).
  27549. *
  27550. * @static
  27551. * @memberOf _
  27552. * @since 0.5.0
  27553. * @category Collection
  27554. * @param {Array|Object} collection The collection to iterate over.
  27555. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27556. * @returns {Object} Returns the composed aggregate object.
  27557. * @example
  27558. *
  27559. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  27560. * // => { '4': 1, '6': 2 }
  27561. *
  27562. * // The `_.property` iteratee shorthand.
  27563. * _.countBy(['one', 'two', 'three'], 'length');
  27564. * // => { '3': 2, '5': 1 }
  27565. */
  27566. var countBy = createAggregator(function(result, value, key) {
  27567. if (hasOwnProperty.call(result, key)) {
  27568. ++result[key];
  27569. } else {
  27570. baseAssignValue(result, key, 1);
  27571. }
  27572. });
  27573. /**
  27574. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  27575. * Iteration is stopped once `predicate` returns falsey. The predicate is
  27576. * invoked with three arguments: (value, index|key, collection).
  27577. *
  27578. * **Note:** This method returns `true` for
  27579. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  27580. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  27581. * elements of empty collections.
  27582. *
  27583. * @static
  27584. * @memberOf _
  27585. * @since 0.1.0
  27586. * @category Collection
  27587. * @param {Array|Object} collection The collection to iterate over.
  27588. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27589. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27590. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  27591. * else `false`.
  27592. * @example
  27593. *
  27594. * _.every([true, 1, null, 'yes'], Boolean);
  27595. * // => false
  27596. *
  27597. * var users = [
  27598. * { 'user': 'barney', 'age': 36, 'active': false },
  27599. * { 'user': 'fred', 'age': 40, 'active': false }
  27600. * ];
  27601. *
  27602. * // The `_.matches` iteratee shorthand.
  27603. * _.every(users, { 'user': 'barney', 'active': false });
  27604. * // => false
  27605. *
  27606. * // The `_.matchesProperty` iteratee shorthand.
  27607. * _.every(users, ['active', false]);
  27608. * // => true
  27609. *
  27610. * // The `_.property` iteratee shorthand.
  27611. * _.every(users, 'active');
  27612. * // => false
  27613. */
  27614. function every(collection, predicate, guard) {
  27615. var func = isArray(collection) ? arrayEvery : baseEvery;
  27616. if (guard && isIterateeCall(collection, predicate, guard)) {
  27617. predicate = undefined;
  27618. }
  27619. return func(collection, getIteratee(predicate, 3));
  27620. }
  27621. /**
  27622. * Iterates over elements of `collection`, returning an array of all elements
  27623. * `predicate` returns truthy for. The predicate is invoked with three
  27624. * arguments: (value, index|key, collection).
  27625. *
  27626. * **Note:** Unlike `_.remove`, this method returns a new array.
  27627. *
  27628. * @static
  27629. * @memberOf _
  27630. * @since 0.1.0
  27631. * @category Collection
  27632. * @param {Array|Object} collection The collection to iterate over.
  27633. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27634. * @returns {Array} Returns the new filtered array.
  27635. * @see _.reject
  27636. * @example
  27637. *
  27638. * var users = [
  27639. * { 'user': 'barney', 'age': 36, 'active': true },
  27640. * { 'user': 'fred', 'age': 40, 'active': false }
  27641. * ];
  27642. *
  27643. * _.filter(users, function(o) { return !o.active; });
  27644. * // => objects for ['fred']
  27645. *
  27646. * // The `_.matches` iteratee shorthand.
  27647. * _.filter(users, { 'age': 36, 'active': true });
  27648. * // => objects for ['barney']
  27649. *
  27650. * // The `_.matchesProperty` iteratee shorthand.
  27651. * _.filter(users, ['active', false]);
  27652. * // => objects for ['fred']
  27653. *
  27654. * // The `_.property` iteratee shorthand.
  27655. * _.filter(users, 'active');
  27656. * // => objects for ['barney']
  27657. */
  27658. function filter(collection, predicate) {
  27659. var func = isArray(collection) ? arrayFilter : baseFilter;
  27660. return func(collection, getIteratee(predicate, 3));
  27661. }
  27662. /**
  27663. * Iterates over elements of `collection`, returning the first element
  27664. * `predicate` returns truthy for. The predicate is invoked with three
  27665. * arguments: (value, index|key, collection).
  27666. *
  27667. * @static
  27668. * @memberOf _
  27669. * @since 0.1.0
  27670. * @category Collection
  27671. * @param {Array|Object} collection The collection to inspect.
  27672. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27673. * @param {number} [fromIndex=0] The index to search from.
  27674. * @returns {*} Returns the matched element, else `undefined`.
  27675. * @example
  27676. *
  27677. * var users = [
  27678. * { 'user': 'barney', 'age': 36, 'active': true },
  27679. * { 'user': 'fred', 'age': 40, 'active': false },
  27680. * { 'user': 'pebbles', 'age': 1, 'active': true }
  27681. * ];
  27682. *
  27683. * _.find(users, function(o) { return o.age < 40; });
  27684. * // => object for 'barney'
  27685. *
  27686. * // The `_.matches` iteratee shorthand.
  27687. * _.find(users, { 'age': 1, 'active': true });
  27688. * // => object for 'pebbles'
  27689. *
  27690. * // The `_.matchesProperty` iteratee shorthand.
  27691. * _.find(users, ['active', false]);
  27692. * // => object for 'fred'
  27693. *
  27694. * // The `_.property` iteratee shorthand.
  27695. * _.find(users, 'active');
  27696. * // => object for 'barney'
  27697. */
  27698. var find = createFind(findIndex);
  27699. /**
  27700. * This method is like `_.find` except that it iterates over elements of
  27701. * `collection` from right to left.
  27702. *
  27703. * @static
  27704. * @memberOf _
  27705. * @since 2.0.0
  27706. * @category Collection
  27707. * @param {Array|Object} collection The collection to inspect.
  27708. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27709. * @param {number} [fromIndex=collection.length-1] The index to search from.
  27710. * @returns {*} Returns the matched element, else `undefined`.
  27711. * @example
  27712. *
  27713. * _.findLast([1, 2, 3, 4], function(n) {
  27714. * return n % 2 == 1;
  27715. * });
  27716. * // => 3
  27717. */
  27718. var findLast = createFind(findLastIndex);
  27719. /**
  27720. * Creates a flattened array of values by running each element in `collection`
  27721. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  27722. * with three arguments: (value, index|key, collection).
  27723. *
  27724. * @static
  27725. * @memberOf _
  27726. * @since 4.0.0
  27727. * @category Collection
  27728. * @param {Array|Object} collection The collection to iterate over.
  27729. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27730. * @returns {Array} Returns the new flattened array.
  27731. * @example
  27732. *
  27733. * function duplicate(n) {
  27734. * return [n, n];
  27735. * }
  27736. *
  27737. * _.flatMap([1, 2], duplicate);
  27738. * // => [1, 1, 2, 2]
  27739. */
  27740. function flatMap(collection, iteratee) {
  27741. return baseFlatten(map(collection, iteratee), 1);
  27742. }
  27743. /**
  27744. * This method is like `_.flatMap` except that it recursively flattens the
  27745. * mapped results.
  27746. *
  27747. * @static
  27748. * @memberOf _
  27749. * @since 4.7.0
  27750. * @category Collection
  27751. * @param {Array|Object} collection The collection to iterate over.
  27752. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27753. * @returns {Array} Returns the new flattened array.
  27754. * @example
  27755. *
  27756. * function duplicate(n) {
  27757. * return [[[n, n]]];
  27758. * }
  27759. *
  27760. * _.flatMapDeep([1, 2], duplicate);
  27761. * // => [1, 1, 2, 2]
  27762. */
  27763. function flatMapDeep(collection, iteratee) {
  27764. return baseFlatten(map(collection, iteratee), INFINITY);
  27765. }
  27766. /**
  27767. * This method is like `_.flatMap` except that it recursively flattens the
  27768. * mapped results up to `depth` times.
  27769. *
  27770. * @static
  27771. * @memberOf _
  27772. * @since 4.7.0
  27773. * @category Collection
  27774. * @param {Array|Object} collection The collection to iterate over.
  27775. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27776. * @param {number} [depth=1] The maximum recursion depth.
  27777. * @returns {Array} Returns the new flattened array.
  27778. * @example
  27779. *
  27780. * function duplicate(n) {
  27781. * return [[[n, n]]];
  27782. * }
  27783. *
  27784. * _.flatMapDepth([1, 2], duplicate, 2);
  27785. * // => [[1, 1], [2, 2]]
  27786. */
  27787. function flatMapDepth(collection, iteratee, depth) {
  27788. depth = depth === undefined ? 1 : toInteger(depth);
  27789. return baseFlatten(map(collection, iteratee), depth);
  27790. }
  27791. /**
  27792. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  27793. * The iteratee is invoked with three arguments: (value, index|key, collection).
  27794. * Iteratee functions may exit iteration early by explicitly returning `false`.
  27795. *
  27796. * **Note:** As with other "Collections" methods, objects with a "length"
  27797. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  27798. * or `_.forOwn` for object iteration.
  27799. *
  27800. * @static
  27801. * @memberOf _
  27802. * @since 0.1.0
  27803. * @alias each
  27804. * @category Collection
  27805. * @param {Array|Object} collection The collection to iterate over.
  27806. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27807. * @returns {Array|Object} Returns `collection`.
  27808. * @see _.forEachRight
  27809. * @example
  27810. *
  27811. * _.forEach([1, 2], function(value) {
  27812. * console.log(value);
  27813. * });
  27814. * // => Logs `1` then `2`.
  27815. *
  27816. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  27817. * console.log(key);
  27818. * });
  27819. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  27820. */
  27821. function forEach(collection, iteratee) {
  27822. var func = isArray(collection) ? arrayEach : baseEach;
  27823. return func(collection, getIteratee(iteratee, 3));
  27824. }
  27825. /**
  27826. * This method is like `_.forEach` except that it iterates over elements of
  27827. * `collection` from right to left.
  27828. *
  27829. * @static
  27830. * @memberOf _
  27831. * @since 2.0.0
  27832. * @alias eachRight
  27833. * @category Collection
  27834. * @param {Array|Object} collection The collection to iterate over.
  27835. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27836. * @returns {Array|Object} Returns `collection`.
  27837. * @see _.forEach
  27838. * @example
  27839. *
  27840. * _.forEachRight([1, 2], function(value) {
  27841. * console.log(value);
  27842. * });
  27843. * // => Logs `2` then `1`.
  27844. */
  27845. function forEachRight(collection, iteratee) {
  27846. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  27847. return func(collection, getIteratee(iteratee, 3));
  27848. }
  27849. /**
  27850. * Creates an object composed of keys generated from the results of running
  27851. * each element of `collection` thru `iteratee`. The order of grouped values
  27852. * is determined by the order they occur in `collection`. The corresponding
  27853. * value of each key is an array of elements responsible for generating the
  27854. * key. The iteratee is invoked with one argument: (value).
  27855. *
  27856. * @static
  27857. * @memberOf _
  27858. * @since 0.1.0
  27859. * @category Collection
  27860. * @param {Array|Object} collection The collection to iterate over.
  27861. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27862. * @returns {Object} Returns the composed aggregate object.
  27863. * @example
  27864. *
  27865. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  27866. * // => { '4': [4.2], '6': [6.1, 6.3] }
  27867. *
  27868. * // The `_.property` iteratee shorthand.
  27869. * _.groupBy(['one', 'two', 'three'], 'length');
  27870. * // => { '3': ['one', 'two'], '5': ['three'] }
  27871. */
  27872. var groupBy = createAggregator(function(result, value, key) {
  27873. if (hasOwnProperty.call(result, key)) {
  27874. result[key].push(value);
  27875. } else {
  27876. baseAssignValue(result, key, [value]);
  27877. }
  27878. });
  27879. /**
  27880. * Checks if `value` is in `collection`. If `collection` is a string, it's
  27881. * checked for a substring of `value`, otherwise
  27882. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  27883. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  27884. * the offset from the end of `collection`.
  27885. *
  27886. * @static
  27887. * @memberOf _
  27888. * @since 0.1.0
  27889. * @category Collection
  27890. * @param {Array|Object|string} collection The collection to inspect.
  27891. * @param {*} value The value to search for.
  27892. * @param {number} [fromIndex=0] The index to search from.
  27893. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27894. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  27895. * @example
  27896. *
  27897. * _.includes([1, 2, 3], 1);
  27898. * // => true
  27899. *
  27900. * _.includes([1, 2, 3], 1, 2);
  27901. * // => false
  27902. *
  27903. * _.includes({ 'a': 1, 'b': 2 }, 1);
  27904. * // => true
  27905. *
  27906. * _.includes('abcd', 'bc');
  27907. * // => true
  27908. */
  27909. function includes(collection, value, fromIndex, guard) {
  27910. collection = isArrayLike(collection) ? collection : values(collection);
  27911. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  27912. var length = collection.length;
  27913. if (fromIndex < 0) {
  27914. fromIndex = nativeMax(length + fromIndex, 0);
  27915. }
  27916. return isString(collection)
  27917. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  27918. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  27919. }
  27920. /**
  27921. * Invokes the method at `path` of each element in `collection`, returning
  27922. * an array of the results of each invoked method. Any additional arguments
  27923. * are provided to each invoked method. If `path` is a function, it's invoked
  27924. * for, and `this` bound to, each element in `collection`.
  27925. *
  27926. * @static
  27927. * @memberOf _
  27928. * @since 4.0.0
  27929. * @category Collection
  27930. * @param {Array|Object} collection The collection to iterate over.
  27931. * @param {Array|Function|string} path The path of the method to invoke or
  27932. * the function invoked per iteration.
  27933. * @param {...*} [args] The arguments to invoke each method with.
  27934. * @returns {Array} Returns the array of results.
  27935. * @example
  27936. *
  27937. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  27938. * // => [[1, 5, 7], [1, 2, 3]]
  27939. *
  27940. * _.invokeMap([123, 456], String.prototype.split, '');
  27941. * // => [['1', '2', '3'], ['4', '5', '6']]
  27942. */
  27943. var invokeMap = baseRest(function(collection, path, args) {
  27944. var index = -1,
  27945. isFunc = typeof path == 'function',
  27946. result = isArrayLike(collection) ? Array(collection.length) : [];
  27947. baseEach(collection, function(value) {
  27948. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  27949. });
  27950. return result;
  27951. });
  27952. /**
  27953. * Creates an object composed of keys generated from the results of running
  27954. * each element of `collection` thru `iteratee`. The corresponding value of
  27955. * each key is the last element responsible for generating the key. The
  27956. * iteratee is invoked with one argument: (value).
  27957. *
  27958. * @static
  27959. * @memberOf _
  27960. * @since 4.0.0
  27961. * @category Collection
  27962. * @param {Array|Object} collection The collection to iterate over.
  27963. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27964. * @returns {Object} Returns the composed aggregate object.
  27965. * @example
  27966. *
  27967. * var array = [
  27968. * { 'dir': 'left', 'code': 97 },
  27969. * { 'dir': 'right', 'code': 100 }
  27970. * ];
  27971. *
  27972. * _.keyBy(array, function(o) {
  27973. * return String.fromCharCode(o.code);
  27974. * });
  27975. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  27976. *
  27977. * _.keyBy(array, 'dir');
  27978. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  27979. */
  27980. var keyBy = createAggregator(function(result, value, key) {
  27981. baseAssignValue(result, key, value);
  27982. });
  27983. /**
  27984. * Creates an array of values by running each element in `collection` thru
  27985. * `iteratee`. The iteratee is invoked with three arguments:
  27986. * (value, index|key, collection).
  27987. *
  27988. * Many lodash methods are guarded to work as iteratees for methods like
  27989. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  27990. *
  27991. * The guarded methods are:
  27992. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  27993. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  27994. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  27995. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  27996. *
  27997. * @static
  27998. * @memberOf _
  27999. * @since 0.1.0
  28000. * @category Collection
  28001. * @param {Array|Object} collection The collection to iterate over.
  28002. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  28003. * @returns {Array} Returns the new mapped array.
  28004. * @example
  28005. *
  28006. * function square(n) {
  28007. * return n * n;
  28008. * }
  28009. *
  28010. * _.map([4, 8], square);
  28011. * // => [16, 64]
  28012. *
  28013. * _.map({ 'a': 4, 'b': 8 }, square);
  28014. * // => [16, 64] (iteration order is not guaranteed)
  28015. *
  28016. * var users = [
  28017. * { 'user': 'barney' },
  28018. * { 'user': 'fred' }
  28019. * ];
  28020. *
  28021. * // The `_.property` iteratee shorthand.
  28022. * _.map(users, 'user');
  28023. * // => ['barney', 'fred']
  28024. */
  28025. function map(collection, iteratee) {
  28026. var func = isArray(collection) ? arrayMap : baseMap;
  28027. return func(collection, getIteratee(iteratee, 3));
  28028. }
  28029. /**
  28030. * This method is like `_.sortBy` except that it allows specifying the sort
  28031. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  28032. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  28033. * descending or "asc" for ascending sort order of corresponding values.
  28034. *
  28035. * @static
  28036. * @memberOf _
  28037. * @since 4.0.0
  28038. * @category Collection
  28039. * @param {Array|Object} collection The collection to iterate over.
  28040. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  28041. * The iteratees to sort by.
  28042. * @param {string[]} [orders] The sort orders of `iteratees`.
  28043. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  28044. * @returns {Array} Returns the new sorted array.
  28045. * @example
  28046. *
  28047. * var users = [
  28048. * { 'user': 'fred', 'age': 48 },
  28049. * { 'user': 'barney', 'age': 34 },
  28050. * { 'user': 'fred', 'age': 40 },
  28051. * { 'user': 'barney', 'age': 36 }
  28052. * ];
  28053. *
  28054. * // Sort by `user` in ascending order and by `age` in descending order.
  28055. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  28056. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  28057. */
  28058. function orderBy(collection, iteratees, orders, guard) {
  28059. if (collection == null) {
  28060. return [];
  28061. }
  28062. if (!isArray(iteratees)) {
  28063. iteratees = iteratees == null ? [] : [iteratees];
  28064. }
  28065. orders = guard ? undefined : orders;
  28066. if (!isArray(orders)) {
  28067. orders = orders == null ? [] : [orders];
  28068. }
  28069. return baseOrderBy(collection, iteratees, orders);
  28070. }
  28071. /**
  28072. * Creates an array of elements split into two groups, the first of which
  28073. * contains elements `predicate` returns truthy for, the second of which
  28074. * contains elements `predicate` returns falsey for. The predicate is
  28075. * invoked with one argument: (value).
  28076. *
  28077. * @static
  28078. * @memberOf _
  28079. * @since 3.0.0
  28080. * @category Collection
  28081. * @param {Array|Object} collection The collection to iterate over.
  28082. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  28083. * @returns {Array} Returns the array of grouped elements.
  28084. * @example
  28085. *
  28086. * var users = [
  28087. * { 'user': 'barney', 'age': 36, 'active': false },
  28088. * { 'user': 'fred', 'age': 40, 'active': true },
  28089. * { 'user': 'pebbles', 'age': 1, 'active': false }
  28090. * ];
  28091. *
  28092. * _.partition(users, function(o) { return o.active; });
  28093. * // => objects for [['fred'], ['barney', 'pebbles']]
  28094. *
  28095. * // The `_.matches` iteratee shorthand.
  28096. * _.partition(users, { 'age': 1, 'active': false });
  28097. * // => objects for [['pebbles'], ['barney', 'fred']]
  28098. *
  28099. * // The `_.matchesProperty` iteratee shorthand.
  28100. * _.partition(users, ['active', false]);
  28101. * // => objects for [['barney', 'pebbles'], ['fred']]
  28102. *
  28103. * // The `_.property` iteratee shorthand.
  28104. * _.partition(users, 'active');
  28105. * // => objects for [['fred'], ['barney', 'pebbles']]
  28106. */
  28107. var partition = createAggregator(function(result, value, key) {
  28108. result[key ? 0 : 1].push(value);
  28109. }, function() { return [[], []]; });
  28110. /**
  28111. * Reduces `collection` to a value which is the accumulated result of running
  28112. * each element in `collection` thru `iteratee`, where each successive
  28113. * invocation is supplied the return value of the previous. If `accumulator`
  28114. * is not given, the first element of `collection` is used as the initial
  28115. * value. The iteratee is invoked with four arguments:
  28116. * (accumulator, value, index|key, collection).
  28117. *
  28118. * Many lodash methods are guarded to work as iteratees for methods like
  28119. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  28120. *
  28121. * The guarded methods are:
  28122. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  28123. * and `sortBy`
  28124. *
  28125. * @static
  28126. * @memberOf _
  28127. * @since 0.1.0
  28128. * @category Collection
  28129. * @param {Array|Object} collection The collection to iterate over.
  28130. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  28131. * @param {*} [accumulator] The initial value.
  28132. * @returns {*} Returns the accumulated value.
  28133. * @see _.reduceRight
  28134. * @example
  28135. *
  28136. * _.reduce([1, 2], function(sum, n) {
  28137. * return sum + n;
  28138. * }, 0);
  28139. * // => 3
  28140. *
  28141. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  28142. * (result[value] || (result[value] = [])).push(key);
  28143. * return result;
  28144. * }, {});
  28145. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  28146. */
  28147. function reduce(collection, iteratee, accumulator) {
  28148. var func = isArray(collection) ? arrayReduce : baseReduce,
  28149. initAccum = arguments.length < 3;
  28150. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  28151. }
  28152. /**
  28153. * This method is like `_.reduce` except that it iterates over elements of
  28154. * `collection` from right to left.
  28155. *
  28156. * @static
  28157. * @memberOf _
  28158. * @since 0.1.0
  28159. * @category Collection
  28160. * @param {Array|Object} collection The collection to iterate over.
  28161. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  28162. * @param {*} [accumulator] The initial value.
  28163. * @returns {*} Returns the accumulated value.
  28164. * @see _.reduce
  28165. * @example
  28166. *
  28167. * var array = [[0, 1], [2, 3], [4, 5]];
  28168. *
  28169. * _.reduceRight(array, function(flattened, other) {
  28170. * return flattened.concat(other);
  28171. * }, []);
  28172. * // => [4, 5, 2, 3, 0, 1]
  28173. */
  28174. function reduceRight(collection, iteratee, accumulator) {
  28175. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  28176. initAccum = arguments.length < 3;
  28177. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  28178. }
  28179. /**
  28180. * The opposite of `_.filter`; this method returns the elements of `collection`
  28181. * that `predicate` does **not** return truthy for.
  28182. *
  28183. * @static
  28184. * @memberOf _
  28185. * @since 0.1.0
  28186. * @category Collection
  28187. * @param {Array|Object} collection The collection to iterate over.
  28188. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  28189. * @returns {Array} Returns the new filtered array.
  28190. * @see _.filter
  28191. * @example
  28192. *
  28193. * var users = [
  28194. * { 'user': 'barney', 'age': 36, 'active': false },
  28195. * { 'user': 'fred', 'age': 40, 'active': true }
  28196. * ];
  28197. *
  28198. * _.reject(users, function(o) { return !o.active; });
  28199. * // => objects for ['fred']
  28200. *
  28201. * // The `_.matches` iteratee shorthand.
  28202. * _.reject(users, { 'age': 40, 'active': true });
  28203. * // => objects for ['barney']
  28204. *
  28205. * // The `_.matchesProperty` iteratee shorthand.
  28206. * _.reject(users, ['active', false]);
  28207. * // => objects for ['fred']
  28208. *
  28209. * // The `_.property` iteratee shorthand.
  28210. * _.reject(users, 'active');
  28211. * // => objects for ['barney']
  28212. */
  28213. function reject(collection, predicate) {
  28214. var func = isArray(collection) ? arrayFilter : baseFilter;
  28215. return func(collection, negate(getIteratee(predicate, 3)));
  28216. }
  28217. /**
  28218. * Gets a random element from `collection`.
  28219. *
  28220. * @static
  28221. * @memberOf _
  28222. * @since 2.0.0
  28223. * @category Collection
  28224. * @param {Array|Object} collection The collection to sample.
  28225. * @returns {*} Returns the random element.
  28226. * @example
  28227. *
  28228. * _.sample([1, 2, 3, 4]);
  28229. * // => 2
  28230. */
  28231. function sample(collection) {
  28232. var func = isArray(collection) ? arraySample : baseSample;
  28233. return func(collection);
  28234. }
  28235. /**
  28236. * Gets `n` random elements at unique keys from `collection` up to the
  28237. * size of `collection`.
  28238. *
  28239. * @static
  28240. * @memberOf _
  28241. * @since 4.0.0
  28242. * @category Collection
  28243. * @param {Array|Object} collection The collection to sample.
  28244. * @param {number} [n=1] The number of elements to sample.
  28245. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28246. * @returns {Array} Returns the random elements.
  28247. * @example
  28248. *
  28249. * _.sampleSize([1, 2, 3], 2);
  28250. * // => [3, 1]
  28251. *
  28252. * _.sampleSize([1, 2, 3], 4);
  28253. * // => [2, 3, 1]
  28254. */
  28255. function sampleSize(collection, n, guard) {
  28256. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  28257. n = 1;
  28258. } else {
  28259. n = toInteger(n);
  28260. }
  28261. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  28262. return func(collection, n);
  28263. }
  28264. /**
  28265. * Creates an array of shuffled values, using a version of the
  28266. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  28267. *
  28268. * @static
  28269. * @memberOf _
  28270. * @since 0.1.0
  28271. * @category Collection
  28272. * @param {Array|Object} collection The collection to shuffle.
  28273. * @returns {Array} Returns the new shuffled array.
  28274. * @example
  28275. *
  28276. * _.shuffle([1, 2, 3, 4]);
  28277. * // => [4, 1, 3, 2]
  28278. */
  28279. function shuffle(collection) {
  28280. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  28281. return func(collection);
  28282. }
  28283. /**
  28284. * Gets the size of `collection` by returning its length for array-like
  28285. * values or the number of own enumerable string keyed properties for objects.
  28286. *
  28287. * @static
  28288. * @memberOf _
  28289. * @since 0.1.0
  28290. * @category Collection
  28291. * @param {Array|Object|string} collection The collection to inspect.
  28292. * @returns {number} Returns the collection size.
  28293. * @example
  28294. *
  28295. * _.size([1, 2, 3]);
  28296. * // => 3
  28297. *
  28298. * _.size({ 'a': 1, 'b': 2 });
  28299. * // => 2
  28300. *
  28301. * _.size('pebbles');
  28302. * // => 7
  28303. */
  28304. function size(collection) {
  28305. if (collection == null) {
  28306. return 0;
  28307. }
  28308. if (isArrayLike(collection)) {
  28309. return isString(collection) ? stringSize(collection) : collection.length;
  28310. }
  28311. var tag = getTag(collection);
  28312. if (tag == mapTag || tag == setTag) {
  28313. return collection.size;
  28314. }
  28315. return baseKeys(collection).length;
  28316. }
  28317. /**
  28318. * Checks if `predicate` returns truthy for **any** element of `collection`.
  28319. * Iteration is stopped once `predicate` returns truthy. The predicate is
  28320. * invoked with three arguments: (value, index|key, collection).
  28321. *
  28322. * @static
  28323. * @memberOf _
  28324. * @since 0.1.0
  28325. * @category Collection
  28326. * @param {Array|Object} collection The collection to iterate over.
  28327. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  28328. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28329. * @returns {boolean} Returns `true` if any element passes the predicate check,
  28330. * else `false`.
  28331. * @example
  28332. *
  28333. * _.some([null, 0, 'yes', false], Boolean);
  28334. * // => true
  28335. *
  28336. * var users = [
  28337. * { 'user': 'barney', 'active': true },
  28338. * { 'user': 'fred', 'active': false }
  28339. * ];
  28340. *
  28341. * // The `_.matches` iteratee shorthand.
  28342. * _.some(users, { 'user': 'barney', 'active': false });
  28343. * // => false
  28344. *
  28345. * // The `_.matchesProperty` iteratee shorthand.
  28346. * _.some(users, ['active', false]);
  28347. * // => true
  28348. *
  28349. * // The `_.property` iteratee shorthand.
  28350. * _.some(users, 'active');
  28351. * // => true
  28352. */
  28353. function some(collection, predicate, guard) {
  28354. var func = isArray(collection) ? arraySome : baseSome;
  28355. if (guard && isIterateeCall(collection, predicate, guard)) {
  28356. predicate = undefined;
  28357. }
  28358. return func(collection, getIteratee(predicate, 3));
  28359. }
  28360. /**
  28361. * Creates an array of elements, sorted in ascending order by the results of
  28362. * running each element in a collection thru each iteratee. This method
  28363. * performs a stable sort, that is, it preserves the original sort order of
  28364. * equal elements. The iteratees are invoked with one argument: (value).
  28365. *
  28366. * @static
  28367. * @memberOf _
  28368. * @since 0.1.0
  28369. * @category Collection
  28370. * @param {Array|Object} collection The collection to iterate over.
  28371. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  28372. * The iteratees to sort by.
  28373. * @returns {Array} Returns the new sorted array.
  28374. * @example
  28375. *
  28376. * var users = [
  28377. * { 'user': 'fred', 'age': 48 },
  28378. * { 'user': 'barney', 'age': 36 },
  28379. * { 'user': 'fred', 'age': 40 },
  28380. * { 'user': 'barney', 'age': 34 }
  28381. * ];
  28382. *
  28383. * _.sortBy(users, [function(o) { return o.user; }]);
  28384. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  28385. *
  28386. * _.sortBy(users, ['user', 'age']);
  28387. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  28388. */
  28389. var sortBy = baseRest(function(collection, iteratees) {
  28390. if (collection == null) {
  28391. return [];
  28392. }
  28393. var length = iteratees.length;
  28394. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  28395. iteratees = [];
  28396. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  28397. iteratees = [iteratees[0]];
  28398. }
  28399. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  28400. });
  28401. /*------------------------------------------------------------------------*/
  28402. /**
  28403. * Gets the timestamp of the number of milliseconds that have elapsed since
  28404. * the Unix epoch (1 January 1970 00:00:00 UTC).
  28405. *
  28406. * @static
  28407. * @memberOf _
  28408. * @since 2.4.0
  28409. * @category Date
  28410. * @returns {number} Returns the timestamp.
  28411. * @example
  28412. *
  28413. * _.defer(function(stamp) {
  28414. * console.log(_.now() - stamp);
  28415. * }, _.now());
  28416. * // => Logs the number of milliseconds it took for the deferred invocation.
  28417. */
  28418. var now = ctxNow || function() {
  28419. return root.Date.now();
  28420. };
  28421. /*------------------------------------------------------------------------*/
  28422. /**
  28423. * The opposite of `_.before`; this method creates a function that invokes
  28424. * `func` once it's called `n` or more times.
  28425. *
  28426. * @static
  28427. * @memberOf _
  28428. * @since 0.1.0
  28429. * @category Function
  28430. * @param {number} n The number of calls before `func` is invoked.
  28431. * @param {Function} func The function to restrict.
  28432. * @returns {Function} Returns the new restricted function.
  28433. * @example
  28434. *
  28435. * var saves = ['profile', 'settings'];
  28436. *
  28437. * var done = _.after(saves.length, function() {
  28438. * console.log('done saving!');
  28439. * });
  28440. *
  28441. * _.forEach(saves, function(type) {
  28442. * asyncSave({ 'type': type, 'complete': done });
  28443. * });
  28444. * // => Logs 'done saving!' after the two async saves have completed.
  28445. */
  28446. function after(n, func) {
  28447. if (typeof func != 'function') {
  28448. throw new TypeError(FUNC_ERROR_TEXT);
  28449. }
  28450. n = toInteger(n);
  28451. return function() {
  28452. if (--n < 1) {
  28453. return func.apply(this, arguments);
  28454. }
  28455. };
  28456. }
  28457. /**
  28458. * Creates a function that invokes `func`, with up to `n` arguments,
  28459. * ignoring any additional arguments.
  28460. *
  28461. * @static
  28462. * @memberOf _
  28463. * @since 3.0.0
  28464. * @category Function
  28465. * @param {Function} func The function to cap arguments for.
  28466. * @param {number} [n=func.length] The arity cap.
  28467. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28468. * @returns {Function} Returns the new capped function.
  28469. * @example
  28470. *
  28471. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  28472. * // => [6, 8, 10]
  28473. */
  28474. function ary(func, n, guard) {
  28475. n = guard ? undefined : n;
  28476. n = (func && n == null) ? func.length : n;
  28477. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  28478. }
  28479. /**
  28480. * Creates a function that invokes `func`, with the `this` binding and arguments
  28481. * of the created function, while it's called less than `n` times. Subsequent
  28482. * calls to the created function return the result of the last `func` invocation.
  28483. *
  28484. * @static
  28485. * @memberOf _
  28486. * @since 3.0.0
  28487. * @category Function
  28488. * @param {number} n The number of calls at which `func` is no longer invoked.
  28489. * @param {Function} func The function to restrict.
  28490. * @returns {Function} Returns the new restricted function.
  28491. * @example
  28492. *
  28493. * jQuery(element).on('click', _.before(5, addContactToList));
  28494. * // => Allows adding up to 4 contacts to the list.
  28495. */
  28496. function before(n, func) {
  28497. var result;
  28498. if (typeof func != 'function') {
  28499. throw new TypeError(FUNC_ERROR_TEXT);
  28500. }
  28501. n = toInteger(n);
  28502. return function() {
  28503. if (--n > 0) {
  28504. result = func.apply(this, arguments);
  28505. }
  28506. if (n <= 1) {
  28507. func = undefined;
  28508. }
  28509. return result;
  28510. };
  28511. }
  28512. /**
  28513. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  28514. * and `partials` prepended to the arguments it receives.
  28515. *
  28516. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  28517. * may be used as a placeholder for partially applied arguments.
  28518. *
  28519. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  28520. * property of bound functions.
  28521. *
  28522. * @static
  28523. * @memberOf _
  28524. * @since 0.1.0
  28525. * @category Function
  28526. * @param {Function} func The function to bind.
  28527. * @param {*} thisArg The `this` binding of `func`.
  28528. * @param {...*} [partials] The arguments to be partially applied.
  28529. * @returns {Function} Returns the new bound function.
  28530. * @example
  28531. *
  28532. * function greet(greeting, punctuation) {
  28533. * return greeting + ' ' + this.user + punctuation;
  28534. * }
  28535. *
  28536. * var object = { 'user': 'fred' };
  28537. *
  28538. * var bound = _.bind(greet, object, 'hi');
  28539. * bound('!');
  28540. * // => 'hi fred!'
  28541. *
  28542. * // Bound with placeholders.
  28543. * var bound = _.bind(greet, object, _, '!');
  28544. * bound('hi');
  28545. * // => 'hi fred!'
  28546. */
  28547. var bind = baseRest(function(func, thisArg, partials) {
  28548. var bitmask = WRAP_BIND_FLAG;
  28549. if (partials.length) {
  28550. var holders = replaceHolders(partials, getHolder(bind));
  28551. bitmask |= WRAP_PARTIAL_FLAG;
  28552. }
  28553. return createWrap(func, bitmask, thisArg, partials, holders);
  28554. });
  28555. /**
  28556. * Creates a function that invokes the method at `object[key]` with `partials`
  28557. * prepended to the arguments it receives.
  28558. *
  28559. * This method differs from `_.bind` by allowing bound functions to reference
  28560. * methods that may be redefined or don't yet exist. See
  28561. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  28562. * for more details.
  28563. *
  28564. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  28565. * builds, may be used as a placeholder for partially applied arguments.
  28566. *
  28567. * @static
  28568. * @memberOf _
  28569. * @since 0.10.0
  28570. * @category Function
  28571. * @param {Object} object The object to invoke the method on.
  28572. * @param {string} key The key of the method.
  28573. * @param {...*} [partials] The arguments to be partially applied.
  28574. * @returns {Function} Returns the new bound function.
  28575. * @example
  28576. *
  28577. * var object = {
  28578. * 'user': 'fred',
  28579. * 'greet': function(greeting, punctuation) {
  28580. * return greeting + ' ' + this.user + punctuation;
  28581. * }
  28582. * };
  28583. *
  28584. * var bound = _.bindKey(object, 'greet', 'hi');
  28585. * bound('!');
  28586. * // => 'hi fred!'
  28587. *
  28588. * object.greet = function(greeting, punctuation) {
  28589. * return greeting + 'ya ' + this.user + punctuation;
  28590. * };
  28591. *
  28592. * bound('!');
  28593. * // => 'hiya fred!'
  28594. *
  28595. * // Bound with placeholders.
  28596. * var bound = _.bindKey(object, 'greet', _, '!');
  28597. * bound('hi');
  28598. * // => 'hiya fred!'
  28599. */
  28600. var bindKey = baseRest(function(object, key, partials) {
  28601. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  28602. if (partials.length) {
  28603. var holders = replaceHolders(partials, getHolder(bindKey));
  28604. bitmask |= WRAP_PARTIAL_FLAG;
  28605. }
  28606. return createWrap(key, bitmask, object, partials, holders);
  28607. });
  28608. /**
  28609. * Creates a function that accepts arguments of `func` and either invokes
  28610. * `func` returning its result, if at least `arity` number of arguments have
  28611. * been provided, or returns a function that accepts the remaining `func`
  28612. * arguments, and so on. The arity of `func` may be specified if `func.length`
  28613. * is not sufficient.
  28614. *
  28615. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  28616. * may be used as a placeholder for provided arguments.
  28617. *
  28618. * **Note:** This method doesn't set the "length" property of curried functions.
  28619. *
  28620. * @static
  28621. * @memberOf _
  28622. * @since 2.0.0
  28623. * @category Function
  28624. * @param {Function} func The function to curry.
  28625. * @param {number} [arity=func.length] The arity of `func`.
  28626. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28627. * @returns {Function} Returns the new curried function.
  28628. * @example
  28629. *
  28630. * var abc = function(a, b, c) {
  28631. * return [a, b, c];
  28632. * };
  28633. *
  28634. * var curried = _.curry(abc);
  28635. *
  28636. * curried(1)(2)(3);
  28637. * // => [1, 2, 3]
  28638. *
  28639. * curried(1, 2)(3);
  28640. * // => [1, 2, 3]
  28641. *
  28642. * curried(1, 2, 3);
  28643. * // => [1, 2, 3]
  28644. *
  28645. * // Curried with placeholders.
  28646. * curried(1)(_, 3)(2);
  28647. * // => [1, 2, 3]
  28648. */
  28649. function curry(func, arity, guard) {
  28650. arity = guard ? undefined : arity;
  28651. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  28652. result.placeholder = curry.placeholder;
  28653. return result;
  28654. }
  28655. /**
  28656. * This method is like `_.curry` except that arguments are applied to `func`
  28657. * in the manner of `_.partialRight` instead of `_.partial`.
  28658. *
  28659. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  28660. * builds, may be used as a placeholder for provided arguments.
  28661. *
  28662. * **Note:** This method doesn't set the "length" property of curried functions.
  28663. *
  28664. * @static
  28665. * @memberOf _
  28666. * @since 3.0.0
  28667. * @category Function
  28668. * @param {Function} func The function to curry.
  28669. * @param {number} [arity=func.length] The arity of `func`.
  28670. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28671. * @returns {Function} Returns the new curried function.
  28672. * @example
  28673. *
  28674. * var abc = function(a, b, c) {
  28675. * return [a, b, c];
  28676. * };
  28677. *
  28678. * var curried = _.curryRight(abc);
  28679. *
  28680. * curried(3)(2)(1);
  28681. * // => [1, 2, 3]
  28682. *
  28683. * curried(2, 3)(1);
  28684. * // => [1, 2, 3]
  28685. *
  28686. * curried(1, 2, 3);
  28687. * // => [1, 2, 3]
  28688. *
  28689. * // Curried with placeholders.
  28690. * curried(3)(1, _)(2);
  28691. * // => [1, 2, 3]
  28692. */
  28693. function curryRight(func, arity, guard) {
  28694. arity = guard ? undefined : arity;
  28695. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  28696. result.placeholder = curryRight.placeholder;
  28697. return result;
  28698. }
  28699. /**
  28700. * Creates a debounced function that delays invoking `func` until after `wait`
  28701. * milliseconds have elapsed since the last time the debounced function was
  28702. * invoked. The debounced function comes with a `cancel` method to cancel
  28703. * delayed `func` invocations and a `flush` method to immediately invoke them.
  28704. * Provide `options` to indicate whether `func` should be invoked on the
  28705. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  28706. * with the last arguments provided to the debounced function. Subsequent
  28707. * calls to the debounced function return the result of the last `func`
  28708. * invocation.
  28709. *
  28710. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  28711. * invoked on the trailing edge of the timeout only if the debounced function
  28712. * is invoked more than once during the `wait` timeout.
  28713. *
  28714. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  28715. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  28716. *
  28717. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  28718. * for details over the differences between `_.debounce` and `_.throttle`.
  28719. *
  28720. * @static
  28721. * @memberOf _
  28722. * @since 0.1.0
  28723. * @category Function
  28724. * @param {Function} func The function to debounce.
  28725. * @param {number} [wait=0] The number of milliseconds to delay.
  28726. * @param {Object} [options={}] The options object.
  28727. * @param {boolean} [options.leading=false]
  28728. * Specify invoking on the leading edge of the timeout.
  28729. * @param {number} [options.maxWait]
  28730. * The maximum time `func` is allowed to be delayed before it's invoked.
  28731. * @param {boolean} [options.trailing=true]
  28732. * Specify invoking on the trailing edge of the timeout.
  28733. * @returns {Function} Returns the new debounced function.
  28734. * @example
  28735. *
  28736. * // Avoid costly calculations while the window size is in flux.
  28737. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  28738. *
  28739. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  28740. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  28741. * 'leading': true,
  28742. * 'trailing': false
  28743. * }));
  28744. *
  28745. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  28746. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  28747. * var source = new EventSource('/stream');
  28748. * jQuery(source).on('message', debounced);
  28749. *
  28750. * // Cancel the trailing debounced invocation.
  28751. * jQuery(window).on('popstate', debounced.cancel);
  28752. */
  28753. function debounce(func, wait, options) {
  28754. var lastArgs,
  28755. lastThis,
  28756. maxWait,
  28757. result,
  28758. timerId,
  28759. lastCallTime,
  28760. lastInvokeTime = 0,
  28761. leading = false,
  28762. maxing = false,
  28763. trailing = true;
  28764. if (typeof func != 'function') {
  28765. throw new TypeError(FUNC_ERROR_TEXT);
  28766. }
  28767. wait = toNumber(wait) || 0;
  28768. if (isObject(options)) {
  28769. leading = !!options.leading;
  28770. maxing = 'maxWait' in options;
  28771. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  28772. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28773. }
  28774. function invokeFunc(time) {
  28775. var args = lastArgs,
  28776. thisArg = lastThis;
  28777. lastArgs = lastThis = undefined;
  28778. lastInvokeTime = time;
  28779. result = func.apply(thisArg, args);
  28780. return result;
  28781. }
  28782. function leadingEdge(time) {
  28783. // Reset any `maxWait` timer.
  28784. lastInvokeTime = time;
  28785. // Start the timer for the trailing edge.
  28786. timerId = setTimeout(timerExpired, wait);
  28787. // Invoke the leading edge.
  28788. return leading ? invokeFunc(time) : result;
  28789. }
  28790. function remainingWait(time) {
  28791. var timeSinceLastCall = time - lastCallTime,
  28792. timeSinceLastInvoke = time - lastInvokeTime,
  28793. timeWaiting = wait - timeSinceLastCall;
  28794. return maxing
  28795. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  28796. : timeWaiting;
  28797. }
  28798. function shouldInvoke(time) {
  28799. var timeSinceLastCall = time - lastCallTime,
  28800. timeSinceLastInvoke = time - lastInvokeTime;
  28801. // Either this is the first call, activity has stopped and we're at the
  28802. // trailing edge, the system time has gone backwards and we're treating
  28803. // it as the trailing edge, or we've hit the `maxWait` limit.
  28804. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  28805. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  28806. }
  28807. function timerExpired() {
  28808. var time = now();
  28809. if (shouldInvoke(time)) {
  28810. return trailingEdge(time);
  28811. }
  28812. // Restart the timer.
  28813. timerId = setTimeout(timerExpired, remainingWait(time));
  28814. }
  28815. function trailingEdge(time) {
  28816. timerId = undefined;
  28817. // Only invoke if we have `lastArgs` which means `func` has been
  28818. // debounced at least once.
  28819. if (trailing && lastArgs) {
  28820. return invokeFunc(time);
  28821. }
  28822. lastArgs = lastThis = undefined;
  28823. return result;
  28824. }
  28825. function cancel() {
  28826. if (timerId !== undefined) {
  28827. clearTimeout(timerId);
  28828. }
  28829. lastInvokeTime = 0;
  28830. lastArgs = lastCallTime = lastThis = timerId = undefined;
  28831. }
  28832. function flush() {
  28833. return timerId === undefined ? result : trailingEdge(now());
  28834. }
  28835. function debounced() {
  28836. var time = now(),
  28837. isInvoking = shouldInvoke(time);
  28838. lastArgs = arguments;
  28839. lastThis = this;
  28840. lastCallTime = time;
  28841. if (isInvoking) {
  28842. if (timerId === undefined) {
  28843. return leadingEdge(lastCallTime);
  28844. }
  28845. if (maxing) {
  28846. // Handle invocations in a tight loop.
  28847. clearTimeout(timerId);
  28848. timerId = setTimeout(timerExpired, wait);
  28849. return invokeFunc(lastCallTime);
  28850. }
  28851. }
  28852. if (timerId === undefined) {
  28853. timerId = setTimeout(timerExpired, wait);
  28854. }
  28855. return result;
  28856. }
  28857. debounced.cancel = cancel;
  28858. debounced.flush = flush;
  28859. return debounced;
  28860. }
  28861. /**
  28862. * Defers invoking the `func` until the current call stack has cleared. Any
  28863. * additional arguments are provided to `func` when it's invoked.
  28864. *
  28865. * @static
  28866. * @memberOf _
  28867. * @since 0.1.0
  28868. * @category Function
  28869. * @param {Function} func The function to defer.
  28870. * @param {...*} [args] The arguments to invoke `func` with.
  28871. * @returns {number} Returns the timer id.
  28872. * @example
  28873. *
  28874. * _.defer(function(text) {
  28875. * console.log(text);
  28876. * }, 'deferred');
  28877. * // => Logs 'deferred' after one millisecond.
  28878. */
  28879. var defer = baseRest(function(func, args) {
  28880. return baseDelay(func, 1, args);
  28881. });
  28882. /**
  28883. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  28884. * provided to `func` when it's invoked.
  28885. *
  28886. * @static
  28887. * @memberOf _
  28888. * @since 0.1.0
  28889. * @category Function
  28890. * @param {Function} func The function to delay.
  28891. * @param {number} wait The number of milliseconds to delay invocation.
  28892. * @param {...*} [args] The arguments to invoke `func` with.
  28893. * @returns {number} Returns the timer id.
  28894. * @example
  28895. *
  28896. * _.delay(function(text) {
  28897. * console.log(text);
  28898. * }, 1000, 'later');
  28899. * // => Logs 'later' after one second.
  28900. */
  28901. var delay = baseRest(function(func, wait, args) {
  28902. return baseDelay(func, toNumber(wait) || 0, args);
  28903. });
  28904. /**
  28905. * Creates a function that invokes `func` with arguments reversed.
  28906. *
  28907. * @static
  28908. * @memberOf _
  28909. * @since 4.0.0
  28910. * @category Function
  28911. * @param {Function} func The function to flip arguments for.
  28912. * @returns {Function} Returns the new flipped function.
  28913. * @example
  28914. *
  28915. * var flipped = _.flip(function() {
  28916. * return _.toArray(arguments);
  28917. * });
  28918. *
  28919. * flipped('a', 'b', 'c', 'd');
  28920. * // => ['d', 'c', 'b', 'a']
  28921. */
  28922. function flip(func) {
  28923. return createWrap(func, WRAP_FLIP_FLAG);
  28924. }
  28925. /**
  28926. * Creates a function that memoizes the result of `func`. If `resolver` is
  28927. * provided, it determines the cache key for storing the result based on the
  28928. * arguments provided to the memoized function. By default, the first argument
  28929. * provided to the memoized function is used as the map cache key. The `func`
  28930. * is invoked with the `this` binding of the memoized function.
  28931. *
  28932. * **Note:** The cache is exposed as the `cache` property on the memoized
  28933. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  28934. * constructor with one whose instances implement the
  28935. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  28936. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  28937. *
  28938. * @static
  28939. * @memberOf _
  28940. * @since 0.1.0
  28941. * @category Function
  28942. * @param {Function} func The function to have its output memoized.
  28943. * @param {Function} [resolver] The function to resolve the cache key.
  28944. * @returns {Function} Returns the new memoized function.
  28945. * @example
  28946. *
  28947. * var object = { 'a': 1, 'b': 2 };
  28948. * var other = { 'c': 3, 'd': 4 };
  28949. *
  28950. * var values = _.memoize(_.values);
  28951. * values(object);
  28952. * // => [1, 2]
  28953. *
  28954. * values(other);
  28955. * // => [3, 4]
  28956. *
  28957. * object.a = 2;
  28958. * values(object);
  28959. * // => [1, 2]
  28960. *
  28961. * // Modify the result cache.
  28962. * values.cache.set(object, ['a', 'b']);
  28963. * values(object);
  28964. * // => ['a', 'b']
  28965. *
  28966. * // Replace `_.memoize.Cache`.
  28967. * _.memoize.Cache = WeakMap;
  28968. */
  28969. function memoize(func, resolver) {
  28970. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  28971. throw new TypeError(FUNC_ERROR_TEXT);
  28972. }
  28973. var memoized = function() {
  28974. var args = arguments,
  28975. key = resolver ? resolver.apply(this, args) : args[0],
  28976. cache = memoized.cache;
  28977. if (cache.has(key)) {
  28978. return cache.get(key);
  28979. }
  28980. var result = func.apply(this, args);
  28981. memoized.cache = cache.set(key, result) || cache;
  28982. return result;
  28983. };
  28984. memoized.cache = new (memoize.Cache || MapCache);
  28985. return memoized;
  28986. }
  28987. // Expose `MapCache`.
  28988. memoize.Cache = MapCache;
  28989. /**
  28990. * Creates a function that negates the result of the predicate `func`. The
  28991. * `func` predicate is invoked with the `this` binding and arguments of the
  28992. * created function.
  28993. *
  28994. * @static
  28995. * @memberOf _
  28996. * @since 3.0.0
  28997. * @category Function
  28998. * @param {Function} predicate The predicate to negate.
  28999. * @returns {Function} Returns the new negated function.
  29000. * @example
  29001. *
  29002. * function isEven(n) {
  29003. * return n % 2 == 0;
  29004. * }
  29005. *
  29006. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  29007. * // => [1, 3, 5]
  29008. */
  29009. function negate(predicate) {
  29010. if (typeof predicate != 'function') {
  29011. throw new TypeError(FUNC_ERROR_TEXT);
  29012. }
  29013. return function() {
  29014. var args = arguments;
  29015. switch (args.length) {
  29016. case 0: return !predicate.call(this);
  29017. case 1: return !predicate.call(this, args[0]);
  29018. case 2: return !predicate.call(this, args[0], args[1]);
  29019. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  29020. }
  29021. return !predicate.apply(this, args);
  29022. };
  29023. }
  29024. /**
  29025. * Creates a function that is restricted to invoking `func` once. Repeat calls
  29026. * to the function return the value of the first invocation. The `func` is
  29027. * invoked with the `this` binding and arguments of the created function.
  29028. *
  29029. * @static
  29030. * @memberOf _
  29031. * @since 0.1.0
  29032. * @category Function
  29033. * @param {Function} func The function to restrict.
  29034. * @returns {Function} Returns the new restricted function.
  29035. * @example
  29036. *
  29037. * var initialize = _.once(createApplication);
  29038. * initialize();
  29039. * initialize();
  29040. * // => `createApplication` is invoked once
  29041. */
  29042. function once(func) {
  29043. return before(2, func);
  29044. }
  29045. /**
  29046. * Creates a function that invokes `func` with its arguments transformed.
  29047. *
  29048. * @static
  29049. * @since 4.0.0
  29050. * @memberOf _
  29051. * @category Function
  29052. * @param {Function} func The function to wrap.
  29053. * @param {...(Function|Function[])} [transforms=[_.identity]]
  29054. * The argument transforms.
  29055. * @returns {Function} Returns the new function.
  29056. * @example
  29057. *
  29058. * function doubled(n) {
  29059. * return n * 2;
  29060. * }
  29061. *
  29062. * function square(n) {
  29063. * return n * n;
  29064. * }
  29065. *
  29066. * var func = _.overArgs(function(x, y) {
  29067. * return [x, y];
  29068. * }, [square, doubled]);
  29069. *
  29070. * func(9, 3);
  29071. * // => [81, 6]
  29072. *
  29073. * func(10, 5);
  29074. * // => [100, 10]
  29075. */
  29076. var overArgs = castRest(function(func, transforms) {
  29077. transforms = (transforms.length == 1 && isArray(transforms[0]))
  29078. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  29079. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  29080. var funcsLength = transforms.length;
  29081. return baseRest(function(args) {
  29082. var index = -1,
  29083. length = nativeMin(args.length, funcsLength);
  29084. while (++index < length) {
  29085. args[index] = transforms[index].call(this, args[index]);
  29086. }
  29087. return apply(func, this, args);
  29088. });
  29089. });
  29090. /**
  29091. * Creates a function that invokes `func` with `partials` prepended to the
  29092. * arguments it receives. This method is like `_.bind` except it does **not**
  29093. * alter the `this` binding.
  29094. *
  29095. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  29096. * builds, may be used as a placeholder for partially applied arguments.
  29097. *
  29098. * **Note:** This method doesn't set the "length" property of partially
  29099. * applied functions.
  29100. *
  29101. * @static
  29102. * @memberOf _
  29103. * @since 0.2.0
  29104. * @category Function
  29105. * @param {Function} func The function to partially apply arguments to.
  29106. * @param {...*} [partials] The arguments to be partially applied.
  29107. * @returns {Function} Returns the new partially applied function.
  29108. * @example
  29109. *
  29110. * function greet(greeting, name) {
  29111. * return greeting + ' ' + name;
  29112. * }
  29113. *
  29114. * var sayHelloTo = _.partial(greet, 'hello');
  29115. * sayHelloTo('fred');
  29116. * // => 'hello fred'
  29117. *
  29118. * // Partially applied with placeholders.
  29119. * var greetFred = _.partial(greet, _, 'fred');
  29120. * greetFred('hi');
  29121. * // => 'hi fred'
  29122. */
  29123. var partial = baseRest(function(func, partials) {
  29124. var holders = replaceHolders(partials, getHolder(partial));
  29125. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  29126. });
  29127. /**
  29128. * This method is like `_.partial` except that partially applied arguments
  29129. * are appended to the arguments it receives.
  29130. *
  29131. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  29132. * builds, may be used as a placeholder for partially applied arguments.
  29133. *
  29134. * **Note:** This method doesn't set the "length" property of partially
  29135. * applied functions.
  29136. *
  29137. * @static
  29138. * @memberOf _
  29139. * @since 1.0.0
  29140. * @category Function
  29141. * @param {Function} func The function to partially apply arguments to.
  29142. * @param {...*} [partials] The arguments to be partially applied.
  29143. * @returns {Function} Returns the new partially applied function.
  29144. * @example
  29145. *
  29146. * function greet(greeting, name) {
  29147. * return greeting + ' ' + name;
  29148. * }
  29149. *
  29150. * var greetFred = _.partialRight(greet, 'fred');
  29151. * greetFred('hi');
  29152. * // => 'hi fred'
  29153. *
  29154. * // Partially applied with placeholders.
  29155. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  29156. * sayHelloTo('fred');
  29157. * // => 'hello fred'
  29158. */
  29159. var partialRight = baseRest(function(func, partials) {
  29160. var holders = replaceHolders(partials, getHolder(partialRight));
  29161. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  29162. });
  29163. /**
  29164. * Creates a function that invokes `func` with arguments arranged according
  29165. * to the specified `indexes` where the argument value at the first index is
  29166. * provided as the first argument, the argument value at the second index is
  29167. * provided as the second argument, and so on.
  29168. *
  29169. * @static
  29170. * @memberOf _
  29171. * @since 3.0.0
  29172. * @category Function
  29173. * @param {Function} func The function to rearrange arguments for.
  29174. * @param {...(number|number[])} indexes The arranged argument indexes.
  29175. * @returns {Function} Returns the new function.
  29176. * @example
  29177. *
  29178. * var rearged = _.rearg(function(a, b, c) {
  29179. * return [a, b, c];
  29180. * }, [2, 0, 1]);
  29181. *
  29182. * rearged('b', 'c', 'a')
  29183. * // => ['a', 'b', 'c']
  29184. */
  29185. var rearg = flatRest(function(func, indexes) {
  29186. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  29187. });
  29188. /**
  29189. * Creates a function that invokes `func` with the `this` binding of the
  29190. * created function and arguments from `start` and beyond provided as
  29191. * an array.
  29192. *
  29193. * **Note:** This method is based on the
  29194. * [rest parameter](https://mdn.io/rest_parameters).
  29195. *
  29196. * @static
  29197. * @memberOf _
  29198. * @since 4.0.0
  29199. * @category Function
  29200. * @param {Function} func The function to apply a rest parameter to.
  29201. * @param {number} [start=func.length-1] The start position of the rest parameter.
  29202. * @returns {Function} Returns the new function.
  29203. * @example
  29204. *
  29205. * var say = _.rest(function(what, names) {
  29206. * return what + ' ' + _.initial(names).join(', ') +
  29207. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  29208. * });
  29209. *
  29210. * say('hello', 'fred', 'barney', 'pebbles');
  29211. * // => 'hello fred, barney, & pebbles'
  29212. */
  29213. function rest(func, start) {
  29214. if (typeof func != 'function') {
  29215. throw new TypeError(FUNC_ERROR_TEXT);
  29216. }
  29217. start = start === undefined ? start : toInteger(start);
  29218. return baseRest(func, start);
  29219. }
  29220. /**
  29221. * Creates a function that invokes `func` with the `this` binding of the
  29222. * create function and an array of arguments much like
  29223. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  29224. *
  29225. * **Note:** This method is based on the
  29226. * [spread operator](https://mdn.io/spread_operator).
  29227. *
  29228. * @static
  29229. * @memberOf _
  29230. * @since 3.2.0
  29231. * @category Function
  29232. * @param {Function} func The function to spread arguments over.
  29233. * @param {number} [start=0] The start position of the spread.
  29234. * @returns {Function} Returns the new function.
  29235. * @example
  29236. *
  29237. * var say = _.spread(function(who, what) {
  29238. * return who + ' says ' + what;
  29239. * });
  29240. *
  29241. * say(['fred', 'hello']);
  29242. * // => 'fred says hello'
  29243. *
  29244. * var numbers = Promise.all([
  29245. * Promise.resolve(40),
  29246. * Promise.resolve(36)
  29247. * ]);
  29248. *
  29249. * numbers.then(_.spread(function(x, y) {
  29250. * return x + y;
  29251. * }));
  29252. * // => a Promise of 76
  29253. */
  29254. function spread(func, start) {
  29255. if (typeof func != 'function') {
  29256. throw new TypeError(FUNC_ERROR_TEXT);
  29257. }
  29258. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  29259. return baseRest(function(args) {
  29260. var array = args[start],
  29261. otherArgs = castSlice(args, 0, start);
  29262. if (array) {
  29263. arrayPush(otherArgs, array);
  29264. }
  29265. return apply(func, this, otherArgs);
  29266. });
  29267. }
  29268. /**
  29269. * Creates a throttled function that only invokes `func` at most once per
  29270. * every `wait` milliseconds. The throttled function comes with a `cancel`
  29271. * method to cancel delayed `func` invocations and a `flush` method to
  29272. * immediately invoke them. Provide `options` to indicate whether `func`
  29273. * should be invoked on the leading and/or trailing edge of the `wait`
  29274. * timeout. The `func` is invoked with the last arguments provided to the
  29275. * throttled function. Subsequent calls to the throttled function return the
  29276. * result of the last `func` invocation.
  29277. *
  29278. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  29279. * invoked on the trailing edge of the timeout only if the throttled function
  29280. * is invoked more than once during the `wait` timeout.
  29281. *
  29282. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  29283. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  29284. *
  29285. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  29286. * for details over the differences between `_.throttle` and `_.debounce`.
  29287. *
  29288. * @static
  29289. * @memberOf _
  29290. * @since 0.1.0
  29291. * @category Function
  29292. * @param {Function} func The function to throttle.
  29293. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  29294. * @param {Object} [options={}] The options object.
  29295. * @param {boolean} [options.leading=true]
  29296. * Specify invoking on the leading edge of the timeout.
  29297. * @param {boolean} [options.trailing=true]
  29298. * Specify invoking on the trailing edge of the timeout.
  29299. * @returns {Function} Returns the new throttled function.
  29300. * @example
  29301. *
  29302. * // Avoid excessively updating the position while scrolling.
  29303. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  29304. *
  29305. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  29306. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  29307. * jQuery(element).on('click', throttled);
  29308. *
  29309. * // Cancel the trailing throttled invocation.
  29310. * jQuery(window).on('popstate', throttled.cancel);
  29311. */
  29312. function throttle(func, wait, options) {
  29313. var leading = true,
  29314. trailing = true;
  29315. if (typeof func != 'function') {
  29316. throw new TypeError(FUNC_ERROR_TEXT);
  29317. }
  29318. if (isObject(options)) {
  29319. leading = 'leading' in options ? !!options.leading : leading;
  29320. trailing = 'trailing' in options ? !!options.trailing : trailing;
  29321. }
  29322. return debounce(func, wait, {
  29323. 'leading': leading,
  29324. 'maxWait': wait,
  29325. 'trailing': trailing
  29326. });
  29327. }
  29328. /**
  29329. * Creates a function that accepts up to one argument, ignoring any
  29330. * additional arguments.
  29331. *
  29332. * @static
  29333. * @memberOf _
  29334. * @since 4.0.0
  29335. * @category Function
  29336. * @param {Function} func The function to cap arguments for.
  29337. * @returns {Function} Returns the new capped function.
  29338. * @example
  29339. *
  29340. * _.map(['6', '8', '10'], _.unary(parseInt));
  29341. * // => [6, 8, 10]
  29342. */
  29343. function unary(func) {
  29344. return ary(func, 1);
  29345. }
  29346. /**
  29347. * Creates a function that provides `value` to `wrapper` as its first
  29348. * argument. Any additional arguments provided to the function are appended
  29349. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  29350. * binding of the created function.
  29351. *
  29352. * @static
  29353. * @memberOf _
  29354. * @since 0.1.0
  29355. * @category Function
  29356. * @param {*} value The value to wrap.
  29357. * @param {Function} [wrapper=identity] The wrapper function.
  29358. * @returns {Function} Returns the new function.
  29359. * @example
  29360. *
  29361. * var p = _.wrap(_.escape, function(func, text) {
  29362. * return '<p>' + func(text) + '</p>';
  29363. * });
  29364. *
  29365. * p('fred, barney, & pebbles');
  29366. * // => '<p>fred, barney, &amp; pebbles</p>'
  29367. */
  29368. function wrap(value, wrapper) {
  29369. return partial(castFunction(wrapper), value);
  29370. }
  29371. /*------------------------------------------------------------------------*/
  29372. /**
  29373. * Casts `value` as an array if it's not one.
  29374. *
  29375. * @static
  29376. * @memberOf _
  29377. * @since 4.4.0
  29378. * @category Lang
  29379. * @param {*} value The value to inspect.
  29380. * @returns {Array} Returns the cast array.
  29381. * @example
  29382. *
  29383. * _.castArray(1);
  29384. * // => [1]
  29385. *
  29386. * _.castArray({ 'a': 1 });
  29387. * // => [{ 'a': 1 }]
  29388. *
  29389. * _.castArray('abc');
  29390. * // => ['abc']
  29391. *
  29392. * _.castArray(null);
  29393. * // => [null]
  29394. *
  29395. * _.castArray(undefined);
  29396. * // => [undefined]
  29397. *
  29398. * _.castArray();
  29399. * // => []
  29400. *
  29401. * var array = [1, 2, 3];
  29402. * console.log(_.castArray(array) === array);
  29403. * // => true
  29404. */
  29405. function castArray() {
  29406. if (!arguments.length) {
  29407. return [];
  29408. }
  29409. var value = arguments[0];
  29410. return isArray(value) ? value : [value];
  29411. }
  29412. /**
  29413. * Creates a shallow clone of `value`.
  29414. *
  29415. * **Note:** This method is loosely based on the
  29416. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  29417. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  29418. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  29419. * arrays. The own enumerable properties of `arguments` objects are cloned
  29420. * as plain objects. An empty object is returned for uncloneable values such
  29421. * as error objects, functions, DOM nodes, and WeakMaps.
  29422. *
  29423. * @static
  29424. * @memberOf _
  29425. * @since 0.1.0
  29426. * @category Lang
  29427. * @param {*} value The value to clone.
  29428. * @returns {*} Returns the cloned value.
  29429. * @see _.cloneDeep
  29430. * @example
  29431. *
  29432. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  29433. *
  29434. * var shallow = _.clone(objects);
  29435. * console.log(shallow[0] === objects[0]);
  29436. * // => true
  29437. */
  29438. function clone(value) {
  29439. return baseClone(value, CLONE_SYMBOLS_FLAG);
  29440. }
  29441. /**
  29442. * This method is like `_.clone` except that it accepts `customizer` which
  29443. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  29444. * cloning is handled by the method instead. The `customizer` is invoked with
  29445. * up to four arguments; (value [, index|key, object, stack]).
  29446. *
  29447. * @static
  29448. * @memberOf _
  29449. * @since 4.0.0
  29450. * @category Lang
  29451. * @param {*} value The value to clone.
  29452. * @param {Function} [customizer] The function to customize cloning.
  29453. * @returns {*} Returns the cloned value.
  29454. * @see _.cloneDeepWith
  29455. * @example
  29456. *
  29457. * function customizer(value) {
  29458. * if (_.isElement(value)) {
  29459. * return value.cloneNode(false);
  29460. * }
  29461. * }
  29462. *
  29463. * var el = _.cloneWith(document.body, customizer);
  29464. *
  29465. * console.log(el === document.body);
  29466. * // => false
  29467. * console.log(el.nodeName);
  29468. * // => 'BODY'
  29469. * console.log(el.childNodes.length);
  29470. * // => 0
  29471. */
  29472. function cloneWith(value, customizer) {
  29473. customizer = typeof customizer == 'function' ? customizer : undefined;
  29474. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  29475. }
  29476. /**
  29477. * This method is like `_.clone` except that it recursively clones `value`.
  29478. *
  29479. * @static
  29480. * @memberOf _
  29481. * @since 1.0.0
  29482. * @category Lang
  29483. * @param {*} value The value to recursively clone.
  29484. * @returns {*} Returns the deep cloned value.
  29485. * @see _.clone
  29486. * @example
  29487. *
  29488. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  29489. *
  29490. * var deep = _.cloneDeep(objects);
  29491. * console.log(deep[0] === objects[0]);
  29492. * // => false
  29493. */
  29494. function cloneDeep(value) {
  29495. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  29496. }
  29497. /**
  29498. * This method is like `_.cloneWith` except that it recursively clones `value`.
  29499. *
  29500. * @static
  29501. * @memberOf _
  29502. * @since 4.0.0
  29503. * @category Lang
  29504. * @param {*} value The value to recursively clone.
  29505. * @param {Function} [customizer] The function to customize cloning.
  29506. * @returns {*} Returns the deep cloned value.
  29507. * @see _.cloneWith
  29508. * @example
  29509. *
  29510. * function customizer(value) {
  29511. * if (_.isElement(value)) {
  29512. * return value.cloneNode(true);
  29513. * }
  29514. * }
  29515. *
  29516. * var el = _.cloneDeepWith(document.body, customizer);
  29517. *
  29518. * console.log(el === document.body);
  29519. * // => false
  29520. * console.log(el.nodeName);
  29521. * // => 'BODY'
  29522. * console.log(el.childNodes.length);
  29523. * // => 20
  29524. */
  29525. function cloneDeepWith(value, customizer) {
  29526. customizer = typeof customizer == 'function' ? customizer : undefined;
  29527. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  29528. }
  29529. /**
  29530. * Checks if `object` conforms to `source` by invoking the predicate
  29531. * properties of `source` with the corresponding property values of `object`.
  29532. *
  29533. * **Note:** This method is equivalent to `_.conforms` when `source` is
  29534. * partially applied.
  29535. *
  29536. * @static
  29537. * @memberOf _
  29538. * @since 4.14.0
  29539. * @category Lang
  29540. * @param {Object} object The object to inspect.
  29541. * @param {Object} source The object of property predicates to conform to.
  29542. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  29543. * @example
  29544. *
  29545. * var object = { 'a': 1, 'b': 2 };
  29546. *
  29547. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  29548. * // => true
  29549. *
  29550. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  29551. * // => false
  29552. */
  29553. function conformsTo(object, source) {
  29554. return source == null || baseConformsTo(object, source, keys(source));
  29555. }
  29556. /**
  29557. * Performs a
  29558. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  29559. * comparison between two values to determine if they are equivalent.
  29560. *
  29561. * @static
  29562. * @memberOf _
  29563. * @since 4.0.0
  29564. * @category Lang
  29565. * @param {*} value The value to compare.
  29566. * @param {*} other The other value to compare.
  29567. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29568. * @example
  29569. *
  29570. * var object = { 'a': 1 };
  29571. * var other = { 'a': 1 };
  29572. *
  29573. * _.eq(object, object);
  29574. * // => true
  29575. *
  29576. * _.eq(object, other);
  29577. * // => false
  29578. *
  29579. * _.eq('a', 'a');
  29580. * // => true
  29581. *
  29582. * _.eq('a', Object('a'));
  29583. * // => false
  29584. *
  29585. * _.eq(NaN, NaN);
  29586. * // => true
  29587. */
  29588. function eq(value, other) {
  29589. return value === other || (value !== value && other !== other);
  29590. }
  29591. /**
  29592. * Checks if `value` is greater than `other`.
  29593. *
  29594. * @static
  29595. * @memberOf _
  29596. * @since 3.9.0
  29597. * @category Lang
  29598. * @param {*} value The value to compare.
  29599. * @param {*} other The other value to compare.
  29600. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  29601. * else `false`.
  29602. * @see _.lt
  29603. * @example
  29604. *
  29605. * _.gt(3, 1);
  29606. * // => true
  29607. *
  29608. * _.gt(3, 3);
  29609. * // => false
  29610. *
  29611. * _.gt(1, 3);
  29612. * // => false
  29613. */
  29614. var gt = createRelationalOperation(baseGt);
  29615. /**
  29616. * Checks if `value` is greater than or equal to `other`.
  29617. *
  29618. * @static
  29619. * @memberOf _
  29620. * @since 3.9.0
  29621. * @category Lang
  29622. * @param {*} value The value to compare.
  29623. * @param {*} other The other value to compare.
  29624. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  29625. * `other`, else `false`.
  29626. * @see _.lte
  29627. * @example
  29628. *
  29629. * _.gte(3, 1);
  29630. * // => true
  29631. *
  29632. * _.gte(3, 3);
  29633. * // => true
  29634. *
  29635. * _.gte(1, 3);
  29636. * // => false
  29637. */
  29638. var gte = createRelationalOperation(function(value, other) {
  29639. return value >= other;
  29640. });
  29641. /**
  29642. * Checks if `value` is likely an `arguments` object.
  29643. *
  29644. * @static
  29645. * @memberOf _
  29646. * @since 0.1.0
  29647. * @category Lang
  29648. * @param {*} value The value to check.
  29649. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  29650. * else `false`.
  29651. * @example
  29652. *
  29653. * _.isArguments(function() { return arguments; }());
  29654. * // => true
  29655. *
  29656. * _.isArguments([1, 2, 3]);
  29657. * // => false
  29658. */
  29659. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  29660. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  29661. !propertyIsEnumerable.call(value, 'callee');
  29662. };
  29663. /**
  29664. * Checks if `value` is classified as an `Array` object.
  29665. *
  29666. * @static
  29667. * @memberOf _
  29668. * @since 0.1.0
  29669. * @category Lang
  29670. * @param {*} value The value to check.
  29671. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  29672. * @example
  29673. *
  29674. * _.isArray([1, 2, 3]);
  29675. * // => true
  29676. *
  29677. * _.isArray(document.body.children);
  29678. * // => false
  29679. *
  29680. * _.isArray('abc');
  29681. * // => false
  29682. *
  29683. * _.isArray(_.noop);
  29684. * // => false
  29685. */
  29686. var isArray = Array.isArray;
  29687. /**
  29688. * Checks if `value` is classified as an `ArrayBuffer` object.
  29689. *
  29690. * @static
  29691. * @memberOf _
  29692. * @since 4.3.0
  29693. * @category Lang
  29694. * @param {*} value The value to check.
  29695. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  29696. * @example
  29697. *
  29698. * _.isArrayBuffer(new ArrayBuffer(2));
  29699. * // => true
  29700. *
  29701. * _.isArrayBuffer(new Array(2));
  29702. * // => false
  29703. */
  29704. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  29705. /**
  29706. * Checks if `value` is array-like. A value is considered array-like if it's
  29707. * not a function and has a `value.length` that's an integer greater than or
  29708. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  29709. *
  29710. * @static
  29711. * @memberOf _
  29712. * @since 4.0.0
  29713. * @category Lang
  29714. * @param {*} value The value to check.
  29715. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  29716. * @example
  29717. *
  29718. * _.isArrayLike([1, 2, 3]);
  29719. * // => true
  29720. *
  29721. * _.isArrayLike(document.body.children);
  29722. * // => true
  29723. *
  29724. * _.isArrayLike('abc');
  29725. * // => true
  29726. *
  29727. * _.isArrayLike(_.noop);
  29728. * // => false
  29729. */
  29730. function isArrayLike(value) {
  29731. return value != null && isLength(value.length) && !isFunction(value);
  29732. }
  29733. /**
  29734. * This method is like `_.isArrayLike` except that it also checks if `value`
  29735. * is an object.
  29736. *
  29737. * @static
  29738. * @memberOf _
  29739. * @since 4.0.0
  29740. * @category Lang
  29741. * @param {*} value The value to check.
  29742. * @returns {boolean} Returns `true` if `value` is an array-like object,
  29743. * else `false`.
  29744. * @example
  29745. *
  29746. * _.isArrayLikeObject([1, 2, 3]);
  29747. * // => true
  29748. *
  29749. * _.isArrayLikeObject(document.body.children);
  29750. * // => true
  29751. *
  29752. * _.isArrayLikeObject('abc');
  29753. * // => false
  29754. *
  29755. * _.isArrayLikeObject(_.noop);
  29756. * // => false
  29757. */
  29758. function isArrayLikeObject(value) {
  29759. return isObjectLike(value) && isArrayLike(value);
  29760. }
  29761. /**
  29762. * Checks if `value` is classified as a boolean primitive or object.
  29763. *
  29764. * @static
  29765. * @memberOf _
  29766. * @since 0.1.0
  29767. * @category Lang
  29768. * @param {*} value The value to check.
  29769. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  29770. * @example
  29771. *
  29772. * _.isBoolean(false);
  29773. * // => true
  29774. *
  29775. * _.isBoolean(null);
  29776. * // => false
  29777. */
  29778. function isBoolean(value) {
  29779. return value === true || value === false ||
  29780. (isObjectLike(value) && baseGetTag(value) == boolTag);
  29781. }
  29782. /**
  29783. * Checks if `value` is a buffer.
  29784. *
  29785. * @static
  29786. * @memberOf _
  29787. * @since 4.3.0
  29788. * @category Lang
  29789. * @param {*} value The value to check.
  29790. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  29791. * @example
  29792. *
  29793. * _.isBuffer(new Buffer(2));
  29794. * // => true
  29795. *
  29796. * _.isBuffer(new Uint8Array(2));
  29797. * // => false
  29798. */
  29799. var isBuffer = nativeIsBuffer || stubFalse;
  29800. /**
  29801. * Checks if `value` is classified as a `Date` object.
  29802. *
  29803. * @static
  29804. * @memberOf _
  29805. * @since 0.1.0
  29806. * @category Lang
  29807. * @param {*} value The value to check.
  29808. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  29809. * @example
  29810. *
  29811. * _.isDate(new Date);
  29812. * // => true
  29813. *
  29814. * _.isDate('Mon April 23 2012');
  29815. * // => false
  29816. */
  29817. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  29818. /**
  29819. * Checks if `value` is likely a DOM element.
  29820. *
  29821. * @static
  29822. * @memberOf _
  29823. * @since 0.1.0
  29824. * @category Lang
  29825. * @param {*} value The value to check.
  29826. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  29827. * @example
  29828. *
  29829. * _.isElement(document.body);
  29830. * // => true
  29831. *
  29832. * _.isElement('<body>');
  29833. * // => false
  29834. */
  29835. function isElement(value) {
  29836. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  29837. }
  29838. /**
  29839. * Checks if `value` is an empty object, collection, map, or set.
  29840. *
  29841. * Objects are considered empty if they have no own enumerable string keyed
  29842. * properties.
  29843. *
  29844. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  29845. * jQuery-like collections are considered empty if they have a `length` of `0`.
  29846. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  29847. *
  29848. * @static
  29849. * @memberOf _
  29850. * @since 0.1.0
  29851. * @category Lang
  29852. * @param {*} value The value to check.
  29853. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  29854. * @example
  29855. *
  29856. * _.isEmpty(null);
  29857. * // => true
  29858. *
  29859. * _.isEmpty(true);
  29860. * // => true
  29861. *
  29862. * _.isEmpty(1);
  29863. * // => true
  29864. *
  29865. * _.isEmpty([1, 2, 3]);
  29866. * // => false
  29867. *
  29868. * _.isEmpty({ 'a': 1 });
  29869. * // => false
  29870. */
  29871. function isEmpty(value) {
  29872. if (value == null) {
  29873. return true;
  29874. }
  29875. if (isArrayLike(value) &&
  29876. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  29877. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  29878. return !value.length;
  29879. }
  29880. var tag = getTag(value);
  29881. if (tag == mapTag || tag == setTag) {
  29882. return !value.size;
  29883. }
  29884. if (isPrototype(value)) {
  29885. return !baseKeys(value).length;
  29886. }
  29887. for (var key in value) {
  29888. if (hasOwnProperty.call(value, key)) {
  29889. return false;
  29890. }
  29891. }
  29892. return true;
  29893. }
  29894. /**
  29895. * Performs a deep comparison between two values to determine if they are
  29896. * equivalent.
  29897. *
  29898. * **Note:** This method supports comparing arrays, array buffers, booleans,
  29899. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  29900. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  29901. * by their own, not inherited, enumerable properties. Functions and DOM
  29902. * nodes are compared by strict equality, i.e. `===`.
  29903. *
  29904. * @static
  29905. * @memberOf _
  29906. * @since 0.1.0
  29907. * @category Lang
  29908. * @param {*} value The value to compare.
  29909. * @param {*} other The other value to compare.
  29910. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29911. * @example
  29912. *
  29913. * var object = { 'a': 1 };
  29914. * var other = { 'a': 1 };
  29915. *
  29916. * _.isEqual(object, other);
  29917. * // => true
  29918. *
  29919. * object === other;
  29920. * // => false
  29921. */
  29922. function isEqual(value, other) {
  29923. return baseIsEqual(value, other);
  29924. }
  29925. /**
  29926. * This method is like `_.isEqual` except that it accepts `customizer` which
  29927. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29928. * are handled by the method instead. The `customizer` is invoked with up to
  29929. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  29930. *
  29931. * @static
  29932. * @memberOf _
  29933. * @since 4.0.0
  29934. * @category Lang
  29935. * @param {*} value The value to compare.
  29936. * @param {*} other The other value to compare.
  29937. * @param {Function} [customizer] The function to customize comparisons.
  29938. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29939. * @example
  29940. *
  29941. * function isGreeting(value) {
  29942. * return /^h(?:i|ello)$/.test(value);
  29943. * }
  29944. *
  29945. * function customizer(objValue, othValue) {
  29946. * if (isGreeting(objValue) && isGreeting(othValue)) {
  29947. * return true;
  29948. * }
  29949. * }
  29950. *
  29951. * var array = ['hello', 'goodbye'];
  29952. * var other = ['hi', 'goodbye'];
  29953. *
  29954. * _.isEqualWith(array, other, customizer);
  29955. * // => true
  29956. */
  29957. function isEqualWith(value, other, customizer) {
  29958. customizer = typeof customizer == 'function' ? customizer : undefined;
  29959. var result = customizer ? customizer(value, other) : undefined;
  29960. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  29961. }
  29962. /**
  29963. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  29964. * `SyntaxError`, `TypeError`, or `URIError` object.
  29965. *
  29966. * @static
  29967. * @memberOf _
  29968. * @since 3.0.0
  29969. * @category Lang
  29970. * @param {*} value The value to check.
  29971. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  29972. * @example
  29973. *
  29974. * _.isError(new Error);
  29975. * // => true
  29976. *
  29977. * _.isError(Error);
  29978. * // => false
  29979. */
  29980. function isError(value) {
  29981. if (!isObjectLike(value)) {
  29982. return false;
  29983. }
  29984. var tag = baseGetTag(value);
  29985. return tag == errorTag || tag == domExcTag ||
  29986. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  29987. }
  29988. /**
  29989. * Checks if `value` is a finite primitive number.
  29990. *
  29991. * **Note:** This method is based on
  29992. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  29993. *
  29994. * @static
  29995. * @memberOf _
  29996. * @since 0.1.0
  29997. * @category Lang
  29998. * @param {*} value The value to check.
  29999. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  30000. * @example
  30001. *
  30002. * _.isFinite(3);
  30003. * // => true
  30004. *
  30005. * _.isFinite(Number.MIN_VALUE);
  30006. * // => true
  30007. *
  30008. * _.isFinite(Infinity);
  30009. * // => false
  30010. *
  30011. * _.isFinite('3');
  30012. * // => false
  30013. */
  30014. function isFinite(value) {
  30015. return typeof value == 'number' && nativeIsFinite(value);
  30016. }
  30017. /**
  30018. * Checks if `value` is classified as a `Function` object.
  30019. *
  30020. * @static
  30021. * @memberOf _
  30022. * @since 0.1.0
  30023. * @category Lang
  30024. * @param {*} value The value to check.
  30025. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  30026. * @example
  30027. *
  30028. * _.isFunction(_);
  30029. * // => true
  30030. *
  30031. * _.isFunction(/abc/);
  30032. * // => false
  30033. */
  30034. function isFunction(value) {
  30035. if (!isObject(value)) {
  30036. return false;
  30037. }
  30038. // The use of `Object#toString` avoids issues with the `typeof` operator
  30039. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  30040. var tag = baseGetTag(value);
  30041. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  30042. }
  30043. /**
  30044. * Checks if `value` is an integer.
  30045. *
  30046. * **Note:** This method is based on
  30047. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  30048. *
  30049. * @static
  30050. * @memberOf _
  30051. * @since 4.0.0
  30052. * @category Lang
  30053. * @param {*} value The value to check.
  30054. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  30055. * @example
  30056. *
  30057. * _.isInteger(3);
  30058. * // => true
  30059. *
  30060. * _.isInteger(Number.MIN_VALUE);
  30061. * // => false
  30062. *
  30063. * _.isInteger(Infinity);
  30064. * // => false
  30065. *
  30066. * _.isInteger('3');
  30067. * // => false
  30068. */
  30069. function isInteger(value) {
  30070. return typeof value == 'number' && value == toInteger(value);
  30071. }
  30072. /**
  30073. * Checks if `value` is a valid array-like length.
  30074. *
  30075. * **Note:** This method is loosely based on
  30076. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  30077. *
  30078. * @static
  30079. * @memberOf _
  30080. * @since 4.0.0
  30081. * @category Lang
  30082. * @param {*} value The value to check.
  30083. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  30084. * @example
  30085. *
  30086. * _.isLength(3);
  30087. * // => true
  30088. *
  30089. * _.isLength(Number.MIN_VALUE);
  30090. * // => false
  30091. *
  30092. * _.isLength(Infinity);
  30093. * // => false
  30094. *
  30095. * _.isLength('3');
  30096. * // => false
  30097. */
  30098. function isLength(value) {
  30099. return typeof value == 'number' &&
  30100. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  30101. }
  30102. /**
  30103. * Checks if `value` is the
  30104. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  30105. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  30106. *
  30107. * @static
  30108. * @memberOf _
  30109. * @since 0.1.0
  30110. * @category Lang
  30111. * @param {*} value The value to check.
  30112. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  30113. * @example
  30114. *
  30115. * _.isObject({});
  30116. * // => true
  30117. *
  30118. * _.isObject([1, 2, 3]);
  30119. * // => true
  30120. *
  30121. * _.isObject(_.noop);
  30122. * // => true
  30123. *
  30124. * _.isObject(null);
  30125. * // => false
  30126. */
  30127. function isObject(value) {
  30128. var type = typeof value;
  30129. return value != null && (type == 'object' || type == 'function');
  30130. }
  30131. /**
  30132. * Checks if `value` is object-like. A value is object-like if it's not `null`
  30133. * and has a `typeof` result of "object".
  30134. *
  30135. * @static
  30136. * @memberOf _
  30137. * @since 4.0.0
  30138. * @category Lang
  30139. * @param {*} value The value to check.
  30140. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  30141. * @example
  30142. *
  30143. * _.isObjectLike({});
  30144. * // => true
  30145. *
  30146. * _.isObjectLike([1, 2, 3]);
  30147. * // => true
  30148. *
  30149. * _.isObjectLike(_.noop);
  30150. * // => false
  30151. *
  30152. * _.isObjectLike(null);
  30153. * // => false
  30154. */
  30155. function isObjectLike(value) {
  30156. return value != null && typeof value == 'object';
  30157. }
  30158. /**
  30159. * Checks if `value` is classified as a `Map` object.
  30160. *
  30161. * @static
  30162. * @memberOf _
  30163. * @since 4.3.0
  30164. * @category Lang
  30165. * @param {*} value The value to check.
  30166. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  30167. * @example
  30168. *
  30169. * _.isMap(new Map);
  30170. * // => true
  30171. *
  30172. * _.isMap(new WeakMap);
  30173. * // => false
  30174. */
  30175. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  30176. /**
  30177. * Performs a partial deep comparison between `object` and `source` to
  30178. * determine if `object` contains equivalent property values.
  30179. *
  30180. * **Note:** This method is equivalent to `_.matches` when `source` is
  30181. * partially applied.
  30182. *
  30183. * Partial comparisons will match empty array and empty object `source`
  30184. * values against any array or object value, respectively. See `_.isEqual`
  30185. * for a list of supported value comparisons.
  30186. *
  30187. * @static
  30188. * @memberOf _
  30189. * @since 3.0.0
  30190. * @category Lang
  30191. * @param {Object} object The object to inspect.
  30192. * @param {Object} source The object of property values to match.
  30193. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  30194. * @example
  30195. *
  30196. * var object = { 'a': 1, 'b': 2 };
  30197. *
  30198. * _.isMatch(object, { 'b': 2 });
  30199. * // => true
  30200. *
  30201. * _.isMatch(object, { 'b': 1 });
  30202. * // => false
  30203. */
  30204. function isMatch(object, source) {
  30205. return object === source || baseIsMatch(object, source, getMatchData(source));
  30206. }
  30207. /**
  30208. * This method is like `_.isMatch` except that it accepts `customizer` which
  30209. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  30210. * are handled by the method instead. The `customizer` is invoked with five
  30211. * arguments: (objValue, srcValue, index|key, object, source).
  30212. *
  30213. * @static
  30214. * @memberOf _
  30215. * @since 4.0.0
  30216. * @category Lang
  30217. * @param {Object} object The object to inspect.
  30218. * @param {Object} source The object of property values to match.
  30219. * @param {Function} [customizer] The function to customize comparisons.
  30220. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  30221. * @example
  30222. *
  30223. * function isGreeting(value) {
  30224. * return /^h(?:i|ello)$/.test(value);
  30225. * }
  30226. *
  30227. * function customizer(objValue, srcValue) {
  30228. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  30229. * return true;
  30230. * }
  30231. * }
  30232. *
  30233. * var object = { 'greeting': 'hello' };
  30234. * var source = { 'greeting': 'hi' };
  30235. *
  30236. * _.isMatchWith(object, source, customizer);
  30237. * // => true
  30238. */
  30239. function isMatchWith(object, source, customizer) {
  30240. customizer = typeof customizer == 'function' ? customizer : undefined;
  30241. return baseIsMatch(object, source, getMatchData(source), customizer);
  30242. }
  30243. /**
  30244. * Checks if `value` is `NaN`.
  30245. *
  30246. * **Note:** This method is based on
  30247. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  30248. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  30249. * `undefined` and other non-number values.
  30250. *
  30251. * @static
  30252. * @memberOf _
  30253. * @since 0.1.0
  30254. * @category Lang
  30255. * @param {*} value The value to check.
  30256. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  30257. * @example
  30258. *
  30259. * _.isNaN(NaN);
  30260. * // => true
  30261. *
  30262. * _.isNaN(new Number(NaN));
  30263. * // => true
  30264. *
  30265. * isNaN(undefined);
  30266. * // => true
  30267. *
  30268. * _.isNaN(undefined);
  30269. * // => false
  30270. */
  30271. function isNaN(value) {
  30272. // An `NaN` primitive is the only value that is not equal to itself.
  30273. // Perform the `toStringTag` check first to avoid errors with some
  30274. // ActiveX objects in IE.
  30275. return isNumber(value) && value != +value;
  30276. }
  30277. /**
  30278. * Checks if `value` is a pristine native function.
  30279. *
  30280. * **Note:** This method can't reliably detect native functions in the presence
  30281. * of the core-js package because core-js circumvents this kind of detection.
  30282. * Despite multiple requests, the core-js maintainer has made it clear: any
  30283. * attempt to fix the detection will be obstructed. As a result, we're left
  30284. * with little choice but to throw an error. Unfortunately, this also affects
  30285. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  30286. * which rely on core-js.
  30287. *
  30288. * @static
  30289. * @memberOf _
  30290. * @since 3.0.0
  30291. * @category Lang
  30292. * @param {*} value The value to check.
  30293. * @returns {boolean} Returns `true` if `value` is a native function,
  30294. * else `false`.
  30295. * @example
  30296. *
  30297. * _.isNative(Array.prototype.push);
  30298. * // => true
  30299. *
  30300. * _.isNative(_);
  30301. * // => false
  30302. */
  30303. function isNative(value) {
  30304. if (isMaskable(value)) {
  30305. throw new Error(CORE_ERROR_TEXT);
  30306. }
  30307. return baseIsNative(value);
  30308. }
  30309. /**
  30310. * Checks if `value` is `null`.
  30311. *
  30312. * @static
  30313. * @memberOf _
  30314. * @since 0.1.0
  30315. * @category Lang
  30316. * @param {*} value The value to check.
  30317. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  30318. * @example
  30319. *
  30320. * _.isNull(null);
  30321. * // => true
  30322. *
  30323. * _.isNull(void 0);
  30324. * // => false
  30325. */
  30326. function isNull(value) {
  30327. return value === null;
  30328. }
  30329. /**
  30330. * Checks if `value` is `null` or `undefined`.
  30331. *
  30332. * @static
  30333. * @memberOf _
  30334. * @since 4.0.0
  30335. * @category Lang
  30336. * @param {*} value The value to check.
  30337. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  30338. * @example
  30339. *
  30340. * _.isNil(null);
  30341. * // => true
  30342. *
  30343. * _.isNil(void 0);
  30344. * // => true
  30345. *
  30346. * _.isNil(NaN);
  30347. * // => false
  30348. */
  30349. function isNil(value) {
  30350. return value == null;
  30351. }
  30352. /**
  30353. * Checks if `value` is classified as a `Number` primitive or object.
  30354. *
  30355. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  30356. * classified as numbers, use the `_.isFinite` method.
  30357. *
  30358. * @static
  30359. * @memberOf _
  30360. * @since 0.1.0
  30361. * @category Lang
  30362. * @param {*} value The value to check.
  30363. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  30364. * @example
  30365. *
  30366. * _.isNumber(3);
  30367. * // => true
  30368. *
  30369. * _.isNumber(Number.MIN_VALUE);
  30370. * // => true
  30371. *
  30372. * _.isNumber(Infinity);
  30373. * // => true
  30374. *
  30375. * _.isNumber('3');
  30376. * // => false
  30377. */
  30378. function isNumber(value) {
  30379. return typeof value == 'number' ||
  30380. (isObjectLike(value) && baseGetTag(value) == numberTag);
  30381. }
  30382. /**
  30383. * Checks if `value` is a plain object, that is, an object created by the
  30384. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  30385. *
  30386. * @static
  30387. * @memberOf _
  30388. * @since 0.8.0
  30389. * @category Lang
  30390. * @param {*} value The value to check.
  30391. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  30392. * @example
  30393. *
  30394. * function Foo() {
  30395. * this.a = 1;
  30396. * }
  30397. *
  30398. * _.isPlainObject(new Foo);
  30399. * // => false
  30400. *
  30401. * _.isPlainObject([1, 2, 3]);
  30402. * // => false
  30403. *
  30404. * _.isPlainObject({ 'x': 0, 'y': 0 });
  30405. * // => true
  30406. *
  30407. * _.isPlainObject(Object.create(null));
  30408. * // => true
  30409. */
  30410. function isPlainObject(value) {
  30411. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  30412. return false;
  30413. }
  30414. var proto = getPrototype(value);
  30415. if (proto === null) {
  30416. return true;
  30417. }
  30418. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  30419. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  30420. funcToString.call(Ctor) == objectCtorString;
  30421. }
  30422. /**
  30423. * Checks if `value` is classified as a `RegExp` object.
  30424. *
  30425. * @static
  30426. * @memberOf _
  30427. * @since 0.1.0
  30428. * @category Lang
  30429. * @param {*} value The value to check.
  30430. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  30431. * @example
  30432. *
  30433. * _.isRegExp(/abc/);
  30434. * // => true
  30435. *
  30436. * _.isRegExp('/abc/');
  30437. * // => false
  30438. */
  30439. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  30440. /**
  30441. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  30442. * double precision number which isn't the result of a rounded unsafe integer.
  30443. *
  30444. * **Note:** This method is based on
  30445. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  30446. *
  30447. * @static
  30448. * @memberOf _
  30449. * @since 4.0.0
  30450. * @category Lang
  30451. * @param {*} value The value to check.
  30452. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  30453. * @example
  30454. *
  30455. * _.isSafeInteger(3);
  30456. * // => true
  30457. *
  30458. * _.isSafeInteger(Number.MIN_VALUE);
  30459. * // => false
  30460. *
  30461. * _.isSafeInteger(Infinity);
  30462. * // => false
  30463. *
  30464. * _.isSafeInteger('3');
  30465. * // => false
  30466. */
  30467. function isSafeInteger(value) {
  30468. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  30469. }
  30470. /**
  30471. * Checks if `value` is classified as a `Set` object.
  30472. *
  30473. * @static
  30474. * @memberOf _
  30475. * @since 4.3.0
  30476. * @category Lang
  30477. * @param {*} value The value to check.
  30478. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  30479. * @example
  30480. *
  30481. * _.isSet(new Set);
  30482. * // => true
  30483. *
  30484. * _.isSet(new WeakSet);
  30485. * // => false
  30486. */
  30487. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  30488. /**
  30489. * Checks if `value` is classified as a `String` primitive or object.
  30490. *
  30491. * @static
  30492. * @since 0.1.0
  30493. * @memberOf _
  30494. * @category Lang
  30495. * @param {*} value The value to check.
  30496. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  30497. * @example
  30498. *
  30499. * _.isString('abc');
  30500. * // => true
  30501. *
  30502. * _.isString(1);
  30503. * // => false
  30504. */
  30505. function isString(value) {
  30506. return typeof value == 'string' ||
  30507. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  30508. }
  30509. /**
  30510. * Checks if `value` is classified as a `Symbol` primitive or object.
  30511. *
  30512. * @static
  30513. * @memberOf _
  30514. * @since 4.0.0
  30515. * @category Lang
  30516. * @param {*} value The value to check.
  30517. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  30518. * @example
  30519. *
  30520. * _.isSymbol(Symbol.iterator);
  30521. * // => true
  30522. *
  30523. * _.isSymbol('abc');
  30524. * // => false
  30525. */
  30526. function isSymbol(value) {
  30527. return typeof value == 'symbol' ||
  30528. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  30529. }
  30530. /**
  30531. * Checks if `value` is classified as a typed array.
  30532. *
  30533. * @static
  30534. * @memberOf _
  30535. * @since 3.0.0
  30536. * @category Lang
  30537. * @param {*} value The value to check.
  30538. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  30539. * @example
  30540. *
  30541. * _.isTypedArray(new Uint8Array);
  30542. * // => true
  30543. *
  30544. * _.isTypedArray([]);
  30545. * // => false
  30546. */
  30547. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  30548. /**
  30549. * Checks if `value` is `undefined`.
  30550. *
  30551. * @static
  30552. * @since 0.1.0
  30553. * @memberOf _
  30554. * @category Lang
  30555. * @param {*} value The value to check.
  30556. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  30557. * @example
  30558. *
  30559. * _.isUndefined(void 0);
  30560. * // => true
  30561. *
  30562. * _.isUndefined(null);
  30563. * // => false
  30564. */
  30565. function isUndefined(value) {
  30566. return value === undefined;
  30567. }
  30568. /**
  30569. * Checks if `value` is classified as a `WeakMap` object.
  30570. *
  30571. * @static
  30572. * @memberOf _
  30573. * @since 4.3.0
  30574. * @category Lang
  30575. * @param {*} value The value to check.
  30576. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  30577. * @example
  30578. *
  30579. * _.isWeakMap(new WeakMap);
  30580. * // => true
  30581. *
  30582. * _.isWeakMap(new Map);
  30583. * // => false
  30584. */
  30585. function isWeakMap(value) {
  30586. return isObjectLike(value) && getTag(value) == weakMapTag;
  30587. }
  30588. /**
  30589. * Checks if `value` is classified as a `WeakSet` object.
  30590. *
  30591. * @static
  30592. * @memberOf _
  30593. * @since 4.3.0
  30594. * @category Lang
  30595. * @param {*} value The value to check.
  30596. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  30597. * @example
  30598. *
  30599. * _.isWeakSet(new WeakSet);
  30600. * // => true
  30601. *
  30602. * _.isWeakSet(new Set);
  30603. * // => false
  30604. */
  30605. function isWeakSet(value) {
  30606. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  30607. }
  30608. /**
  30609. * Checks if `value` is less than `other`.
  30610. *
  30611. * @static
  30612. * @memberOf _
  30613. * @since 3.9.0
  30614. * @category Lang
  30615. * @param {*} value The value to compare.
  30616. * @param {*} other The other value to compare.
  30617. * @returns {boolean} Returns `true` if `value` is less than `other`,
  30618. * else `false`.
  30619. * @see _.gt
  30620. * @example
  30621. *
  30622. * _.lt(1, 3);
  30623. * // => true
  30624. *
  30625. * _.lt(3, 3);
  30626. * // => false
  30627. *
  30628. * _.lt(3, 1);
  30629. * // => false
  30630. */
  30631. var lt = createRelationalOperation(baseLt);
  30632. /**
  30633. * Checks if `value` is less than or equal to `other`.
  30634. *
  30635. * @static
  30636. * @memberOf _
  30637. * @since 3.9.0
  30638. * @category Lang
  30639. * @param {*} value The value to compare.
  30640. * @param {*} other The other value to compare.
  30641. * @returns {boolean} Returns `true` if `value` is less than or equal to
  30642. * `other`, else `false`.
  30643. * @see _.gte
  30644. * @example
  30645. *
  30646. * _.lte(1, 3);
  30647. * // => true
  30648. *
  30649. * _.lte(3, 3);
  30650. * // => true
  30651. *
  30652. * _.lte(3, 1);
  30653. * // => false
  30654. */
  30655. var lte = createRelationalOperation(function(value, other) {
  30656. return value <= other;
  30657. });
  30658. /**
  30659. * Converts `value` to an array.
  30660. *
  30661. * @static
  30662. * @since 0.1.0
  30663. * @memberOf _
  30664. * @category Lang
  30665. * @param {*} value The value to convert.
  30666. * @returns {Array} Returns the converted array.
  30667. * @example
  30668. *
  30669. * _.toArray({ 'a': 1, 'b': 2 });
  30670. * // => [1, 2]
  30671. *
  30672. * _.toArray('abc');
  30673. * // => ['a', 'b', 'c']
  30674. *
  30675. * _.toArray(1);
  30676. * // => []
  30677. *
  30678. * _.toArray(null);
  30679. * // => []
  30680. */
  30681. function toArray(value) {
  30682. if (!value) {
  30683. return [];
  30684. }
  30685. if (isArrayLike(value)) {
  30686. return isString(value) ? stringToArray(value) : copyArray(value);
  30687. }
  30688. if (symIterator && value[symIterator]) {
  30689. return iteratorToArray(value[symIterator]());
  30690. }
  30691. var tag = getTag(value),
  30692. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  30693. return func(value);
  30694. }
  30695. /**
  30696. * Converts `value` to a finite number.
  30697. *
  30698. * @static
  30699. * @memberOf _
  30700. * @since 4.12.0
  30701. * @category Lang
  30702. * @param {*} value The value to convert.
  30703. * @returns {number} Returns the converted number.
  30704. * @example
  30705. *
  30706. * _.toFinite(3.2);
  30707. * // => 3.2
  30708. *
  30709. * _.toFinite(Number.MIN_VALUE);
  30710. * // => 5e-324
  30711. *
  30712. * _.toFinite(Infinity);
  30713. * // => 1.7976931348623157e+308
  30714. *
  30715. * _.toFinite('3.2');
  30716. * // => 3.2
  30717. */
  30718. function toFinite(value) {
  30719. if (!value) {
  30720. return value === 0 ? value : 0;
  30721. }
  30722. value = toNumber(value);
  30723. if (value === INFINITY || value === -INFINITY) {
  30724. var sign = (value < 0 ? -1 : 1);
  30725. return sign * MAX_INTEGER;
  30726. }
  30727. return value === value ? value : 0;
  30728. }
  30729. /**
  30730. * Converts `value` to an integer.
  30731. *
  30732. * **Note:** This method is loosely based on
  30733. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  30734. *
  30735. * @static
  30736. * @memberOf _
  30737. * @since 4.0.0
  30738. * @category Lang
  30739. * @param {*} value The value to convert.
  30740. * @returns {number} Returns the converted integer.
  30741. * @example
  30742. *
  30743. * _.toInteger(3.2);
  30744. * // => 3
  30745. *
  30746. * _.toInteger(Number.MIN_VALUE);
  30747. * // => 0
  30748. *
  30749. * _.toInteger(Infinity);
  30750. * // => 1.7976931348623157e+308
  30751. *
  30752. * _.toInteger('3.2');
  30753. * // => 3
  30754. */
  30755. function toInteger(value) {
  30756. var result = toFinite(value),
  30757. remainder = result % 1;
  30758. return result === result ? (remainder ? result - remainder : result) : 0;
  30759. }
  30760. /**
  30761. * Converts `value` to an integer suitable for use as the length of an
  30762. * array-like object.
  30763. *
  30764. * **Note:** This method is based on
  30765. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  30766. *
  30767. * @static
  30768. * @memberOf _
  30769. * @since 4.0.0
  30770. * @category Lang
  30771. * @param {*} value The value to convert.
  30772. * @returns {number} Returns the converted integer.
  30773. * @example
  30774. *
  30775. * _.toLength(3.2);
  30776. * // => 3
  30777. *
  30778. * _.toLength(Number.MIN_VALUE);
  30779. * // => 0
  30780. *
  30781. * _.toLength(Infinity);
  30782. * // => 4294967295
  30783. *
  30784. * _.toLength('3.2');
  30785. * // => 3
  30786. */
  30787. function toLength(value) {
  30788. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  30789. }
  30790. /**
  30791. * Converts `value` to a number.
  30792. *
  30793. * @static
  30794. * @memberOf _
  30795. * @since 4.0.0
  30796. * @category Lang
  30797. * @param {*} value The value to process.
  30798. * @returns {number} Returns the number.
  30799. * @example
  30800. *
  30801. * _.toNumber(3.2);
  30802. * // => 3.2
  30803. *
  30804. * _.toNumber(Number.MIN_VALUE);
  30805. * // => 5e-324
  30806. *
  30807. * _.toNumber(Infinity);
  30808. * // => Infinity
  30809. *
  30810. * _.toNumber('3.2');
  30811. * // => 3.2
  30812. */
  30813. function toNumber(value) {
  30814. if (typeof value == 'number') {
  30815. return value;
  30816. }
  30817. if (isSymbol(value)) {
  30818. return NAN;
  30819. }
  30820. if (isObject(value)) {
  30821. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  30822. value = isObject(other) ? (other + '') : other;
  30823. }
  30824. if (typeof value != 'string') {
  30825. return value === 0 ? value : +value;
  30826. }
  30827. value = value.replace(reTrim, '');
  30828. var isBinary = reIsBinary.test(value);
  30829. return (isBinary || reIsOctal.test(value))
  30830. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  30831. : (reIsBadHex.test(value) ? NAN : +value);
  30832. }
  30833. /**
  30834. * Converts `value` to a plain object flattening inherited enumerable string
  30835. * keyed properties of `value` to own properties of the plain object.
  30836. *
  30837. * @static
  30838. * @memberOf _
  30839. * @since 3.0.0
  30840. * @category Lang
  30841. * @param {*} value The value to convert.
  30842. * @returns {Object} Returns the converted plain object.
  30843. * @example
  30844. *
  30845. * function Foo() {
  30846. * this.b = 2;
  30847. * }
  30848. *
  30849. * Foo.prototype.c = 3;
  30850. *
  30851. * _.assign({ 'a': 1 }, new Foo);
  30852. * // => { 'a': 1, 'b': 2 }
  30853. *
  30854. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  30855. * // => { 'a': 1, 'b': 2, 'c': 3 }
  30856. */
  30857. function toPlainObject(value) {
  30858. return copyObject(value, keysIn(value));
  30859. }
  30860. /**
  30861. * Converts `value` to a safe integer. A safe integer can be compared and
  30862. * represented correctly.
  30863. *
  30864. * @static
  30865. * @memberOf _
  30866. * @since 4.0.0
  30867. * @category Lang
  30868. * @param {*} value The value to convert.
  30869. * @returns {number} Returns the converted integer.
  30870. * @example
  30871. *
  30872. * _.toSafeInteger(3.2);
  30873. * // => 3
  30874. *
  30875. * _.toSafeInteger(Number.MIN_VALUE);
  30876. * // => 0
  30877. *
  30878. * _.toSafeInteger(Infinity);
  30879. * // => 9007199254740991
  30880. *
  30881. * _.toSafeInteger('3.2');
  30882. * // => 3
  30883. */
  30884. function toSafeInteger(value) {
  30885. return value
  30886. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  30887. : (value === 0 ? value : 0);
  30888. }
  30889. /**
  30890. * Converts `value` to a string. An empty string is returned for `null`
  30891. * and `undefined` values. The sign of `-0` is preserved.
  30892. *
  30893. * @static
  30894. * @memberOf _
  30895. * @since 4.0.0
  30896. * @category Lang
  30897. * @param {*} value The value to convert.
  30898. * @returns {string} Returns the converted string.
  30899. * @example
  30900. *
  30901. * _.toString(null);
  30902. * // => ''
  30903. *
  30904. * _.toString(-0);
  30905. * // => '-0'
  30906. *
  30907. * _.toString([1, 2, 3]);
  30908. * // => '1,2,3'
  30909. */
  30910. function toString(value) {
  30911. return value == null ? '' : baseToString(value);
  30912. }
  30913. /*------------------------------------------------------------------------*/
  30914. /**
  30915. * Assigns own enumerable string keyed properties of source objects to the
  30916. * destination object. Source objects are applied from left to right.
  30917. * Subsequent sources overwrite property assignments of previous sources.
  30918. *
  30919. * **Note:** This method mutates `object` and is loosely based on
  30920. * [`Object.assign`](https://mdn.io/Object/assign).
  30921. *
  30922. * @static
  30923. * @memberOf _
  30924. * @since 0.10.0
  30925. * @category Object
  30926. * @param {Object} object The destination object.
  30927. * @param {...Object} [sources] The source objects.
  30928. * @returns {Object} Returns `object`.
  30929. * @see _.assignIn
  30930. * @example
  30931. *
  30932. * function Foo() {
  30933. * this.a = 1;
  30934. * }
  30935. *
  30936. * function Bar() {
  30937. * this.c = 3;
  30938. * }
  30939. *
  30940. * Foo.prototype.b = 2;
  30941. * Bar.prototype.d = 4;
  30942. *
  30943. * _.assign({ 'a': 0 }, new Foo, new Bar);
  30944. * // => { 'a': 1, 'c': 3 }
  30945. */
  30946. var assign = createAssigner(function(object, source) {
  30947. if (isPrototype(source) || isArrayLike(source)) {
  30948. copyObject(source, keys(source), object);
  30949. return;
  30950. }
  30951. for (var key in source) {
  30952. if (hasOwnProperty.call(source, key)) {
  30953. assignValue(object, key, source[key]);
  30954. }
  30955. }
  30956. });
  30957. /**
  30958. * This method is like `_.assign` except that it iterates over own and
  30959. * inherited source properties.
  30960. *
  30961. * **Note:** This method mutates `object`.
  30962. *
  30963. * @static
  30964. * @memberOf _
  30965. * @since 4.0.0
  30966. * @alias extend
  30967. * @category Object
  30968. * @param {Object} object The destination object.
  30969. * @param {...Object} [sources] The source objects.
  30970. * @returns {Object} Returns `object`.
  30971. * @see _.assign
  30972. * @example
  30973. *
  30974. * function Foo() {
  30975. * this.a = 1;
  30976. * }
  30977. *
  30978. * function Bar() {
  30979. * this.c = 3;
  30980. * }
  30981. *
  30982. * Foo.prototype.b = 2;
  30983. * Bar.prototype.d = 4;
  30984. *
  30985. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  30986. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  30987. */
  30988. var assignIn = createAssigner(function(object, source) {
  30989. copyObject(source, keysIn(source), object);
  30990. });
  30991. /**
  30992. * This method is like `_.assignIn` except that it accepts `customizer`
  30993. * which is invoked to produce the assigned values. If `customizer` returns
  30994. * `undefined`, assignment is handled by the method instead. The `customizer`
  30995. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30996. *
  30997. * **Note:** This method mutates `object`.
  30998. *
  30999. * @static
  31000. * @memberOf _
  31001. * @since 4.0.0
  31002. * @alias extendWith
  31003. * @category Object
  31004. * @param {Object} object The destination object.
  31005. * @param {...Object} sources The source objects.
  31006. * @param {Function} [customizer] The function to customize assigned values.
  31007. * @returns {Object} Returns `object`.
  31008. * @see _.assignWith
  31009. * @example
  31010. *
  31011. * function customizer(objValue, srcValue) {
  31012. * return _.isUndefined(objValue) ? srcValue : objValue;
  31013. * }
  31014. *
  31015. * var defaults = _.partialRight(_.assignInWith, customizer);
  31016. *
  31017. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  31018. * // => { 'a': 1, 'b': 2 }
  31019. */
  31020. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  31021. copyObject(source, keysIn(source), object, customizer);
  31022. });
  31023. /**
  31024. * This method is like `_.assign` except that it accepts `customizer`
  31025. * which is invoked to produce the assigned values. If `customizer` returns
  31026. * `undefined`, assignment is handled by the method instead. The `customizer`
  31027. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  31028. *
  31029. * **Note:** This method mutates `object`.
  31030. *
  31031. * @static
  31032. * @memberOf _
  31033. * @since 4.0.0
  31034. * @category Object
  31035. * @param {Object} object The destination object.
  31036. * @param {...Object} sources The source objects.
  31037. * @param {Function} [customizer] The function to customize assigned values.
  31038. * @returns {Object} Returns `object`.
  31039. * @see _.assignInWith
  31040. * @example
  31041. *
  31042. * function customizer(objValue, srcValue) {
  31043. * return _.isUndefined(objValue) ? srcValue : objValue;
  31044. * }
  31045. *
  31046. * var defaults = _.partialRight(_.assignWith, customizer);
  31047. *
  31048. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  31049. * // => { 'a': 1, 'b': 2 }
  31050. */
  31051. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  31052. copyObject(source, keys(source), object, customizer);
  31053. });
  31054. /**
  31055. * Creates an array of values corresponding to `paths` of `object`.
  31056. *
  31057. * @static
  31058. * @memberOf _
  31059. * @since 1.0.0
  31060. * @category Object
  31061. * @param {Object} object The object to iterate over.
  31062. * @param {...(string|string[])} [paths] The property paths to pick.
  31063. * @returns {Array} Returns the picked values.
  31064. * @example
  31065. *
  31066. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  31067. *
  31068. * _.at(object, ['a[0].b.c', 'a[1]']);
  31069. * // => [3, 4]
  31070. */
  31071. var at = flatRest(baseAt);
  31072. /**
  31073. * Creates an object that inherits from the `prototype` object. If a
  31074. * `properties` object is given, its own enumerable string keyed properties
  31075. * are assigned to the created object.
  31076. *
  31077. * @static
  31078. * @memberOf _
  31079. * @since 2.3.0
  31080. * @category Object
  31081. * @param {Object} prototype The object to inherit from.
  31082. * @param {Object} [properties] The properties to assign to the object.
  31083. * @returns {Object} Returns the new object.
  31084. * @example
  31085. *
  31086. * function Shape() {
  31087. * this.x = 0;
  31088. * this.y = 0;
  31089. * }
  31090. *
  31091. * function Circle() {
  31092. * Shape.call(this);
  31093. * }
  31094. *
  31095. * Circle.prototype = _.create(Shape.prototype, {
  31096. * 'constructor': Circle
  31097. * });
  31098. *
  31099. * var circle = new Circle;
  31100. * circle instanceof Circle;
  31101. * // => true
  31102. *
  31103. * circle instanceof Shape;
  31104. * // => true
  31105. */
  31106. function create(prototype, properties) {
  31107. var result = baseCreate(prototype);
  31108. return properties == null ? result : baseAssign(result, properties);
  31109. }
  31110. /**
  31111. * Assigns own and inherited enumerable string keyed properties of source
  31112. * objects to the destination object for all destination properties that
  31113. * resolve to `undefined`. Source objects are applied from left to right.
  31114. * Once a property is set, additional values of the same property are ignored.
  31115. *
  31116. * **Note:** This method mutates `object`.
  31117. *
  31118. * @static
  31119. * @since 0.1.0
  31120. * @memberOf _
  31121. * @category Object
  31122. * @param {Object} object The destination object.
  31123. * @param {...Object} [sources] The source objects.
  31124. * @returns {Object} Returns `object`.
  31125. * @see _.defaultsDeep
  31126. * @example
  31127. *
  31128. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  31129. * // => { 'a': 1, 'b': 2 }
  31130. */
  31131. var defaults = baseRest(function(object, sources) {
  31132. object = Object(object);
  31133. var index = -1;
  31134. var length = sources.length;
  31135. var guard = length > 2 ? sources[2] : undefined;
  31136. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  31137. length = 1;
  31138. }
  31139. while (++index < length) {
  31140. var source = sources[index];
  31141. var props = keysIn(source);
  31142. var propsIndex = -1;
  31143. var propsLength = props.length;
  31144. while (++propsIndex < propsLength) {
  31145. var key = props[propsIndex];
  31146. var value = object[key];
  31147. if (value === undefined ||
  31148. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  31149. object[key] = source[key];
  31150. }
  31151. }
  31152. }
  31153. return object;
  31154. });
  31155. /**
  31156. * This method is like `_.defaults` except that it recursively assigns
  31157. * default properties.
  31158. *
  31159. * **Note:** This method mutates `object`.
  31160. *
  31161. * @static
  31162. * @memberOf _
  31163. * @since 3.10.0
  31164. * @category Object
  31165. * @param {Object} object The destination object.
  31166. * @param {...Object} [sources] The source objects.
  31167. * @returns {Object} Returns `object`.
  31168. * @see _.defaults
  31169. * @example
  31170. *
  31171. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  31172. * // => { 'a': { 'b': 2, 'c': 3 } }
  31173. */
  31174. var defaultsDeep = baseRest(function(args) {
  31175. args.push(undefined, customDefaultsMerge);
  31176. return apply(mergeWith, undefined, args);
  31177. });
  31178. /**
  31179. * This method is like `_.find` except that it returns the key of the first
  31180. * element `predicate` returns truthy for instead of the element itself.
  31181. *
  31182. * @static
  31183. * @memberOf _
  31184. * @since 1.1.0
  31185. * @category Object
  31186. * @param {Object} object The object to inspect.
  31187. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  31188. * @returns {string|undefined} Returns the key of the matched element,
  31189. * else `undefined`.
  31190. * @example
  31191. *
  31192. * var users = {
  31193. * 'barney': { 'age': 36, 'active': true },
  31194. * 'fred': { 'age': 40, 'active': false },
  31195. * 'pebbles': { 'age': 1, 'active': true }
  31196. * };
  31197. *
  31198. * _.findKey(users, function(o) { return o.age < 40; });
  31199. * // => 'barney' (iteration order is not guaranteed)
  31200. *
  31201. * // The `_.matches` iteratee shorthand.
  31202. * _.findKey(users, { 'age': 1, 'active': true });
  31203. * // => 'pebbles'
  31204. *
  31205. * // The `_.matchesProperty` iteratee shorthand.
  31206. * _.findKey(users, ['active', false]);
  31207. * // => 'fred'
  31208. *
  31209. * // The `_.property` iteratee shorthand.
  31210. * _.findKey(users, 'active');
  31211. * // => 'barney'
  31212. */
  31213. function findKey(object, predicate) {
  31214. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  31215. }
  31216. /**
  31217. * This method is like `_.findKey` except that it iterates over elements of
  31218. * a collection in the opposite order.
  31219. *
  31220. * @static
  31221. * @memberOf _
  31222. * @since 2.0.0
  31223. * @category Object
  31224. * @param {Object} object The object to inspect.
  31225. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  31226. * @returns {string|undefined} Returns the key of the matched element,
  31227. * else `undefined`.
  31228. * @example
  31229. *
  31230. * var users = {
  31231. * 'barney': { 'age': 36, 'active': true },
  31232. * 'fred': { 'age': 40, 'active': false },
  31233. * 'pebbles': { 'age': 1, 'active': true }
  31234. * };
  31235. *
  31236. * _.findLastKey(users, function(o) { return o.age < 40; });
  31237. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  31238. *
  31239. * // The `_.matches` iteratee shorthand.
  31240. * _.findLastKey(users, { 'age': 36, 'active': true });
  31241. * // => 'barney'
  31242. *
  31243. * // The `_.matchesProperty` iteratee shorthand.
  31244. * _.findLastKey(users, ['active', false]);
  31245. * // => 'fred'
  31246. *
  31247. * // The `_.property` iteratee shorthand.
  31248. * _.findLastKey(users, 'active');
  31249. * // => 'pebbles'
  31250. */
  31251. function findLastKey(object, predicate) {
  31252. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  31253. }
  31254. /**
  31255. * Iterates over own and inherited enumerable string keyed properties of an
  31256. * object and invokes `iteratee` for each property. The iteratee is invoked
  31257. * with three arguments: (value, key, object). Iteratee functions may exit
  31258. * iteration early by explicitly returning `false`.
  31259. *
  31260. * @static
  31261. * @memberOf _
  31262. * @since 0.3.0
  31263. * @category Object
  31264. * @param {Object} object The object to iterate over.
  31265. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31266. * @returns {Object} Returns `object`.
  31267. * @see _.forInRight
  31268. * @example
  31269. *
  31270. * function Foo() {
  31271. * this.a = 1;
  31272. * this.b = 2;
  31273. * }
  31274. *
  31275. * Foo.prototype.c = 3;
  31276. *
  31277. * _.forIn(new Foo, function(value, key) {
  31278. * console.log(key);
  31279. * });
  31280. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  31281. */
  31282. function forIn(object, iteratee) {
  31283. return object == null
  31284. ? object
  31285. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  31286. }
  31287. /**
  31288. * This method is like `_.forIn` except that it iterates over properties of
  31289. * `object` in the opposite order.
  31290. *
  31291. * @static
  31292. * @memberOf _
  31293. * @since 2.0.0
  31294. * @category Object
  31295. * @param {Object} object The object to iterate over.
  31296. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31297. * @returns {Object} Returns `object`.
  31298. * @see _.forIn
  31299. * @example
  31300. *
  31301. * function Foo() {
  31302. * this.a = 1;
  31303. * this.b = 2;
  31304. * }
  31305. *
  31306. * Foo.prototype.c = 3;
  31307. *
  31308. * _.forInRight(new Foo, function(value, key) {
  31309. * console.log(key);
  31310. * });
  31311. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  31312. */
  31313. function forInRight(object, iteratee) {
  31314. return object == null
  31315. ? object
  31316. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  31317. }
  31318. /**
  31319. * Iterates over own enumerable string keyed properties of an object and
  31320. * invokes `iteratee` for each property. The iteratee is invoked with three
  31321. * arguments: (value, key, object). Iteratee functions may exit iteration
  31322. * early by explicitly returning `false`.
  31323. *
  31324. * @static
  31325. * @memberOf _
  31326. * @since 0.3.0
  31327. * @category Object
  31328. * @param {Object} object The object to iterate over.
  31329. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31330. * @returns {Object} Returns `object`.
  31331. * @see _.forOwnRight
  31332. * @example
  31333. *
  31334. * function Foo() {
  31335. * this.a = 1;
  31336. * this.b = 2;
  31337. * }
  31338. *
  31339. * Foo.prototype.c = 3;
  31340. *
  31341. * _.forOwn(new Foo, function(value, key) {
  31342. * console.log(key);
  31343. * });
  31344. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  31345. */
  31346. function forOwn(object, iteratee) {
  31347. return object && baseForOwn(object, getIteratee(iteratee, 3));
  31348. }
  31349. /**
  31350. * This method is like `_.forOwn` except that it iterates over properties of
  31351. * `object` in the opposite order.
  31352. *
  31353. * @static
  31354. * @memberOf _
  31355. * @since 2.0.0
  31356. * @category Object
  31357. * @param {Object} object The object to iterate over.
  31358. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31359. * @returns {Object} Returns `object`.
  31360. * @see _.forOwn
  31361. * @example
  31362. *
  31363. * function Foo() {
  31364. * this.a = 1;
  31365. * this.b = 2;
  31366. * }
  31367. *
  31368. * Foo.prototype.c = 3;
  31369. *
  31370. * _.forOwnRight(new Foo, function(value, key) {
  31371. * console.log(key);
  31372. * });
  31373. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  31374. */
  31375. function forOwnRight(object, iteratee) {
  31376. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  31377. }
  31378. /**
  31379. * Creates an array of function property names from own enumerable properties
  31380. * of `object`.
  31381. *
  31382. * @static
  31383. * @since 0.1.0
  31384. * @memberOf _
  31385. * @category Object
  31386. * @param {Object} object The object to inspect.
  31387. * @returns {Array} Returns the function names.
  31388. * @see _.functionsIn
  31389. * @example
  31390. *
  31391. * function Foo() {
  31392. * this.a = _.constant('a');
  31393. * this.b = _.constant('b');
  31394. * }
  31395. *
  31396. * Foo.prototype.c = _.constant('c');
  31397. *
  31398. * _.functions(new Foo);
  31399. * // => ['a', 'b']
  31400. */
  31401. function functions(object) {
  31402. return object == null ? [] : baseFunctions(object, keys(object));
  31403. }
  31404. /**
  31405. * Creates an array of function property names from own and inherited
  31406. * enumerable properties of `object`.
  31407. *
  31408. * @static
  31409. * @memberOf _
  31410. * @since 4.0.0
  31411. * @category Object
  31412. * @param {Object} object The object to inspect.
  31413. * @returns {Array} Returns the function names.
  31414. * @see _.functions
  31415. * @example
  31416. *
  31417. * function Foo() {
  31418. * this.a = _.constant('a');
  31419. * this.b = _.constant('b');
  31420. * }
  31421. *
  31422. * Foo.prototype.c = _.constant('c');
  31423. *
  31424. * _.functionsIn(new Foo);
  31425. * // => ['a', 'b', 'c']
  31426. */
  31427. function functionsIn(object) {
  31428. return object == null ? [] : baseFunctions(object, keysIn(object));
  31429. }
  31430. /**
  31431. * Gets the value at `path` of `object`. If the resolved value is
  31432. * `undefined`, the `defaultValue` is returned in its place.
  31433. *
  31434. * @static
  31435. * @memberOf _
  31436. * @since 3.7.0
  31437. * @category Object
  31438. * @param {Object} object The object to query.
  31439. * @param {Array|string} path The path of the property to get.
  31440. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  31441. * @returns {*} Returns the resolved value.
  31442. * @example
  31443. *
  31444. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31445. *
  31446. * _.get(object, 'a[0].b.c');
  31447. * // => 3
  31448. *
  31449. * _.get(object, ['a', '0', 'b', 'c']);
  31450. * // => 3
  31451. *
  31452. * _.get(object, 'a.b.c', 'default');
  31453. * // => 'default'
  31454. */
  31455. function get(object, path, defaultValue) {
  31456. var result = object == null ? undefined : baseGet(object, path);
  31457. return result === undefined ? defaultValue : result;
  31458. }
  31459. /**
  31460. * Checks if `path` is a direct property of `object`.
  31461. *
  31462. * @static
  31463. * @since 0.1.0
  31464. * @memberOf _
  31465. * @category Object
  31466. * @param {Object} object The object to query.
  31467. * @param {Array|string} path The path to check.
  31468. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  31469. * @example
  31470. *
  31471. * var object = { 'a': { 'b': 2 } };
  31472. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  31473. *
  31474. * _.has(object, 'a');
  31475. * // => true
  31476. *
  31477. * _.has(object, 'a.b');
  31478. * // => true
  31479. *
  31480. * _.has(object, ['a', 'b']);
  31481. * // => true
  31482. *
  31483. * _.has(other, 'a');
  31484. * // => false
  31485. */
  31486. function has(object, path) {
  31487. return object != null && hasPath(object, path, baseHas);
  31488. }
  31489. /**
  31490. * Checks if `path` is a direct or inherited property of `object`.
  31491. *
  31492. * @static
  31493. * @memberOf _
  31494. * @since 4.0.0
  31495. * @category Object
  31496. * @param {Object} object The object to query.
  31497. * @param {Array|string} path The path to check.
  31498. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  31499. * @example
  31500. *
  31501. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  31502. *
  31503. * _.hasIn(object, 'a');
  31504. * // => true
  31505. *
  31506. * _.hasIn(object, 'a.b');
  31507. * // => true
  31508. *
  31509. * _.hasIn(object, ['a', 'b']);
  31510. * // => true
  31511. *
  31512. * _.hasIn(object, 'b');
  31513. * // => false
  31514. */
  31515. function hasIn(object, path) {
  31516. return object != null && hasPath(object, path, baseHasIn);
  31517. }
  31518. /**
  31519. * Creates an object composed of the inverted keys and values of `object`.
  31520. * If `object` contains duplicate values, subsequent values overwrite
  31521. * property assignments of previous values.
  31522. *
  31523. * @static
  31524. * @memberOf _
  31525. * @since 0.7.0
  31526. * @category Object
  31527. * @param {Object} object The object to invert.
  31528. * @returns {Object} Returns the new inverted object.
  31529. * @example
  31530. *
  31531. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  31532. *
  31533. * _.invert(object);
  31534. * // => { '1': 'c', '2': 'b' }
  31535. */
  31536. var invert = createInverter(function(result, value, key) {
  31537. if (value != null &&
  31538. typeof value.toString != 'function') {
  31539. value = nativeObjectToString.call(value);
  31540. }
  31541. result[value] = key;
  31542. }, constant(identity));
  31543. /**
  31544. * This method is like `_.invert` except that the inverted object is generated
  31545. * from the results of running each element of `object` thru `iteratee`. The
  31546. * corresponding inverted value of each inverted key is an array of keys
  31547. * responsible for generating the inverted value. The iteratee is invoked
  31548. * with one argument: (value).
  31549. *
  31550. * @static
  31551. * @memberOf _
  31552. * @since 4.1.0
  31553. * @category Object
  31554. * @param {Object} object The object to invert.
  31555. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  31556. * @returns {Object} Returns the new inverted object.
  31557. * @example
  31558. *
  31559. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  31560. *
  31561. * _.invertBy(object);
  31562. * // => { '1': ['a', 'c'], '2': ['b'] }
  31563. *
  31564. * _.invertBy(object, function(value) {
  31565. * return 'group' + value;
  31566. * });
  31567. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  31568. */
  31569. var invertBy = createInverter(function(result, value, key) {
  31570. if (value != null &&
  31571. typeof value.toString != 'function') {
  31572. value = nativeObjectToString.call(value);
  31573. }
  31574. if (hasOwnProperty.call(result, value)) {
  31575. result[value].push(key);
  31576. } else {
  31577. result[value] = [key];
  31578. }
  31579. }, getIteratee);
  31580. /**
  31581. * Invokes the method at `path` of `object`.
  31582. *
  31583. * @static
  31584. * @memberOf _
  31585. * @since 4.0.0
  31586. * @category Object
  31587. * @param {Object} object The object to query.
  31588. * @param {Array|string} path The path of the method to invoke.
  31589. * @param {...*} [args] The arguments to invoke the method with.
  31590. * @returns {*} Returns the result of the invoked method.
  31591. * @example
  31592. *
  31593. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  31594. *
  31595. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  31596. * // => [2, 3]
  31597. */
  31598. var invoke = baseRest(baseInvoke);
  31599. /**
  31600. * Creates an array of the own enumerable property names of `object`.
  31601. *
  31602. * **Note:** Non-object values are coerced to objects. See the
  31603. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  31604. * for more details.
  31605. *
  31606. * @static
  31607. * @since 0.1.0
  31608. * @memberOf _
  31609. * @category Object
  31610. * @param {Object} object The object to query.
  31611. * @returns {Array} Returns the array of property names.
  31612. * @example
  31613. *
  31614. * function Foo() {
  31615. * this.a = 1;
  31616. * this.b = 2;
  31617. * }
  31618. *
  31619. * Foo.prototype.c = 3;
  31620. *
  31621. * _.keys(new Foo);
  31622. * // => ['a', 'b'] (iteration order is not guaranteed)
  31623. *
  31624. * _.keys('hi');
  31625. * // => ['0', '1']
  31626. */
  31627. function keys(object) {
  31628. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  31629. }
  31630. /**
  31631. * Creates an array of the own and inherited enumerable property names of `object`.
  31632. *
  31633. * **Note:** Non-object values are coerced to objects.
  31634. *
  31635. * @static
  31636. * @memberOf _
  31637. * @since 3.0.0
  31638. * @category Object
  31639. * @param {Object} object The object to query.
  31640. * @returns {Array} Returns the array of property names.
  31641. * @example
  31642. *
  31643. * function Foo() {
  31644. * this.a = 1;
  31645. * this.b = 2;
  31646. * }
  31647. *
  31648. * Foo.prototype.c = 3;
  31649. *
  31650. * _.keysIn(new Foo);
  31651. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  31652. */
  31653. function keysIn(object) {
  31654. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  31655. }
  31656. /**
  31657. * The opposite of `_.mapValues`; this method creates an object with the
  31658. * same values as `object` and keys generated by running each own enumerable
  31659. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  31660. * with three arguments: (value, key, object).
  31661. *
  31662. * @static
  31663. * @memberOf _
  31664. * @since 3.8.0
  31665. * @category Object
  31666. * @param {Object} object The object to iterate over.
  31667. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31668. * @returns {Object} Returns the new mapped object.
  31669. * @see _.mapValues
  31670. * @example
  31671. *
  31672. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  31673. * return key + value;
  31674. * });
  31675. * // => { 'a1': 1, 'b2': 2 }
  31676. */
  31677. function mapKeys(object, iteratee) {
  31678. var result = {};
  31679. iteratee = getIteratee(iteratee, 3);
  31680. baseForOwn(object, function(value, key, object) {
  31681. baseAssignValue(result, iteratee(value, key, object), value);
  31682. });
  31683. return result;
  31684. }
  31685. /**
  31686. * Creates an object with the same keys as `object` and values generated
  31687. * by running each own enumerable string keyed property of `object` thru
  31688. * `iteratee`. The iteratee is invoked with three arguments:
  31689. * (value, key, object).
  31690. *
  31691. * @static
  31692. * @memberOf _
  31693. * @since 2.4.0
  31694. * @category Object
  31695. * @param {Object} object The object to iterate over.
  31696. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31697. * @returns {Object} Returns the new mapped object.
  31698. * @see _.mapKeys
  31699. * @example
  31700. *
  31701. * var users = {
  31702. * 'fred': { 'user': 'fred', 'age': 40 },
  31703. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  31704. * };
  31705. *
  31706. * _.mapValues(users, function(o) { return o.age; });
  31707. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  31708. *
  31709. * // The `_.property` iteratee shorthand.
  31710. * _.mapValues(users, 'age');
  31711. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  31712. */
  31713. function mapValues(object, iteratee) {
  31714. var result = {};
  31715. iteratee = getIteratee(iteratee, 3);
  31716. baseForOwn(object, function(value, key, object) {
  31717. baseAssignValue(result, key, iteratee(value, key, object));
  31718. });
  31719. return result;
  31720. }
  31721. /**
  31722. * This method is like `_.assign` except that it recursively merges own and
  31723. * inherited enumerable string keyed properties of source objects into the
  31724. * destination object. Source properties that resolve to `undefined` are
  31725. * skipped if a destination value exists. Array and plain object properties
  31726. * are merged recursively. Other objects and value types are overridden by
  31727. * assignment. Source objects are applied from left to right. Subsequent
  31728. * sources overwrite property assignments of previous sources.
  31729. *
  31730. * **Note:** This method mutates `object`.
  31731. *
  31732. * @static
  31733. * @memberOf _
  31734. * @since 0.5.0
  31735. * @category Object
  31736. * @param {Object} object The destination object.
  31737. * @param {...Object} [sources] The source objects.
  31738. * @returns {Object} Returns `object`.
  31739. * @example
  31740. *
  31741. * var object = {
  31742. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  31743. * };
  31744. *
  31745. * var other = {
  31746. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  31747. * };
  31748. *
  31749. * _.merge(object, other);
  31750. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  31751. */
  31752. var merge = createAssigner(function(object, source, srcIndex) {
  31753. baseMerge(object, source, srcIndex);
  31754. });
  31755. /**
  31756. * This method is like `_.merge` except that it accepts `customizer` which
  31757. * is invoked to produce the merged values of the destination and source
  31758. * properties. If `customizer` returns `undefined`, merging is handled by the
  31759. * method instead. The `customizer` is invoked with six arguments:
  31760. * (objValue, srcValue, key, object, source, stack).
  31761. *
  31762. * **Note:** This method mutates `object`.
  31763. *
  31764. * @static
  31765. * @memberOf _
  31766. * @since 4.0.0
  31767. * @category Object
  31768. * @param {Object} object The destination object.
  31769. * @param {...Object} sources The source objects.
  31770. * @param {Function} customizer The function to customize assigned values.
  31771. * @returns {Object} Returns `object`.
  31772. * @example
  31773. *
  31774. * function customizer(objValue, srcValue) {
  31775. * if (_.isArray(objValue)) {
  31776. * return objValue.concat(srcValue);
  31777. * }
  31778. * }
  31779. *
  31780. * var object = { 'a': [1], 'b': [2] };
  31781. * var other = { 'a': [3], 'b': [4] };
  31782. *
  31783. * _.mergeWith(object, other, customizer);
  31784. * // => { 'a': [1, 3], 'b': [2, 4] }
  31785. */
  31786. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  31787. baseMerge(object, source, srcIndex, customizer);
  31788. });
  31789. /**
  31790. * The opposite of `_.pick`; this method creates an object composed of the
  31791. * own and inherited enumerable property paths of `object` that are not omitted.
  31792. *
  31793. * **Note:** This method is considerably slower than `_.pick`.
  31794. *
  31795. * @static
  31796. * @since 0.1.0
  31797. * @memberOf _
  31798. * @category Object
  31799. * @param {Object} object The source object.
  31800. * @param {...(string|string[])} [paths] The property paths to omit.
  31801. * @returns {Object} Returns the new object.
  31802. * @example
  31803. *
  31804. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31805. *
  31806. * _.omit(object, ['a', 'c']);
  31807. * // => { 'b': '2' }
  31808. */
  31809. var omit = flatRest(function(object, paths) {
  31810. var result = {};
  31811. if (object == null) {
  31812. return result;
  31813. }
  31814. var isDeep = false;
  31815. paths = arrayMap(paths, function(path) {
  31816. path = castPath(path, object);
  31817. isDeep || (isDeep = path.length > 1);
  31818. return path;
  31819. });
  31820. copyObject(object, getAllKeysIn(object), result);
  31821. if (isDeep) {
  31822. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  31823. }
  31824. var length = paths.length;
  31825. while (length--) {
  31826. baseUnset(result, paths[length]);
  31827. }
  31828. return result;
  31829. });
  31830. /**
  31831. * The opposite of `_.pickBy`; this method creates an object composed of
  31832. * the own and inherited enumerable string keyed properties of `object` that
  31833. * `predicate` doesn't return truthy for. The predicate is invoked with two
  31834. * arguments: (value, key).
  31835. *
  31836. * @static
  31837. * @memberOf _
  31838. * @since 4.0.0
  31839. * @category Object
  31840. * @param {Object} object The source object.
  31841. * @param {Function} [predicate=_.identity] The function invoked per property.
  31842. * @returns {Object} Returns the new object.
  31843. * @example
  31844. *
  31845. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31846. *
  31847. * _.omitBy(object, _.isNumber);
  31848. * // => { 'b': '2' }
  31849. */
  31850. function omitBy(object, predicate) {
  31851. return pickBy(object, negate(getIteratee(predicate)));
  31852. }
  31853. /**
  31854. * Creates an object composed of the picked `object` properties.
  31855. *
  31856. * @static
  31857. * @since 0.1.0
  31858. * @memberOf _
  31859. * @category Object
  31860. * @param {Object} object The source object.
  31861. * @param {...(string|string[])} [paths] The property paths to pick.
  31862. * @returns {Object} Returns the new object.
  31863. * @example
  31864. *
  31865. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31866. *
  31867. * _.pick(object, ['a', 'c']);
  31868. * // => { 'a': 1, 'c': 3 }
  31869. */
  31870. var pick = flatRest(function(object, paths) {
  31871. return object == null ? {} : basePick(object, paths);
  31872. });
  31873. /**
  31874. * Creates an object composed of the `object` properties `predicate` returns
  31875. * truthy for. The predicate is invoked with two arguments: (value, key).
  31876. *
  31877. * @static
  31878. * @memberOf _
  31879. * @since 4.0.0
  31880. * @category Object
  31881. * @param {Object} object The source object.
  31882. * @param {Function} [predicate=_.identity] The function invoked per property.
  31883. * @returns {Object} Returns the new object.
  31884. * @example
  31885. *
  31886. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31887. *
  31888. * _.pickBy(object, _.isNumber);
  31889. * // => { 'a': 1, 'c': 3 }
  31890. */
  31891. function pickBy(object, predicate) {
  31892. if (object == null) {
  31893. return {};
  31894. }
  31895. var props = arrayMap(getAllKeysIn(object), function(prop) {
  31896. return [prop];
  31897. });
  31898. predicate = getIteratee(predicate);
  31899. return basePickBy(object, props, function(value, path) {
  31900. return predicate(value, path[0]);
  31901. });
  31902. }
  31903. /**
  31904. * This method is like `_.get` except that if the resolved value is a
  31905. * function it's invoked with the `this` binding of its parent object and
  31906. * its result is returned.
  31907. *
  31908. * @static
  31909. * @since 0.1.0
  31910. * @memberOf _
  31911. * @category Object
  31912. * @param {Object} object The object to query.
  31913. * @param {Array|string} path The path of the property to resolve.
  31914. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  31915. * @returns {*} Returns the resolved value.
  31916. * @example
  31917. *
  31918. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  31919. *
  31920. * _.result(object, 'a[0].b.c1');
  31921. * // => 3
  31922. *
  31923. * _.result(object, 'a[0].b.c2');
  31924. * // => 4
  31925. *
  31926. * _.result(object, 'a[0].b.c3', 'default');
  31927. * // => 'default'
  31928. *
  31929. * _.result(object, 'a[0].b.c3', _.constant('default'));
  31930. * // => 'default'
  31931. */
  31932. function result(object, path, defaultValue) {
  31933. path = castPath(path, object);
  31934. var index = -1,
  31935. length = path.length;
  31936. // Ensure the loop is entered when path is empty.
  31937. if (!length) {
  31938. length = 1;
  31939. object = undefined;
  31940. }
  31941. while (++index < length) {
  31942. var value = object == null ? undefined : object[toKey(path[index])];
  31943. if (value === undefined) {
  31944. index = length;
  31945. value = defaultValue;
  31946. }
  31947. object = isFunction(value) ? value.call(object) : value;
  31948. }
  31949. return object;
  31950. }
  31951. /**
  31952. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  31953. * it's created. Arrays are created for missing index properties while objects
  31954. * are created for all other missing properties. Use `_.setWith` to customize
  31955. * `path` creation.
  31956. *
  31957. * **Note:** This method mutates `object`.
  31958. *
  31959. * @static
  31960. * @memberOf _
  31961. * @since 3.7.0
  31962. * @category Object
  31963. * @param {Object} object The object to modify.
  31964. * @param {Array|string} path The path of the property to set.
  31965. * @param {*} value The value to set.
  31966. * @returns {Object} Returns `object`.
  31967. * @example
  31968. *
  31969. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31970. *
  31971. * _.set(object, 'a[0].b.c', 4);
  31972. * console.log(object.a[0].b.c);
  31973. * // => 4
  31974. *
  31975. * _.set(object, ['x', '0', 'y', 'z'], 5);
  31976. * console.log(object.x[0].y.z);
  31977. * // => 5
  31978. */
  31979. function set(object, path, value) {
  31980. return object == null ? object : baseSet(object, path, value);
  31981. }
  31982. /**
  31983. * This method is like `_.set` except that it accepts `customizer` which is
  31984. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31985. * path creation is handled by the method instead. The `customizer` is invoked
  31986. * with three arguments: (nsValue, key, nsObject).
  31987. *
  31988. * **Note:** This method mutates `object`.
  31989. *
  31990. * @static
  31991. * @memberOf _
  31992. * @since 4.0.0
  31993. * @category Object
  31994. * @param {Object} object The object to modify.
  31995. * @param {Array|string} path The path of the property to set.
  31996. * @param {*} value The value to set.
  31997. * @param {Function} [customizer] The function to customize assigned values.
  31998. * @returns {Object} Returns `object`.
  31999. * @example
  32000. *
  32001. * var object = {};
  32002. *
  32003. * _.setWith(object, '[0][1]', 'a', Object);
  32004. * // => { '0': { '1': 'a' } }
  32005. */
  32006. function setWith(object, path, value, customizer) {
  32007. customizer = typeof customizer == 'function' ? customizer : undefined;
  32008. return object == null ? object : baseSet(object, path, value, customizer);
  32009. }
  32010. /**
  32011. * Creates an array of own enumerable string keyed-value pairs for `object`
  32012. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  32013. * entries are returned.
  32014. *
  32015. * @static
  32016. * @memberOf _
  32017. * @since 4.0.0
  32018. * @alias entries
  32019. * @category Object
  32020. * @param {Object} object The object to query.
  32021. * @returns {Array} Returns the key-value pairs.
  32022. * @example
  32023. *
  32024. * function Foo() {
  32025. * this.a = 1;
  32026. * this.b = 2;
  32027. * }
  32028. *
  32029. * Foo.prototype.c = 3;
  32030. *
  32031. * _.toPairs(new Foo);
  32032. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  32033. */
  32034. var toPairs = createToPairs(keys);
  32035. /**
  32036. * Creates an array of own and inherited enumerable string keyed-value pairs
  32037. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  32038. * or set, its entries are returned.
  32039. *
  32040. * @static
  32041. * @memberOf _
  32042. * @since 4.0.0
  32043. * @alias entriesIn
  32044. * @category Object
  32045. * @param {Object} object The object to query.
  32046. * @returns {Array} Returns the key-value pairs.
  32047. * @example
  32048. *
  32049. * function Foo() {
  32050. * this.a = 1;
  32051. * this.b = 2;
  32052. * }
  32053. *
  32054. * Foo.prototype.c = 3;
  32055. *
  32056. * _.toPairsIn(new Foo);
  32057. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  32058. */
  32059. var toPairsIn = createToPairs(keysIn);
  32060. /**
  32061. * An alternative to `_.reduce`; this method transforms `object` to a new
  32062. * `accumulator` object which is the result of running each of its own
  32063. * enumerable string keyed properties thru `iteratee`, with each invocation
  32064. * potentially mutating the `accumulator` object. If `accumulator` is not
  32065. * provided, a new object with the same `[[Prototype]]` will be used. The
  32066. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  32067. * Iteratee functions may exit iteration early by explicitly returning `false`.
  32068. *
  32069. * @static
  32070. * @memberOf _
  32071. * @since 1.3.0
  32072. * @category Object
  32073. * @param {Object} object The object to iterate over.
  32074. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  32075. * @param {*} [accumulator] The custom accumulator value.
  32076. * @returns {*} Returns the accumulated value.
  32077. * @example
  32078. *
  32079. * _.transform([2, 3, 4], function(result, n) {
  32080. * result.push(n *= n);
  32081. * return n % 2 == 0;
  32082. * }, []);
  32083. * // => [4, 9]
  32084. *
  32085. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  32086. * (result[value] || (result[value] = [])).push(key);
  32087. * }, {});
  32088. * // => { '1': ['a', 'c'], '2': ['b'] }
  32089. */
  32090. function transform(object, iteratee, accumulator) {
  32091. var isArr = isArray(object),
  32092. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  32093. iteratee = getIteratee(iteratee, 4);
  32094. if (accumulator == null) {
  32095. var Ctor = object && object.constructor;
  32096. if (isArrLike) {
  32097. accumulator = isArr ? new Ctor : [];
  32098. }
  32099. else if (isObject(object)) {
  32100. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  32101. }
  32102. else {
  32103. accumulator = {};
  32104. }
  32105. }
  32106. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  32107. return iteratee(accumulator, value, index, object);
  32108. });
  32109. return accumulator;
  32110. }
  32111. /**
  32112. * Removes the property at `path` of `object`.
  32113. *
  32114. * **Note:** This method mutates `object`.
  32115. *
  32116. * @static
  32117. * @memberOf _
  32118. * @since 4.0.0
  32119. * @category Object
  32120. * @param {Object} object The object to modify.
  32121. * @param {Array|string} path The path of the property to unset.
  32122. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  32123. * @example
  32124. *
  32125. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  32126. * _.unset(object, 'a[0].b.c');
  32127. * // => true
  32128. *
  32129. * console.log(object);
  32130. * // => { 'a': [{ 'b': {} }] };
  32131. *
  32132. * _.unset(object, ['a', '0', 'b', 'c']);
  32133. * // => true
  32134. *
  32135. * console.log(object);
  32136. * // => { 'a': [{ 'b': {} }] };
  32137. */
  32138. function unset(object, path) {
  32139. return object == null ? true : baseUnset(object, path);
  32140. }
  32141. /**
  32142. * This method is like `_.set` except that accepts `updater` to produce the
  32143. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  32144. * is invoked with one argument: (value).
  32145. *
  32146. * **Note:** This method mutates `object`.
  32147. *
  32148. * @static
  32149. * @memberOf _
  32150. * @since 4.6.0
  32151. * @category Object
  32152. * @param {Object} object The object to modify.
  32153. * @param {Array|string} path The path of the property to set.
  32154. * @param {Function} updater The function to produce the updated value.
  32155. * @returns {Object} Returns `object`.
  32156. * @example
  32157. *
  32158. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  32159. *
  32160. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  32161. * console.log(object.a[0].b.c);
  32162. * // => 9
  32163. *
  32164. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  32165. * console.log(object.x[0].y.z);
  32166. * // => 0
  32167. */
  32168. function update(object, path, updater) {
  32169. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  32170. }
  32171. /**
  32172. * This method is like `_.update` except that it accepts `customizer` which is
  32173. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  32174. * path creation is handled by the method instead. The `customizer` is invoked
  32175. * with three arguments: (nsValue, key, nsObject).
  32176. *
  32177. * **Note:** This method mutates `object`.
  32178. *
  32179. * @static
  32180. * @memberOf _
  32181. * @since 4.6.0
  32182. * @category Object
  32183. * @param {Object} object The object to modify.
  32184. * @param {Array|string} path The path of the property to set.
  32185. * @param {Function} updater The function to produce the updated value.
  32186. * @param {Function} [customizer] The function to customize assigned values.
  32187. * @returns {Object} Returns `object`.
  32188. * @example
  32189. *
  32190. * var object = {};
  32191. *
  32192. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  32193. * // => { '0': { '1': 'a' } }
  32194. */
  32195. function updateWith(object, path, updater, customizer) {
  32196. customizer = typeof customizer == 'function' ? customizer : undefined;
  32197. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  32198. }
  32199. /**
  32200. * Creates an array of the own enumerable string keyed property values of `object`.
  32201. *
  32202. * **Note:** Non-object values are coerced to objects.
  32203. *
  32204. * @static
  32205. * @since 0.1.0
  32206. * @memberOf _
  32207. * @category Object
  32208. * @param {Object} object The object to query.
  32209. * @returns {Array} Returns the array of property values.
  32210. * @example
  32211. *
  32212. * function Foo() {
  32213. * this.a = 1;
  32214. * this.b = 2;
  32215. * }
  32216. *
  32217. * Foo.prototype.c = 3;
  32218. *
  32219. * _.values(new Foo);
  32220. * // => [1, 2] (iteration order is not guaranteed)
  32221. *
  32222. * _.values('hi');
  32223. * // => ['h', 'i']
  32224. */
  32225. function values(object) {
  32226. return object == null ? [] : baseValues(object, keys(object));
  32227. }
  32228. /**
  32229. * Creates an array of the own and inherited enumerable string keyed property
  32230. * values of `object`.
  32231. *
  32232. * **Note:** Non-object values are coerced to objects.
  32233. *
  32234. * @static
  32235. * @memberOf _
  32236. * @since 3.0.0
  32237. * @category Object
  32238. * @param {Object} object The object to query.
  32239. * @returns {Array} Returns the array of property values.
  32240. * @example
  32241. *
  32242. * function Foo() {
  32243. * this.a = 1;
  32244. * this.b = 2;
  32245. * }
  32246. *
  32247. * Foo.prototype.c = 3;
  32248. *
  32249. * _.valuesIn(new Foo);
  32250. * // => [1, 2, 3] (iteration order is not guaranteed)
  32251. */
  32252. function valuesIn(object) {
  32253. return object == null ? [] : baseValues(object, keysIn(object));
  32254. }
  32255. /*------------------------------------------------------------------------*/
  32256. /**
  32257. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  32258. *
  32259. * @static
  32260. * @memberOf _
  32261. * @since 4.0.0
  32262. * @category Number
  32263. * @param {number} number The number to clamp.
  32264. * @param {number} [lower] The lower bound.
  32265. * @param {number} upper The upper bound.
  32266. * @returns {number} Returns the clamped number.
  32267. * @example
  32268. *
  32269. * _.clamp(-10, -5, 5);
  32270. * // => -5
  32271. *
  32272. * _.clamp(10, -5, 5);
  32273. * // => 5
  32274. */
  32275. function clamp(number, lower, upper) {
  32276. if (upper === undefined) {
  32277. upper = lower;
  32278. lower = undefined;
  32279. }
  32280. if (upper !== undefined) {
  32281. upper = toNumber(upper);
  32282. upper = upper === upper ? upper : 0;
  32283. }
  32284. if (lower !== undefined) {
  32285. lower = toNumber(lower);
  32286. lower = lower === lower ? lower : 0;
  32287. }
  32288. return baseClamp(toNumber(number), lower, upper);
  32289. }
  32290. /**
  32291. * Checks if `n` is between `start` and up to, but not including, `end`. If
  32292. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  32293. * If `start` is greater than `end` the params are swapped to support
  32294. * negative ranges.
  32295. *
  32296. * @static
  32297. * @memberOf _
  32298. * @since 3.3.0
  32299. * @category Number
  32300. * @param {number} number The number to check.
  32301. * @param {number} [start=0] The start of the range.
  32302. * @param {number} end The end of the range.
  32303. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  32304. * @see _.range, _.rangeRight
  32305. * @example
  32306. *
  32307. * _.inRange(3, 2, 4);
  32308. * // => true
  32309. *
  32310. * _.inRange(4, 8);
  32311. * // => true
  32312. *
  32313. * _.inRange(4, 2);
  32314. * // => false
  32315. *
  32316. * _.inRange(2, 2);
  32317. * // => false
  32318. *
  32319. * _.inRange(1.2, 2);
  32320. * // => true
  32321. *
  32322. * _.inRange(5.2, 4);
  32323. * // => false
  32324. *
  32325. * _.inRange(-3, -2, -6);
  32326. * // => true
  32327. */
  32328. function inRange(number, start, end) {
  32329. start = toFinite(start);
  32330. if (end === undefined) {
  32331. end = start;
  32332. start = 0;
  32333. } else {
  32334. end = toFinite(end);
  32335. }
  32336. number = toNumber(number);
  32337. return baseInRange(number, start, end);
  32338. }
  32339. /**
  32340. * Produces a random number between the inclusive `lower` and `upper` bounds.
  32341. * If only one argument is provided a number between `0` and the given number
  32342. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  32343. * floats, a floating-point number is returned instead of an integer.
  32344. *
  32345. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  32346. * floating-point values which can produce unexpected results.
  32347. *
  32348. * @static
  32349. * @memberOf _
  32350. * @since 0.7.0
  32351. * @category Number
  32352. * @param {number} [lower=0] The lower bound.
  32353. * @param {number} [upper=1] The upper bound.
  32354. * @param {boolean} [floating] Specify returning a floating-point number.
  32355. * @returns {number} Returns the random number.
  32356. * @example
  32357. *
  32358. * _.random(0, 5);
  32359. * // => an integer between 0 and 5
  32360. *
  32361. * _.random(5);
  32362. * // => also an integer between 0 and 5
  32363. *
  32364. * _.random(5, true);
  32365. * // => a floating-point number between 0 and 5
  32366. *
  32367. * _.random(1.2, 5.2);
  32368. * // => a floating-point number between 1.2 and 5.2
  32369. */
  32370. function random(lower, upper, floating) {
  32371. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  32372. upper = floating = undefined;
  32373. }
  32374. if (floating === undefined) {
  32375. if (typeof upper == 'boolean') {
  32376. floating = upper;
  32377. upper = undefined;
  32378. }
  32379. else if (typeof lower == 'boolean') {
  32380. floating = lower;
  32381. lower = undefined;
  32382. }
  32383. }
  32384. if (lower === undefined && upper === undefined) {
  32385. lower = 0;
  32386. upper = 1;
  32387. }
  32388. else {
  32389. lower = toFinite(lower);
  32390. if (upper === undefined) {
  32391. upper = lower;
  32392. lower = 0;
  32393. } else {
  32394. upper = toFinite(upper);
  32395. }
  32396. }
  32397. if (lower > upper) {
  32398. var temp = lower;
  32399. lower = upper;
  32400. upper = temp;
  32401. }
  32402. if (floating || lower % 1 || upper % 1) {
  32403. var rand = nativeRandom();
  32404. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  32405. }
  32406. return baseRandom(lower, upper);
  32407. }
  32408. /*------------------------------------------------------------------------*/
  32409. /**
  32410. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  32411. *
  32412. * @static
  32413. * @memberOf _
  32414. * @since 3.0.0
  32415. * @category String
  32416. * @param {string} [string=''] The string to convert.
  32417. * @returns {string} Returns the camel cased string.
  32418. * @example
  32419. *
  32420. * _.camelCase('Foo Bar');
  32421. * // => 'fooBar'
  32422. *
  32423. * _.camelCase('--foo-bar--');
  32424. * // => 'fooBar'
  32425. *
  32426. * _.camelCase('__FOO_BAR__');
  32427. * // => 'fooBar'
  32428. */
  32429. var camelCase = createCompounder(function(result, word, index) {
  32430. word = word.toLowerCase();
  32431. return result + (index ? capitalize(word) : word);
  32432. });
  32433. /**
  32434. * Converts the first character of `string` to upper case and the remaining
  32435. * to lower case.
  32436. *
  32437. * @static
  32438. * @memberOf _
  32439. * @since 3.0.0
  32440. * @category String
  32441. * @param {string} [string=''] The string to capitalize.
  32442. * @returns {string} Returns the capitalized string.
  32443. * @example
  32444. *
  32445. * _.capitalize('FRED');
  32446. * // => 'Fred'
  32447. */
  32448. function capitalize(string) {
  32449. return upperFirst(toString(string).toLowerCase());
  32450. }
  32451. /**
  32452. * Deburrs `string` by converting
  32453. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  32454. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  32455. * letters to basic Latin letters and removing
  32456. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  32457. *
  32458. * @static
  32459. * @memberOf _
  32460. * @since 3.0.0
  32461. * @category String
  32462. * @param {string} [string=''] The string to deburr.
  32463. * @returns {string} Returns the deburred string.
  32464. * @example
  32465. *
  32466. * _.deburr('déjà vu');
  32467. * // => 'deja vu'
  32468. */
  32469. function deburr(string) {
  32470. string = toString(string);
  32471. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  32472. }
  32473. /**
  32474. * Checks if `string` ends with the given target string.
  32475. *
  32476. * @static
  32477. * @memberOf _
  32478. * @since 3.0.0
  32479. * @category String
  32480. * @param {string} [string=''] The string to inspect.
  32481. * @param {string} [target] The string to search for.
  32482. * @param {number} [position=string.length] The position to search up to.
  32483. * @returns {boolean} Returns `true` if `string` ends with `target`,
  32484. * else `false`.
  32485. * @example
  32486. *
  32487. * _.endsWith('abc', 'c');
  32488. * // => true
  32489. *
  32490. * _.endsWith('abc', 'b');
  32491. * // => false
  32492. *
  32493. * _.endsWith('abc', 'b', 2);
  32494. * // => true
  32495. */
  32496. function endsWith(string, target, position) {
  32497. string = toString(string);
  32498. target = baseToString(target);
  32499. var length = string.length;
  32500. position = position === undefined
  32501. ? length
  32502. : baseClamp(toInteger(position), 0, length);
  32503. var end = position;
  32504. position -= target.length;
  32505. return position >= 0 && string.slice(position, end) == target;
  32506. }
  32507. /**
  32508. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  32509. * corresponding HTML entities.
  32510. *
  32511. * **Note:** No other characters are escaped. To escape additional
  32512. * characters use a third-party library like [_he_](https://mths.be/he).
  32513. *
  32514. * Though the ">" character is escaped for symmetry, characters like
  32515. * ">" and "/" don't need escaping in HTML and have no special meaning
  32516. * unless they're part of a tag or unquoted attribute value. See
  32517. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  32518. * (under "semi-related fun fact") for more details.
  32519. *
  32520. * When working with HTML you should always
  32521. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  32522. * XSS vectors.
  32523. *
  32524. * @static
  32525. * @since 0.1.0
  32526. * @memberOf _
  32527. * @category String
  32528. * @param {string} [string=''] The string to escape.
  32529. * @returns {string} Returns the escaped string.
  32530. * @example
  32531. *
  32532. * _.escape('fred, barney, & pebbles');
  32533. * // => 'fred, barney, &amp; pebbles'
  32534. */
  32535. function escape(string) {
  32536. string = toString(string);
  32537. return (string && reHasUnescapedHtml.test(string))
  32538. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  32539. : string;
  32540. }
  32541. /**
  32542. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  32543. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  32544. *
  32545. * @static
  32546. * @memberOf _
  32547. * @since 3.0.0
  32548. * @category String
  32549. * @param {string} [string=''] The string to escape.
  32550. * @returns {string} Returns the escaped string.
  32551. * @example
  32552. *
  32553. * _.escapeRegExp('[lodash](https://lodash.com/)');
  32554. * // => '\[lodash\]\(https://lodash\.com/\)'
  32555. */
  32556. function escapeRegExp(string) {
  32557. string = toString(string);
  32558. return (string && reHasRegExpChar.test(string))
  32559. ? string.replace(reRegExpChar, '\\$&')
  32560. : string;
  32561. }
  32562. /**
  32563. * Converts `string` to
  32564. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  32565. *
  32566. * @static
  32567. * @memberOf _
  32568. * @since 3.0.0
  32569. * @category String
  32570. * @param {string} [string=''] The string to convert.
  32571. * @returns {string} Returns the kebab cased string.
  32572. * @example
  32573. *
  32574. * _.kebabCase('Foo Bar');
  32575. * // => 'foo-bar'
  32576. *
  32577. * _.kebabCase('fooBar');
  32578. * // => 'foo-bar'
  32579. *
  32580. * _.kebabCase('__FOO_BAR__');
  32581. * // => 'foo-bar'
  32582. */
  32583. var kebabCase = createCompounder(function(result, word, index) {
  32584. return result + (index ? '-' : '') + word.toLowerCase();
  32585. });
  32586. /**
  32587. * Converts `string`, as space separated words, to lower case.
  32588. *
  32589. * @static
  32590. * @memberOf _
  32591. * @since 4.0.0
  32592. * @category String
  32593. * @param {string} [string=''] The string to convert.
  32594. * @returns {string} Returns the lower cased string.
  32595. * @example
  32596. *
  32597. * _.lowerCase('--Foo-Bar--');
  32598. * // => 'foo bar'
  32599. *
  32600. * _.lowerCase('fooBar');
  32601. * // => 'foo bar'
  32602. *
  32603. * _.lowerCase('__FOO_BAR__');
  32604. * // => 'foo bar'
  32605. */
  32606. var lowerCase = createCompounder(function(result, word, index) {
  32607. return result + (index ? ' ' : '') + word.toLowerCase();
  32608. });
  32609. /**
  32610. * Converts the first character of `string` to lower case.
  32611. *
  32612. * @static
  32613. * @memberOf _
  32614. * @since 4.0.0
  32615. * @category String
  32616. * @param {string} [string=''] The string to convert.
  32617. * @returns {string} Returns the converted string.
  32618. * @example
  32619. *
  32620. * _.lowerFirst('Fred');
  32621. * // => 'fred'
  32622. *
  32623. * _.lowerFirst('FRED');
  32624. * // => 'fRED'
  32625. */
  32626. var lowerFirst = createCaseFirst('toLowerCase');
  32627. /**
  32628. * Pads `string` on the left and right sides if it's shorter than `length`.
  32629. * Padding characters are truncated if they can't be evenly divided by `length`.
  32630. *
  32631. * @static
  32632. * @memberOf _
  32633. * @since 3.0.0
  32634. * @category String
  32635. * @param {string} [string=''] The string to pad.
  32636. * @param {number} [length=0] The padding length.
  32637. * @param {string} [chars=' '] The string used as padding.
  32638. * @returns {string} Returns the padded string.
  32639. * @example
  32640. *
  32641. * _.pad('abc', 8);
  32642. * // => ' abc '
  32643. *
  32644. * _.pad('abc', 8, '_-');
  32645. * // => '_-abc_-_'
  32646. *
  32647. * _.pad('abc', 3);
  32648. * // => 'abc'
  32649. */
  32650. function pad(string, length, chars) {
  32651. string = toString(string);
  32652. length = toInteger(length);
  32653. var strLength = length ? stringSize(string) : 0;
  32654. if (!length || strLength >= length) {
  32655. return string;
  32656. }
  32657. var mid = (length - strLength) / 2;
  32658. return (
  32659. createPadding(nativeFloor(mid), chars) +
  32660. string +
  32661. createPadding(nativeCeil(mid), chars)
  32662. );
  32663. }
  32664. /**
  32665. * Pads `string` on the right side if it's shorter than `length`. Padding
  32666. * characters are truncated if they exceed `length`.
  32667. *
  32668. * @static
  32669. * @memberOf _
  32670. * @since 4.0.0
  32671. * @category String
  32672. * @param {string} [string=''] The string to pad.
  32673. * @param {number} [length=0] The padding length.
  32674. * @param {string} [chars=' '] The string used as padding.
  32675. * @returns {string} Returns the padded string.
  32676. * @example
  32677. *
  32678. * _.padEnd('abc', 6);
  32679. * // => 'abc '
  32680. *
  32681. * _.padEnd('abc', 6, '_-');
  32682. * // => 'abc_-_'
  32683. *
  32684. * _.padEnd('abc', 3);
  32685. * // => 'abc'
  32686. */
  32687. function padEnd(string, length, chars) {
  32688. string = toString(string);
  32689. length = toInteger(length);
  32690. var strLength = length ? stringSize(string) : 0;
  32691. return (length && strLength < length)
  32692. ? (string + createPadding(length - strLength, chars))
  32693. : string;
  32694. }
  32695. /**
  32696. * Pads `string` on the left side if it's shorter than `length`. Padding
  32697. * characters are truncated if they exceed `length`.
  32698. *
  32699. * @static
  32700. * @memberOf _
  32701. * @since 4.0.0
  32702. * @category String
  32703. * @param {string} [string=''] The string to pad.
  32704. * @param {number} [length=0] The padding length.
  32705. * @param {string} [chars=' '] The string used as padding.
  32706. * @returns {string} Returns the padded string.
  32707. * @example
  32708. *
  32709. * _.padStart('abc', 6);
  32710. * // => ' abc'
  32711. *
  32712. * _.padStart('abc', 6, '_-');
  32713. * // => '_-_abc'
  32714. *
  32715. * _.padStart('abc', 3);
  32716. * // => 'abc'
  32717. */
  32718. function padStart(string, length, chars) {
  32719. string = toString(string);
  32720. length = toInteger(length);
  32721. var strLength = length ? stringSize(string) : 0;
  32722. return (length && strLength < length)
  32723. ? (createPadding(length - strLength, chars) + string)
  32724. : string;
  32725. }
  32726. /**
  32727. * Converts `string` to an integer of the specified radix. If `radix` is
  32728. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  32729. * hexadecimal, in which case a `radix` of `16` is used.
  32730. *
  32731. * **Note:** This method aligns with the
  32732. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  32733. *
  32734. * @static
  32735. * @memberOf _
  32736. * @since 1.1.0
  32737. * @category String
  32738. * @param {string} string The string to convert.
  32739. * @param {number} [radix=10] The radix to interpret `value` by.
  32740. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32741. * @returns {number} Returns the converted integer.
  32742. * @example
  32743. *
  32744. * _.parseInt('08');
  32745. * // => 8
  32746. *
  32747. * _.map(['6', '08', '10'], _.parseInt);
  32748. * // => [6, 8, 10]
  32749. */
  32750. function parseInt(string, radix, guard) {
  32751. if (guard || radix == null) {
  32752. radix = 0;
  32753. } else if (radix) {
  32754. radix = +radix;
  32755. }
  32756. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  32757. }
  32758. /**
  32759. * Repeats the given string `n` times.
  32760. *
  32761. * @static
  32762. * @memberOf _
  32763. * @since 3.0.0
  32764. * @category String
  32765. * @param {string} [string=''] The string to repeat.
  32766. * @param {number} [n=1] The number of times to repeat the string.
  32767. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32768. * @returns {string} Returns the repeated string.
  32769. * @example
  32770. *
  32771. * _.repeat('*', 3);
  32772. * // => '***'
  32773. *
  32774. * _.repeat('abc', 2);
  32775. * // => 'abcabc'
  32776. *
  32777. * _.repeat('abc', 0);
  32778. * // => ''
  32779. */
  32780. function repeat(string, n, guard) {
  32781. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  32782. n = 1;
  32783. } else {
  32784. n = toInteger(n);
  32785. }
  32786. return baseRepeat(toString(string), n);
  32787. }
  32788. /**
  32789. * Replaces matches for `pattern` in `string` with `replacement`.
  32790. *
  32791. * **Note:** This method is based on
  32792. * [`String#replace`](https://mdn.io/String/replace).
  32793. *
  32794. * @static
  32795. * @memberOf _
  32796. * @since 4.0.0
  32797. * @category String
  32798. * @param {string} [string=''] The string to modify.
  32799. * @param {RegExp|string} pattern The pattern to replace.
  32800. * @param {Function|string} replacement The match replacement.
  32801. * @returns {string} Returns the modified string.
  32802. * @example
  32803. *
  32804. * _.replace('Hi Fred', 'Fred', 'Barney');
  32805. * // => 'Hi Barney'
  32806. */
  32807. function replace() {
  32808. var args = arguments,
  32809. string = toString(args[0]);
  32810. return args.length < 3 ? string : string.replace(args[1], args[2]);
  32811. }
  32812. /**
  32813. * Converts `string` to
  32814. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  32815. *
  32816. * @static
  32817. * @memberOf _
  32818. * @since 3.0.0
  32819. * @category String
  32820. * @param {string} [string=''] The string to convert.
  32821. * @returns {string} Returns the snake cased string.
  32822. * @example
  32823. *
  32824. * _.snakeCase('Foo Bar');
  32825. * // => 'foo_bar'
  32826. *
  32827. * _.snakeCase('fooBar');
  32828. * // => 'foo_bar'
  32829. *
  32830. * _.snakeCase('--FOO-BAR--');
  32831. * // => 'foo_bar'
  32832. */
  32833. var snakeCase = createCompounder(function(result, word, index) {
  32834. return result + (index ? '_' : '') + word.toLowerCase();
  32835. });
  32836. /**
  32837. * Splits `string` by `separator`.
  32838. *
  32839. * **Note:** This method is based on
  32840. * [`String#split`](https://mdn.io/String/split).
  32841. *
  32842. * @static
  32843. * @memberOf _
  32844. * @since 4.0.0
  32845. * @category String
  32846. * @param {string} [string=''] The string to split.
  32847. * @param {RegExp|string} separator The separator pattern to split by.
  32848. * @param {number} [limit] The length to truncate results to.
  32849. * @returns {Array} Returns the string segments.
  32850. * @example
  32851. *
  32852. * _.split('a-b-c', '-', 2);
  32853. * // => ['a', 'b']
  32854. */
  32855. function split(string, separator, limit) {
  32856. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  32857. separator = limit = undefined;
  32858. }
  32859. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  32860. if (!limit) {
  32861. return [];
  32862. }
  32863. string = toString(string);
  32864. if (string && (
  32865. typeof separator == 'string' ||
  32866. (separator != null && !isRegExp(separator))
  32867. )) {
  32868. separator = baseToString(separator);
  32869. if (!separator && hasUnicode(string)) {
  32870. return castSlice(stringToArray(string), 0, limit);
  32871. }
  32872. }
  32873. return string.split(separator, limit);
  32874. }
  32875. /**
  32876. * Converts `string` to
  32877. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  32878. *
  32879. * @static
  32880. * @memberOf _
  32881. * @since 3.1.0
  32882. * @category String
  32883. * @param {string} [string=''] The string to convert.
  32884. * @returns {string} Returns the start cased string.
  32885. * @example
  32886. *
  32887. * _.startCase('--foo-bar--');
  32888. * // => 'Foo Bar'
  32889. *
  32890. * _.startCase('fooBar');
  32891. * // => 'Foo Bar'
  32892. *
  32893. * _.startCase('__FOO_BAR__');
  32894. * // => 'FOO BAR'
  32895. */
  32896. var startCase = createCompounder(function(result, word, index) {
  32897. return result + (index ? ' ' : '') + upperFirst(word);
  32898. });
  32899. /**
  32900. * Checks if `string` starts with the given target string.
  32901. *
  32902. * @static
  32903. * @memberOf _
  32904. * @since 3.0.0
  32905. * @category String
  32906. * @param {string} [string=''] The string to inspect.
  32907. * @param {string} [target] The string to search for.
  32908. * @param {number} [position=0] The position to search from.
  32909. * @returns {boolean} Returns `true` if `string` starts with `target`,
  32910. * else `false`.
  32911. * @example
  32912. *
  32913. * _.startsWith('abc', 'a');
  32914. * // => true
  32915. *
  32916. * _.startsWith('abc', 'b');
  32917. * // => false
  32918. *
  32919. * _.startsWith('abc', 'b', 1);
  32920. * // => true
  32921. */
  32922. function startsWith(string, target, position) {
  32923. string = toString(string);
  32924. position = position == null
  32925. ? 0
  32926. : baseClamp(toInteger(position), 0, string.length);
  32927. target = baseToString(target);
  32928. return string.slice(position, position + target.length) == target;
  32929. }
  32930. /**
  32931. * Creates a compiled template function that can interpolate data properties
  32932. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  32933. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  32934. * properties may be accessed as free variables in the template. If a setting
  32935. * object is given, it takes precedence over `_.templateSettings` values.
  32936. *
  32937. * **Note:** In the development build `_.template` utilizes
  32938. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  32939. * for easier debugging.
  32940. *
  32941. * For more information on precompiling templates see
  32942. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  32943. *
  32944. * For more information on Chrome extension sandboxes see
  32945. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  32946. *
  32947. * @static
  32948. * @since 0.1.0
  32949. * @memberOf _
  32950. * @category String
  32951. * @param {string} [string=''] The template string.
  32952. * @param {Object} [options={}] The options object.
  32953. * @param {RegExp} [options.escape=_.templateSettings.escape]
  32954. * The HTML "escape" delimiter.
  32955. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  32956. * The "evaluate" delimiter.
  32957. * @param {Object} [options.imports=_.templateSettings.imports]
  32958. * An object to import into the template as free variables.
  32959. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  32960. * The "interpolate" delimiter.
  32961. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  32962. * The sourceURL of the compiled template.
  32963. * @param {string} [options.variable='obj']
  32964. * The data object variable name.
  32965. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32966. * @returns {Function} Returns the compiled template function.
  32967. * @example
  32968. *
  32969. * // Use the "interpolate" delimiter to create a compiled template.
  32970. * var compiled = _.template('hello <%= user %>!');
  32971. * compiled({ 'user': 'fred' });
  32972. * // => 'hello fred!'
  32973. *
  32974. * // Use the HTML "escape" delimiter to escape data property values.
  32975. * var compiled = _.template('<b><%- value %></b>');
  32976. * compiled({ 'value': '<script>' });
  32977. * // => '<b>&lt;script&gt;</b>'
  32978. *
  32979. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  32980. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  32981. * compiled({ 'users': ['fred', 'barney'] });
  32982. * // => '<li>fred</li><li>barney</li>'
  32983. *
  32984. * // Use the internal `print` function in "evaluate" delimiters.
  32985. * var compiled = _.template('<% print("hello " + user); %>!');
  32986. * compiled({ 'user': 'barney' });
  32987. * // => 'hello barney!'
  32988. *
  32989. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  32990. * // Disable support by replacing the "interpolate" delimiter.
  32991. * var compiled = _.template('hello ${ user }!');
  32992. * compiled({ 'user': 'pebbles' });
  32993. * // => 'hello pebbles!'
  32994. *
  32995. * // Use backslashes to treat delimiters as plain text.
  32996. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  32997. * compiled({ 'value': 'ignored' });
  32998. * // => '<%- value %>'
  32999. *
  33000. * // Use the `imports` option to import `jQuery` as `jq`.
  33001. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  33002. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  33003. * compiled({ 'users': ['fred', 'barney'] });
  33004. * // => '<li>fred</li><li>barney</li>'
  33005. *
  33006. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  33007. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  33008. * compiled(data);
  33009. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  33010. *
  33011. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  33012. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  33013. * compiled.source;
  33014. * // => function(data) {
  33015. * // var __t, __p = '';
  33016. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  33017. * // return __p;
  33018. * // }
  33019. *
  33020. * // Use custom template delimiters.
  33021. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  33022. * var compiled = _.template('hello {{ user }}!');
  33023. * compiled({ 'user': 'mustache' });
  33024. * // => 'hello mustache!'
  33025. *
  33026. * // Use the `source` property to inline compiled templates for meaningful
  33027. * // line numbers in error messages and stack traces.
  33028. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  33029. * var JST = {\
  33030. * "main": ' + _.template(mainText).source + '\
  33031. * };\
  33032. * ');
  33033. */
  33034. function template(string, options, guard) {
  33035. // Based on John Resig's `tmpl` implementation
  33036. // (http://ejohn.org/blog/javascript-micro-templating/)
  33037. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  33038. var settings = lodash.templateSettings;
  33039. if (guard && isIterateeCall(string, options, guard)) {
  33040. options = undefined;
  33041. }
  33042. string = toString(string);
  33043. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  33044. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  33045. importsKeys = keys(imports),
  33046. importsValues = baseValues(imports, importsKeys);
  33047. var isEscaping,
  33048. isEvaluating,
  33049. index = 0,
  33050. interpolate = options.interpolate || reNoMatch,
  33051. source = "__p += '";
  33052. // Compile the regexp to match each delimiter.
  33053. var reDelimiters = RegExp(
  33054. (options.escape || reNoMatch).source + '|' +
  33055. interpolate.source + '|' +
  33056. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  33057. (options.evaluate || reNoMatch).source + '|$'
  33058. , 'g');
  33059. // Use a sourceURL for easier debugging.
  33060. // The sourceURL gets injected into the source that's eval-ed, so be careful
  33061. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  33062. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  33063. var sourceURL = '//# sourceURL=' +
  33064. (hasOwnProperty.call(options, 'sourceURL')
  33065. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  33066. : ('lodash.templateSources[' + (++templateCounter) + ']')
  33067. ) + '\n';
  33068. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  33069. interpolateValue || (interpolateValue = esTemplateValue);
  33070. // Escape characters that can't be included in string literals.
  33071. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  33072. // Replace delimiters with snippets.
  33073. if (escapeValue) {
  33074. isEscaping = true;
  33075. source += "' +\n__e(" + escapeValue + ") +\n'";
  33076. }
  33077. if (evaluateValue) {
  33078. isEvaluating = true;
  33079. source += "';\n" + evaluateValue + ";\n__p += '";
  33080. }
  33081. if (interpolateValue) {
  33082. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  33083. }
  33084. index = offset + match.length;
  33085. // The JS engine embedded in Adobe products needs `match` returned in
  33086. // order to produce the correct `offset` value.
  33087. return match;
  33088. });
  33089. source += "';\n";
  33090. // If `variable` is not specified wrap a with-statement around the generated
  33091. // code to add the data object to the top of the scope chain.
  33092. // Like with sourceURL, we take care to not check the option's prototype,
  33093. // as this configuration is a code injection vector.
  33094. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  33095. if (!variable) {
  33096. source = 'with (obj) {\n' + source + '\n}\n';
  33097. }
  33098. // Cleanup code by stripping empty strings.
  33099. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  33100. .replace(reEmptyStringMiddle, '$1')
  33101. .replace(reEmptyStringTrailing, '$1;');
  33102. // Frame code as the function body.
  33103. source = 'function(' + (variable || 'obj') + ') {\n' +
  33104. (variable
  33105. ? ''
  33106. : 'obj || (obj = {});\n'
  33107. ) +
  33108. "var __t, __p = ''" +
  33109. (isEscaping
  33110. ? ', __e = _.escape'
  33111. : ''
  33112. ) +
  33113. (isEvaluating
  33114. ? ', __j = Array.prototype.join;\n' +
  33115. "function print() { __p += __j.call(arguments, '') }\n"
  33116. : ';\n'
  33117. ) +
  33118. source +
  33119. 'return __p\n}';
  33120. var result = attempt(function() {
  33121. return Function(importsKeys, sourceURL + 'return ' + source)
  33122. .apply(undefined, importsValues);
  33123. });
  33124. // Provide the compiled function's source by its `toString` method or
  33125. // the `source` property as a convenience for inlining compiled templates.
  33126. result.source = source;
  33127. if (isError(result)) {
  33128. throw result;
  33129. }
  33130. return result;
  33131. }
  33132. /**
  33133. * Converts `string`, as a whole, to lower case just like
  33134. * [String#toLowerCase](https://mdn.io/toLowerCase).
  33135. *
  33136. * @static
  33137. * @memberOf _
  33138. * @since 4.0.0
  33139. * @category String
  33140. * @param {string} [string=''] The string to convert.
  33141. * @returns {string} Returns the lower cased string.
  33142. * @example
  33143. *
  33144. * _.toLower('--Foo-Bar--');
  33145. * // => '--foo-bar--'
  33146. *
  33147. * _.toLower('fooBar');
  33148. * // => 'foobar'
  33149. *
  33150. * _.toLower('__FOO_BAR__');
  33151. * // => '__foo_bar__'
  33152. */
  33153. function toLower(value) {
  33154. return toString(value).toLowerCase();
  33155. }
  33156. /**
  33157. * Converts `string`, as a whole, to upper case just like
  33158. * [String#toUpperCase](https://mdn.io/toUpperCase).
  33159. *
  33160. * @static
  33161. * @memberOf _
  33162. * @since 4.0.0
  33163. * @category String
  33164. * @param {string} [string=''] The string to convert.
  33165. * @returns {string} Returns the upper cased string.
  33166. * @example
  33167. *
  33168. * _.toUpper('--foo-bar--');
  33169. * // => '--FOO-BAR--'
  33170. *
  33171. * _.toUpper('fooBar');
  33172. * // => 'FOOBAR'
  33173. *
  33174. * _.toUpper('__foo_bar__');
  33175. * // => '__FOO_BAR__'
  33176. */
  33177. function toUpper(value) {
  33178. return toString(value).toUpperCase();
  33179. }
  33180. /**
  33181. * Removes leading and trailing whitespace or specified characters from `string`.
  33182. *
  33183. * @static
  33184. * @memberOf _
  33185. * @since 3.0.0
  33186. * @category String
  33187. * @param {string} [string=''] The string to trim.
  33188. * @param {string} [chars=whitespace] The characters to trim.
  33189. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  33190. * @returns {string} Returns the trimmed string.
  33191. * @example
  33192. *
  33193. * _.trim(' abc ');
  33194. * // => 'abc'
  33195. *
  33196. * _.trim('-_-abc-_-', '_-');
  33197. * // => 'abc'
  33198. *
  33199. * _.map([' foo ', ' bar '], _.trim);
  33200. * // => ['foo', 'bar']
  33201. */
  33202. function trim(string, chars, guard) {
  33203. string = toString(string);
  33204. if (string && (guard || chars === undefined)) {
  33205. return string.replace(reTrim, '');
  33206. }
  33207. if (!string || !(chars = baseToString(chars))) {
  33208. return string;
  33209. }
  33210. var strSymbols = stringToArray(string),
  33211. chrSymbols = stringToArray(chars),
  33212. start = charsStartIndex(strSymbols, chrSymbols),
  33213. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  33214. return castSlice(strSymbols, start, end).join('');
  33215. }
  33216. /**
  33217. * Removes trailing whitespace or specified characters from `string`.
  33218. *
  33219. * @static
  33220. * @memberOf _
  33221. * @since 4.0.0
  33222. * @category String
  33223. * @param {string} [string=''] The string to trim.
  33224. * @param {string} [chars=whitespace] The characters to trim.
  33225. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  33226. * @returns {string} Returns the trimmed string.
  33227. * @example
  33228. *
  33229. * _.trimEnd(' abc ');
  33230. * // => ' abc'
  33231. *
  33232. * _.trimEnd('-_-abc-_-', '_-');
  33233. * // => '-_-abc'
  33234. */
  33235. function trimEnd(string, chars, guard) {
  33236. string = toString(string);
  33237. if (string && (guard || chars === undefined)) {
  33238. return string.replace(reTrimEnd, '');
  33239. }
  33240. if (!string || !(chars = baseToString(chars))) {
  33241. return string;
  33242. }
  33243. var strSymbols = stringToArray(string),
  33244. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  33245. return castSlice(strSymbols, 0, end).join('');
  33246. }
  33247. /**
  33248. * Removes leading whitespace or specified characters from `string`.
  33249. *
  33250. * @static
  33251. * @memberOf _
  33252. * @since 4.0.0
  33253. * @category String
  33254. * @param {string} [string=''] The string to trim.
  33255. * @param {string} [chars=whitespace] The characters to trim.
  33256. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  33257. * @returns {string} Returns the trimmed string.
  33258. * @example
  33259. *
  33260. * _.trimStart(' abc ');
  33261. * // => 'abc '
  33262. *
  33263. * _.trimStart('-_-abc-_-', '_-');
  33264. * // => 'abc-_-'
  33265. */
  33266. function trimStart(string, chars, guard) {
  33267. string = toString(string);
  33268. if (string && (guard || chars === undefined)) {
  33269. return string.replace(reTrimStart, '');
  33270. }
  33271. if (!string || !(chars = baseToString(chars))) {
  33272. return string;
  33273. }
  33274. var strSymbols = stringToArray(string),
  33275. start = charsStartIndex(strSymbols, stringToArray(chars));
  33276. return castSlice(strSymbols, start).join('');
  33277. }
  33278. /**
  33279. * Truncates `string` if it's longer than the given maximum string length.
  33280. * The last characters of the truncated string are replaced with the omission
  33281. * string which defaults to "...".
  33282. *
  33283. * @static
  33284. * @memberOf _
  33285. * @since 4.0.0
  33286. * @category String
  33287. * @param {string} [string=''] The string to truncate.
  33288. * @param {Object} [options={}] The options object.
  33289. * @param {number} [options.length=30] The maximum string length.
  33290. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  33291. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  33292. * @returns {string} Returns the truncated string.
  33293. * @example
  33294. *
  33295. * _.truncate('hi-diddly-ho there, neighborino');
  33296. * // => 'hi-diddly-ho there, neighbo...'
  33297. *
  33298. * _.truncate('hi-diddly-ho there, neighborino', {
  33299. * 'length': 24,
  33300. * 'separator': ' '
  33301. * });
  33302. * // => 'hi-diddly-ho there,...'
  33303. *
  33304. * _.truncate('hi-diddly-ho there, neighborino', {
  33305. * 'length': 24,
  33306. * 'separator': /,? +/
  33307. * });
  33308. * // => 'hi-diddly-ho there...'
  33309. *
  33310. * _.truncate('hi-diddly-ho there, neighborino', {
  33311. * 'omission': ' [...]'
  33312. * });
  33313. * // => 'hi-diddly-ho there, neig [...]'
  33314. */
  33315. function truncate(string, options) {
  33316. var length = DEFAULT_TRUNC_LENGTH,
  33317. omission = DEFAULT_TRUNC_OMISSION;
  33318. if (isObject(options)) {
  33319. var separator = 'separator' in options ? options.separator : separator;
  33320. length = 'length' in options ? toInteger(options.length) : length;
  33321. omission = 'omission' in options ? baseToString(options.omission) : omission;
  33322. }
  33323. string = toString(string);
  33324. var strLength = string.length;
  33325. if (hasUnicode(string)) {
  33326. var strSymbols = stringToArray(string);
  33327. strLength = strSymbols.length;
  33328. }
  33329. if (length >= strLength) {
  33330. return string;
  33331. }
  33332. var end = length - stringSize(omission);
  33333. if (end < 1) {
  33334. return omission;
  33335. }
  33336. var result = strSymbols
  33337. ? castSlice(strSymbols, 0, end).join('')
  33338. : string.slice(0, end);
  33339. if (separator === undefined) {
  33340. return result + omission;
  33341. }
  33342. if (strSymbols) {
  33343. end += (result.length - end);
  33344. }
  33345. if (isRegExp(separator)) {
  33346. if (string.slice(end).search(separator)) {
  33347. var match,
  33348. substring = result;
  33349. if (!separator.global) {
  33350. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  33351. }
  33352. separator.lastIndex = 0;
  33353. while ((match = separator.exec(substring))) {
  33354. var newEnd = match.index;
  33355. }
  33356. result = result.slice(0, newEnd === undefined ? end : newEnd);
  33357. }
  33358. } else if (string.indexOf(baseToString(separator), end) != end) {
  33359. var index = result.lastIndexOf(separator);
  33360. if (index > -1) {
  33361. result = result.slice(0, index);
  33362. }
  33363. }
  33364. return result + omission;
  33365. }
  33366. /**
  33367. * The inverse of `_.escape`; this method converts the HTML entities
  33368. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  33369. * their corresponding characters.
  33370. *
  33371. * **Note:** No other HTML entities are unescaped. To unescape additional
  33372. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  33373. *
  33374. * @static
  33375. * @memberOf _
  33376. * @since 0.6.0
  33377. * @category String
  33378. * @param {string} [string=''] The string to unescape.
  33379. * @returns {string} Returns the unescaped string.
  33380. * @example
  33381. *
  33382. * _.unescape('fred, barney, &amp; pebbles');
  33383. * // => 'fred, barney, & pebbles'
  33384. */
  33385. function unescape(string) {
  33386. string = toString(string);
  33387. return (string && reHasEscapedHtml.test(string))
  33388. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  33389. : string;
  33390. }
  33391. /**
  33392. * Converts `string`, as space separated words, to upper case.
  33393. *
  33394. * @static
  33395. * @memberOf _
  33396. * @since 4.0.0
  33397. * @category String
  33398. * @param {string} [string=''] The string to convert.
  33399. * @returns {string} Returns the upper cased string.
  33400. * @example
  33401. *
  33402. * _.upperCase('--foo-bar');
  33403. * // => 'FOO BAR'
  33404. *
  33405. * _.upperCase('fooBar');
  33406. * // => 'FOO BAR'
  33407. *
  33408. * _.upperCase('__foo_bar__');
  33409. * // => 'FOO BAR'
  33410. */
  33411. var upperCase = createCompounder(function(result, word, index) {
  33412. return result + (index ? ' ' : '') + word.toUpperCase();
  33413. });
  33414. /**
  33415. * Converts the first character of `string` to upper case.
  33416. *
  33417. * @static
  33418. * @memberOf _
  33419. * @since 4.0.0
  33420. * @category String
  33421. * @param {string} [string=''] The string to convert.
  33422. * @returns {string} Returns the converted string.
  33423. * @example
  33424. *
  33425. * _.upperFirst('fred');
  33426. * // => 'Fred'
  33427. *
  33428. * _.upperFirst('FRED');
  33429. * // => 'FRED'
  33430. */
  33431. var upperFirst = createCaseFirst('toUpperCase');
  33432. /**
  33433. * Splits `string` into an array of its words.
  33434. *
  33435. * @static
  33436. * @memberOf _
  33437. * @since 3.0.0
  33438. * @category String
  33439. * @param {string} [string=''] The string to inspect.
  33440. * @param {RegExp|string} [pattern] The pattern to match words.
  33441. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  33442. * @returns {Array} Returns the words of `string`.
  33443. * @example
  33444. *
  33445. * _.words('fred, barney, & pebbles');
  33446. * // => ['fred', 'barney', 'pebbles']
  33447. *
  33448. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  33449. * // => ['fred', 'barney', '&', 'pebbles']
  33450. */
  33451. function words(string, pattern, guard) {
  33452. string = toString(string);
  33453. pattern = guard ? undefined : pattern;
  33454. if (pattern === undefined) {
  33455. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  33456. }
  33457. return string.match(pattern) || [];
  33458. }
  33459. /*------------------------------------------------------------------------*/
  33460. /**
  33461. * Attempts to invoke `func`, returning either the result or the caught error
  33462. * object. Any additional arguments are provided to `func` when it's invoked.
  33463. *
  33464. * @static
  33465. * @memberOf _
  33466. * @since 3.0.0
  33467. * @category Util
  33468. * @param {Function} func The function to attempt.
  33469. * @param {...*} [args] The arguments to invoke `func` with.
  33470. * @returns {*} Returns the `func` result or error object.
  33471. * @example
  33472. *
  33473. * // Avoid throwing errors for invalid selectors.
  33474. * var elements = _.attempt(function(selector) {
  33475. * return document.querySelectorAll(selector);
  33476. * }, '>_>');
  33477. *
  33478. * if (_.isError(elements)) {
  33479. * elements = [];
  33480. * }
  33481. */
  33482. var attempt = baseRest(function(func, args) {
  33483. try {
  33484. return apply(func, undefined, args);
  33485. } catch (e) {
  33486. return isError(e) ? e : new Error(e);
  33487. }
  33488. });
  33489. /**
  33490. * Binds methods of an object to the object itself, overwriting the existing
  33491. * method.
  33492. *
  33493. * **Note:** This method doesn't set the "length" property of bound functions.
  33494. *
  33495. * @static
  33496. * @since 0.1.0
  33497. * @memberOf _
  33498. * @category Util
  33499. * @param {Object} object The object to bind and assign the bound methods to.
  33500. * @param {...(string|string[])} methodNames The object method names to bind.
  33501. * @returns {Object} Returns `object`.
  33502. * @example
  33503. *
  33504. * var view = {
  33505. * 'label': 'docs',
  33506. * 'click': function() {
  33507. * console.log('clicked ' + this.label);
  33508. * }
  33509. * };
  33510. *
  33511. * _.bindAll(view, ['click']);
  33512. * jQuery(element).on('click', view.click);
  33513. * // => Logs 'clicked docs' when clicked.
  33514. */
  33515. var bindAll = flatRest(function(object, methodNames) {
  33516. arrayEach(methodNames, function(key) {
  33517. key = toKey(key);
  33518. baseAssignValue(object, key, bind(object[key], object));
  33519. });
  33520. return object;
  33521. });
  33522. /**
  33523. * Creates a function that iterates over `pairs` and invokes the corresponding
  33524. * function of the first predicate to return truthy. The predicate-function
  33525. * pairs are invoked with the `this` binding and arguments of the created
  33526. * function.
  33527. *
  33528. * @static
  33529. * @memberOf _
  33530. * @since 4.0.0
  33531. * @category Util
  33532. * @param {Array} pairs The predicate-function pairs.
  33533. * @returns {Function} Returns the new composite function.
  33534. * @example
  33535. *
  33536. * var func = _.cond([
  33537. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  33538. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  33539. * [_.stubTrue, _.constant('no match')]
  33540. * ]);
  33541. *
  33542. * func({ 'a': 1, 'b': 2 });
  33543. * // => 'matches A'
  33544. *
  33545. * func({ 'a': 0, 'b': 1 });
  33546. * // => 'matches B'
  33547. *
  33548. * func({ 'a': '1', 'b': '2' });
  33549. * // => 'no match'
  33550. */
  33551. function cond(pairs) {
  33552. var length = pairs == null ? 0 : pairs.length,
  33553. toIteratee = getIteratee();
  33554. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  33555. if (typeof pair[1] != 'function') {
  33556. throw new TypeError(FUNC_ERROR_TEXT);
  33557. }
  33558. return [toIteratee(pair[0]), pair[1]];
  33559. });
  33560. return baseRest(function(args) {
  33561. var index = -1;
  33562. while (++index < length) {
  33563. var pair = pairs[index];
  33564. if (apply(pair[0], this, args)) {
  33565. return apply(pair[1], this, args);
  33566. }
  33567. }
  33568. });
  33569. }
  33570. /**
  33571. * Creates a function that invokes the predicate properties of `source` with
  33572. * the corresponding property values of a given object, returning `true` if
  33573. * all predicates return truthy, else `false`.
  33574. *
  33575. * **Note:** The created function is equivalent to `_.conformsTo` with
  33576. * `source` partially applied.
  33577. *
  33578. * @static
  33579. * @memberOf _
  33580. * @since 4.0.0
  33581. * @category Util
  33582. * @param {Object} source The object of property predicates to conform to.
  33583. * @returns {Function} Returns the new spec function.
  33584. * @example
  33585. *
  33586. * var objects = [
  33587. * { 'a': 2, 'b': 1 },
  33588. * { 'a': 1, 'b': 2 }
  33589. * ];
  33590. *
  33591. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  33592. * // => [{ 'a': 1, 'b': 2 }]
  33593. */
  33594. function conforms(source) {
  33595. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  33596. }
  33597. /**
  33598. * Creates a function that returns `value`.
  33599. *
  33600. * @static
  33601. * @memberOf _
  33602. * @since 2.4.0
  33603. * @category Util
  33604. * @param {*} value The value to return from the new function.
  33605. * @returns {Function} Returns the new constant function.
  33606. * @example
  33607. *
  33608. * var objects = _.times(2, _.constant({ 'a': 1 }));
  33609. *
  33610. * console.log(objects);
  33611. * // => [{ 'a': 1 }, { 'a': 1 }]
  33612. *
  33613. * console.log(objects[0] === objects[1]);
  33614. * // => true
  33615. */
  33616. function constant(value) {
  33617. return function() {
  33618. return value;
  33619. };
  33620. }
  33621. /**
  33622. * Checks `value` to determine whether a default value should be returned in
  33623. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  33624. * or `undefined`.
  33625. *
  33626. * @static
  33627. * @memberOf _
  33628. * @since 4.14.0
  33629. * @category Util
  33630. * @param {*} value The value to check.
  33631. * @param {*} defaultValue The default value.
  33632. * @returns {*} Returns the resolved value.
  33633. * @example
  33634. *
  33635. * _.defaultTo(1, 10);
  33636. * // => 1
  33637. *
  33638. * _.defaultTo(undefined, 10);
  33639. * // => 10
  33640. */
  33641. function defaultTo(value, defaultValue) {
  33642. return (value == null || value !== value) ? defaultValue : value;
  33643. }
  33644. /**
  33645. * Creates a function that returns the result of invoking the given functions
  33646. * with the `this` binding of the created function, where each successive
  33647. * invocation is supplied the return value of the previous.
  33648. *
  33649. * @static
  33650. * @memberOf _
  33651. * @since 3.0.0
  33652. * @category Util
  33653. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  33654. * @returns {Function} Returns the new composite function.
  33655. * @see _.flowRight
  33656. * @example
  33657. *
  33658. * function square(n) {
  33659. * return n * n;
  33660. * }
  33661. *
  33662. * var addSquare = _.flow([_.add, square]);
  33663. * addSquare(1, 2);
  33664. * // => 9
  33665. */
  33666. var flow = createFlow();
  33667. /**
  33668. * This method is like `_.flow` except that it creates a function that
  33669. * invokes the given functions from right to left.
  33670. *
  33671. * @static
  33672. * @since 3.0.0
  33673. * @memberOf _
  33674. * @category Util
  33675. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  33676. * @returns {Function} Returns the new composite function.
  33677. * @see _.flow
  33678. * @example
  33679. *
  33680. * function square(n) {
  33681. * return n * n;
  33682. * }
  33683. *
  33684. * var addSquare = _.flowRight([square, _.add]);
  33685. * addSquare(1, 2);
  33686. * // => 9
  33687. */
  33688. var flowRight = createFlow(true);
  33689. /**
  33690. * This method returns the first argument it receives.
  33691. *
  33692. * @static
  33693. * @since 0.1.0
  33694. * @memberOf _
  33695. * @category Util
  33696. * @param {*} value Any value.
  33697. * @returns {*} Returns `value`.
  33698. * @example
  33699. *
  33700. * var object = { 'a': 1 };
  33701. *
  33702. * console.log(_.identity(object) === object);
  33703. * // => true
  33704. */
  33705. function identity(value) {
  33706. return value;
  33707. }
  33708. /**
  33709. * Creates a function that invokes `func` with the arguments of the created
  33710. * function. If `func` is a property name, the created function returns the
  33711. * property value for a given element. If `func` is an array or object, the
  33712. * created function returns `true` for elements that contain the equivalent
  33713. * source properties, otherwise it returns `false`.
  33714. *
  33715. * @static
  33716. * @since 4.0.0
  33717. * @memberOf _
  33718. * @category Util
  33719. * @param {*} [func=_.identity] The value to convert to a callback.
  33720. * @returns {Function} Returns the callback.
  33721. * @example
  33722. *
  33723. * var users = [
  33724. * { 'user': 'barney', 'age': 36, 'active': true },
  33725. * { 'user': 'fred', 'age': 40, 'active': false }
  33726. * ];
  33727. *
  33728. * // The `_.matches` iteratee shorthand.
  33729. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  33730. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  33731. *
  33732. * // The `_.matchesProperty` iteratee shorthand.
  33733. * _.filter(users, _.iteratee(['user', 'fred']));
  33734. * // => [{ 'user': 'fred', 'age': 40 }]
  33735. *
  33736. * // The `_.property` iteratee shorthand.
  33737. * _.map(users, _.iteratee('user'));
  33738. * // => ['barney', 'fred']
  33739. *
  33740. * // Create custom iteratee shorthands.
  33741. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  33742. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  33743. * return func.test(string);
  33744. * };
  33745. * });
  33746. *
  33747. * _.filter(['abc', 'def'], /ef/);
  33748. * // => ['def']
  33749. */
  33750. function iteratee(func) {
  33751. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  33752. }
  33753. /**
  33754. * Creates a function that performs a partial deep comparison between a given
  33755. * object and `source`, returning `true` if the given object has equivalent
  33756. * property values, else `false`.
  33757. *
  33758. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  33759. * partially applied.
  33760. *
  33761. * Partial comparisons will match empty array and empty object `source`
  33762. * values against any array or object value, respectively. See `_.isEqual`
  33763. * for a list of supported value comparisons.
  33764. *
  33765. * @static
  33766. * @memberOf _
  33767. * @since 3.0.0
  33768. * @category Util
  33769. * @param {Object} source The object of property values to match.
  33770. * @returns {Function} Returns the new spec function.
  33771. * @example
  33772. *
  33773. * var objects = [
  33774. * { 'a': 1, 'b': 2, 'c': 3 },
  33775. * { 'a': 4, 'b': 5, 'c': 6 }
  33776. * ];
  33777. *
  33778. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  33779. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  33780. */
  33781. function matches(source) {
  33782. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  33783. }
  33784. /**
  33785. * Creates a function that performs a partial deep comparison between the
  33786. * value at `path` of a given object to `srcValue`, returning `true` if the
  33787. * object value is equivalent, else `false`.
  33788. *
  33789. * **Note:** Partial comparisons will match empty array and empty object
  33790. * `srcValue` values against any array or object value, respectively. See
  33791. * `_.isEqual` for a list of supported value comparisons.
  33792. *
  33793. * @static
  33794. * @memberOf _
  33795. * @since 3.2.0
  33796. * @category Util
  33797. * @param {Array|string} path The path of the property to get.
  33798. * @param {*} srcValue The value to match.
  33799. * @returns {Function} Returns the new spec function.
  33800. * @example
  33801. *
  33802. * var objects = [
  33803. * { 'a': 1, 'b': 2, 'c': 3 },
  33804. * { 'a': 4, 'b': 5, 'c': 6 }
  33805. * ];
  33806. *
  33807. * _.find(objects, _.matchesProperty('a', 4));
  33808. * // => { 'a': 4, 'b': 5, 'c': 6 }
  33809. */
  33810. function matchesProperty(path, srcValue) {
  33811. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  33812. }
  33813. /**
  33814. * Creates a function that invokes the method at `path` of a given object.
  33815. * Any additional arguments are provided to the invoked method.
  33816. *
  33817. * @static
  33818. * @memberOf _
  33819. * @since 3.7.0
  33820. * @category Util
  33821. * @param {Array|string} path The path of the method to invoke.
  33822. * @param {...*} [args] The arguments to invoke the method with.
  33823. * @returns {Function} Returns the new invoker function.
  33824. * @example
  33825. *
  33826. * var objects = [
  33827. * { 'a': { 'b': _.constant(2) } },
  33828. * { 'a': { 'b': _.constant(1) } }
  33829. * ];
  33830. *
  33831. * _.map(objects, _.method('a.b'));
  33832. * // => [2, 1]
  33833. *
  33834. * _.map(objects, _.method(['a', 'b']));
  33835. * // => [2, 1]
  33836. */
  33837. var method = baseRest(function(path, args) {
  33838. return function(object) {
  33839. return baseInvoke(object, path, args);
  33840. };
  33841. });
  33842. /**
  33843. * The opposite of `_.method`; this method creates a function that invokes
  33844. * the method at a given path of `object`. Any additional arguments are
  33845. * provided to the invoked method.
  33846. *
  33847. * @static
  33848. * @memberOf _
  33849. * @since 3.7.0
  33850. * @category Util
  33851. * @param {Object} object The object to query.
  33852. * @param {...*} [args] The arguments to invoke the method with.
  33853. * @returns {Function} Returns the new invoker function.
  33854. * @example
  33855. *
  33856. * var array = _.times(3, _.constant),
  33857. * object = { 'a': array, 'b': array, 'c': array };
  33858. *
  33859. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  33860. * // => [2, 0]
  33861. *
  33862. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  33863. * // => [2, 0]
  33864. */
  33865. var methodOf = baseRest(function(object, args) {
  33866. return function(path) {
  33867. return baseInvoke(object, path, args);
  33868. };
  33869. });
  33870. /**
  33871. * Adds all own enumerable string keyed function properties of a source
  33872. * object to the destination object. If `object` is a function, then methods
  33873. * are added to its prototype as well.
  33874. *
  33875. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  33876. * avoid conflicts caused by modifying the original.
  33877. *
  33878. * @static
  33879. * @since 0.1.0
  33880. * @memberOf _
  33881. * @category Util
  33882. * @param {Function|Object} [object=lodash] The destination object.
  33883. * @param {Object} source The object of functions to add.
  33884. * @param {Object} [options={}] The options object.
  33885. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  33886. * @returns {Function|Object} Returns `object`.
  33887. * @example
  33888. *
  33889. * function vowels(string) {
  33890. * return _.filter(string, function(v) {
  33891. * return /[aeiou]/i.test(v);
  33892. * });
  33893. * }
  33894. *
  33895. * _.mixin({ 'vowels': vowels });
  33896. * _.vowels('fred');
  33897. * // => ['e']
  33898. *
  33899. * _('fred').vowels().value();
  33900. * // => ['e']
  33901. *
  33902. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  33903. * _('fred').vowels();
  33904. * // => ['e']
  33905. */
  33906. function mixin(object, source, options) {
  33907. var props = keys(source),
  33908. methodNames = baseFunctions(source, props);
  33909. if (options == null &&
  33910. !(isObject(source) && (methodNames.length || !props.length))) {
  33911. options = source;
  33912. source = object;
  33913. object = this;
  33914. methodNames = baseFunctions(source, keys(source));
  33915. }
  33916. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  33917. isFunc = isFunction(object);
  33918. arrayEach(methodNames, function(methodName) {
  33919. var func = source[methodName];
  33920. object[methodName] = func;
  33921. if (isFunc) {
  33922. object.prototype[methodName] = function() {
  33923. var chainAll = this.__chain__;
  33924. if (chain || chainAll) {
  33925. var result = object(this.__wrapped__),
  33926. actions = result.__actions__ = copyArray(this.__actions__);
  33927. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  33928. result.__chain__ = chainAll;
  33929. return result;
  33930. }
  33931. return func.apply(object, arrayPush([this.value()], arguments));
  33932. };
  33933. }
  33934. });
  33935. return object;
  33936. }
  33937. /**
  33938. * Reverts the `_` variable to its previous value and returns a reference to
  33939. * the `lodash` function.
  33940. *
  33941. * @static
  33942. * @since 0.1.0
  33943. * @memberOf _
  33944. * @category Util
  33945. * @returns {Function} Returns the `lodash` function.
  33946. * @example
  33947. *
  33948. * var lodash = _.noConflict();
  33949. */
  33950. function noConflict() {
  33951. if (root._ === this) {
  33952. root._ = oldDash;
  33953. }
  33954. return this;
  33955. }
  33956. /**
  33957. * This method returns `undefined`.
  33958. *
  33959. * @static
  33960. * @memberOf _
  33961. * @since 2.3.0
  33962. * @category Util
  33963. * @example
  33964. *
  33965. * _.times(2, _.noop);
  33966. * // => [undefined, undefined]
  33967. */
  33968. function noop() {
  33969. // No operation performed.
  33970. }
  33971. /**
  33972. * Creates a function that gets the argument at index `n`. If `n` is negative,
  33973. * the nth argument from the end is returned.
  33974. *
  33975. * @static
  33976. * @memberOf _
  33977. * @since 4.0.0
  33978. * @category Util
  33979. * @param {number} [n=0] The index of the argument to return.
  33980. * @returns {Function} Returns the new pass-thru function.
  33981. * @example
  33982. *
  33983. * var func = _.nthArg(1);
  33984. * func('a', 'b', 'c', 'd');
  33985. * // => 'b'
  33986. *
  33987. * var func = _.nthArg(-2);
  33988. * func('a', 'b', 'c', 'd');
  33989. * // => 'c'
  33990. */
  33991. function nthArg(n) {
  33992. n = toInteger(n);
  33993. return baseRest(function(args) {
  33994. return baseNth(args, n);
  33995. });
  33996. }
  33997. /**
  33998. * Creates a function that invokes `iteratees` with the arguments it receives
  33999. * and returns their results.
  34000. *
  34001. * @static
  34002. * @memberOf _
  34003. * @since 4.0.0
  34004. * @category Util
  34005. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  34006. * The iteratees to invoke.
  34007. * @returns {Function} Returns the new function.
  34008. * @example
  34009. *
  34010. * var func = _.over([Math.max, Math.min]);
  34011. *
  34012. * func(1, 2, 3, 4);
  34013. * // => [4, 1]
  34014. */
  34015. var over = createOver(arrayMap);
  34016. /**
  34017. * Creates a function that checks if **all** of the `predicates` return
  34018. * truthy when invoked with the arguments it receives.
  34019. *
  34020. * @static
  34021. * @memberOf _
  34022. * @since 4.0.0
  34023. * @category Util
  34024. * @param {...(Function|Function[])} [predicates=[_.identity]]
  34025. * The predicates to check.
  34026. * @returns {Function} Returns the new function.
  34027. * @example
  34028. *
  34029. * var func = _.overEvery([Boolean, isFinite]);
  34030. *
  34031. * func('1');
  34032. * // => true
  34033. *
  34034. * func(null);
  34035. * // => false
  34036. *
  34037. * func(NaN);
  34038. * // => false
  34039. */
  34040. var overEvery = createOver(arrayEvery);
  34041. /**
  34042. * Creates a function that checks if **any** of the `predicates` return
  34043. * truthy when invoked with the arguments it receives.
  34044. *
  34045. * @static
  34046. * @memberOf _
  34047. * @since 4.0.0
  34048. * @category Util
  34049. * @param {...(Function|Function[])} [predicates=[_.identity]]
  34050. * The predicates to check.
  34051. * @returns {Function} Returns the new function.
  34052. * @example
  34053. *
  34054. * var func = _.overSome([Boolean, isFinite]);
  34055. *
  34056. * func('1');
  34057. * // => true
  34058. *
  34059. * func(null);
  34060. * // => true
  34061. *
  34062. * func(NaN);
  34063. * // => false
  34064. */
  34065. var overSome = createOver(arraySome);
  34066. /**
  34067. * Creates a function that returns the value at `path` of a given object.
  34068. *
  34069. * @static
  34070. * @memberOf _
  34071. * @since 2.4.0
  34072. * @category Util
  34073. * @param {Array|string} path The path of the property to get.
  34074. * @returns {Function} Returns the new accessor function.
  34075. * @example
  34076. *
  34077. * var objects = [
  34078. * { 'a': { 'b': 2 } },
  34079. * { 'a': { 'b': 1 } }
  34080. * ];
  34081. *
  34082. * _.map(objects, _.property('a.b'));
  34083. * // => [2, 1]
  34084. *
  34085. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  34086. * // => [1, 2]
  34087. */
  34088. function property(path) {
  34089. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  34090. }
  34091. /**
  34092. * The opposite of `_.property`; this method creates a function that returns
  34093. * the value at a given path of `object`.
  34094. *
  34095. * @static
  34096. * @memberOf _
  34097. * @since 3.0.0
  34098. * @category Util
  34099. * @param {Object} object The object to query.
  34100. * @returns {Function} Returns the new accessor function.
  34101. * @example
  34102. *
  34103. * var array = [0, 1, 2],
  34104. * object = { 'a': array, 'b': array, 'c': array };
  34105. *
  34106. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  34107. * // => [2, 0]
  34108. *
  34109. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  34110. * // => [2, 0]
  34111. */
  34112. function propertyOf(object) {
  34113. return function(path) {
  34114. return object == null ? undefined : baseGet(object, path);
  34115. };
  34116. }
  34117. /**
  34118. * Creates an array of numbers (positive and/or negative) progressing from
  34119. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  34120. * `start` is specified without an `end` or `step`. If `end` is not specified,
  34121. * it's set to `start` with `start` then set to `0`.
  34122. *
  34123. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  34124. * floating-point values which can produce unexpected results.
  34125. *
  34126. * @static
  34127. * @since 0.1.0
  34128. * @memberOf _
  34129. * @category Util
  34130. * @param {number} [start=0] The start of the range.
  34131. * @param {number} end The end of the range.
  34132. * @param {number} [step=1] The value to increment or decrement by.
  34133. * @returns {Array} Returns the range of numbers.
  34134. * @see _.inRange, _.rangeRight
  34135. * @example
  34136. *
  34137. * _.range(4);
  34138. * // => [0, 1, 2, 3]
  34139. *
  34140. * _.range(-4);
  34141. * // => [0, -1, -2, -3]
  34142. *
  34143. * _.range(1, 5);
  34144. * // => [1, 2, 3, 4]
  34145. *
  34146. * _.range(0, 20, 5);
  34147. * // => [0, 5, 10, 15]
  34148. *
  34149. * _.range(0, -4, -1);
  34150. * // => [0, -1, -2, -3]
  34151. *
  34152. * _.range(1, 4, 0);
  34153. * // => [1, 1, 1]
  34154. *
  34155. * _.range(0);
  34156. * // => []
  34157. */
  34158. var range = createRange();
  34159. /**
  34160. * This method is like `_.range` except that it populates values in
  34161. * descending order.
  34162. *
  34163. * @static
  34164. * @memberOf _
  34165. * @since 4.0.0
  34166. * @category Util
  34167. * @param {number} [start=0] The start of the range.
  34168. * @param {number} end The end of the range.
  34169. * @param {number} [step=1] The value to increment or decrement by.
  34170. * @returns {Array} Returns the range of numbers.
  34171. * @see _.inRange, _.range
  34172. * @example
  34173. *
  34174. * _.rangeRight(4);
  34175. * // => [3, 2, 1, 0]
  34176. *
  34177. * _.rangeRight(-4);
  34178. * // => [-3, -2, -1, 0]
  34179. *
  34180. * _.rangeRight(1, 5);
  34181. * // => [4, 3, 2, 1]
  34182. *
  34183. * _.rangeRight(0, 20, 5);
  34184. * // => [15, 10, 5, 0]
  34185. *
  34186. * _.rangeRight(0, -4, -1);
  34187. * // => [-3, -2, -1, 0]
  34188. *
  34189. * _.rangeRight(1, 4, 0);
  34190. * // => [1, 1, 1]
  34191. *
  34192. * _.rangeRight(0);
  34193. * // => []
  34194. */
  34195. var rangeRight = createRange(true);
  34196. /**
  34197. * This method returns a new empty array.
  34198. *
  34199. * @static
  34200. * @memberOf _
  34201. * @since 4.13.0
  34202. * @category Util
  34203. * @returns {Array} Returns the new empty array.
  34204. * @example
  34205. *
  34206. * var arrays = _.times(2, _.stubArray);
  34207. *
  34208. * console.log(arrays);
  34209. * // => [[], []]
  34210. *
  34211. * console.log(arrays[0] === arrays[1]);
  34212. * // => false
  34213. */
  34214. function stubArray() {
  34215. return [];
  34216. }
  34217. /**
  34218. * This method returns `false`.
  34219. *
  34220. * @static
  34221. * @memberOf _
  34222. * @since 4.13.0
  34223. * @category Util
  34224. * @returns {boolean} Returns `false`.
  34225. * @example
  34226. *
  34227. * _.times(2, _.stubFalse);
  34228. * // => [false, false]
  34229. */
  34230. function stubFalse() {
  34231. return false;
  34232. }
  34233. /**
  34234. * This method returns a new empty object.
  34235. *
  34236. * @static
  34237. * @memberOf _
  34238. * @since 4.13.0
  34239. * @category Util
  34240. * @returns {Object} Returns the new empty object.
  34241. * @example
  34242. *
  34243. * var objects = _.times(2, _.stubObject);
  34244. *
  34245. * console.log(objects);
  34246. * // => [{}, {}]
  34247. *
  34248. * console.log(objects[0] === objects[1]);
  34249. * // => false
  34250. */
  34251. function stubObject() {
  34252. return {};
  34253. }
  34254. /**
  34255. * This method returns an empty string.
  34256. *
  34257. * @static
  34258. * @memberOf _
  34259. * @since 4.13.0
  34260. * @category Util
  34261. * @returns {string} Returns the empty string.
  34262. * @example
  34263. *
  34264. * _.times(2, _.stubString);
  34265. * // => ['', '']
  34266. */
  34267. function stubString() {
  34268. return '';
  34269. }
  34270. /**
  34271. * This method returns `true`.
  34272. *
  34273. * @static
  34274. * @memberOf _
  34275. * @since 4.13.0
  34276. * @category Util
  34277. * @returns {boolean} Returns `true`.
  34278. * @example
  34279. *
  34280. * _.times(2, _.stubTrue);
  34281. * // => [true, true]
  34282. */
  34283. function stubTrue() {
  34284. return true;
  34285. }
  34286. /**
  34287. * Invokes the iteratee `n` times, returning an array of the results of
  34288. * each invocation. The iteratee is invoked with one argument; (index).
  34289. *
  34290. * @static
  34291. * @since 0.1.0
  34292. * @memberOf _
  34293. * @category Util
  34294. * @param {number} n The number of times to invoke `iteratee`.
  34295. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  34296. * @returns {Array} Returns the array of results.
  34297. * @example
  34298. *
  34299. * _.times(3, String);
  34300. * // => ['0', '1', '2']
  34301. *
  34302. * _.times(4, _.constant(0));
  34303. * // => [0, 0, 0, 0]
  34304. */
  34305. function times(n, iteratee) {
  34306. n = toInteger(n);
  34307. if (n < 1 || n > MAX_SAFE_INTEGER) {
  34308. return [];
  34309. }
  34310. var index = MAX_ARRAY_LENGTH,
  34311. length = nativeMin(n, MAX_ARRAY_LENGTH);
  34312. iteratee = getIteratee(iteratee);
  34313. n -= MAX_ARRAY_LENGTH;
  34314. var result = baseTimes(length, iteratee);
  34315. while (++index < n) {
  34316. iteratee(index);
  34317. }
  34318. return result;
  34319. }
  34320. /**
  34321. * Converts `value` to a property path array.
  34322. *
  34323. * @static
  34324. * @memberOf _
  34325. * @since 4.0.0
  34326. * @category Util
  34327. * @param {*} value The value to convert.
  34328. * @returns {Array} Returns the new property path array.
  34329. * @example
  34330. *
  34331. * _.toPath('a.b.c');
  34332. * // => ['a', 'b', 'c']
  34333. *
  34334. * _.toPath('a[0].b.c');
  34335. * // => ['a', '0', 'b', 'c']
  34336. */
  34337. function toPath(value) {
  34338. if (isArray(value)) {
  34339. return arrayMap(value, toKey);
  34340. }
  34341. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  34342. }
  34343. /**
  34344. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  34345. *
  34346. * @static
  34347. * @since 0.1.0
  34348. * @memberOf _
  34349. * @category Util
  34350. * @param {string} [prefix=''] The value to prefix the ID with.
  34351. * @returns {string} Returns the unique ID.
  34352. * @example
  34353. *
  34354. * _.uniqueId('contact_');
  34355. * // => 'contact_104'
  34356. *
  34357. * _.uniqueId();
  34358. * // => '105'
  34359. */
  34360. function uniqueId(prefix) {
  34361. var id = ++idCounter;
  34362. return toString(prefix) + id;
  34363. }
  34364. /*------------------------------------------------------------------------*/
  34365. /**
  34366. * Adds two numbers.
  34367. *
  34368. * @static
  34369. * @memberOf _
  34370. * @since 3.4.0
  34371. * @category Math
  34372. * @param {number} augend The first number in an addition.
  34373. * @param {number} addend The second number in an addition.
  34374. * @returns {number} Returns the total.
  34375. * @example
  34376. *
  34377. * _.add(6, 4);
  34378. * // => 10
  34379. */
  34380. var add = createMathOperation(function(augend, addend) {
  34381. return augend + addend;
  34382. }, 0);
  34383. /**
  34384. * Computes `number` rounded up to `precision`.
  34385. *
  34386. * @static
  34387. * @memberOf _
  34388. * @since 3.10.0
  34389. * @category Math
  34390. * @param {number} number The number to round up.
  34391. * @param {number} [precision=0] The precision to round up to.
  34392. * @returns {number} Returns the rounded up number.
  34393. * @example
  34394. *
  34395. * _.ceil(4.006);
  34396. * // => 5
  34397. *
  34398. * _.ceil(6.004, 2);
  34399. * // => 6.01
  34400. *
  34401. * _.ceil(6040, -2);
  34402. * // => 6100
  34403. */
  34404. var ceil = createRound('ceil');
  34405. /**
  34406. * Divide two numbers.
  34407. *
  34408. * @static
  34409. * @memberOf _
  34410. * @since 4.7.0
  34411. * @category Math
  34412. * @param {number} dividend The first number in a division.
  34413. * @param {number} divisor The second number in a division.
  34414. * @returns {number} Returns the quotient.
  34415. * @example
  34416. *
  34417. * _.divide(6, 4);
  34418. * // => 1.5
  34419. */
  34420. var divide = createMathOperation(function(dividend, divisor) {
  34421. return dividend / divisor;
  34422. }, 1);
  34423. /**
  34424. * Computes `number` rounded down to `precision`.
  34425. *
  34426. * @static
  34427. * @memberOf _
  34428. * @since 3.10.0
  34429. * @category Math
  34430. * @param {number} number The number to round down.
  34431. * @param {number} [precision=0] The precision to round down to.
  34432. * @returns {number} Returns the rounded down number.
  34433. * @example
  34434. *
  34435. * _.floor(4.006);
  34436. * // => 4
  34437. *
  34438. * _.floor(0.046, 2);
  34439. * // => 0.04
  34440. *
  34441. * _.floor(4060, -2);
  34442. * // => 4000
  34443. */
  34444. var floor = createRound('floor');
  34445. /**
  34446. * Computes the maximum value of `array`. If `array` is empty or falsey,
  34447. * `undefined` is returned.
  34448. *
  34449. * @static
  34450. * @since 0.1.0
  34451. * @memberOf _
  34452. * @category Math
  34453. * @param {Array} array The array to iterate over.
  34454. * @returns {*} Returns the maximum value.
  34455. * @example
  34456. *
  34457. * _.max([4, 2, 8, 6]);
  34458. * // => 8
  34459. *
  34460. * _.max([]);
  34461. * // => undefined
  34462. */
  34463. function max(array) {
  34464. return (array && array.length)
  34465. ? baseExtremum(array, identity, baseGt)
  34466. : undefined;
  34467. }
  34468. /**
  34469. * This method is like `_.max` except that it accepts `iteratee` which is
  34470. * invoked for each element in `array` to generate the criterion by which
  34471. * the value is ranked. The iteratee is invoked with one argument: (value).
  34472. *
  34473. * @static
  34474. * @memberOf _
  34475. * @since 4.0.0
  34476. * @category Math
  34477. * @param {Array} array The array to iterate over.
  34478. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  34479. * @returns {*} Returns the maximum value.
  34480. * @example
  34481. *
  34482. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  34483. *
  34484. * _.maxBy(objects, function(o) { return o.n; });
  34485. * // => { 'n': 2 }
  34486. *
  34487. * // The `_.property` iteratee shorthand.
  34488. * _.maxBy(objects, 'n');
  34489. * // => { 'n': 2 }
  34490. */
  34491. function maxBy(array, iteratee) {
  34492. return (array && array.length)
  34493. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  34494. : undefined;
  34495. }
  34496. /**
  34497. * Computes the mean of the values in `array`.
  34498. *
  34499. * @static
  34500. * @memberOf _
  34501. * @since 4.0.0
  34502. * @category Math
  34503. * @param {Array} array The array to iterate over.
  34504. * @returns {number} Returns the mean.
  34505. * @example
  34506. *
  34507. * _.mean([4, 2, 8, 6]);
  34508. * // => 5
  34509. */
  34510. function mean(array) {
  34511. return baseMean(array, identity);
  34512. }
  34513. /**
  34514. * This method is like `_.mean` except that it accepts `iteratee` which is
  34515. * invoked for each element in `array` to generate the value to be averaged.
  34516. * The iteratee is invoked with one argument: (value).
  34517. *
  34518. * @static
  34519. * @memberOf _
  34520. * @since 4.7.0
  34521. * @category Math
  34522. * @param {Array} array The array to iterate over.
  34523. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  34524. * @returns {number} Returns the mean.
  34525. * @example
  34526. *
  34527. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  34528. *
  34529. * _.meanBy(objects, function(o) { return o.n; });
  34530. * // => 5
  34531. *
  34532. * // The `_.property` iteratee shorthand.
  34533. * _.meanBy(objects, 'n');
  34534. * // => 5
  34535. */
  34536. function meanBy(array, iteratee) {
  34537. return baseMean(array, getIteratee(iteratee, 2));
  34538. }
  34539. /**
  34540. * Computes the minimum value of `array`. If `array` is empty or falsey,
  34541. * `undefined` is returned.
  34542. *
  34543. * @static
  34544. * @since 0.1.0
  34545. * @memberOf _
  34546. * @category Math
  34547. * @param {Array} array The array to iterate over.
  34548. * @returns {*} Returns the minimum value.
  34549. * @example
  34550. *
  34551. * _.min([4, 2, 8, 6]);
  34552. * // => 2
  34553. *
  34554. * _.min([]);
  34555. * // => undefined
  34556. */
  34557. function min(array) {
  34558. return (array && array.length)
  34559. ? baseExtremum(array, identity, baseLt)
  34560. : undefined;
  34561. }
  34562. /**
  34563. * This method is like `_.min` except that it accepts `iteratee` which is
  34564. * invoked for each element in `array` to generate the criterion by which
  34565. * the value is ranked. The iteratee is invoked with one argument: (value).
  34566. *
  34567. * @static
  34568. * @memberOf _
  34569. * @since 4.0.0
  34570. * @category Math
  34571. * @param {Array} array The array to iterate over.
  34572. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  34573. * @returns {*} Returns the minimum value.
  34574. * @example
  34575. *
  34576. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  34577. *
  34578. * _.minBy(objects, function(o) { return o.n; });
  34579. * // => { 'n': 1 }
  34580. *
  34581. * // The `_.property` iteratee shorthand.
  34582. * _.minBy(objects, 'n');
  34583. * // => { 'n': 1 }
  34584. */
  34585. function minBy(array, iteratee) {
  34586. return (array && array.length)
  34587. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  34588. : undefined;
  34589. }
  34590. /**
  34591. * Multiply two numbers.
  34592. *
  34593. * @static
  34594. * @memberOf _
  34595. * @since 4.7.0
  34596. * @category Math
  34597. * @param {number} multiplier The first number in a multiplication.
  34598. * @param {number} multiplicand The second number in a multiplication.
  34599. * @returns {number} Returns the product.
  34600. * @example
  34601. *
  34602. * _.multiply(6, 4);
  34603. * // => 24
  34604. */
  34605. var multiply = createMathOperation(function(multiplier, multiplicand) {
  34606. return multiplier * multiplicand;
  34607. }, 1);
  34608. /**
  34609. * Computes `number` rounded to `precision`.
  34610. *
  34611. * @static
  34612. * @memberOf _
  34613. * @since 3.10.0
  34614. * @category Math
  34615. * @param {number} number The number to round.
  34616. * @param {number} [precision=0] The precision to round to.
  34617. * @returns {number} Returns the rounded number.
  34618. * @example
  34619. *
  34620. * _.round(4.006);
  34621. * // => 4
  34622. *
  34623. * _.round(4.006, 2);
  34624. * // => 4.01
  34625. *
  34626. * _.round(4060, -2);
  34627. * // => 4100
  34628. */
  34629. var round = createRound('round');
  34630. /**
  34631. * Subtract two numbers.
  34632. *
  34633. * @static
  34634. * @memberOf _
  34635. * @since 4.0.0
  34636. * @category Math
  34637. * @param {number} minuend The first number in a subtraction.
  34638. * @param {number} subtrahend The second number in a subtraction.
  34639. * @returns {number} Returns the difference.
  34640. * @example
  34641. *
  34642. * _.subtract(6, 4);
  34643. * // => 2
  34644. */
  34645. var subtract = createMathOperation(function(minuend, subtrahend) {
  34646. return minuend - subtrahend;
  34647. }, 0);
  34648. /**
  34649. * Computes the sum of the values in `array`.
  34650. *
  34651. * @static
  34652. * @memberOf _
  34653. * @since 3.4.0
  34654. * @category Math
  34655. * @param {Array} array The array to iterate over.
  34656. * @returns {number} Returns the sum.
  34657. * @example
  34658. *
  34659. * _.sum([4, 2, 8, 6]);
  34660. * // => 20
  34661. */
  34662. function sum(array) {
  34663. return (array && array.length)
  34664. ? baseSum(array, identity)
  34665. : 0;
  34666. }
  34667. /**
  34668. * This method is like `_.sum` except that it accepts `iteratee` which is
  34669. * invoked for each element in `array` to generate the value to be summed.
  34670. * The iteratee is invoked with one argument: (value).
  34671. *
  34672. * @static
  34673. * @memberOf _
  34674. * @since 4.0.0
  34675. * @category Math
  34676. * @param {Array} array The array to iterate over.
  34677. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  34678. * @returns {number} Returns the sum.
  34679. * @example
  34680. *
  34681. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  34682. *
  34683. * _.sumBy(objects, function(o) { return o.n; });
  34684. * // => 20
  34685. *
  34686. * // The `_.property` iteratee shorthand.
  34687. * _.sumBy(objects, 'n');
  34688. * // => 20
  34689. */
  34690. function sumBy(array, iteratee) {
  34691. return (array && array.length)
  34692. ? baseSum(array, getIteratee(iteratee, 2))
  34693. : 0;
  34694. }
  34695. /*------------------------------------------------------------------------*/
  34696. // Add methods that return wrapped values in chain sequences.
  34697. lodash.after = after;
  34698. lodash.ary = ary;
  34699. lodash.assign = assign;
  34700. lodash.assignIn = assignIn;
  34701. lodash.assignInWith = assignInWith;
  34702. lodash.assignWith = assignWith;
  34703. lodash.at = at;
  34704. lodash.before = before;
  34705. lodash.bind = bind;
  34706. lodash.bindAll = bindAll;
  34707. lodash.bindKey = bindKey;
  34708. lodash.castArray = castArray;
  34709. lodash.chain = chain;
  34710. lodash.chunk = chunk;
  34711. lodash.compact = compact;
  34712. lodash.concat = concat;
  34713. lodash.cond = cond;
  34714. lodash.conforms = conforms;
  34715. lodash.constant = constant;
  34716. lodash.countBy = countBy;
  34717. lodash.create = create;
  34718. lodash.curry = curry;
  34719. lodash.curryRight = curryRight;
  34720. lodash.debounce = debounce;
  34721. lodash.defaults = defaults;
  34722. lodash.defaultsDeep = defaultsDeep;
  34723. lodash.defer = defer;
  34724. lodash.delay = delay;
  34725. lodash.difference = difference;
  34726. lodash.differenceBy = differenceBy;
  34727. lodash.differenceWith = differenceWith;
  34728. lodash.drop = drop;
  34729. lodash.dropRight = dropRight;
  34730. lodash.dropRightWhile = dropRightWhile;
  34731. lodash.dropWhile = dropWhile;
  34732. lodash.fill = fill;
  34733. lodash.filter = filter;
  34734. lodash.flatMap = flatMap;
  34735. lodash.flatMapDeep = flatMapDeep;
  34736. lodash.flatMapDepth = flatMapDepth;
  34737. lodash.flatten = flatten;
  34738. lodash.flattenDeep = flattenDeep;
  34739. lodash.flattenDepth = flattenDepth;
  34740. lodash.flip = flip;
  34741. lodash.flow = flow;
  34742. lodash.flowRight = flowRight;
  34743. lodash.fromPairs = fromPairs;
  34744. lodash.functions = functions;
  34745. lodash.functionsIn = functionsIn;
  34746. lodash.groupBy = groupBy;
  34747. lodash.initial = initial;
  34748. lodash.intersection = intersection;
  34749. lodash.intersectionBy = intersectionBy;
  34750. lodash.intersectionWith = intersectionWith;
  34751. lodash.invert = invert;
  34752. lodash.invertBy = invertBy;
  34753. lodash.invokeMap = invokeMap;
  34754. lodash.iteratee = iteratee;
  34755. lodash.keyBy = keyBy;
  34756. lodash.keys = keys;
  34757. lodash.keysIn = keysIn;
  34758. lodash.map = map;
  34759. lodash.mapKeys = mapKeys;
  34760. lodash.mapValues = mapValues;
  34761. lodash.matches = matches;
  34762. lodash.matchesProperty = matchesProperty;
  34763. lodash.memoize = memoize;
  34764. lodash.merge = merge;
  34765. lodash.mergeWith = mergeWith;
  34766. lodash.method = method;
  34767. lodash.methodOf = methodOf;
  34768. lodash.mixin = mixin;
  34769. lodash.negate = negate;
  34770. lodash.nthArg = nthArg;
  34771. lodash.omit = omit;
  34772. lodash.omitBy = omitBy;
  34773. lodash.once = once;
  34774. lodash.orderBy = orderBy;
  34775. lodash.over = over;
  34776. lodash.overArgs = overArgs;
  34777. lodash.overEvery = overEvery;
  34778. lodash.overSome = overSome;
  34779. lodash.partial = partial;
  34780. lodash.partialRight = partialRight;
  34781. lodash.partition = partition;
  34782. lodash.pick = pick;
  34783. lodash.pickBy = pickBy;
  34784. lodash.property = property;
  34785. lodash.propertyOf = propertyOf;
  34786. lodash.pull = pull;
  34787. lodash.pullAll = pullAll;
  34788. lodash.pullAllBy = pullAllBy;
  34789. lodash.pullAllWith = pullAllWith;
  34790. lodash.pullAt = pullAt;
  34791. lodash.range = range;
  34792. lodash.rangeRight = rangeRight;
  34793. lodash.rearg = rearg;
  34794. lodash.reject = reject;
  34795. lodash.remove = remove;
  34796. lodash.rest = rest;
  34797. lodash.reverse = reverse;
  34798. lodash.sampleSize = sampleSize;
  34799. lodash.set = set;
  34800. lodash.setWith = setWith;
  34801. lodash.shuffle = shuffle;
  34802. lodash.slice = slice;
  34803. lodash.sortBy = sortBy;
  34804. lodash.sortedUniq = sortedUniq;
  34805. lodash.sortedUniqBy = sortedUniqBy;
  34806. lodash.split = split;
  34807. lodash.spread = spread;
  34808. lodash.tail = tail;
  34809. lodash.take = take;
  34810. lodash.takeRight = takeRight;
  34811. lodash.takeRightWhile = takeRightWhile;
  34812. lodash.takeWhile = takeWhile;
  34813. lodash.tap = tap;
  34814. lodash.throttle = throttle;
  34815. lodash.thru = thru;
  34816. lodash.toArray = toArray;
  34817. lodash.toPairs = toPairs;
  34818. lodash.toPairsIn = toPairsIn;
  34819. lodash.toPath = toPath;
  34820. lodash.toPlainObject = toPlainObject;
  34821. lodash.transform = transform;
  34822. lodash.unary = unary;
  34823. lodash.union = union;
  34824. lodash.unionBy = unionBy;
  34825. lodash.unionWith = unionWith;
  34826. lodash.uniq = uniq;
  34827. lodash.uniqBy = uniqBy;
  34828. lodash.uniqWith = uniqWith;
  34829. lodash.unset = unset;
  34830. lodash.unzip = unzip;
  34831. lodash.unzipWith = unzipWith;
  34832. lodash.update = update;
  34833. lodash.updateWith = updateWith;
  34834. lodash.values = values;
  34835. lodash.valuesIn = valuesIn;
  34836. lodash.without = without;
  34837. lodash.words = words;
  34838. lodash.wrap = wrap;
  34839. lodash.xor = xor;
  34840. lodash.xorBy = xorBy;
  34841. lodash.xorWith = xorWith;
  34842. lodash.zip = zip;
  34843. lodash.zipObject = zipObject;
  34844. lodash.zipObjectDeep = zipObjectDeep;
  34845. lodash.zipWith = zipWith;
  34846. // Add aliases.
  34847. lodash.entries = toPairs;
  34848. lodash.entriesIn = toPairsIn;
  34849. lodash.extend = assignIn;
  34850. lodash.extendWith = assignInWith;
  34851. // Add methods to `lodash.prototype`.
  34852. mixin(lodash, lodash);
  34853. /*------------------------------------------------------------------------*/
  34854. // Add methods that return unwrapped values in chain sequences.
  34855. lodash.add = add;
  34856. lodash.attempt = attempt;
  34857. lodash.camelCase = camelCase;
  34858. lodash.capitalize = capitalize;
  34859. lodash.ceil = ceil;
  34860. lodash.clamp = clamp;
  34861. lodash.clone = clone;
  34862. lodash.cloneDeep = cloneDeep;
  34863. lodash.cloneDeepWith = cloneDeepWith;
  34864. lodash.cloneWith = cloneWith;
  34865. lodash.conformsTo = conformsTo;
  34866. lodash.deburr = deburr;
  34867. lodash.defaultTo = defaultTo;
  34868. lodash.divide = divide;
  34869. lodash.endsWith = endsWith;
  34870. lodash.eq = eq;
  34871. lodash.escape = escape;
  34872. lodash.escapeRegExp = escapeRegExp;
  34873. lodash.every = every;
  34874. lodash.find = find;
  34875. lodash.findIndex = findIndex;
  34876. lodash.findKey = findKey;
  34877. lodash.findLast = findLast;
  34878. lodash.findLastIndex = findLastIndex;
  34879. lodash.findLastKey = findLastKey;
  34880. lodash.floor = floor;
  34881. lodash.forEach = forEach;
  34882. lodash.forEachRight = forEachRight;
  34883. lodash.forIn = forIn;
  34884. lodash.forInRight = forInRight;
  34885. lodash.forOwn = forOwn;
  34886. lodash.forOwnRight = forOwnRight;
  34887. lodash.get = get;
  34888. lodash.gt = gt;
  34889. lodash.gte = gte;
  34890. lodash.has = has;
  34891. lodash.hasIn = hasIn;
  34892. lodash.head = head;
  34893. lodash.identity = identity;
  34894. lodash.includes = includes;
  34895. lodash.indexOf = indexOf;
  34896. lodash.inRange = inRange;
  34897. lodash.invoke = invoke;
  34898. lodash.isArguments = isArguments;
  34899. lodash.isArray = isArray;
  34900. lodash.isArrayBuffer = isArrayBuffer;
  34901. lodash.isArrayLike = isArrayLike;
  34902. lodash.isArrayLikeObject = isArrayLikeObject;
  34903. lodash.isBoolean = isBoolean;
  34904. lodash.isBuffer = isBuffer;
  34905. lodash.isDate = isDate;
  34906. lodash.isElement = isElement;
  34907. lodash.isEmpty = isEmpty;
  34908. lodash.isEqual = isEqual;
  34909. lodash.isEqualWith = isEqualWith;
  34910. lodash.isError = isError;
  34911. lodash.isFinite = isFinite;
  34912. lodash.isFunction = isFunction;
  34913. lodash.isInteger = isInteger;
  34914. lodash.isLength = isLength;
  34915. lodash.isMap = isMap;
  34916. lodash.isMatch = isMatch;
  34917. lodash.isMatchWith = isMatchWith;
  34918. lodash.isNaN = isNaN;
  34919. lodash.isNative = isNative;
  34920. lodash.isNil = isNil;
  34921. lodash.isNull = isNull;
  34922. lodash.isNumber = isNumber;
  34923. lodash.isObject = isObject;
  34924. lodash.isObjectLike = isObjectLike;
  34925. lodash.isPlainObject = isPlainObject;
  34926. lodash.isRegExp = isRegExp;
  34927. lodash.isSafeInteger = isSafeInteger;
  34928. lodash.isSet = isSet;
  34929. lodash.isString = isString;
  34930. lodash.isSymbol = isSymbol;
  34931. lodash.isTypedArray = isTypedArray;
  34932. lodash.isUndefined = isUndefined;
  34933. lodash.isWeakMap = isWeakMap;
  34934. lodash.isWeakSet = isWeakSet;
  34935. lodash.join = join;
  34936. lodash.kebabCase = kebabCase;
  34937. lodash.last = last;
  34938. lodash.lastIndexOf = lastIndexOf;
  34939. lodash.lowerCase = lowerCase;
  34940. lodash.lowerFirst = lowerFirst;
  34941. lodash.lt = lt;
  34942. lodash.lte = lte;
  34943. lodash.max = max;
  34944. lodash.maxBy = maxBy;
  34945. lodash.mean = mean;
  34946. lodash.meanBy = meanBy;
  34947. lodash.min = min;
  34948. lodash.minBy = minBy;
  34949. lodash.stubArray = stubArray;
  34950. lodash.stubFalse = stubFalse;
  34951. lodash.stubObject = stubObject;
  34952. lodash.stubString = stubString;
  34953. lodash.stubTrue = stubTrue;
  34954. lodash.multiply = multiply;
  34955. lodash.nth = nth;
  34956. lodash.noConflict = noConflict;
  34957. lodash.noop = noop;
  34958. lodash.now = now;
  34959. lodash.pad = pad;
  34960. lodash.padEnd = padEnd;
  34961. lodash.padStart = padStart;
  34962. lodash.parseInt = parseInt;
  34963. lodash.random = random;
  34964. lodash.reduce = reduce;
  34965. lodash.reduceRight = reduceRight;
  34966. lodash.repeat = repeat;
  34967. lodash.replace = replace;
  34968. lodash.result = result;
  34969. lodash.round = round;
  34970. lodash.runInContext = runInContext;
  34971. lodash.sample = sample;
  34972. lodash.size = size;
  34973. lodash.snakeCase = snakeCase;
  34974. lodash.some = some;
  34975. lodash.sortedIndex = sortedIndex;
  34976. lodash.sortedIndexBy = sortedIndexBy;
  34977. lodash.sortedIndexOf = sortedIndexOf;
  34978. lodash.sortedLastIndex = sortedLastIndex;
  34979. lodash.sortedLastIndexBy = sortedLastIndexBy;
  34980. lodash.sortedLastIndexOf = sortedLastIndexOf;
  34981. lodash.startCase = startCase;
  34982. lodash.startsWith = startsWith;
  34983. lodash.subtract = subtract;
  34984. lodash.sum = sum;
  34985. lodash.sumBy = sumBy;
  34986. lodash.template = template;
  34987. lodash.times = times;
  34988. lodash.toFinite = toFinite;
  34989. lodash.toInteger = toInteger;
  34990. lodash.toLength = toLength;
  34991. lodash.toLower = toLower;
  34992. lodash.toNumber = toNumber;
  34993. lodash.toSafeInteger = toSafeInteger;
  34994. lodash.toString = toString;
  34995. lodash.toUpper = toUpper;
  34996. lodash.trim = trim;
  34997. lodash.trimEnd = trimEnd;
  34998. lodash.trimStart = trimStart;
  34999. lodash.truncate = truncate;
  35000. lodash.unescape = unescape;
  35001. lodash.uniqueId = uniqueId;
  35002. lodash.upperCase = upperCase;
  35003. lodash.upperFirst = upperFirst;
  35004. // Add aliases.
  35005. lodash.each = forEach;
  35006. lodash.eachRight = forEachRight;
  35007. lodash.first = head;
  35008. mixin(lodash, (function() {
  35009. var source = {};
  35010. baseForOwn(lodash, function(func, methodName) {
  35011. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  35012. source[methodName] = func;
  35013. }
  35014. });
  35015. return source;
  35016. }()), { 'chain': false });
  35017. /*------------------------------------------------------------------------*/
  35018. /**
  35019. * The semantic version number.
  35020. *
  35021. * @static
  35022. * @memberOf _
  35023. * @type {string}
  35024. */
  35025. lodash.VERSION = VERSION;
  35026. // Assign default placeholders.
  35027. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  35028. lodash[methodName].placeholder = lodash;
  35029. });
  35030. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  35031. arrayEach(['drop', 'take'], function(methodName, index) {
  35032. LazyWrapper.prototype[methodName] = function(n) {
  35033. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  35034. var result = (this.__filtered__ && !index)
  35035. ? new LazyWrapper(this)
  35036. : this.clone();
  35037. if (result.__filtered__) {
  35038. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  35039. } else {
  35040. result.__views__.push({
  35041. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  35042. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  35043. });
  35044. }
  35045. return result;
  35046. };
  35047. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  35048. return this.reverse()[methodName](n).reverse();
  35049. };
  35050. });
  35051. // Add `LazyWrapper` methods that accept an `iteratee` value.
  35052. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  35053. var type = index + 1,
  35054. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  35055. LazyWrapper.prototype[methodName] = function(iteratee) {
  35056. var result = this.clone();
  35057. result.__iteratees__.push({
  35058. 'iteratee': getIteratee(iteratee, 3),
  35059. 'type': type
  35060. });
  35061. result.__filtered__ = result.__filtered__ || isFilter;
  35062. return result;
  35063. };
  35064. });
  35065. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  35066. arrayEach(['head', 'last'], function(methodName, index) {
  35067. var takeName = 'take' + (index ? 'Right' : '');
  35068. LazyWrapper.prototype[methodName] = function() {
  35069. return this[takeName](1).value()[0];
  35070. };
  35071. });
  35072. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  35073. arrayEach(['initial', 'tail'], function(methodName, index) {
  35074. var dropName = 'drop' + (index ? '' : 'Right');
  35075. LazyWrapper.prototype[methodName] = function() {
  35076. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  35077. };
  35078. });
  35079. LazyWrapper.prototype.compact = function() {
  35080. return this.filter(identity);
  35081. };
  35082. LazyWrapper.prototype.find = function(predicate) {
  35083. return this.filter(predicate).head();
  35084. };
  35085. LazyWrapper.prototype.findLast = function(predicate) {
  35086. return this.reverse().find(predicate);
  35087. };
  35088. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  35089. if (typeof path == 'function') {
  35090. return new LazyWrapper(this);
  35091. }
  35092. return this.map(function(value) {
  35093. return baseInvoke(value, path, args);
  35094. });
  35095. });
  35096. LazyWrapper.prototype.reject = function(predicate) {
  35097. return this.filter(negate(getIteratee(predicate)));
  35098. };
  35099. LazyWrapper.prototype.slice = function(start, end) {
  35100. start = toInteger(start);
  35101. var result = this;
  35102. if (result.__filtered__ && (start > 0 || end < 0)) {
  35103. return new LazyWrapper(result);
  35104. }
  35105. if (start < 0) {
  35106. result = result.takeRight(-start);
  35107. } else if (start) {
  35108. result = result.drop(start);
  35109. }
  35110. if (end !== undefined) {
  35111. end = toInteger(end);
  35112. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  35113. }
  35114. return result;
  35115. };
  35116. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  35117. return this.reverse().takeWhile(predicate).reverse();
  35118. };
  35119. LazyWrapper.prototype.toArray = function() {
  35120. return this.take(MAX_ARRAY_LENGTH);
  35121. };
  35122. // Add `LazyWrapper` methods to `lodash.prototype`.
  35123. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  35124. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  35125. isTaker = /^(?:head|last)$/.test(methodName),
  35126. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  35127. retUnwrapped = isTaker || /^find/.test(methodName);
  35128. if (!lodashFunc) {
  35129. return;
  35130. }
  35131. lodash.prototype[methodName] = function() {
  35132. var value = this.__wrapped__,
  35133. args = isTaker ? [1] : arguments,
  35134. isLazy = value instanceof LazyWrapper,
  35135. iteratee = args[0],
  35136. useLazy = isLazy || isArray(value);
  35137. var interceptor = function(value) {
  35138. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  35139. return (isTaker && chainAll) ? result[0] : result;
  35140. };
  35141. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  35142. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  35143. isLazy = useLazy = false;
  35144. }
  35145. var chainAll = this.__chain__,
  35146. isHybrid = !!this.__actions__.length,
  35147. isUnwrapped = retUnwrapped && !chainAll,
  35148. onlyLazy = isLazy && !isHybrid;
  35149. if (!retUnwrapped && useLazy) {
  35150. value = onlyLazy ? value : new LazyWrapper(this);
  35151. var result = func.apply(value, args);
  35152. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  35153. return new LodashWrapper(result, chainAll);
  35154. }
  35155. if (isUnwrapped && onlyLazy) {
  35156. return func.apply(this, args);
  35157. }
  35158. result = this.thru(interceptor);
  35159. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  35160. };
  35161. });
  35162. // Add `Array` methods to `lodash.prototype`.
  35163. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  35164. var func = arrayProto[methodName],
  35165. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  35166. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  35167. lodash.prototype[methodName] = function() {
  35168. var args = arguments;
  35169. if (retUnwrapped && !this.__chain__) {
  35170. var value = this.value();
  35171. return func.apply(isArray(value) ? value : [], args);
  35172. }
  35173. return this[chainName](function(value) {
  35174. return func.apply(isArray(value) ? value : [], args);
  35175. });
  35176. };
  35177. });
  35178. // Map minified method names to their real names.
  35179. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  35180. var lodashFunc = lodash[methodName];
  35181. if (lodashFunc) {
  35182. var key = lodashFunc.name + '';
  35183. if (!hasOwnProperty.call(realNames, key)) {
  35184. realNames[key] = [];
  35185. }
  35186. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  35187. }
  35188. });
  35189. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  35190. 'name': 'wrapper',
  35191. 'func': undefined
  35192. }];
  35193. // Add methods to `LazyWrapper`.
  35194. LazyWrapper.prototype.clone = lazyClone;
  35195. LazyWrapper.prototype.reverse = lazyReverse;
  35196. LazyWrapper.prototype.value = lazyValue;
  35197. // Add chain sequence methods to the `lodash` wrapper.
  35198. lodash.prototype.at = wrapperAt;
  35199. lodash.prototype.chain = wrapperChain;
  35200. lodash.prototype.commit = wrapperCommit;
  35201. lodash.prototype.next = wrapperNext;
  35202. lodash.prototype.plant = wrapperPlant;
  35203. lodash.prototype.reverse = wrapperReverse;
  35204. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  35205. // Add lazy aliases.
  35206. lodash.prototype.first = lodash.prototype.head;
  35207. if (symIterator) {
  35208. lodash.prototype[symIterator] = wrapperToIterator;
  35209. }
  35210. return lodash;
  35211. });
  35212. /*--------------------------------------------------------------------------*/
  35213. // Export lodash.
  35214. var _ = runInContext();
  35215. // Some AMD build optimizers, like r.js, check for condition patterns like:
  35216. if (true) {
  35217. // Expose Lodash on the global object to prevent errors when Lodash is
  35218. // loaded by a script tag in the presence of an AMD loader.
  35219. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  35220. // Use `_.noConflict` to remove Lodash from the global object.
  35221. root._ = _;
  35222. // Define as an anonymous module so, through path mapping, it can be
  35223. // referenced as the "underscore" module.
  35224. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  35225. return _;
  35226. }).call(exports, __webpack_require__, exports, module),
  35227. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  35228. }
  35229. // Check for `exports` after `define` in case a build optimizer adds it.
  35230. else {}
  35231. }.call(this));
  35232. /* 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)))
  35233. /***/ }),
  35234. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  35235. /*!***************************************************!*\
  35236. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  35237. \***************************************************/
  35238. /*! exports provided: default */
  35239. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  35240. "use strict";
  35241. __webpack_require__.r(__webpack_exports__);
  35242. /* WEBPACK VAR INJECTION */(function(global) {/**!
  35243. * @fileOverview Kickass library to create and place poppers near their reference elements.
  35244. * @version 1.16.1
  35245. * @license
  35246. * Copyright (c) 2016 Federico Zivolo and contributors
  35247. *
  35248. * Permission is hereby granted, free of charge, to any person obtaining a copy
  35249. * of this software and associated documentation files (the "Software"), to deal
  35250. * in the Software without restriction, including without limitation the rights
  35251. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  35252. * copies of the Software, and to permit persons to whom the Software is
  35253. * furnished to do so, subject to the following conditions:
  35254. *
  35255. * The above copyright notice and this permission notice shall be included in all
  35256. * copies or substantial portions of the Software.
  35257. *
  35258. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  35259. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  35260. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  35261. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  35262. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  35263. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  35264. * SOFTWARE.
  35265. */
  35266. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  35267. var timeoutDuration = function () {
  35268. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  35269. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  35270. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  35271. return 1;
  35272. }
  35273. }
  35274. return 0;
  35275. }();
  35276. function microtaskDebounce(fn) {
  35277. var called = false;
  35278. return function () {
  35279. if (called) {
  35280. return;
  35281. }
  35282. called = true;
  35283. window.Promise.resolve().then(function () {
  35284. called = false;
  35285. fn();
  35286. });
  35287. };
  35288. }
  35289. function taskDebounce(fn) {
  35290. var scheduled = false;
  35291. return function () {
  35292. if (!scheduled) {
  35293. scheduled = true;
  35294. setTimeout(function () {
  35295. scheduled = false;
  35296. fn();
  35297. }, timeoutDuration);
  35298. }
  35299. };
  35300. }
  35301. var supportsMicroTasks = isBrowser && window.Promise;
  35302. /**
  35303. * Create a debounced version of a method, that's asynchronously deferred
  35304. * but called in the minimum time possible.
  35305. *
  35306. * @method
  35307. * @memberof Popper.Utils
  35308. * @argument {Function} fn
  35309. * @returns {Function}
  35310. */
  35311. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  35312. /**
  35313. * Check if the given variable is a function
  35314. * @method
  35315. * @memberof Popper.Utils
  35316. * @argument {Any} functionToCheck - variable to check
  35317. * @returns {Boolean} answer to: is a function?
  35318. */
  35319. function isFunction(functionToCheck) {
  35320. var getType = {};
  35321. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  35322. }
  35323. /**
  35324. * Get CSS computed property of the given element
  35325. * @method
  35326. * @memberof Popper.Utils
  35327. * @argument {Eement} element
  35328. * @argument {String} property
  35329. */
  35330. function getStyleComputedProperty(element, property) {
  35331. if (element.nodeType !== 1) {
  35332. return [];
  35333. }
  35334. // NOTE: 1 DOM access here
  35335. var window = element.ownerDocument.defaultView;
  35336. var css = window.getComputedStyle(element, null);
  35337. return property ? css[property] : css;
  35338. }
  35339. /**
  35340. * Returns the parentNode or the host of the element
  35341. * @method
  35342. * @memberof Popper.Utils
  35343. * @argument {Element} element
  35344. * @returns {Element} parent
  35345. */
  35346. function getParentNode(element) {
  35347. if (element.nodeName === 'HTML') {
  35348. return element;
  35349. }
  35350. return element.parentNode || element.host;
  35351. }
  35352. /**
  35353. * Returns the scrolling parent of the given element
  35354. * @method
  35355. * @memberof Popper.Utils
  35356. * @argument {Element} element
  35357. * @returns {Element} scroll parent
  35358. */
  35359. function getScrollParent(element) {
  35360. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  35361. if (!element) {
  35362. return document.body;
  35363. }
  35364. switch (element.nodeName) {
  35365. case 'HTML':
  35366. case 'BODY':
  35367. return element.ownerDocument.body;
  35368. case '#document':
  35369. return element.body;
  35370. }
  35371. // Firefox want us to check `-x` and `-y` variations as well
  35372. var _getStyleComputedProp = getStyleComputedProperty(element),
  35373. overflow = _getStyleComputedProp.overflow,
  35374. overflowX = _getStyleComputedProp.overflowX,
  35375. overflowY = _getStyleComputedProp.overflowY;
  35376. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  35377. return element;
  35378. }
  35379. return getScrollParent(getParentNode(element));
  35380. }
  35381. /**
  35382. * Returns the reference node of the reference object, or the reference object itself.
  35383. * @method
  35384. * @memberof Popper.Utils
  35385. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  35386. * @returns {Element} parent
  35387. */
  35388. function getReferenceNode(reference) {
  35389. return reference && reference.referenceNode ? reference.referenceNode : reference;
  35390. }
  35391. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  35392. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  35393. /**
  35394. * Determines if the browser is Internet Explorer
  35395. * @method
  35396. * @memberof Popper.Utils
  35397. * @param {Number} version to check
  35398. * @returns {Boolean} isIE
  35399. */
  35400. function isIE(version) {
  35401. if (version === 11) {
  35402. return isIE11;
  35403. }
  35404. if (version === 10) {
  35405. return isIE10;
  35406. }
  35407. return isIE11 || isIE10;
  35408. }
  35409. /**
  35410. * Returns the offset parent of the given element
  35411. * @method
  35412. * @memberof Popper.Utils
  35413. * @argument {Element} element
  35414. * @returns {Element} offset parent
  35415. */
  35416. function getOffsetParent(element) {
  35417. if (!element) {
  35418. return document.documentElement;
  35419. }
  35420. var noOffsetParent = isIE(10) ? document.body : null;
  35421. // NOTE: 1 DOM access here
  35422. var offsetParent = element.offsetParent || null;
  35423. // Skip hidden elements which don't have an offsetParent
  35424. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  35425. offsetParent = (element = element.nextElementSibling).offsetParent;
  35426. }
  35427. var nodeName = offsetParent && offsetParent.nodeName;
  35428. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  35429. return element ? element.ownerDocument.documentElement : document.documentElement;
  35430. }
  35431. // .offsetParent will return the closest TH, TD or TABLE in case
  35432. // no offsetParent is present, I hate this job...
  35433. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  35434. return getOffsetParent(offsetParent);
  35435. }
  35436. return offsetParent;
  35437. }
  35438. function isOffsetContainer(element) {
  35439. var nodeName = element.nodeName;
  35440. if (nodeName === 'BODY') {
  35441. return false;
  35442. }
  35443. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  35444. }
  35445. /**
  35446. * Finds the root node (document, shadowDOM root) of the given element
  35447. * @method
  35448. * @memberof Popper.Utils
  35449. * @argument {Element} node
  35450. * @returns {Element} root node
  35451. */
  35452. function getRoot(node) {
  35453. if (node.parentNode !== null) {
  35454. return getRoot(node.parentNode);
  35455. }
  35456. return node;
  35457. }
  35458. /**
  35459. * Finds the offset parent common to the two provided nodes
  35460. * @method
  35461. * @memberof Popper.Utils
  35462. * @argument {Element} element1
  35463. * @argument {Element} element2
  35464. * @returns {Element} common offset parent
  35465. */
  35466. function findCommonOffsetParent(element1, element2) {
  35467. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  35468. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  35469. return document.documentElement;
  35470. }
  35471. // Here we make sure to give as "start" the element that comes first in the DOM
  35472. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  35473. var start = order ? element1 : element2;
  35474. var end = order ? element2 : element1;
  35475. // Get common ancestor container
  35476. var range = document.createRange();
  35477. range.setStart(start, 0);
  35478. range.setEnd(end, 0);
  35479. var commonAncestorContainer = range.commonAncestorContainer;
  35480. // Both nodes are inside #document
  35481. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  35482. if (isOffsetContainer(commonAncestorContainer)) {
  35483. return commonAncestorContainer;
  35484. }
  35485. return getOffsetParent(commonAncestorContainer);
  35486. }
  35487. // one of the nodes is inside shadowDOM, find which one
  35488. var element1root = getRoot(element1);
  35489. if (element1root.host) {
  35490. return findCommonOffsetParent(element1root.host, element2);
  35491. } else {
  35492. return findCommonOffsetParent(element1, getRoot(element2).host);
  35493. }
  35494. }
  35495. /**
  35496. * Gets the scroll value of the given element in the given side (top and left)
  35497. * @method
  35498. * @memberof Popper.Utils
  35499. * @argument {Element} element
  35500. * @argument {String} side `top` or `left`
  35501. * @returns {number} amount of scrolled pixels
  35502. */
  35503. function getScroll(element) {
  35504. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  35505. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  35506. var nodeName = element.nodeName;
  35507. if (nodeName === 'BODY' || nodeName === 'HTML') {
  35508. var html = element.ownerDocument.documentElement;
  35509. var scrollingElement = element.ownerDocument.scrollingElement || html;
  35510. return scrollingElement[upperSide];
  35511. }
  35512. return element[upperSide];
  35513. }
  35514. /*
  35515. * Sum or subtract the element scroll values (left and top) from a given rect object
  35516. * @method
  35517. * @memberof Popper.Utils
  35518. * @param {Object} rect - Rect object you want to change
  35519. * @param {HTMLElement} element - The element from the function reads the scroll values
  35520. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  35521. * @return {Object} rect - The modifier rect object
  35522. */
  35523. function includeScroll(rect, element) {
  35524. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  35525. var scrollTop = getScroll(element, 'top');
  35526. var scrollLeft = getScroll(element, 'left');
  35527. var modifier = subtract ? -1 : 1;
  35528. rect.top += scrollTop * modifier;
  35529. rect.bottom += scrollTop * modifier;
  35530. rect.left += scrollLeft * modifier;
  35531. rect.right += scrollLeft * modifier;
  35532. return rect;
  35533. }
  35534. /*
  35535. * Helper to detect borders of a given element
  35536. * @method
  35537. * @memberof Popper.Utils
  35538. * @param {CSSStyleDeclaration} styles
  35539. * Result of `getStyleComputedProperty` on the given element
  35540. * @param {String} axis - `x` or `y`
  35541. * @return {number} borders - The borders size of the given axis
  35542. */
  35543. function getBordersSize(styles, axis) {
  35544. var sideA = axis === 'x' ? 'Left' : 'Top';
  35545. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  35546. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  35547. }
  35548. function getSize(axis, body, html, computedStyle) {
  35549. 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);
  35550. }
  35551. function getWindowSizes(document) {
  35552. var body = document.body;
  35553. var html = document.documentElement;
  35554. var computedStyle = isIE(10) && getComputedStyle(html);
  35555. return {
  35556. height: getSize('Height', body, html, computedStyle),
  35557. width: getSize('Width', body, html, computedStyle)
  35558. };
  35559. }
  35560. var classCallCheck = function (instance, Constructor) {
  35561. if (!(instance instanceof Constructor)) {
  35562. throw new TypeError("Cannot call a class as a function");
  35563. }
  35564. };
  35565. var createClass = function () {
  35566. function defineProperties(target, props) {
  35567. for (var i = 0; i < props.length; i++) {
  35568. var descriptor = props[i];
  35569. descriptor.enumerable = descriptor.enumerable || false;
  35570. descriptor.configurable = true;
  35571. if ("value" in descriptor) descriptor.writable = true;
  35572. Object.defineProperty(target, descriptor.key, descriptor);
  35573. }
  35574. }
  35575. return function (Constructor, protoProps, staticProps) {
  35576. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  35577. if (staticProps) defineProperties(Constructor, staticProps);
  35578. return Constructor;
  35579. };
  35580. }();
  35581. var defineProperty = function (obj, key, value) {
  35582. if (key in obj) {
  35583. Object.defineProperty(obj, key, {
  35584. value: value,
  35585. enumerable: true,
  35586. configurable: true,
  35587. writable: true
  35588. });
  35589. } else {
  35590. obj[key] = value;
  35591. }
  35592. return obj;
  35593. };
  35594. var _extends = Object.assign || function (target) {
  35595. for (var i = 1; i < arguments.length; i++) {
  35596. var source = arguments[i];
  35597. for (var key in source) {
  35598. if (Object.prototype.hasOwnProperty.call(source, key)) {
  35599. target[key] = source[key];
  35600. }
  35601. }
  35602. }
  35603. return target;
  35604. };
  35605. /**
  35606. * Given element offsets, generate an output similar to getBoundingClientRect
  35607. * @method
  35608. * @memberof Popper.Utils
  35609. * @argument {Object} offsets
  35610. * @returns {Object} ClientRect like output
  35611. */
  35612. function getClientRect(offsets) {
  35613. return _extends({}, offsets, {
  35614. right: offsets.left + offsets.width,
  35615. bottom: offsets.top + offsets.height
  35616. });
  35617. }
  35618. /**
  35619. * Get bounding client rect of given element
  35620. * @method
  35621. * @memberof Popper.Utils
  35622. * @param {HTMLElement} element
  35623. * @return {Object} client rect
  35624. */
  35625. function getBoundingClientRect(element) {
  35626. var rect = {};
  35627. // IE10 10 FIX: Please, don't ask, the element isn't
  35628. // considered in DOM in some circumstances...
  35629. // This isn't reproducible in IE10 compatibility mode of IE11
  35630. try {
  35631. if (isIE(10)) {
  35632. rect = element.getBoundingClientRect();
  35633. var scrollTop = getScroll(element, 'top');
  35634. var scrollLeft = getScroll(element, 'left');
  35635. rect.top += scrollTop;
  35636. rect.left += scrollLeft;
  35637. rect.bottom += scrollTop;
  35638. rect.right += scrollLeft;
  35639. } else {
  35640. rect = element.getBoundingClientRect();
  35641. }
  35642. } catch (e) {}
  35643. var result = {
  35644. left: rect.left,
  35645. top: rect.top,
  35646. width: rect.right - rect.left,
  35647. height: rect.bottom - rect.top
  35648. };
  35649. // subtract scrollbar size from sizes
  35650. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  35651. var width = sizes.width || element.clientWidth || result.width;
  35652. var height = sizes.height || element.clientHeight || result.height;
  35653. var horizScrollbar = element.offsetWidth - width;
  35654. var vertScrollbar = element.offsetHeight - height;
  35655. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  35656. // we make this check conditional for performance reasons
  35657. if (horizScrollbar || vertScrollbar) {
  35658. var styles = getStyleComputedProperty(element);
  35659. horizScrollbar -= getBordersSize(styles, 'x');
  35660. vertScrollbar -= getBordersSize(styles, 'y');
  35661. result.width -= horizScrollbar;
  35662. result.height -= vertScrollbar;
  35663. }
  35664. return getClientRect(result);
  35665. }
  35666. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  35667. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  35668. var isIE10 = isIE(10);
  35669. var isHTML = parent.nodeName === 'HTML';
  35670. var childrenRect = getBoundingClientRect(children);
  35671. var parentRect = getBoundingClientRect(parent);
  35672. var scrollParent = getScrollParent(children);
  35673. var styles = getStyleComputedProperty(parent);
  35674. var borderTopWidth = parseFloat(styles.borderTopWidth);
  35675. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  35676. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  35677. if (fixedPosition && isHTML) {
  35678. parentRect.top = Math.max(parentRect.top, 0);
  35679. parentRect.left = Math.max(parentRect.left, 0);
  35680. }
  35681. var offsets = getClientRect({
  35682. top: childrenRect.top - parentRect.top - borderTopWidth,
  35683. left: childrenRect.left - parentRect.left - borderLeftWidth,
  35684. width: childrenRect.width,
  35685. height: childrenRect.height
  35686. });
  35687. offsets.marginTop = 0;
  35688. offsets.marginLeft = 0;
  35689. // Subtract margins of documentElement in case it's being used as parent
  35690. // we do this only on HTML because it's the only element that behaves
  35691. // differently when margins are applied to it. The margins are included in
  35692. // the box of the documentElement, in the other cases not.
  35693. if (!isIE10 && isHTML) {
  35694. var marginTop = parseFloat(styles.marginTop);
  35695. var marginLeft = parseFloat(styles.marginLeft);
  35696. offsets.top -= borderTopWidth - marginTop;
  35697. offsets.bottom -= borderTopWidth - marginTop;
  35698. offsets.left -= borderLeftWidth - marginLeft;
  35699. offsets.right -= borderLeftWidth - marginLeft;
  35700. // Attach marginTop and marginLeft because in some circumstances we may need them
  35701. offsets.marginTop = marginTop;
  35702. offsets.marginLeft = marginLeft;
  35703. }
  35704. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  35705. offsets = includeScroll(offsets, parent);
  35706. }
  35707. return offsets;
  35708. }
  35709. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  35710. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  35711. var html = element.ownerDocument.documentElement;
  35712. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  35713. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  35714. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  35715. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  35716. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  35717. var offset = {
  35718. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  35719. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  35720. width: width,
  35721. height: height
  35722. };
  35723. return getClientRect(offset);
  35724. }
  35725. /**
  35726. * Check if the given element is fixed or is inside a fixed parent
  35727. * @method
  35728. * @memberof Popper.Utils
  35729. * @argument {Element} element
  35730. * @argument {Element} customContainer
  35731. * @returns {Boolean} answer to "isFixed?"
  35732. */
  35733. function isFixed(element) {
  35734. var nodeName = element.nodeName;
  35735. if (nodeName === 'BODY' || nodeName === 'HTML') {
  35736. return false;
  35737. }
  35738. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  35739. return true;
  35740. }
  35741. var parentNode = getParentNode(element);
  35742. if (!parentNode) {
  35743. return false;
  35744. }
  35745. return isFixed(parentNode);
  35746. }
  35747. /**
  35748. * Finds the first parent of an element that has a transformed property defined
  35749. * @method
  35750. * @memberof Popper.Utils
  35751. * @argument {Element} element
  35752. * @returns {Element} first transformed parent or documentElement
  35753. */
  35754. function getFixedPositionOffsetParent(element) {
  35755. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  35756. if (!element || !element.parentElement || isIE()) {
  35757. return document.documentElement;
  35758. }
  35759. var el = element.parentElement;
  35760. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  35761. el = el.parentElement;
  35762. }
  35763. return el || document.documentElement;
  35764. }
  35765. /**
  35766. * Computed the boundaries limits and return them
  35767. * @method
  35768. * @memberof Popper.Utils
  35769. * @param {HTMLElement} popper
  35770. * @param {HTMLElement} reference
  35771. * @param {number} padding
  35772. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  35773. * @param {Boolean} fixedPosition - Is in fixed position mode
  35774. * @returns {Object} Coordinates of the boundaries
  35775. */
  35776. function getBoundaries(popper, reference, padding, boundariesElement) {
  35777. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  35778. // NOTE: 1 DOM access here
  35779. var boundaries = { top: 0, left: 0 };
  35780. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  35781. // Handle viewport case
  35782. if (boundariesElement === 'viewport') {
  35783. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  35784. } else {
  35785. // Handle other cases based on DOM element used as boundaries
  35786. var boundariesNode = void 0;
  35787. if (boundariesElement === 'scrollParent') {
  35788. boundariesNode = getScrollParent(getParentNode(reference));
  35789. if (boundariesNode.nodeName === 'BODY') {
  35790. boundariesNode = popper.ownerDocument.documentElement;
  35791. }
  35792. } else if (boundariesElement === 'window') {
  35793. boundariesNode = popper.ownerDocument.documentElement;
  35794. } else {
  35795. boundariesNode = boundariesElement;
  35796. }
  35797. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  35798. // In case of HTML, we need a different computation
  35799. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  35800. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  35801. height = _getWindowSizes.height,
  35802. width = _getWindowSizes.width;
  35803. boundaries.top += offsets.top - offsets.marginTop;
  35804. boundaries.bottom = height + offsets.top;
  35805. boundaries.left += offsets.left - offsets.marginLeft;
  35806. boundaries.right = width + offsets.left;
  35807. } else {
  35808. // for all the other DOM elements, this one is good
  35809. boundaries = offsets;
  35810. }
  35811. }
  35812. // Add paddings
  35813. padding = padding || 0;
  35814. var isPaddingNumber = typeof padding === 'number';
  35815. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  35816. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  35817. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  35818. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  35819. return boundaries;
  35820. }
  35821. function getArea(_ref) {
  35822. var width = _ref.width,
  35823. height = _ref.height;
  35824. return width * height;
  35825. }
  35826. /**
  35827. * Utility used to transform the `auto` placement to the placement with more
  35828. * available space.
  35829. * @method
  35830. * @memberof Popper.Utils
  35831. * @argument {Object} data - The data object generated by update method
  35832. * @argument {Object} options - Modifiers configuration and options
  35833. * @returns {Object} The data object, properly modified
  35834. */
  35835. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  35836. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  35837. if (placement.indexOf('auto') === -1) {
  35838. return placement;
  35839. }
  35840. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  35841. var rects = {
  35842. top: {
  35843. width: boundaries.width,
  35844. height: refRect.top - boundaries.top
  35845. },
  35846. right: {
  35847. width: boundaries.right - refRect.right,
  35848. height: boundaries.height
  35849. },
  35850. bottom: {
  35851. width: boundaries.width,
  35852. height: boundaries.bottom - refRect.bottom
  35853. },
  35854. left: {
  35855. width: refRect.left - boundaries.left,
  35856. height: boundaries.height
  35857. }
  35858. };
  35859. var sortedAreas = Object.keys(rects).map(function (key) {
  35860. return _extends({
  35861. key: key
  35862. }, rects[key], {
  35863. area: getArea(rects[key])
  35864. });
  35865. }).sort(function (a, b) {
  35866. return b.area - a.area;
  35867. });
  35868. var filteredAreas = sortedAreas.filter(function (_ref2) {
  35869. var width = _ref2.width,
  35870. height = _ref2.height;
  35871. return width >= popper.clientWidth && height >= popper.clientHeight;
  35872. });
  35873. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  35874. var variation = placement.split('-')[1];
  35875. return computedPlacement + (variation ? '-' + variation : '');
  35876. }
  35877. /**
  35878. * Get offsets to the reference element
  35879. * @method
  35880. * @memberof Popper.Utils
  35881. * @param {Object} state
  35882. * @param {Element} popper - the popper element
  35883. * @param {Element} reference - the reference element (the popper will be relative to this)
  35884. * @param {Element} fixedPosition - is in fixed position mode
  35885. * @returns {Object} An object containing the offsets which will be applied to the popper
  35886. */
  35887. function getReferenceOffsets(state, popper, reference) {
  35888. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  35889. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  35890. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  35891. }
  35892. /**
  35893. * Get the outer sizes of the given element (offset size + margins)
  35894. * @method
  35895. * @memberof Popper.Utils
  35896. * @argument {Element} element
  35897. * @returns {Object} object containing width and height properties
  35898. */
  35899. function getOuterSizes(element) {
  35900. var window = element.ownerDocument.defaultView;
  35901. var styles = window.getComputedStyle(element);
  35902. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  35903. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  35904. var result = {
  35905. width: element.offsetWidth + y,
  35906. height: element.offsetHeight + x
  35907. };
  35908. return result;
  35909. }
  35910. /**
  35911. * Get the opposite placement of the given one
  35912. * @method
  35913. * @memberof Popper.Utils
  35914. * @argument {String} placement
  35915. * @returns {String} flipped placement
  35916. */
  35917. function getOppositePlacement(placement) {
  35918. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  35919. return placement.replace(/left|right|bottom|top/g, function (matched) {
  35920. return hash[matched];
  35921. });
  35922. }
  35923. /**
  35924. * Get offsets to the popper
  35925. * @method
  35926. * @memberof Popper.Utils
  35927. * @param {Object} position - CSS position the Popper will get applied
  35928. * @param {HTMLElement} popper - the popper element
  35929. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  35930. * @param {String} placement - one of the valid placement options
  35931. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  35932. */
  35933. function getPopperOffsets(popper, referenceOffsets, placement) {
  35934. placement = placement.split('-')[0];
  35935. // Get popper node sizes
  35936. var popperRect = getOuterSizes(popper);
  35937. // Add position, width and height to our offsets object
  35938. var popperOffsets = {
  35939. width: popperRect.width,
  35940. height: popperRect.height
  35941. };
  35942. // depending by the popper placement we have to compute its offsets slightly differently
  35943. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  35944. var mainSide = isHoriz ? 'top' : 'left';
  35945. var secondarySide = isHoriz ? 'left' : 'top';
  35946. var measurement = isHoriz ? 'height' : 'width';
  35947. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  35948. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  35949. if (placement === secondarySide) {
  35950. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  35951. } else {
  35952. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  35953. }
  35954. return popperOffsets;
  35955. }
  35956. /**
  35957. * Mimics the `find` method of Array
  35958. * @method
  35959. * @memberof Popper.Utils
  35960. * @argument {Array} arr
  35961. * @argument prop
  35962. * @argument value
  35963. * @returns index or -1
  35964. */
  35965. function find(arr, check) {
  35966. // use native find if supported
  35967. if (Array.prototype.find) {
  35968. return arr.find(check);
  35969. }
  35970. // use `filter` to obtain the same behavior of `find`
  35971. return arr.filter(check)[0];
  35972. }
  35973. /**
  35974. * Return the index of the matching object
  35975. * @method
  35976. * @memberof Popper.Utils
  35977. * @argument {Array} arr
  35978. * @argument prop
  35979. * @argument value
  35980. * @returns index or -1
  35981. */
  35982. function findIndex(arr, prop, value) {
  35983. // use native findIndex if supported
  35984. if (Array.prototype.findIndex) {
  35985. return arr.findIndex(function (cur) {
  35986. return cur[prop] === value;
  35987. });
  35988. }
  35989. // use `find` + `indexOf` if `findIndex` isn't supported
  35990. var match = find(arr, function (obj) {
  35991. return obj[prop] === value;
  35992. });
  35993. return arr.indexOf(match);
  35994. }
  35995. /**
  35996. * Loop trough the list of modifiers and run them in order,
  35997. * each of them will then edit the data object.
  35998. * @method
  35999. * @memberof Popper.Utils
  36000. * @param {dataObject} data
  36001. * @param {Array} modifiers
  36002. * @param {String} ends - Optional modifier name used as stopper
  36003. * @returns {dataObject}
  36004. */
  36005. function runModifiers(modifiers, data, ends) {
  36006. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  36007. modifiersToRun.forEach(function (modifier) {
  36008. if (modifier['function']) {
  36009. // eslint-disable-line dot-notation
  36010. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  36011. }
  36012. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  36013. if (modifier.enabled && isFunction(fn)) {
  36014. // Add properties to offsets to make them a complete clientRect object
  36015. // we do this before each modifier to make sure the previous one doesn't
  36016. // mess with these values
  36017. data.offsets.popper = getClientRect(data.offsets.popper);
  36018. data.offsets.reference = getClientRect(data.offsets.reference);
  36019. data = fn(data, modifier);
  36020. }
  36021. });
  36022. return data;
  36023. }
  36024. /**
  36025. * Updates the position of the popper, computing the new offsets and applying
  36026. * the new style.<br />
  36027. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  36028. * @method
  36029. * @memberof Popper
  36030. */
  36031. function update() {
  36032. // if popper is destroyed, don't perform any further update
  36033. if (this.state.isDestroyed) {
  36034. return;
  36035. }
  36036. var data = {
  36037. instance: this,
  36038. styles: {},
  36039. arrowStyles: {},
  36040. attributes: {},
  36041. flipped: false,
  36042. offsets: {}
  36043. };
  36044. // compute reference element offsets
  36045. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  36046. // compute auto placement, store placement inside the data object,
  36047. // modifiers will be able to edit `placement` if needed
  36048. // and refer to originalPlacement to know the original value
  36049. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  36050. // store the computed placement inside `originalPlacement`
  36051. data.originalPlacement = data.placement;
  36052. data.positionFixed = this.options.positionFixed;
  36053. // compute the popper offsets
  36054. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  36055. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  36056. // run the modifiers
  36057. data = runModifiers(this.modifiers, data);
  36058. // the first `update` will call `onCreate` callback
  36059. // the other ones will call `onUpdate` callback
  36060. if (!this.state.isCreated) {
  36061. this.state.isCreated = true;
  36062. this.options.onCreate(data);
  36063. } else {
  36064. this.options.onUpdate(data);
  36065. }
  36066. }
  36067. /**
  36068. * Helper used to know if the given modifier is enabled.
  36069. * @method
  36070. * @memberof Popper.Utils
  36071. * @returns {Boolean}
  36072. */
  36073. function isModifierEnabled(modifiers, modifierName) {
  36074. return modifiers.some(function (_ref) {
  36075. var name = _ref.name,
  36076. enabled = _ref.enabled;
  36077. return enabled && name === modifierName;
  36078. });
  36079. }
  36080. /**
  36081. * Get the prefixed supported property name
  36082. * @method
  36083. * @memberof Popper.Utils
  36084. * @argument {String} property (camelCase)
  36085. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  36086. */
  36087. function getSupportedPropertyName(property) {
  36088. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  36089. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  36090. for (var i = 0; i < prefixes.length; i++) {
  36091. var prefix = prefixes[i];
  36092. var toCheck = prefix ? '' + prefix + upperProp : property;
  36093. if (typeof document.body.style[toCheck] !== 'undefined') {
  36094. return toCheck;
  36095. }
  36096. }
  36097. return null;
  36098. }
  36099. /**
  36100. * Destroys the popper.
  36101. * @method
  36102. * @memberof Popper
  36103. */
  36104. function destroy() {
  36105. this.state.isDestroyed = true;
  36106. // touch DOM only if `applyStyle` modifier is enabled
  36107. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  36108. this.popper.removeAttribute('x-placement');
  36109. this.popper.style.position = '';
  36110. this.popper.style.top = '';
  36111. this.popper.style.left = '';
  36112. this.popper.style.right = '';
  36113. this.popper.style.bottom = '';
  36114. this.popper.style.willChange = '';
  36115. this.popper.style[getSupportedPropertyName('transform')] = '';
  36116. }
  36117. this.disableEventListeners();
  36118. // remove the popper if user explicitly asked for the deletion on destroy
  36119. // do not use `remove` because IE11 doesn't support it
  36120. if (this.options.removeOnDestroy) {
  36121. this.popper.parentNode.removeChild(this.popper);
  36122. }
  36123. return this;
  36124. }
  36125. /**
  36126. * Get the window associated with the element
  36127. * @argument {Element} element
  36128. * @returns {Window}
  36129. */
  36130. function getWindow(element) {
  36131. var ownerDocument = element.ownerDocument;
  36132. return ownerDocument ? ownerDocument.defaultView : window;
  36133. }
  36134. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  36135. var isBody = scrollParent.nodeName === 'BODY';
  36136. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  36137. target.addEventListener(event, callback, { passive: true });
  36138. if (!isBody) {
  36139. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  36140. }
  36141. scrollParents.push(target);
  36142. }
  36143. /**
  36144. * Setup needed event listeners used to update the popper position
  36145. * @method
  36146. * @memberof Popper.Utils
  36147. * @private
  36148. */
  36149. function setupEventListeners(reference, options, state, updateBound) {
  36150. // Resize event listener on window
  36151. state.updateBound = updateBound;
  36152. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  36153. // Scroll event listener on scroll parents
  36154. var scrollElement = getScrollParent(reference);
  36155. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  36156. state.scrollElement = scrollElement;
  36157. state.eventsEnabled = true;
  36158. return state;
  36159. }
  36160. /**
  36161. * It will add resize/scroll events and start recalculating
  36162. * position of the popper element when they are triggered.
  36163. * @method
  36164. * @memberof Popper
  36165. */
  36166. function enableEventListeners() {
  36167. if (!this.state.eventsEnabled) {
  36168. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  36169. }
  36170. }
  36171. /**
  36172. * Remove event listeners used to update the popper position
  36173. * @method
  36174. * @memberof Popper.Utils
  36175. * @private
  36176. */
  36177. function removeEventListeners(reference, state) {
  36178. // Remove resize event listener on window
  36179. getWindow(reference).removeEventListener('resize', state.updateBound);
  36180. // Remove scroll event listener on scroll parents
  36181. state.scrollParents.forEach(function (target) {
  36182. target.removeEventListener('scroll', state.updateBound);
  36183. });
  36184. // Reset state
  36185. state.updateBound = null;
  36186. state.scrollParents = [];
  36187. state.scrollElement = null;
  36188. state.eventsEnabled = false;
  36189. return state;
  36190. }
  36191. /**
  36192. * It will remove resize/scroll events and won't recalculate popper position
  36193. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  36194. * unless you call `update` method manually.
  36195. * @method
  36196. * @memberof Popper
  36197. */
  36198. function disableEventListeners() {
  36199. if (this.state.eventsEnabled) {
  36200. cancelAnimationFrame(this.scheduleUpdate);
  36201. this.state = removeEventListeners(this.reference, this.state);
  36202. }
  36203. }
  36204. /**
  36205. * Tells if a given input is a number
  36206. * @method
  36207. * @memberof Popper.Utils
  36208. * @param {*} input to check
  36209. * @return {Boolean}
  36210. */
  36211. function isNumeric(n) {
  36212. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  36213. }
  36214. /**
  36215. * Set the style to the given popper
  36216. * @method
  36217. * @memberof Popper.Utils
  36218. * @argument {Element} element - Element to apply the style to
  36219. * @argument {Object} styles
  36220. * Object with a list of properties and values which will be applied to the element
  36221. */
  36222. function setStyles(element, styles) {
  36223. Object.keys(styles).forEach(function (prop) {
  36224. var unit = '';
  36225. // add unit if the value is numeric and is one of the following
  36226. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  36227. unit = 'px';
  36228. }
  36229. element.style[prop] = styles[prop] + unit;
  36230. });
  36231. }
  36232. /**
  36233. * Set the attributes to the given popper
  36234. * @method
  36235. * @memberof Popper.Utils
  36236. * @argument {Element} element - Element to apply the attributes to
  36237. * @argument {Object} styles
  36238. * Object with a list of properties and values which will be applied to the element
  36239. */
  36240. function setAttributes(element, attributes) {
  36241. Object.keys(attributes).forEach(function (prop) {
  36242. var value = attributes[prop];
  36243. if (value !== false) {
  36244. element.setAttribute(prop, attributes[prop]);
  36245. } else {
  36246. element.removeAttribute(prop);
  36247. }
  36248. });
  36249. }
  36250. /**
  36251. * @function
  36252. * @memberof Modifiers
  36253. * @argument {Object} data - The data object generated by `update` method
  36254. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  36255. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  36256. * @argument {Object} options - Modifiers configuration and options
  36257. * @returns {Object} The same data object
  36258. */
  36259. function applyStyle(data) {
  36260. // any property present in `data.styles` will be applied to the popper,
  36261. // in this way we can make the 3rd party modifiers add custom styles to it
  36262. // Be aware, modifiers could override the properties defined in the previous
  36263. // lines of this modifier!
  36264. setStyles(data.instance.popper, data.styles);
  36265. // any property present in `data.attributes` will be applied to the popper,
  36266. // they will be set as HTML attributes of the element
  36267. setAttributes(data.instance.popper, data.attributes);
  36268. // if arrowElement is defined and arrowStyles has some properties
  36269. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  36270. setStyles(data.arrowElement, data.arrowStyles);
  36271. }
  36272. return data;
  36273. }
  36274. /**
  36275. * Set the x-placement attribute before everything else because it could be used
  36276. * to add margins to the popper margins needs to be calculated to get the
  36277. * correct popper offsets.
  36278. * @method
  36279. * @memberof Popper.modifiers
  36280. * @param {HTMLElement} reference - The reference element used to position the popper
  36281. * @param {HTMLElement} popper - The HTML element used as popper
  36282. * @param {Object} options - Popper.js options
  36283. */
  36284. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  36285. // compute reference element offsets
  36286. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  36287. // compute auto placement, store placement inside the data object,
  36288. // modifiers will be able to edit `placement` if needed
  36289. // and refer to originalPlacement to know the original value
  36290. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  36291. popper.setAttribute('x-placement', placement);
  36292. // Apply `position` to popper before anything else because
  36293. // without the position applied we can't guarantee correct computations
  36294. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  36295. return options;
  36296. }
  36297. /**
  36298. * @function
  36299. * @memberof Popper.Utils
  36300. * @argument {Object} data - The data object generated by `update` method
  36301. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  36302. * @returns {Object} The popper's position offsets rounded
  36303. *
  36304. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  36305. * good as it can be within reason.
  36306. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  36307. *
  36308. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  36309. * as well on High DPI screens).
  36310. *
  36311. * Firefox prefers no rounding for positioning and does not have blurriness on
  36312. * high DPI screens.
  36313. *
  36314. * Only horizontal placement and left/right values need to be considered.
  36315. */
  36316. function getRoundedOffsets(data, shouldRound) {
  36317. var _data$offsets = data.offsets,
  36318. popper = _data$offsets.popper,
  36319. reference = _data$offsets.reference;
  36320. var round = Math.round,
  36321. floor = Math.floor;
  36322. var noRound = function noRound(v) {
  36323. return v;
  36324. };
  36325. var referenceWidth = round(reference.width);
  36326. var popperWidth = round(popper.width);
  36327. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  36328. var isVariation = data.placement.indexOf('-') !== -1;
  36329. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  36330. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  36331. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  36332. var verticalToInteger = !shouldRound ? noRound : round;
  36333. return {
  36334. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  36335. top: verticalToInteger(popper.top),
  36336. bottom: verticalToInteger(popper.bottom),
  36337. right: horizontalToInteger(popper.right)
  36338. };
  36339. }
  36340. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  36341. /**
  36342. * @function
  36343. * @memberof Modifiers
  36344. * @argument {Object} data - The data object generated by `update` method
  36345. * @argument {Object} options - Modifiers configuration and options
  36346. * @returns {Object} The data object, properly modified
  36347. */
  36348. function computeStyle(data, options) {
  36349. var x = options.x,
  36350. y = options.y;
  36351. var popper = data.offsets.popper;
  36352. // Remove this legacy support in Popper.js v2
  36353. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  36354. return modifier.name === 'applyStyle';
  36355. }).gpuAcceleration;
  36356. if (legacyGpuAccelerationOption !== undefined) {
  36357. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  36358. }
  36359. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  36360. var offsetParent = getOffsetParent(data.instance.popper);
  36361. var offsetParentRect = getBoundingClientRect(offsetParent);
  36362. // Styles
  36363. var styles = {
  36364. position: popper.position
  36365. };
  36366. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  36367. var sideA = x === 'bottom' ? 'top' : 'bottom';
  36368. var sideB = y === 'right' ? 'left' : 'right';
  36369. // if gpuAcceleration is set to `true` and transform is supported,
  36370. // we use `translate3d` to apply the position to the popper we
  36371. // automatically use the supported prefixed version if needed
  36372. var prefixedProperty = getSupportedPropertyName('transform');
  36373. // now, let's make a step back and look at this code closely (wtf?)
  36374. // If the content of the popper grows once it's been positioned, it
  36375. // may happen that the popper gets misplaced because of the new content
  36376. // overflowing its reference element
  36377. // To avoid this problem, we provide two options (x and y), which allow
  36378. // the consumer to define the offset origin.
  36379. // If we position a popper on top of a reference element, we can set
  36380. // `x` to `top` to make the popper grow towards its top instead of
  36381. // its bottom.
  36382. var left = void 0,
  36383. top = void 0;
  36384. if (sideA === 'bottom') {
  36385. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  36386. // and not the bottom of the html element
  36387. if (offsetParent.nodeName === 'HTML') {
  36388. top = -offsetParent.clientHeight + offsets.bottom;
  36389. } else {
  36390. top = -offsetParentRect.height + offsets.bottom;
  36391. }
  36392. } else {
  36393. top = offsets.top;
  36394. }
  36395. if (sideB === 'right') {
  36396. if (offsetParent.nodeName === 'HTML') {
  36397. left = -offsetParent.clientWidth + offsets.right;
  36398. } else {
  36399. left = -offsetParentRect.width + offsets.right;
  36400. }
  36401. } else {
  36402. left = offsets.left;
  36403. }
  36404. if (gpuAcceleration && prefixedProperty) {
  36405. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  36406. styles[sideA] = 0;
  36407. styles[sideB] = 0;
  36408. styles.willChange = 'transform';
  36409. } else {
  36410. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  36411. var invertTop = sideA === 'bottom' ? -1 : 1;
  36412. var invertLeft = sideB === 'right' ? -1 : 1;
  36413. styles[sideA] = top * invertTop;
  36414. styles[sideB] = left * invertLeft;
  36415. styles.willChange = sideA + ', ' + sideB;
  36416. }
  36417. // Attributes
  36418. var attributes = {
  36419. 'x-placement': data.placement
  36420. };
  36421. // Update `data` attributes, styles and arrowStyles
  36422. data.attributes = _extends({}, attributes, data.attributes);
  36423. data.styles = _extends({}, styles, data.styles);
  36424. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  36425. return data;
  36426. }
  36427. /**
  36428. * Helper used to know if the given modifier depends from another one.<br />
  36429. * It checks if the needed modifier is listed and enabled.
  36430. * @method
  36431. * @memberof Popper.Utils
  36432. * @param {Array} modifiers - list of modifiers
  36433. * @param {String} requestingName - name of requesting modifier
  36434. * @param {String} requestedName - name of requested modifier
  36435. * @returns {Boolean}
  36436. */
  36437. function isModifierRequired(modifiers, requestingName, requestedName) {
  36438. var requesting = find(modifiers, function (_ref) {
  36439. var name = _ref.name;
  36440. return name === requestingName;
  36441. });
  36442. var isRequired = !!requesting && modifiers.some(function (modifier) {
  36443. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  36444. });
  36445. if (!isRequired) {
  36446. var _requesting = '`' + requestingName + '`';
  36447. var requested = '`' + requestedName + '`';
  36448. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  36449. }
  36450. return isRequired;
  36451. }
  36452. /**
  36453. * @function
  36454. * @memberof Modifiers
  36455. * @argument {Object} data - The data object generated by update method
  36456. * @argument {Object} options - Modifiers configuration and options
  36457. * @returns {Object} The data object, properly modified
  36458. */
  36459. function arrow(data, options) {
  36460. var _data$offsets$arrow;
  36461. // arrow depends on keepTogether in order to work
  36462. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  36463. return data;
  36464. }
  36465. var arrowElement = options.element;
  36466. // if arrowElement is a string, suppose it's a CSS selector
  36467. if (typeof arrowElement === 'string') {
  36468. arrowElement = data.instance.popper.querySelector(arrowElement);
  36469. // if arrowElement is not found, don't run the modifier
  36470. if (!arrowElement) {
  36471. return data;
  36472. }
  36473. } else {
  36474. // if the arrowElement isn't a query selector we must check that the
  36475. // provided DOM node is child of its popper node
  36476. if (!data.instance.popper.contains(arrowElement)) {
  36477. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  36478. return data;
  36479. }
  36480. }
  36481. var placement = data.placement.split('-')[0];
  36482. var _data$offsets = data.offsets,
  36483. popper = _data$offsets.popper,
  36484. reference = _data$offsets.reference;
  36485. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  36486. var len = isVertical ? 'height' : 'width';
  36487. var sideCapitalized = isVertical ? 'Top' : 'Left';
  36488. var side = sideCapitalized.toLowerCase();
  36489. var altSide = isVertical ? 'left' : 'top';
  36490. var opSide = isVertical ? 'bottom' : 'right';
  36491. var arrowElementSize = getOuterSizes(arrowElement)[len];
  36492. //
  36493. // extends keepTogether behavior making sure the popper and its
  36494. // reference have enough pixels in conjunction
  36495. //
  36496. // top/left side
  36497. if (reference[opSide] - arrowElementSize < popper[side]) {
  36498. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  36499. }
  36500. // bottom/right side
  36501. if (reference[side] + arrowElementSize > popper[opSide]) {
  36502. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  36503. }
  36504. data.offsets.popper = getClientRect(data.offsets.popper);
  36505. // compute center of the popper
  36506. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  36507. // Compute the sideValue using the updated popper offsets
  36508. // take popper margin in account because we don't have this info available
  36509. var css = getStyleComputedProperty(data.instance.popper);
  36510. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  36511. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  36512. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  36513. // prevent arrowElement from being placed not contiguously to its popper
  36514. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  36515. data.arrowElement = arrowElement;
  36516. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  36517. return data;
  36518. }
  36519. /**
  36520. * Get the opposite placement variation of the given one
  36521. * @method
  36522. * @memberof Popper.Utils
  36523. * @argument {String} placement variation
  36524. * @returns {String} flipped placement variation
  36525. */
  36526. function getOppositeVariation(variation) {
  36527. if (variation === 'end') {
  36528. return 'start';
  36529. } else if (variation === 'start') {
  36530. return 'end';
  36531. }
  36532. return variation;
  36533. }
  36534. /**
  36535. * List of accepted placements to use as values of the `placement` option.<br />
  36536. * Valid placements are:
  36537. * - `auto`
  36538. * - `top`
  36539. * - `right`
  36540. * - `bottom`
  36541. * - `left`
  36542. *
  36543. * Each placement can have a variation from this list:
  36544. * - `-start`
  36545. * - `-end`
  36546. *
  36547. * Variations are interpreted easily if you think of them as the left to right
  36548. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  36549. * is right.<br />
  36550. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  36551. *
  36552. * Some valid examples are:
  36553. * - `top-end` (on top of reference, right aligned)
  36554. * - `right-start` (on right of reference, top aligned)
  36555. * - `bottom` (on bottom, centered)
  36556. * - `auto-end` (on the side with more space available, alignment depends by placement)
  36557. *
  36558. * @static
  36559. * @type {Array}
  36560. * @enum {String}
  36561. * @readonly
  36562. * @method placements
  36563. * @memberof Popper
  36564. */
  36565. 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'];
  36566. // Get rid of `auto` `auto-start` and `auto-end`
  36567. var validPlacements = placements.slice(3);
  36568. /**
  36569. * Given an initial placement, returns all the subsequent placements
  36570. * clockwise (or counter-clockwise).
  36571. *
  36572. * @method
  36573. * @memberof Popper.Utils
  36574. * @argument {String} placement - A valid placement (it accepts variations)
  36575. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  36576. * @returns {Array} placements including their variations
  36577. */
  36578. function clockwise(placement) {
  36579. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  36580. var index = validPlacements.indexOf(placement);
  36581. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  36582. return counter ? arr.reverse() : arr;
  36583. }
  36584. var BEHAVIORS = {
  36585. FLIP: 'flip',
  36586. CLOCKWISE: 'clockwise',
  36587. COUNTERCLOCKWISE: 'counterclockwise'
  36588. };
  36589. /**
  36590. * @function
  36591. * @memberof Modifiers
  36592. * @argument {Object} data - The data object generated by update method
  36593. * @argument {Object} options - Modifiers configuration and options
  36594. * @returns {Object} The data object, properly modified
  36595. */
  36596. function flip(data, options) {
  36597. // if `inner` modifier is enabled, we can't use the `flip` modifier
  36598. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  36599. return data;
  36600. }
  36601. if (data.flipped && data.placement === data.originalPlacement) {
  36602. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  36603. return data;
  36604. }
  36605. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  36606. var placement = data.placement.split('-')[0];
  36607. var placementOpposite = getOppositePlacement(placement);
  36608. var variation = data.placement.split('-')[1] || '';
  36609. var flipOrder = [];
  36610. switch (options.behavior) {
  36611. case BEHAVIORS.FLIP:
  36612. flipOrder = [placement, placementOpposite];
  36613. break;
  36614. case BEHAVIORS.CLOCKWISE:
  36615. flipOrder = clockwise(placement);
  36616. break;
  36617. case BEHAVIORS.COUNTERCLOCKWISE:
  36618. flipOrder = clockwise(placement, true);
  36619. break;
  36620. default:
  36621. flipOrder = options.behavior;
  36622. }
  36623. flipOrder.forEach(function (step, index) {
  36624. if (placement !== step || flipOrder.length === index + 1) {
  36625. return data;
  36626. }
  36627. placement = data.placement.split('-')[0];
  36628. placementOpposite = getOppositePlacement(placement);
  36629. var popperOffsets = data.offsets.popper;
  36630. var refOffsets = data.offsets.reference;
  36631. // using floor because the reference offsets may contain decimals we are not going to consider here
  36632. var floor = Math.floor;
  36633. 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);
  36634. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  36635. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  36636. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  36637. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  36638. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  36639. // flip the variation if required
  36640. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  36641. // flips variation if reference element overflows boundaries
  36642. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  36643. // flips variation if popper content overflows boundaries
  36644. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  36645. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  36646. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  36647. // this boolean to detect any flip loop
  36648. data.flipped = true;
  36649. if (overlapsRef || overflowsBoundaries) {
  36650. placement = flipOrder[index + 1];
  36651. }
  36652. if (flippedVariation) {
  36653. variation = getOppositeVariation(variation);
  36654. }
  36655. data.placement = placement + (variation ? '-' + variation : '');
  36656. // this object contains `position`, we want to preserve it along with
  36657. // any additional property we may add in the future
  36658. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  36659. data = runModifiers(data.instance.modifiers, data, 'flip');
  36660. }
  36661. });
  36662. return data;
  36663. }
  36664. /**
  36665. * @function
  36666. * @memberof Modifiers
  36667. * @argument {Object} data - The data object generated by update method
  36668. * @argument {Object} options - Modifiers configuration and options
  36669. * @returns {Object} The data object, properly modified
  36670. */
  36671. function keepTogether(data) {
  36672. var _data$offsets = data.offsets,
  36673. popper = _data$offsets.popper,
  36674. reference = _data$offsets.reference;
  36675. var placement = data.placement.split('-')[0];
  36676. var floor = Math.floor;
  36677. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  36678. var side = isVertical ? 'right' : 'bottom';
  36679. var opSide = isVertical ? 'left' : 'top';
  36680. var measurement = isVertical ? 'width' : 'height';
  36681. if (popper[side] < floor(reference[opSide])) {
  36682. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  36683. }
  36684. if (popper[opSide] > floor(reference[side])) {
  36685. data.offsets.popper[opSide] = floor(reference[side]);
  36686. }
  36687. return data;
  36688. }
  36689. /**
  36690. * Converts a string containing value + unit into a px value number
  36691. * @function
  36692. * @memberof {modifiers~offset}
  36693. * @private
  36694. * @argument {String} str - Value + unit string
  36695. * @argument {String} measurement - `height` or `width`
  36696. * @argument {Object} popperOffsets
  36697. * @argument {Object} referenceOffsets
  36698. * @returns {Number|String}
  36699. * Value in pixels, or original string if no values were extracted
  36700. */
  36701. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  36702. // separate value from unit
  36703. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  36704. var value = +split[1];
  36705. var unit = split[2];
  36706. // If it's not a number it's an operator, I guess
  36707. if (!value) {
  36708. return str;
  36709. }
  36710. if (unit.indexOf('%') === 0) {
  36711. var element = void 0;
  36712. switch (unit) {
  36713. case '%p':
  36714. element = popperOffsets;
  36715. break;
  36716. case '%':
  36717. case '%r':
  36718. default:
  36719. element = referenceOffsets;
  36720. }
  36721. var rect = getClientRect(element);
  36722. return rect[measurement] / 100 * value;
  36723. } else if (unit === 'vh' || unit === 'vw') {
  36724. // if is a vh or vw, we calculate the size based on the viewport
  36725. var size = void 0;
  36726. if (unit === 'vh') {
  36727. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  36728. } else {
  36729. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  36730. }
  36731. return size / 100 * value;
  36732. } else {
  36733. // if is an explicit pixel unit, we get rid of the unit and keep the value
  36734. // if is an implicit unit, it's px, and we return just the value
  36735. return value;
  36736. }
  36737. }
  36738. /**
  36739. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  36740. * @function
  36741. * @memberof {modifiers~offset}
  36742. * @private
  36743. * @argument {String} offset
  36744. * @argument {Object} popperOffsets
  36745. * @argument {Object} referenceOffsets
  36746. * @argument {String} basePlacement
  36747. * @returns {Array} a two cells array with x and y offsets in numbers
  36748. */
  36749. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  36750. var offsets = [0, 0];
  36751. // Use height if placement is left or right and index is 0 otherwise use width
  36752. // in this way the first offset will use an axis and the second one
  36753. // will use the other one
  36754. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  36755. // Split the offset string to obtain a list of values and operands
  36756. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  36757. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  36758. return frag.trim();
  36759. });
  36760. // Detect if the offset string contains a pair of values or a single one
  36761. // they could be separated by comma or space
  36762. var divider = fragments.indexOf(find(fragments, function (frag) {
  36763. return frag.search(/,|\s/) !== -1;
  36764. }));
  36765. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  36766. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  36767. }
  36768. // If divider is found, we divide the list of values and operands to divide
  36769. // them by ofset X and Y.
  36770. var splitRegex = /\s*,\s*|\s+/;
  36771. 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];
  36772. // Convert the values with units to absolute pixels to allow our computations
  36773. ops = ops.map(function (op, index) {
  36774. // Most of the units rely on the orientation of the popper
  36775. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  36776. var mergeWithPrevious = false;
  36777. return op
  36778. // This aggregates any `+` or `-` sign that aren't considered operators
  36779. // e.g.: 10 + +5 => [10, +, +5]
  36780. .reduce(function (a, b) {
  36781. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  36782. a[a.length - 1] = b;
  36783. mergeWithPrevious = true;
  36784. return a;
  36785. } else if (mergeWithPrevious) {
  36786. a[a.length - 1] += b;
  36787. mergeWithPrevious = false;
  36788. return a;
  36789. } else {
  36790. return a.concat(b);
  36791. }
  36792. }, [])
  36793. // Here we convert the string values into number values (in px)
  36794. .map(function (str) {
  36795. return toValue(str, measurement, popperOffsets, referenceOffsets);
  36796. });
  36797. });
  36798. // Loop trough the offsets arrays and execute the operations
  36799. ops.forEach(function (op, index) {
  36800. op.forEach(function (frag, index2) {
  36801. if (isNumeric(frag)) {
  36802. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  36803. }
  36804. });
  36805. });
  36806. return offsets;
  36807. }
  36808. /**
  36809. * @function
  36810. * @memberof Modifiers
  36811. * @argument {Object} data - The data object generated by update method
  36812. * @argument {Object} options - Modifiers configuration and options
  36813. * @argument {Number|String} options.offset=0
  36814. * The offset value as described in the modifier description
  36815. * @returns {Object} The data object, properly modified
  36816. */
  36817. function offset(data, _ref) {
  36818. var offset = _ref.offset;
  36819. var placement = data.placement,
  36820. _data$offsets = data.offsets,
  36821. popper = _data$offsets.popper,
  36822. reference = _data$offsets.reference;
  36823. var basePlacement = placement.split('-')[0];
  36824. var offsets = void 0;
  36825. if (isNumeric(+offset)) {
  36826. offsets = [+offset, 0];
  36827. } else {
  36828. offsets = parseOffset(offset, popper, reference, basePlacement);
  36829. }
  36830. if (basePlacement === 'left') {
  36831. popper.top += offsets[0];
  36832. popper.left -= offsets[1];
  36833. } else if (basePlacement === 'right') {
  36834. popper.top += offsets[0];
  36835. popper.left += offsets[1];
  36836. } else if (basePlacement === 'top') {
  36837. popper.left += offsets[0];
  36838. popper.top -= offsets[1];
  36839. } else if (basePlacement === 'bottom') {
  36840. popper.left += offsets[0];
  36841. popper.top += offsets[1];
  36842. }
  36843. data.popper = popper;
  36844. return data;
  36845. }
  36846. /**
  36847. * @function
  36848. * @memberof Modifiers
  36849. * @argument {Object} data - The data object generated by `update` method
  36850. * @argument {Object} options - Modifiers configuration and options
  36851. * @returns {Object} The data object, properly modified
  36852. */
  36853. function preventOverflow(data, options) {
  36854. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  36855. // If offsetParent is the reference element, we really want to
  36856. // go one step up and use the next offsetParent as reference to
  36857. // avoid to make this modifier completely useless and look like broken
  36858. if (data.instance.reference === boundariesElement) {
  36859. boundariesElement = getOffsetParent(boundariesElement);
  36860. }
  36861. // NOTE: DOM access here
  36862. // resets the popper's position so that the document size can be calculated excluding
  36863. // the size of the popper element itself
  36864. var transformProp = getSupportedPropertyName('transform');
  36865. var popperStyles = data.instance.popper.style; // assignment to help minification
  36866. var top = popperStyles.top,
  36867. left = popperStyles.left,
  36868. transform = popperStyles[transformProp];
  36869. popperStyles.top = '';
  36870. popperStyles.left = '';
  36871. popperStyles[transformProp] = '';
  36872. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  36873. // NOTE: DOM access here
  36874. // restores the original style properties after the offsets have been computed
  36875. popperStyles.top = top;
  36876. popperStyles.left = left;
  36877. popperStyles[transformProp] = transform;
  36878. options.boundaries = boundaries;
  36879. var order = options.priority;
  36880. var popper = data.offsets.popper;
  36881. var check = {
  36882. primary: function primary(placement) {
  36883. var value = popper[placement];
  36884. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  36885. value = Math.max(popper[placement], boundaries[placement]);
  36886. }
  36887. return defineProperty({}, placement, value);
  36888. },
  36889. secondary: function secondary(placement) {
  36890. var mainSide = placement === 'right' ? 'left' : 'top';
  36891. var value = popper[mainSide];
  36892. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  36893. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  36894. }
  36895. return defineProperty({}, mainSide, value);
  36896. }
  36897. };
  36898. order.forEach(function (placement) {
  36899. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  36900. popper = _extends({}, popper, check[side](placement));
  36901. });
  36902. data.offsets.popper = popper;
  36903. return data;
  36904. }
  36905. /**
  36906. * @function
  36907. * @memberof Modifiers
  36908. * @argument {Object} data - The data object generated by `update` method
  36909. * @argument {Object} options - Modifiers configuration and options
  36910. * @returns {Object} The data object, properly modified
  36911. */
  36912. function shift(data) {
  36913. var placement = data.placement;
  36914. var basePlacement = placement.split('-')[0];
  36915. var shiftvariation = placement.split('-')[1];
  36916. // if shift shiftvariation is specified, run the modifier
  36917. if (shiftvariation) {
  36918. var _data$offsets = data.offsets,
  36919. reference = _data$offsets.reference,
  36920. popper = _data$offsets.popper;
  36921. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  36922. var side = isVertical ? 'left' : 'top';
  36923. var measurement = isVertical ? 'width' : 'height';
  36924. var shiftOffsets = {
  36925. start: defineProperty({}, side, reference[side]),
  36926. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  36927. };
  36928. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  36929. }
  36930. return data;
  36931. }
  36932. /**
  36933. * @function
  36934. * @memberof Modifiers
  36935. * @argument {Object} data - The data object generated by update method
  36936. * @argument {Object} options - Modifiers configuration and options
  36937. * @returns {Object} The data object, properly modified
  36938. */
  36939. function hide(data) {
  36940. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  36941. return data;
  36942. }
  36943. var refRect = data.offsets.reference;
  36944. var bound = find(data.instance.modifiers, function (modifier) {
  36945. return modifier.name === 'preventOverflow';
  36946. }).boundaries;
  36947. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  36948. // Avoid unnecessary DOM access if visibility hasn't changed
  36949. if (data.hide === true) {
  36950. return data;
  36951. }
  36952. data.hide = true;
  36953. data.attributes['x-out-of-boundaries'] = '';
  36954. } else {
  36955. // Avoid unnecessary DOM access if visibility hasn't changed
  36956. if (data.hide === false) {
  36957. return data;
  36958. }
  36959. data.hide = false;
  36960. data.attributes['x-out-of-boundaries'] = false;
  36961. }
  36962. return data;
  36963. }
  36964. /**
  36965. * @function
  36966. * @memberof Modifiers
  36967. * @argument {Object} data - The data object generated by `update` method
  36968. * @argument {Object} options - Modifiers configuration and options
  36969. * @returns {Object} The data object, properly modified
  36970. */
  36971. function inner(data) {
  36972. var placement = data.placement;
  36973. var basePlacement = placement.split('-')[0];
  36974. var _data$offsets = data.offsets,
  36975. popper = _data$offsets.popper,
  36976. reference = _data$offsets.reference;
  36977. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  36978. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  36979. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  36980. data.placement = getOppositePlacement(placement);
  36981. data.offsets.popper = getClientRect(popper);
  36982. return data;
  36983. }
  36984. /**
  36985. * Modifier function, each modifier can have a function of this type assigned
  36986. * to its `fn` property.<br />
  36987. * These functions will be called on each update, this means that you must
  36988. * make sure they are performant enough to avoid performance bottlenecks.
  36989. *
  36990. * @function ModifierFn
  36991. * @argument {dataObject} data - The data object generated by `update` method
  36992. * @argument {Object} options - Modifiers configuration and options
  36993. * @returns {dataObject} The data object, properly modified
  36994. */
  36995. /**
  36996. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  36997. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  36998. * needed by the library.
  36999. *
  37000. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  37001. * All the other properties are configurations that could be tweaked.
  37002. * @namespace modifiers
  37003. */
  37004. var modifiers = {
  37005. /**
  37006. * Modifier used to shift the popper on the start or end of its reference
  37007. * element.<br />
  37008. * It will read the variation of the `placement` property.<br />
  37009. * It can be one either `-end` or `-start`.
  37010. * @memberof modifiers
  37011. * @inner
  37012. */
  37013. shift: {
  37014. /** @prop {number} order=100 - Index used to define the order of execution */
  37015. order: 100,
  37016. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37017. enabled: true,
  37018. /** @prop {ModifierFn} */
  37019. fn: shift
  37020. },
  37021. /**
  37022. * The `offset` modifier can shift your popper on both its axis.
  37023. *
  37024. * It accepts the following units:
  37025. * - `px` or unit-less, interpreted as pixels
  37026. * - `%` or `%r`, percentage relative to the length of the reference element
  37027. * - `%p`, percentage relative to the length of the popper element
  37028. * - `vw`, CSS viewport width unit
  37029. * - `vh`, CSS viewport height unit
  37030. *
  37031. * For length is intended the main axis relative to the placement of the popper.<br />
  37032. * This means that if the placement is `top` or `bottom`, the length will be the
  37033. * `width`. In case of `left` or `right`, it will be the `height`.
  37034. *
  37035. * You can provide a single value (as `Number` or `String`), or a pair of values
  37036. * as `String` divided by a comma or one (or more) white spaces.<br />
  37037. * The latter is a deprecated method because it leads to confusion and will be
  37038. * removed in v2.<br />
  37039. * Additionally, it accepts additions and subtractions between different units.
  37040. * Note that multiplications and divisions aren't supported.
  37041. *
  37042. * Valid examples are:
  37043. * ```
  37044. * 10
  37045. * '10%'
  37046. * '10, 10'
  37047. * '10%, 10'
  37048. * '10 + 10%'
  37049. * '10 - 5vh + 3%'
  37050. * '-10px + 5vh, 5px - 6%'
  37051. * ```
  37052. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  37053. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  37054. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  37055. *
  37056. * @memberof modifiers
  37057. * @inner
  37058. */
  37059. offset: {
  37060. /** @prop {number} order=200 - Index used to define the order of execution */
  37061. order: 200,
  37062. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37063. enabled: true,
  37064. /** @prop {ModifierFn} */
  37065. fn: offset,
  37066. /** @prop {Number|String} offset=0
  37067. * The offset value as described in the modifier description
  37068. */
  37069. offset: 0
  37070. },
  37071. /**
  37072. * Modifier used to prevent the popper from being positioned outside the boundary.
  37073. *
  37074. * A scenario exists where the reference itself is not within the boundaries.<br />
  37075. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  37076. * In this case we need to decide whether the popper should either:
  37077. *
  37078. * - detach from the reference and remain "trapped" in the boundaries, or
  37079. * - if it should ignore the boundary and "escape with its reference"
  37080. *
  37081. * When `escapeWithReference` is set to`true` and reference is completely
  37082. * outside its boundaries, the popper will overflow (or completely leave)
  37083. * the boundaries in order to remain attached to the edge of the reference.
  37084. *
  37085. * @memberof modifiers
  37086. * @inner
  37087. */
  37088. preventOverflow: {
  37089. /** @prop {number} order=300 - Index used to define the order of execution */
  37090. order: 300,
  37091. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37092. enabled: true,
  37093. /** @prop {ModifierFn} */
  37094. fn: preventOverflow,
  37095. /**
  37096. * @prop {Array} [priority=['left','right','top','bottom']]
  37097. * Popper will try to prevent overflow following these priorities by default,
  37098. * then, it could overflow on the left and on top of the `boundariesElement`
  37099. */
  37100. priority: ['left', 'right', 'top', 'bottom'],
  37101. /**
  37102. * @prop {number} padding=5
  37103. * Amount of pixel used to define a minimum distance between the boundaries
  37104. * and the popper. This makes sure the popper always has a little padding
  37105. * between the edges of its container
  37106. */
  37107. padding: 5,
  37108. /**
  37109. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  37110. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  37111. * `viewport` or any DOM element.
  37112. */
  37113. boundariesElement: 'scrollParent'
  37114. },
  37115. /**
  37116. * Modifier used to make sure the reference and its popper stay near each other
  37117. * without leaving any gap between the two. Especially useful when the arrow is
  37118. * enabled and you want to ensure that it points to its reference element.
  37119. * It cares only about the first axis. You can still have poppers with margin
  37120. * between the popper and its reference element.
  37121. * @memberof modifiers
  37122. * @inner
  37123. */
  37124. keepTogether: {
  37125. /** @prop {number} order=400 - Index used to define the order of execution */
  37126. order: 400,
  37127. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37128. enabled: true,
  37129. /** @prop {ModifierFn} */
  37130. fn: keepTogether
  37131. },
  37132. /**
  37133. * This modifier is used to move the `arrowElement` of the popper to make
  37134. * sure it is positioned between the reference element and its popper element.
  37135. * It will read the outer size of the `arrowElement` node to detect how many
  37136. * pixels of conjunction are needed.
  37137. *
  37138. * It has no effect if no `arrowElement` is provided.
  37139. * @memberof modifiers
  37140. * @inner
  37141. */
  37142. arrow: {
  37143. /** @prop {number} order=500 - Index used to define the order of execution */
  37144. order: 500,
  37145. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37146. enabled: true,
  37147. /** @prop {ModifierFn} */
  37148. fn: arrow,
  37149. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  37150. element: '[x-arrow]'
  37151. },
  37152. /**
  37153. * Modifier used to flip the popper's placement when it starts to overlap its
  37154. * reference element.
  37155. *
  37156. * Requires the `preventOverflow` modifier before it in order to work.
  37157. *
  37158. * **NOTE:** this modifier will interrupt the current update cycle and will
  37159. * restart it if it detects the need to flip the placement.
  37160. * @memberof modifiers
  37161. * @inner
  37162. */
  37163. flip: {
  37164. /** @prop {number} order=600 - Index used to define the order of execution */
  37165. order: 600,
  37166. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37167. enabled: true,
  37168. /** @prop {ModifierFn} */
  37169. fn: flip,
  37170. /**
  37171. * @prop {String|Array} behavior='flip'
  37172. * The behavior used to change the popper's placement. It can be one of
  37173. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  37174. * placements (with optional variations)
  37175. */
  37176. behavior: 'flip',
  37177. /**
  37178. * @prop {number} padding=5
  37179. * The popper will flip if it hits the edges of the `boundariesElement`
  37180. */
  37181. padding: 5,
  37182. /**
  37183. * @prop {String|HTMLElement} boundariesElement='viewport'
  37184. * The element which will define the boundaries of the popper position.
  37185. * The popper will never be placed outside of the defined boundaries
  37186. * (except if `keepTogether` is enabled)
  37187. */
  37188. boundariesElement: 'viewport',
  37189. /**
  37190. * @prop {Boolean} flipVariations=false
  37191. * The popper will switch placement variation between `-start` and `-end` when
  37192. * the reference element overlaps its boundaries.
  37193. *
  37194. * The original placement should have a set variation.
  37195. */
  37196. flipVariations: false,
  37197. /**
  37198. * @prop {Boolean} flipVariationsByContent=false
  37199. * The popper will switch placement variation between `-start` and `-end` when
  37200. * the popper element overlaps its reference boundaries.
  37201. *
  37202. * The original placement should have a set variation.
  37203. */
  37204. flipVariationsByContent: false
  37205. },
  37206. /**
  37207. * Modifier used to make the popper flow toward the inner of the reference element.
  37208. * By default, when this modifier is disabled, the popper will be placed outside
  37209. * the reference element.
  37210. * @memberof modifiers
  37211. * @inner
  37212. */
  37213. inner: {
  37214. /** @prop {number} order=700 - Index used to define the order of execution */
  37215. order: 700,
  37216. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  37217. enabled: false,
  37218. /** @prop {ModifierFn} */
  37219. fn: inner
  37220. },
  37221. /**
  37222. * Modifier used to hide the popper when its reference element is outside of the
  37223. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  37224. * be used to hide with a CSS selector the popper when its reference is
  37225. * out of boundaries.
  37226. *
  37227. * Requires the `preventOverflow` modifier before it in order to work.
  37228. * @memberof modifiers
  37229. * @inner
  37230. */
  37231. hide: {
  37232. /** @prop {number} order=800 - Index used to define the order of execution */
  37233. order: 800,
  37234. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37235. enabled: true,
  37236. /** @prop {ModifierFn} */
  37237. fn: hide
  37238. },
  37239. /**
  37240. * Computes the style that will be applied to the popper element to gets
  37241. * properly positioned.
  37242. *
  37243. * Note that this modifier will not touch the DOM, it just prepares the styles
  37244. * so that `applyStyle` modifier can apply it. This separation is useful
  37245. * in case you need to replace `applyStyle` with a custom implementation.
  37246. *
  37247. * This modifier has `850` as `order` value to maintain backward compatibility
  37248. * with previous versions of Popper.js. Expect the modifiers ordering method
  37249. * to change in future major versions of the library.
  37250. *
  37251. * @memberof modifiers
  37252. * @inner
  37253. */
  37254. computeStyle: {
  37255. /** @prop {number} order=850 - Index used to define the order of execution */
  37256. order: 850,
  37257. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37258. enabled: true,
  37259. /** @prop {ModifierFn} */
  37260. fn: computeStyle,
  37261. /**
  37262. * @prop {Boolean} gpuAcceleration=true
  37263. * If true, it uses the CSS 3D transformation to position the popper.
  37264. * Otherwise, it will use the `top` and `left` properties
  37265. */
  37266. gpuAcceleration: true,
  37267. /**
  37268. * @prop {string} [x='bottom']
  37269. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  37270. * Change this if your popper should grow in a direction different from `bottom`
  37271. */
  37272. x: 'bottom',
  37273. /**
  37274. * @prop {string} [x='left']
  37275. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  37276. * Change this if your popper should grow in a direction different from `right`
  37277. */
  37278. y: 'right'
  37279. },
  37280. /**
  37281. * Applies the computed styles to the popper element.
  37282. *
  37283. * All the DOM manipulations are limited to this modifier. This is useful in case
  37284. * you want to integrate Popper.js inside a framework or view library and you
  37285. * want to delegate all the DOM manipulations to it.
  37286. *
  37287. * Note that if you disable this modifier, you must make sure the popper element
  37288. * has its position set to `absolute` before Popper.js can do its work!
  37289. *
  37290. * Just disable this modifier and define your own to achieve the desired effect.
  37291. *
  37292. * @memberof modifiers
  37293. * @inner
  37294. */
  37295. applyStyle: {
  37296. /** @prop {number} order=900 - Index used to define the order of execution */
  37297. order: 900,
  37298. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37299. enabled: true,
  37300. /** @prop {ModifierFn} */
  37301. fn: applyStyle,
  37302. /** @prop {Function} */
  37303. onLoad: applyStyleOnLoad,
  37304. /**
  37305. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  37306. * @prop {Boolean} gpuAcceleration=true
  37307. * If true, it uses the CSS 3D transformation to position the popper.
  37308. * Otherwise, it will use the `top` and `left` properties
  37309. */
  37310. gpuAcceleration: undefined
  37311. }
  37312. };
  37313. /**
  37314. * The `dataObject` is an object containing all the information used by Popper.js.
  37315. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  37316. * @name dataObject
  37317. * @property {Object} data.instance The Popper.js instance
  37318. * @property {String} data.placement Placement applied to popper
  37319. * @property {String} data.originalPlacement Placement originally defined on init
  37320. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  37321. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  37322. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  37323. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  37324. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  37325. * @property {Object} data.boundaries Offsets of the popper boundaries
  37326. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  37327. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  37328. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  37329. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  37330. */
  37331. /**
  37332. * Default options provided to Popper.js constructor.<br />
  37333. * These can be overridden using the `options` argument of Popper.js.<br />
  37334. * To override an option, simply pass an object with the same
  37335. * structure of the `options` object, as the 3rd argument. For example:
  37336. * ```
  37337. * new Popper(ref, pop, {
  37338. * modifiers: {
  37339. * preventOverflow: { enabled: false }
  37340. * }
  37341. * })
  37342. * ```
  37343. * @type {Object}
  37344. * @static
  37345. * @memberof Popper
  37346. */
  37347. var Defaults = {
  37348. /**
  37349. * Popper's placement.
  37350. * @prop {Popper.placements} placement='bottom'
  37351. */
  37352. placement: 'bottom',
  37353. /**
  37354. * Set this to true if you want popper to position it self in 'fixed' mode
  37355. * @prop {Boolean} positionFixed=false
  37356. */
  37357. positionFixed: false,
  37358. /**
  37359. * Whether events (resize, scroll) are initially enabled.
  37360. * @prop {Boolean} eventsEnabled=true
  37361. */
  37362. eventsEnabled: true,
  37363. /**
  37364. * Set to true if you want to automatically remove the popper when
  37365. * you call the `destroy` method.
  37366. * @prop {Boolean} removeOnDestroy=false
  37367. */
  37368. removeOnDestroy: false,
  37369. /**
  37370. * Callback called when the popper is created.<br />
  37371. * By default, it is set to no-op.<br />
  37372. * Access Popper.js instance with `data.instance`.
  37373. * @prop {onCreate}
  37374. */
  37375. onCreate: function onCreate() {},
  37376. /**
  37377. * Callback called when the popper is updated. This callback is not called
  37378. * on the initialization/creation of the popper, but only on subsequent
  37379. * updates.<br />
  37380. * By default, it is set to no-op.<br />
  37381. * Access Popper.js instance with `data.instance`.
  37382. * @prop {onUpdate}
  37383. */
  37384. onUpdate: function onUpdate() {},
  37385. /**
  37386. * List of modifiers used to modify the offsets before they are applied to the popper.
  37387. * They provide most of the functionalities of Popper.js.
  37388. * @prop {modifiers}
  37389. */
  37390. modifiers: modifiers
  37391. };
  37392. /**
  37393. * @callback onCreate
  37394. * @param {dataObject} data
  37395. */
  37396. /**
  37397. * @callback onUpdate
  37398. * @param {dataObject} data
  37399. */
  37400. // Utils
  37401. // Methods
  37402. var Popper = function () {
  37403. /**
  37404. * Creates a new Popper.js instance.
  37405. * @class Popper
  37406. * @param {Element|referenceObject} reference - The reference element used to position the popper
  37407. * @param {Element} popper - The HTML / XML element used as the popper
  37408. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  37409. * @return {Object} instance - The generated Popper.js instance
  37410. */
  37411. function Popper(reference, popper) {
  37412. var _this = this;
  37413. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  37414. classCallCheck(this, Popper);
  37415. this.scheduleUpdate = function () {
  37416. return requestAnimationFrame(_this.update);
  37417. };
  37418. // make update() debounced, so that it only runs at most once-per-tick
  37419. this.update = debounce(this.update.bind(this));
  37420. // with {} we create a new object with the options inside it
  37421. this.options = _extends({}, Popper.Defaults, options);
  37422. // init state
  37423. this.state = {
  37424. isDestroyed: false,
  37425. isCreated: false,
  37426. scrollParents: []
  37427. };
  37428. // get reference and popper elements (allow jQuery wrappers)
  37429. this.reference = reference && reference.jquery ? reference[0] : reference;
  37430. this.popper = popper && popper.jquery ? popper[0] : popper;
  37431. // Deep merge modifiers options
  37432. this.options.modifiers = {};
  37433. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  37434. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  37435. });
  37436. // Refactoring modifiers' list (Object => Array)
  37437. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  37438. return _extends({
  37439. name: name
  37440. }, _this.options.modifiers[name]);
  37441. })
  37442. // sort the modifiers by order
  37443. .sort(function (a, b) {
  37444. return a.order - b.order;
  37445. });
  37446. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  37447. // such code is executed in the same order of its modifier
  37448. // they could add new properties to their options configuration
  37449. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  37450. this.modifiers.forEach(function (modifierOptions) {
  37451. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  37452. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  37453. }
  37454. });
  37455. // fire the first update to position the popper in the right place
  37456. this.update();
  37457. var eventsEnabled = this.options.eventsEnabled;
  37458. if (eventsEnabled) {
  37459. // setup event listeners, they will take care of update the position in specific situations
  37460. this.enableEventListeners();
  37461. }
  37462. this.state.eventsEnabled = eventsEnabled;
  37463. }
  37464. // We can't use class properties because they don't get listed in the
  37465. // class prototype and break stuff like Sinon stubs
  37466. createClass(Popper, [{
  37467. key: 'update',
  37468. value: function update$$1() {
  37469. return update.call(this);
  37470. }
  37471. }, {
  37472. key: 'destroy',
  37473. value: function destroy$$1() {
  37474. return destroy.call(this);
  37475. }
  37476. }, {
  37477. key: 'enableEventListeners',
  37478. value: function enableEventListeners$$1() {
  37479. return enableEventListeners.call(this);
  37480. }
  37481. }, {
  37482. key: 'disableEventListeners',
  37483. value: function disableEventListeners$$1() {
  37484. return disableEventListeners.call(this);
  37485. }
  37486. /**
  37487. * Schedules an update. It will run on the next UI update available.
  37488. * @method scheduleUpdate
  37489. * @memberof Popper
  37490. */
  37491. /**
  37492. * Collection of utilities useful when writing custom modifiers.
  37493. * Starting from version 1.7, this method is available only if you
  37494. * include `popper-utils.js` before `popper.js`.
  37495. *
  37496. * **DEPRECATION**: This way to access PopperUtils is deprecated
  37497. * and will be removed in v2! Use the PopperUtils module directly instead.
  37498. * Due to the high instability of the methods contained in Utils, we can't
  37499. * guarantee them to follow semver. Use them at your own risk!
  37500. * @static
  37501. * @private
  37502. * @type {Object}
  37503. * @deprecated since version 1.8
  37504. * @member Utils
  37505. * @memberof Popper
  37506. */
  37507. }]);
  37508. return Popper;
  37509. }();
  37510. /**
  37511. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  37512. * and lets you use it as replacement of a real DOM node.<br />
  37513. * You can use this method to position a popper relatively to a set of coordinates
  37514. * in case you don't have a DOM node to use as reference.
  37515. *
  37516. * ```
  37517. * new Popper(referenceObject, popperNode);
  37518. * ```
  37519. *
  37520. * NB: This feature isn't supported in Internet Explorer 10.
  37521. * @name referenceObject
  37522. * @property {Function} data.getBoundingClientRect
  37523. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  37524. * @property {number} data.clientWidth
  37525. * An ES6 getter that will return the width of the virtual reference element.
  37526. * @property {number} data.clientHeight
  37527. * An ES6 getter that will return the height of the virtual reference element.
  37528. */
  37529. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  37530. Popper.placements = placements;
  37531. Popper.Defaults = Defaults;
  37532. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  37533. //# sourceMappingURL=popper.js.map
  37534. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  37535. /***/ }),
  37536. /***/ "./node_modules/process/browser.js":
  37537. /*!*****************************************!*\
  37538. !*** ./node_modules/process/browser.js ***!
  37539. \*****************************************/
  37540. /*! no static exports found */
  37541. /***/ (function(module, exports) {
  37542. // shim for using process in browser
  37543. var process = module.exports = {};
  37544. // cached from whatever global is present so that test runners that stub it
  37545. // don't break things. But we need to wrap it in a try catch in case it is
  37546. // wrapped in strict mode code which doesn't define any globals. It's inside a
  37547. // function because try/catches deoptimize in certain engines.
  37548. var cachedSetTimeout;
  37549. var cachedClearTimeout;
  37550. function defaultSetTimout() {
  37551. throw new Error('setTimeout has not been defined');
  37552. }
  37553. function defaultClearTimeout () {
  37554. throw new Error('clearTimeout has not been defined');
  37555. }
  37556. (function () {
  37557. try {
  37558. if (typeof setTimeout === 'function') {
  37559. cachedSetTimeout = setTimeout;
  37560. } else {
  37561. cachedSetTimeout = defaultSetTimout;
  37562. }
  37563. } catch (e) {
  37564. cachedSetTimeout = defaultSetTimout;
  37565. }
  37566. try {
  37567. if (typeof clearTimeout === 'function') {
  37568. cachedClearTimeout = clearTimeout;
  37569. } else {
  37570. cachedClearTimeout = defaultClearTimeout;
  37571. }
  37572. } catch (e) {
  37573. cachedClearTimeout = defaultClearTimeout;
  37574. }
  37575. } ())
  37576. function runTimeout(fun) {
  37577. if (cachedSetTimeout === setTimeout) {
  37578. //normal enviroments in sane situations
  37579. return setTimeout(fun, 0);
  37580. }
  37581. // if setTimeout wasn't available but was latter defined
  37582. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  37583. cachedSetTimeout = setTimeout;
  37584. return setTimeout(fun, 0);
  37585. }
  37586. try {
  37587. // when when somebody has screwed with setTimeout but no I.E. maddness
  37588. return cachedSetTimeout(fun, 0);
  37589. } catch(e){
  37590. try {
  37591. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  37592. return cachedSetTimeout.call(null, fun, 0);
  37593. } catch(e){
  37594. // 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
  37595. return cachedSetTimeout.call(this, fun, 0);
  37596. }
  37597. }
  37598. }
  37599. function runClearTimeout(marker) {
  37600. if (cachedClearTimeout === clearTimeout) {
  37601. //normal enviroments in sane situations
  37602. return clearTimeout(marker);
  37603. }
  37604. // if clearTimeout wasn't available but was latter defined
  37605. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  37606. cachedClearTimeout = clearTimeout;
  37607. return clearTimeout(marker);
  37608. }
  37609. try {
  37610. // when when somebody has screwed with setTimeout but no I.E. maddness
  37611. return cachedClearTimeout(marker);
  37612. } catch (e){
  37613. try {
  37614. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  37615. return cachedClearTimeout.call(null, marker);
  37616. } catch (e){
  37617. // 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.
  37618. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  37619. return cachedClearTimeout.call(this, marker);
  37620. }
  37621. }
  37622. }
  37623. var queue = [];
  37624. var draining = false;
  37625. var currentQueue;
  37626. var queueIndex = -1;
  37627. function cleanUpNextTick() {
  37628. if (!draining || !currentQueue) {
  37629. return;
  37630. }
  37631. draining = false;
  37632. if (currentQueue.length) {
  37633. queue = currentQueue.concat(queue);
  37634. } else {
  37635. queueIndex = -1;
  37636. }
  37637. if (queue.length) {
  37638. drainQueue();
  37639. }
  37640. }
  37641. function drainQueue() {
  37642. if (draining) {
  37643. return;
  37644. }
  37645. var timeout = runTimeout(cleanUpNextTick);
  37646. draining = true;
  37647. var len = queue.length;
  37648. while(len) {
  37649. currentQueue = queue;
  37650. queue = [];
  37651. while (++queueIndex < len) {
  37652. if (currentQueue) {
  37653. currentQueue[queueIndex].run();
  37654. }
  37655. }
  37656. queueIndex = -1;
  37657. len = queue.length;
  37658. }
  37659. currentQueue = null;
  37660. draining = false;
  37661. runClearTimeout(timeout);
  37662. }
  37663. process.nextTick = function (fun) {
  37664. var args = new Array(arguments.length - 1);
  37665. if (arguments.length > 1) {
  37666. for (var i = 1; i < arguments.length; i++) {
  37667. args[i - 1] = arguments[i];
  37668. }
  37669. }
  37670. queue.push(new Item(fun, args));
  37671. if (queue.length === 1 && !draining) {
  37672. runTimeout(drainQueue);
  37673. }
  37674. };
  37675. // v8 likes predictible objects
  37676. function Item(fun, array) {
  37677. this.fun = fun;
  37678. this.array = array;
  37679. }
  37680. Item.prototype.run = function () {
  37681. this.fun.apply(null, this.array);
  37682. };
  37683. process.title = 'browser';
  37684. process.browser = true;
  37685. process.env = {};
  37686. process.argv = [];
  37687. process.version = ''; // empty string to avoid regexp issues
  37688. process.versions = {};
  37689. function noop() {}
  37690. process.on = noop;
  37691. process.addListener = noop;
  37692. process.once = noop;
  37693. process.off = noop;
  37694. process.removeListener = noop;
  37695. process.removeAllListeners = noop;
  37696. process.emit = noop;
  37697. process.prependListener = noop;
  37698. process.prependOnceListener = noop;
  37699. process.listeners = function (name) { return [] }
  37700. process.binding = function (name) {
  37701. throw new Error('process.binding is not supported');
  37702. };
  37703. process.cwd = function () { return '/' };
  37704. process.chdir = function (dir) {
  37705. throw new Error('process.chdir is not supported');
  37706. };
  37707. process.umask = function() { return 0; };
  37708. /***/ }),
  37709. /***/ "./node_modules/pusher-js/dist/web/pusher.js":
  37710. /*!***************************************************!*\
  37711. !*** ./node_modules/pusher-js/dist/web/pusher.js ***!
  37712. \***************************************************/
  37713. /*! no static exports found */
  37714. /***/ (function(module, exports, __webpack_require__) {
  37715. /* WEBPACK VAR INJECTION */(function(Buffer) {/*!
  37716. * Pusher JavaScript Library v5.0.3
  37717. * https://pusher.com/
  37718. *
  37719. * Copyright 2017, Pusher
  37720. * Released under the MIT licence.
  37721. */
  37722. (function webpackUniversalModuleDefinition(root, factory) {
  37723. if(true)
  37724. module.exports = factory();
  37725. else {}
  37726. })(window, function() {
  37727. return /******/ (function(modules) { // webpackBootstrap
  37728. /******/ // The module cache
  37729. /******/ var installedModules = {};
  37730. /******/
  37731. /******/ // The require function
  37732. /******/ function __webpack_require__(moduleId) {
  37733. /******/
  37734. /******/ // Check if module is in cache
  37735. /******/ if(installedModules[moduleId]) {
  37736. /******/ return installedModules[moduleId].exports;
  37737. /******/ }
  37738. /******/ // Create a new module (and put it into the cache)
  37739. /******/ var module = installedModules[moduleId] = {
  37740. /******/ i: moduleId,
  37741. /******/ l: false,
  37742. /******/ exports: {}
  37743. /******/ };
  37744. /******/
  37745. /******/ // Execute the module function
  37746. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  37747. /******/
  37748. /******/ // Flag the module as loaded
  37749. /******/ module.l = true;
  37750. /******/
  37751. /******/ // Return the exports of the module
  37752. /******/ return module.exports;
  37753. /******/ }
  37754. /******/
  37755. /******/
  37756. /******/ // expose the modules object (__webpack_modules__)
  37757. /******/ __webpack_require__.m = modules;
  37758. /******/
  37759. /******/ // expose the module cache
  37760. /******/ __webpack_require__.c = installedModules;
  37761. /******/
  37762. /******/ // define getter function for harmony exports
  37763. /******/ __webpack_require__.d = function(exports, name, getter) {
  37764. /******/ if(!__webpack_require__.o(exports, name)) {
  37765. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  37766. /******/ }
  37767. /******/ };
  37768. /******/
  37769. /******/ // define __esModule on exports
  37770. /******/ __webpack_require__.r = function(exports) {
  37771. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  37772. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  37773. /******/ }
  37774. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  37775. /******/ };
  37776. /******/
  37777. /******/ // create a fake namespace object
  37778. /******/ // mode & 1: value is a module id, require it
  37779. /******/ // mode & 2: merge all properties of value into the ns
  37780. /******/ // mode & 4: return value when already ns object
  37781. /******/ // mode & 8|1: behave like require
  37782. /******/ __webpack_require__.t = function(value, mode) {
  37783. /******/ if(mode & 1) value = __webpack_require__(value);
  37784. /******/ if(mode & 8) return value;
  37785. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  37786. /******/ var ns = Object.create(null);
  37787. /******/ __webpack_require__.r(ns);
  37788. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  37789. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  37790. /******/ return ns;
  37791. /******/ };
  37792. /******/
  37793. /******/ // getDefaultExport function for compatibility with non-harmony modules
  37794. /******/ __webpack_require__.n = function(module) {
  37795. /******/ var getter = module && module.__esModule ?
  37796. /******/ function getDefault() { return module['default']; } :
  37797. /******/ function getModuleExports() { return module; };
  37798. /******/ __webpack_require__.d(getter, 'a', getter);
  37799. /******/ return getter;
  37800. /******/ };
  37801. /******/
  37802. /******/ // Object.prototype.hasOwnProperty.call
  37803. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  37804. /******/
  37805. /******/ // __webpack_public_path__
  37806. /******/ __webpack_require__.p = "";
  37807. /******/
  37808. /******/
  37809. /******/ // Load entry module and return exports
  37810. /******/ return __webpack_require__(__webpack_require__.s = 2);
  37811. /******/ })
  37812. /************************************************************************/
  37813. /******/ ([
  37814. /* 0 */
  37815. /***/ (function(module, exports, __webpack_require__) {
  37816. (function(nacl) {
  37817. 'use strict';
  37818. // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
  37819. // Public domain.
  37820. //
  37821. // Implementation derived from TweetNaCl version 20140427.
  37822. // See for details: http://tweetnacl.cr.yp.to/
  37823. var gf = function(init) {
  37824. var i, r = new Float64Array(16);
  37825. if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
  37826. return r;
  37827. };
  37828. // Pluggable, initialized in high-level API below.
  37829. var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
  37830. var _0 = new Uint8Array(16);
  37831. var _9 = new Uint8Array(32); _9[0] = 9;
  37832. var gf0 = gf(),
  37833. gf1 = gf([1]),
  37834. _121665 = gf([0xdb41, 1]),
  37835. D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
  37836. D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
  37837. X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
  37838. Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
  37839. I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
  37840. function ts64(x, i, h, l) {
  37841. x[i] = (h >> 24) & 0xff;
  37842. x[i+1] = (h >> 16) & 0xff;
  37843. x[i+2] = (h >> 8) & 0xff;
  37844. x[i+3] = h & 0xff;
  37845. x[i+4] = (l >> 24) & 0xff;
  37846. x[i+5] = (l >> 16) & 0xff;
  37847. x[i+6] = (l >> 8) & 0xff;
  37848. x[i+7] = l & 0xff;
  37849. }
  37850. function vn(x, xi, y, yi, n) {
  37851. var i,d = 0;
  37852. for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
  37853. return (1 & ((d - 1) >>> 8)) - 1;
  37854. }
  37855. function crypto_verify_16(x, xi, y, yi) {
  37856. return vn(x,xi,y,yi,16);
  37857. }
  37858. function crypto_verify_32(x, xi, y, yi) {
  37859. return vn(x,xi,y,yi,32);
  37860. }
  37861. function core_salsa20(o, p, k, c) {
  37862. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37863. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37864. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37865. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37866. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37867. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37868. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37869. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37870. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37871. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37872. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37873. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37874. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37875. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37876. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37877. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37878. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37879. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37880. x15 = j15, u;
  37881. for (var i = 0; i < 20; i += 2) {
  37882. u = x0 + x12 | 0;
  37883. x4 ^= u<<7 | u>>>(32-7);
  37884. u = x4 + x0 | 0;
  37885. x8 ^= u<<9 | u>>>(32-9);
  37886. u = x8 + x4 | 0;
  37887. x12 ^= u<<13 | u>>>(32-13);
  37888. u = x12 + x8 | 0;
  37889. x0 ^= u<<18 | u>>>(32-18);
  37890. u = x5 + x1 | 0;
  37891. x9 ^= u<<7 | u>>>(32-7);
  37892. u = x9 + x5 | 0;
  37893. x13 ^= u<<9 | u>>>(32-9);
  37894. u = x13 + x9 | 0;
  37895. x1 ^= u<<13 | u>>>(32-13);
  37896. u = x1 + x13 | 0;
  37897. x5 ^= u<<18 | u>>>(32-18);
  37898. u = x10 + x6 | 0;
  37899. x14 ^= u<<7 | u>>>(32-7);
  37900. u = x14 + x10 | 0;
  37901. x2 ^= u<<9 | u>>>(32-9);
  37902. u = x2 + x14 | 0;
  37903. x6 ^= u<<13 | u>>>(32-13);
  37904. u = x6 + x2 | 0;
  37905. x10 ^= u<<18 | u>>>(32-18);
  37906. u = x15 + x11 | 0;
  37907. x3 ^= u<<7 | u>>>(32-7);
  37908. u = x3 + x15 | 0;
  37909. x7 ^= u<<9 | u>>>(32-9);
  37910. u = x7 + x3 | 0;
  37911. x11 ^= u<<13 | u>>>(32-13);
  37912. u = x11 + x7 | 0;
  37913. x15 ^= u<<18 | u>>>(32-18);
  37914. u = x0 + x3 | 0;
  37915. x1 ^= u<<7 | u>>>(32-7);
  37916. u = x1 + x0 | 0;
  37917. x2 ^= u<<9 | u>>>(32-9);
  37918. u = x2 + x1 | 0;
  37919. x3 ^= u<<13 | u>>>(32-13);
  37920. u = x3 + x2 | 0;
  37921. x0 ^= u<<18 | u>>>(32-18);
  37922. u = x5 + x4 | 0;
  37923. x6 ^= u<<7 | u>>>(32-7);
  37924. u = x6 + x5 | 0;
  37925. x7 ^= u<<9 | u>>>(32-9);
  37926. u = x7 + x6 | 0;
  37927. x4 ^= u<<13 | u>>>(32-13);
  37928. u = x4 + x7 | 0;
  37929. x5 ^= u<<18 | u>>>(32-18);
  37930. u = x10 + x9 | 0;
  37931. x11 ^= u<<7 | u>>>(32-7);
  37932. u = x11 + x10 | 0;
  37933. x8 ^= u<<9 | u>>>(32-9);
  37934. u = x8 + x11 | 0;
  37935. x9 ^= u<<13 | u>>>(32-13);
  37936. u = x9 + x8 | 0;
  37937. x10 ^= u<<18 | u>>>(32-18);
  37938. u = x15 + x14 | 0;
  37939. x12 ^= u<<7 | u>>>(32-7);
  37940. u = x12 + x15 | 0;
  37941. x13 ^= u<<9 | u>>>(32-9);
  37942. u = x13 + x12 | 0;
  37943. x14 ^= u<<13 | u>>>(32-13);
  37944. u = x14 + x13 | 0;
  37945. x15 ^= u<<18 | u>>>(32-18);
  37946. }
  37947. x0 = x0 + j0 | 0;
  37948. x1 = x1 + j1 | 0;
  37949. x2 = x2 + j2 | 0;
  37950. x3 = x3 + j3 | 0;
  37951. x4 = x4 + j4 | 0;
  37952. x5 = x5 + j5 | 0;
  37953. x6 = x6 + j6 | 0;
  37954. x7 = x7 + j7 | 0;
  37955. x8 = x8 + j8 | 0;
  37956. x9 = x9 + j9 | 0;
  37957. x10 = x10 + j10 | 0;
  37958. x11 = x11 + j11 | 0;
  37959. x12 = x12 + j12 | 0;
  37960. x13 = x13 + j13 | 0;
  37961. x14 = x14 + j14 | 0;
  37962. x15 = x15 + j15 | 0;
  37963. o[ 0] = x0 >>> 0 & 0xff;
  37964. o[ 1] = x0 >>> 8 & 0xff;
  37965. o[ 2] = x0 >>> 16 & 0xff;
  37966. o[ 3] = x0 >>> 24 & 0xff;
  37967. o[ 4] = x1 >>> 0 & 0xff;
  37968. o[ 5] = x1 >>> 8 & 0xff;
  37969. o[ 6] = x1 >>> 16 & 0xff;
  37970. o[ 7] = x1 >>> 24 & 0xff;
  37971. o[ 8] = x2 >>> 0 & 0xff;
  37972. o[ 9] = x2 >>> 8 & 0xff;
  37973. o[10] = x2 >>> 16 & 0xff;
  37974. o[11] = x2 >>> 24 & 0xff;
  37975. o[12] = x3 >>> 0 & 0xff;
  37976. o[13] = x3 >>> 8 & 0xff;
  37977. o[14] = x3 >>> 16 & 0xff;
  37978. o[15] = x3 >>> 24 & 0xff;
  37979. o[16] = x4 >>> 0 & 0xff;
  37980. o[17] = x4 >>> 8 & 0xff;
  37981. o[18] = x4 >>> 16 & 0xff;
  37982. o[19] = x4 >>> 24 & 0xff;
  37983. o[20] = x5 >>> 0 & 0xff;
  37984. o[21] = x5 >>> 8 & 0xff;
  37985. o[22] = x5 >>> 16 & 0xff;
  37986. o[23] = x5 >>> 24 & 0xff;
  37987. o[24] = x6 >>> 0 & 0xff;
  37988. o[25] = x6 >>> 8 & 0xff;
  37989. o[26] = x6 >>> 16 & 0xff;
  37990. o[27] = x6 >>> 24 & 0xff;
  37991. o[28] = x7 >>> 0 & 0xff;
  37992. o[29] = x7 >>> 8 & 0xff;
  37993. o[30] = x7 >>> 16 & 0xff;
  37994. o[31] = x7 >>> 24 & 0xff;
  37995. o[32] = x8 >>> 0 & 0xff;
  37996. o[33] = x8 >>> 8 & 0xff;
  37997. o[34] = x8 >>> 16 & 0xff;
  37998. o[35] = x8 >>> 24 & 0xff;
  37999. o[36] = x9 >>> 0 & 0xff;
  38000. o[37] = x9 >>> 8 & 0xff;
  38001. o[38] = x9 >>> 16 & 0xff;
  38002. o[39] = x9 >>> 24 & 0xff;
  38003. o[40] = x10 >>> 0 & 0xff;
  38004. o[41] = x10 >>> 8 & 0xff;
  38005. o[42] = x10 >>> 16 & 0xff;
  38006. o[43] = x10 >>> 24 & 0xff;
  38007. o[44] = x11 >>> 0 & 0xff;
  38008. o[45] = x11 >>> 8 & 0xff;
  38009. o[46] = x11 >>> 16 & 0xff;
  38010. o[47] = x11 >>> 24 & 0xff;
  38011. o[48] = x12 >>> 0 & 0xff;
  38012. o[49] = x12 >>> 8 & 0xff;
  38013. o[50] = x12 >>> 16 & 0xff;
  38014. o[51] = x12 >>> 24 & 0xff;
  38015. o[52] = x13 >>> 0 & 0xff;
  38016. o[53] = x13 >>> 8 & 0xff;
  38017. o[54] = x13 >>> 16 & 0xff;
  38018. o[55] = x13 >>> 24 & 0xff;
  38019. o[56] = x14 >>> 0 & 0xff;
  38020. o[57] = x14 >>> 8 & 0xff;
  38021. o[58] = x14 >>> 16 & 0xff;
  38022. o[59] = x14 >>> 24 & 0xff;
  38023. o[60] = x15 >>> 0 & 0xff;
  38024. o[61] = x15 >>> 8 & 0xff;
  38025. o[62] = x15 >>> 16 & 0xff;
  38026. o[63] = x15 >>> 24 & 0xff;
  38027. }
  38028. function core_hsalsa20(o,p,k,c) {
  38029. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  38030. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  38031. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  38032. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  38033. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  38034. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  38035. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  38036. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  38037. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  38038. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  38039. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  38040. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  38041. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  38042. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  38043. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  38044. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  38045. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  38046. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  38047. x15 = j15, u;
  38048. for (var i = 0; i < 20; i += 2) {
  38049. u = x0 + x12 | 0;
  38050. x4 ^= u<<7 | u>>>(32-7);
  38051. u = x4 + x0 | 0;
  38052. x8 ^= u<<9 | u>>>(32-9);
  38053. u = x8 + x4 | 0;
  38054. x12 ^= u<<13 | u>>>(32-13);
  38055. u = x12 + x8 | 0;
  38056. x0 ^= u<<18 | u>>>(32-18);
  38057. u = x5 + x1 | 0;
  38058. x9 ^= u<<7 | u>>>(32-7);
  38059. u = x9 + x5 | 0;
  38060. x13 ^= u<<9 | u>>>(32-9);
  38061. u = x13 + x9 | 0;
  38062. x1 ^= u<<13 | u>>>(32-13);
  38063. u = x1 + x13 | 0;
  38064. x5 ^= u<<18 | u>>>(32-18);
  38065. u = x10 + x6 | 0;
  38066. x14 ^= u<<7 | u>>>(32-7);
  38067. u = x14 + x10 | 0;
  38068. x2 ^= u<<9 | u>>>(32-9);
  38069. u = x2 + x14 | 0;
  38070. x6 ^= u<<13 | u>>>(32-13);
  38071. u = x6 + x2 | 0;
  38072. x10 ^= u<<18 | u>>>(32-18);
  38073. u = x15 + x11 | 0;
  38074. x3 ^= u<<7 | u>>>(32-7);
  38075. u = x3 + x15 | 0;
  38076. x7 ^= u<<9 | u>>>(32-9);
  38077. u = x7 + x3 | 0;
  38078. x11 ^= u<<13 | u>>>(32-13);
  38079. u = x11 + x7 | 0;
  38080. x15 ^= u<<18 | u>>>(32-18);
  38081. u = x0 + x3 | 0;
  38082. x1 ^= u<<7 | u>>>(32-7);
  38083. u = x1 + x0 | 0;
  38084. x2 ^= u<<9 | u>>>(32-9);
  38085. u = x2 + x1 | 0;
  38086. x3 ^= u<<13 | u>>>(32-13);
  38087. u = x3 + x2 | 0;
  38088. x0 ^= u<<18 | u>>>(32-18);
  38089. u = x5 + x4 | 0;
  38090. x6 ^= u<<7 | u>>>(32-7);
  38091. u = x6 + x5 | 0;
  38092. x7 ^= u<<9 | u>>>(32-9);
  38093. u = x7 + x6 | 0;
  38094. x4 ^= u<<13 | u>>>(32-13);
  38095. u = x4 + x7 | 0;
  38096. x5 ^= u<<18 | u>>>(32-18);
  38097. u = x10 + x9 | 0;
  38098. x11 ^= u<<7 | u>>>(32-7);
  38099. u = x11 + x10 | 0;
  38100. x8 ^= u<<9 | u>>>(32-9);
  38101. u = x8 + x11 | 0;
  38102. x9 ^= u<<13 | u>>>(32-13);
  38103. u = x9 + x8 | 0;
  38104. x10 ^= u<<18 | u>>>(32-18);
  38105. u = x15 + x14 | 0;
  38106. x12 ^= u<<7 | u>>>(32-7);
  38107. u = x12 + x15 | 0;
  38108. x13 ^= u<<9 | u>>>(32-9);
  38109. u = x13 + x12 | 0;
  38110. x14 ^= u<<13 | u>>>(32-13);
  38111. u = x14 + x13 | 0;
  38112. x15 ^= u<<18 | u>>>(32-18);
  38113. }
  38114. o[ 0] = x0 >>> 0 & 0xff;
  38115. o[ 1] = x0 >>> 8 & 0xff;
  38116. o[ 2] = x0 >>> 16 & 0xff;
  38117. o[ 3] = x0 >>> 24 & 0xff;
  38118. o[ 4] = x5 >>> 0 & 0xff;
  38119. o[ 5] = x5 >>> 8 & 0xff;
  38120. o[ 6] = x5 >>> 16 & 0xff;
  38121. o[ 7] = x5 >>> 24 & 0xff;
  38122. o[ 8] = x10 >>> 0 & 0xff;
  38123. o[ 9] = x10 >>> 8 & 0xff;
  38124. o[10] = x10 >>> 16 & 0xff;
  38125. o[11] = x10 >>> 24 & 0xff;
  38126. o[12] = x15 >>> 0 & 0xff;
  38127. o[13] = x15 >>> 8 & 0xff;
  38128. o[14] = x15 >>> 16 & 0xff;
  38129. o[15] = x15 >>> 24 & 0xff;
  38130. o[16] = x6 >>> 0 & 0xff;
  38131. o[17] = x6 >>> 8 & 0xff;
  38132. o[18] = x6 >>> 16 & 0xff;
  38133. o[19] = x6 >>> 24 & 0xff;
  38134. o[20] = x7 >>> 0 & 0xff;
  38135. o[21] = x7 >>> 8 & 0xff;
  38136. o[22] = x7 >>> 16 & 0xff;
  38137. o[23] = x7 >>> 24 & 0xff;
  38138. o[24] = x8 >>> 0 & 0xff;
  38139. o[25] = x8 >>> 8 & 0xff;
  38140. o[26] = x8 >>> 16 & 0xff;
  38141. o[27] = x8 >>> 24 & 0xff;
  38142. o[28] = x9 >>> 0 & 0xff;
  38143. o[29] = x9 >>> 8 & 0xff;
  38144. o[30] = x9 >>> 16 & 0xff;
  38145. o[31] = x9 >>> 24 & 0xff;
  38146. }
  38147. function crypto_core_salsa20(out,inp,k,c) {
  38148. core_salsa20(out,inp,k,c);
  38149. }
  38150. function crypto_core_hsalsa20(out,inp,k,c) {
  38151. core_hsalsa20(out,inp,k,c);
  38152. }
  38153. var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
  38154. // "expand 32-byte k"
  38155. function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
  38156. var z = new Uint8Array(16), x = new Uint8Array(64);
  38157. var u, i;
  38158. for (i = 0; i < 16; i++) z[i] = 0;
  38159. for (i = 0; i < 8; i++) z[i] = n[i];
  38160. while (b >= 64) {
  38161. crypto_core_salsa20(x,z,k,sigma);
  38162. for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  38163. u = 1;
  38164. for (i = 8; i < 16; i++) {
  38165. u = u + (z[i] & 0xff) | 0;
  38166. z[i] = u & 0xff;
  38167. u >>>= 8;
  38168. }
  38169. b -= 64;
  38170. cpos += 64;
  38171. mpos += 64;
  38172. }
  38173. if (b > 0) {
  38174. crypto_core_salsa20(x,z,k,sigma);
  38175. for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  38176. }
  38177. return 0;
  38178. }
  38179. function crypto_stream_salsa20(c,cpos,b,n,k) {
  38180. var z = new Uint8Array(16), x = new Uint8Array(64);
  38181. var u, i;
  38182. for (i = 0; i < 16; i++) z[i] = 0;
  38183. for (i = 0; i < 8; i++) z[i] = n[i];
  38184. while (b >= 64) {
  38185. crypto_core_salsa20(x,z,k,sigma);
  38186. for (i = 0; i < 64; i++) c[cpos+i] = x[i];
  38187. u = 1;
  38188. for (i = 8; i < 16; i++) {
  38189. u = u + (z[i] & 0xff) | 0;
  38190. z[i] = u & 0xff;
  38191. u >>>= 8;
  38192. }
  38193. b -= 64;
  38194. cpos += 64;
  38195. }
  38196. if (b > 0) {
  38197. crypto_core_salsa20(x,z,k,sigma);
  38198. for (i = 0; i < b; i++) c[cpos+i] = x[i];
  38199. }
  38200. return 0;
  38201. }
  38202. function crypto_stream(c,cpos,d,n,k) {
  38203. var s = new Uint8Array(32);
  38204. crypto_core_hsalsa20(s,n,k,sigma);
  38205. var sn = new Uint8Array(8);
  38206. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  38207. return crypto_stream_salsa20(c,cpos,d,sn,s);
  38208. }
  38209. function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
  38210. var s = new Uint8Array(32);
  38211. crypto_core_hsalsa20(s,n,k,sigma);
  38212. var sn = new Uint8Array(8);
  38213. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  38214. return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
  38215. }
  38216. /*
  38217. * Port of Andrew Moon's Poly1305-donna-16. Public domain.
  38218. * https://github.com/floodyberry/poly1305-donna
  38219. */
  38220. var poly1305 = function(key) {
  38221. this.buffer = new Uint8Array(16);
  38222. this.r = new Uint16Array(10);
  38223. this.h = new Uint16Array(10);
  38224. this.pad = new Uint16Array(8);
  38225. this.leftover = 0;
  38226. this.fin = 0;
  38227. var t0, t1, t2, t3, t4, t5, t6, t7;
  38228. t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
  38229. t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  38230. t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
  38231. t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  38232. t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
  38233. this.r[5] = ((t4 >>> 1)) & 0x1ffe;
  38234. t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  38235. t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
  38236. t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  38237. this.r[9] = ((t7 >>> 5)) & 0x007f;
  38238. this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
  38239. this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
  38240. this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
  38241. this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
  38242. this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
  38243. this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
  38244. this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
  38245. this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
  38246. };
  38247. poly1305.prototype.blocks = function(m, mpos, bytes) {
  38248. var hibit = this.fin ? 0 : (1 << 11);
  38249. var t0, t1, t2, t3, t4, t5, t6, t7, c;
  38250. var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
  38251. var h0 = this.h[0],
  38252. h1 = this.h[1],
  38253. h2 = this.h[2],
  38254. h3 = this.h[3],
  38255. h4 = this.h[4],
  38256. h5 = this.h[5],
  38257. h6 = this.h[6],
  38258. h7 = this.h[7],
  38259. h8 = this.h[8],
  38260. h9 = this.h[9];
  38261. var r0 = this.r[0],
  38262. r1 = this.r[1],
  38263. r2 = this.r[2],
  38264. r3 = this.r[3],
  38265. r4 = this.r[4],
  38266. r5 = this.r[5],
  38267. r6 = this.r[6],
  38268. r7 = this.r[7],
  38269. r8 = this.r[8],
  38270. r9 = this.r[9];
  38271. while (bytes >= 16) {
  38272. t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
  38273. t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  38274. t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
  38275. t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  38276. t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
  38277. h5 += ((t4 >>> 1)) & 0x1fff;
  38278. t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  38279. t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
  38280. t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  38281. h9 += ((t7 >>> 5)) | hibit;
  38282. c = 0;
  38283. d0 = c;
  38284. d0 += h0 * r0;
  38285. d0 += h1 * (5 * r9);
  38286. d0 += h2 * (5 * r8);
  38287. d0 += h3 * (5 * r7);
  38288. d0 += h4 * (5 * r6);
  38289. c = (d0 >>> 13); d0 &= 0x1fff;
  38290. d0 += h5 * (5 * r5);
  38291. d0 += h6 * (5 * r4);
  38292. d0 += h7 * (5 * r3);
  38293. d0 += h8 * (5 * r2);
  38294. d0 += h9 * (5 * r1);
  38295. c += (d0 >>> 13); d0 &= 0x1fff;
  38296. d1 = c;
  38297. d1 += h0 * r1;
  38298. d1 += h1 * r0;
  38299. d1 += h2 * (5 * r9);
  38300. d1 += h3 * (5 * r8);
  38301. d1 += h4 * (5 * r7);
  38302. c = (d1 >>> 13); d1 &= 0x1fff;
  38303. d1 += h5 * (5 * r6);
  38304. d1 += h6 * (5 * r5);
  38305. d1 += h7 * (5 * r4);
  38306. d1 += h8 * (5 * r3);
  38307. d1 += h9 * (5 * r2);
  38308. c += (d1 >>> 13); d1 &= 0x1fff;
  38309. d2 = c;
  38310. d2 += h0 * r2;
  38311. d2 += h1 * r1;
  38312. d2 += h2 * r0;
  38313. d2 += h3 * (5 * r9);
  38314. d2 += h4 * (5 * r8);
  38315. c = (d2 >>> 13); d2 &= 0x1fff;
  38316. d2 += h5 * (5 * r7);
  38317. d2 += h6 * (5 * r6);
  38318. d2 += h7 * (5 * r5);
  38319. d2 += h8 * (5 * r4);
  38320. d2 += h9 * (5 * r3);
  38321. c += (d2 >>> 13); d2 &= 0x1fff;
  38322. d3 = c;
  38323. d3 += h0 * r3;
  38324. d3 += h1 * r2;
  38325. d3 += h2 * r1;
  38326. d3 += h3 * r0;
  38327. d3 += h4 * (5 * r9);
  38328. c = (d3 >>> 13); d3 &= 0x1fff;
  38329. d3 += h5 * (5 * r8);
  38330. d3 += h6 * (5 * r7);
  38331. d3 += h7 * (5 * r6);
  38332. d3 += h8 * (5 * r5);
  38333. d3 += h9 * (5 * r4);
  38334. c += (d3 >>> 13); d3 &= 0x1fff;
  38335. d4 = c;
  38336. d4 += h0 * r4;
  38337. d4 += h1 * r3;
  38338. d4 += h2 * r2;
  38339. d4 += h3 * r1;
  38340. d4 += h4 * r0;
  38341. c = (d4 >>> 13); d4 &= 0x1fff;
  38342. d4 += h5 * (5 * r9);
  38343. d4 += h6 * (5 * r8);
  38344. d4 += h7 * (5 * r7);
  38345. d4 += h8 * (5 * r6);
  38346. d4 += h9 * (5 * r5);
  38347. c += (d4 >>> 13); d4 &= 0x1fff;
  38348. d5 = c;
  38349. d5 += h0 * r5;
  38350. d5 += h1 * r4;
  38351. d5 += h2 * r3;
  38352. d5 += h3 * r2;
  38353. d5 += h4 * r1;
  38354. c = (d5 >>> 13); d5 &= 0x1fff;
  38355. d5 += h5 * r0;
  38356. d5 += h6 * (5 * r9);
  38357. d5 += h7 * (5 * r8);
  38358. d5 += h8 * (5 * r7);
  38359. d5 += h9 * (5 * r6);
  38360. c += (d5 >>> 13); d5 &= 0x1fff;
  38361. d6 = c;
  38362. d6 += h0 * r6;
  38363. d6 += h1 * r5;
  38364. d6 += h2 * r4;
  38365. d6 += h3 * r3;
  38366. d6 += h4 * r2;
  38367. c = (d6 >>> 13); d6 &= 0x1fff;
  38368. d6 += h5 * r1;
  38369. d6 += h6 * r0;
  38370. d6 += h7 * (5 * r9);
  38371. d6 += h8 * (5 * r8);
  38372. d6 += h9 * (5 * r7);
  38373. c += (d6 >>> 13); d6 &= 0x1fff;
  38374. d7 = c;
  38375. d7 += h0 * r7;
  38376. d7 += h1 * r6;
  38377. d7 += h2 * r5;
  38378. d7 += h3 * r4;
  38379. d7 += h4 * r3;
  38380. c = (d7 >>> 13); d7 &= 0x1fff;
  38381. d7 += h5 * r2;
  38382. d7 += h6 * r1;
  38383. d7 += h7 * r0;
  38384. d7 += h8 * (5 * r9);
  38385. d7 += h9 * (5 * r8);
  38386. c += (d7 >>> 13); d7 &= 0x1fff;
  38387. d8 = c;
  38388. d8 += h0 * r8;
  38389. d8 += h1 * r7;
  38390. d8 += h2 * r6;
  38391. d8 += h3 * r5;
  38392. d8 += h4 * r4;
  38393. c = (d8 >>> 13); d8 &= 0x1fff;
  38394. d8 += h5 * r3;
  38395. d8 += h6 * r2;
  38396. d8 += h7 * r1;
  38397. d8 += h8 * r0;
  38398. d8 += h9 * (5 * r9);
  38399. c += (d8 >>> 13); d8 &= 0x1fff;
  38400. d9 = c;
  38401. d9 += h0 * r9;
  38402. d9 += h1 * r8;
  38403. d9 += h2 * r7;
  38404. d9 += h3 * r6;
  38405. d9 += h4 * r5;
  38406. c = (d9 >>> 13); d9 &= 0x1fff;
  38407. d9 += h5 * r4;
  38408. d9 += h6 * r3;
  38409. d9 += h7 * r2;
  38410. d9 += h8 * r1;
  38411. d9 += h9 * r0;
  38412. c += (d9 >>> 13); d9 &= 0x1fff;
  38413. c = (((c << 2) + c)) | 0;
  38414. c = (c + d0) | 0;
  38415. d0 = c & 0x1fff;
  38416. c = (c >>> 13);
  38417. d1 += c;
  38418. h0 = d0;
  38419. h1 = d1;
  38420. h2 = d2;
  38421. h3 = d3;
  38422. h4 = d4;
  38423. h5 = d5;
  38424. h6 = d6;
  38425. h7 = d7;
  38426. h8 = d8;
  38427. h9 = d9;
  38428. mpos += 16;
  38429. bytes -= 16;
  38430. }
  38431. this.h[0] = h0;
  38432. this.h[1] = h1;
  38433. this.h[2] = h2;
  38434. this.h[3] = h3;
  38435. this.h[4] = h4;
  38436. this.h[5] = h5;
  38437. this.h[6] = h6;
  38438. this.h[7] = h7;
  38439. this.h[8] = h8;
  38440. this.h[9] = h9;
  38441. };
  38442. poly1305.prototype.finish = function(mac, macpos) {
  38443. var g = new Uint16Array(10);
  38444. var c, mask, f, i;
  38445. if (this.leftover) {
  38446. i = this.leftover;
  38447. this.buffer[i++] = 1;
  38448. for (; i < 16; i++) this.buffer[i] = 0;
  38449. this.fin = 1;
  38450. this.blocks(this.buffer, 0, 16);
  38451. }
  38452. c = this.h[1] >>> 13;
  38453. this.h[1] &= 0x1fff;
  38454. for (i = 2; i < 10; i++) {
  38455. this.h[i] += c;
  38456. c = this.h[i] >>> 13;
  38457. this.h[i] &= 0x1fff;
  38458. }
  38459. this.h[0] += (c * 5);
  38460. c = this.h[0] >>> 13;
  38461. this.h[0] &= 0x1fff;
  38462. this.h[1] += c;
  38463. c = this.h[1] >>> 13;
  38464. this.h[1] &= 0x1fff;
  38465. this.h[2] += c;
  38466. g[0] = this.h[0] + 5;
  38467. c = g[0] >>> 13;
  38468. g[0] &= 0x1fff;
  38469. for (i = 1; i < 10; i++) {
  38470. g[i] = this.h[i] + c;
  38471. c = g[i] >>> 13;
  38472. g[i] &= 0x1fff;
  38473. }
  38474. g[9] -= (1 << 13);
  38475. mask = (c ^ 1) - 1;
  38476. for (i = 0; i < 10; i++) g[i] &= mask;
  38477. mask = ~mask;
  38478. for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
  38479. this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
  38480. this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
  38481. this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
  38482. this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
  38483. this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
  38484. this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
  38485. this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
  38486. this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
  38487. f = this.h[0] + this.pad[0];
  38488. this.h[0] = f & 0xffff;
  38489. for (i = 1; i < 8; i++) {
  38490. f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
  38491. this.h[i] = f & 0xffff;
  38492. }
  38493. mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
  38494. mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
  38495. mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
  38496. mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
  38497. mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
  38498. mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
  38499. mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
  38500. mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
  38501. mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
  38502. mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
  38503. mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
  38504. mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
  38505. mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
  38506. mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
  38507. mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
  38508. mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
  38509. };
  38510. poly1305.prototype.update = function(m, mpos, bytes) {
  38511. var i, want;
  38512. if (this.leftover) {
  38513. want = (16 - this.leftover);
  38514. if (want > bytes)
  38515. want = bytes;
  38516. for (i = 0; i < want; i++)
  38517. this.buffer[this.leftover + i] = m[mpos+i];
  38518. bytes -= want;
  38519. mpos += want;
  38520. this.leftover += want;
  38521. if (this.leftover < 16)
  38522. return;
  38523. this.blocks(this.buffer, 0, 16);
  38524. this.leftover = 0;
  38525. }
  38526. if (bytes >= 16) {
  38527. want = bytes - (bytes % 16);
  38528. this.blocks(m, mpos, want);
  38529. mpos += want;
  38530. bytes -= want;
  38531. }
  38532. if (bytes) {
  38533. for (i = 0; i < bytes; i++)
  38534. this.buffer[this.leftover + i] = m[mpos+i];
  38535. this.leftover += bytes;
  38536. }
  38537. };
  38538. function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
  38539. var s = new poly1305(k);
  38540. s.update(m, mpos, n);
  38541. s.finish(out, outpos);
  38542. return 0;
  38543. }
  38544. function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
  38545. var x = new Uint8Array(16);
  38546. crypto_onetimeauth(x,0,m,mpos,n,k);
  38547. return crypto_verify_16(h,hpos,x,0);
  38548. }
  38549. function crypto_secretbox(c,m,d,n,k) {
  38550. var i;
  38551. if (d < 32) return -1;
  38552. crypto_stream_xor(c,0,m,0,d,n,k);
  38553. crypto_onetimeauth(c, 16, c, 32, d - 32, c);
  38554. for (i = 0; i < 16; i++) c[i] = 0;
  38555. return 0;
  38556. }
  38557. function crypto_secretbox_open(m,c,d,n,k) {
  38558. var i;
  38559. var x = new Uint8Array(32);
  38560. if (d < 32) return -1;
  38561. crypto_stream(x,0,32,n,k);
  38562. if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
  38563. crypto_stream_xor(m,0,c,0,d,n,k);
  38564. for (i = 0; i < 32; i++) m[i] = 0;
  38565. return 0;
  38566. }
  38567. function set25519(r, a) {
  38568. var i;
  38569. for (i = 0; i < 16; i++) r[i] = a[i]|0;
  38570. }
  38571. function car25519(o) {
  38572. var i, v, c = 1;
  38573. for (i = 0; i < 16; i++) {
  38574. v = o[i] + c + 65535;
  38575. c = Math.floor(v / 65536);
  38576. o[i] = v - c * 65536;
  38577. }
  38578. o[0] += c-1 + 37 * (c-1);
  38579. }
  38580. function sel25519(p, q, b) {
  38581. var t, c = ~(b-1);
  38582. for (var i = 0; i < 16; i++) {
  38583. t = c & (p[i] ^ q[i]);
  38584. p[i] ^= t;
  38585. q[i] ^= t;
  38586. }
  38587. }
  38588. function pack25519(o, n) {
  38589. var i, j, b;
  38590. var m = gf(), t = gf();
  38591. for (i = 0; i < 16; i++) t[i] = n[i];
  38592. car25519(t);
  38593. car25519(t);
  38594. car25519(t);
  38595. for (j = 0; j < 2; j++) {
  38596. m[0] = t[0] - 0xffed;
  38597. for (i = 1; i < 15; i++) {
  38598. m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
  38599. m[i-1] &= 0xffff;
  38600. }
  38601. m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
  38602. b = (m[15]>>16) & 1;
  38603. m[14] &= 0xffff;
  38604. sel25519(t, m, 1-b);
  38605. }
  38606. for (i = 0; i < 16; i++) {
  38607. o[2*i] = t[i] & 0xff;
  38608. o[2*i+1] = t[i]>>8;
  38609. }
  38610. }
  38611. function neq25519(a, b) {
  38612. var c = new Uint8Array(32), d = new Uint8Array(32);
  38613. pack25519(c, a);
  38614. pack25519(d, b);
  38615. return crypto_verify_32(c, 0, d, 0);
  38616. }
  38617. function par25519(a) {
  38618. var d = new Uint8Array(32);
  38619. pack25519(d, a);
  38620. return d[0] & 1;
  38621. }
  38622. function unpack25519(o, n) {
  38623. var i;
  38624. for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
  38625. o[15] &= 0x7fff;
  38626. }
  38627. function A(o, a, b) {
  38628. for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
  38629. }
  38630. function Z(o, a, b) {
  38631. for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
  38632. }
  38633. function M(o, a, b) {
  38634. var v, c,
  38635. t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
  38636. t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
  38637. t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
  38638. t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
  38639. b0 = b[0],
  38640. b1 = b[1],
  38641. b2 = b[2],
  38642. b3 = b[3],
  38643. b4 = b[4],
  38644. b5 = b[5],
  38645. b6 = b[6],
  38646. b7 = b[7],
  38647. b8 = b[8],
  38648. b9 = b[9],
  38649. b10 = b[10],
  38650. b11 = b[11],
  38651. b12 = b[12],
  38652. b13 = b[13],
  38653. b14 = b[14],
  38654. b15 = b[15];
  38655. v = a[0];
  38656. t0 += v * b0;
  38657. t1 += v * b1;
  38658. t2 += v * b2;
  38659. t3 += v * b3;
  38660. t4 += v * b4;
  38661. t5 += v * b5;
  38662. t6 += v * b6;
  38663. t7 += v * b7;
  38664. t8 += v * b8;
  38665. t9 += v * b9;
  38666. t10 += v * b10;
  38667. t11 += v * b11;
  38668. t12 += v * b12;
  38669. t13 += v * b13;
  38670. t14 += v * b14;
  38671. t15 += v * b15;
  38672. v = a[1];
  38673. t1 += v * b0;
  38674. t2 += v * b1;
  38675. t3 += v * b2;
  38676. t4 += v * b3;
  38677. t5 += v * b4;
  38678. t6 += v * b5;
  38679. t7 += v * b6;
  38680. t8 += v * b7;
  38681. t9 += v * b8;
  38682. t10 += v * b9;
  38683. t11 += v * b10;
  38684. t12 += v * b11;
  38685. t13 += v * b12;
  38686. t14 += v * b13;
  38687. t15 += v * b14;
  38688. t16 += v * b15;
  38689. v = a[2];
  38690. t2 += v * b0;
  38691. t3 += v * b1;
  38692. t4 += v * b2;
  38693. t5 += v * b3;
  38694. t6 += v * b4;
  38695. t7 += v * b5;
  38696. t8 += v * b6;
  38697. t9 += v * b7;
  38698. t10 += v * b8;
  38699. t11 += v * b9;
  38700. t12 += v * b10;
  38701. t13 += v * b11;
  38702. t14 += v * b12;
  38703. t15 += v * b13;
  38704. t16 += v * b14;
  38705. t17 += v * b15;
  38706. v = a[3];
  38707. t3 += v * b0;
  38708. t4 += v * b1;
  38709. t5 += v * b2;
  38710. t6 += v * b3;
  38711. t7 += v * b4;
  38712. t8 += v * b5;
  38713. t9 += v * b6;
  38714. t10 += v * b7;
  38715. t11 += v * b8;
  38716. t12 += v * b9;
  38717. t13 += v * b10;
  38718. t14 += v * b11;
  38719. t15 += v * b12;
  38720. t16 += v * b13;
  38721. t17 += v * b14;
  38722. t18 += v * b15;
  38723. v = a[4];
  38724. t4 += v * b0;
  38725. t5 += v * b1;
  38726. t6 += v * b2;
  38727. t7 += v * b3;
  38728. t8 += v * b4;
  38729. t9 += v * b5;
  38730. t10 += v * b6;
  38731. t11 += v * b7;
  38732. t12 += v * b8;
  38733. t13 += v * b9;
  38734. t14 += v * b10;
  38735. t15 += v * b11;
  38736. t16 += v * b12;
  38737. t17 += v * b13;
  38738. t18 += v * b14;
  38739. t19 += v * b15;
  38740. v = a[5];
  38741. t5 += v * b0;
  38742. t6 += v * b1;
  38743. t7 += v * b2;
  38744. t8 += v * b3;
  38745. t9 += v * b4;
  38746. t10 += v * b5;
  38747. t11 += v * b6;
  38748. t12 += v * b7;
  38749. t13 += v * b8;
  38750. t14 += v * b9;
  38751. t15 += v * b10;
  38752. t16 += v * b11;
  38753. t17 += v * b12;
  38754. t18 += v * b13;
  38755. t19 += v * b14;
  38756. t20 += v * b15;
  38757. v = a[6];
  38758. t6 += v * b0;
  38759. t7 += v * b1;
  38760. t8 += v * b2;
  38761. t9 += v * b3;
  38762. t10 += v * b4;
  38763. t11 += v * b5;
  38764. t12 += v * b6;
  38765. t13 += v * b7;
  38766. t14 += v * b8;
  38767. t15 += v * b9;
  38768. t16 += v * b10;
  38769. t17 += v * b11;
  38770. t18 += v * b12;
  38771. t19 += v * b13;
  38772. t20 += v * b14;
  38773. t21 += v * b15;
  38774. v = a[7];
  38775. t7 += v * b0;
  38776. t8 += v * b1;
  38777. t9 += v * b2;
  38778. t10 += v * b3;
  38779. t11 += v * b4;
  38780. t12 += v * b5;
  38781. t13 += v * b6;
  38782. t14 += v * b7;
  38783. t15 += v * b8;
  38784. t16 += v * b9;
  38785. t17 += v * b10;
  38786. t18 += v * b11;
  38787. t19 += v * b12;
  38788. t20 += v * b13;
  38789. t21 += v * b14;
  38790. t22 += v * b15;
  38791. v = a[8];
  38792. t8 += v * b0;
  38793. t9 += v * b1;
  38794. t10 += v * b2;
  38795. t11 += v * b3;
  38796. t12 += v * b4;
  38797. t13 += v * b5;
  38798. t14 += v * b6;
  38799. t15 += v * b7;
  38800. t16 += v * b8;
  38801. t17 += v * b9;
  38802. t18 += v * b10;
  38803. t19 += v * b11;
  38804. t20 += v * b12;
  38805. t21 += v * b13;
  38806. t22 += v * b14;
  38807. t23 += v * b15;
  38808. v = a[9];
  38809. t9 += v * b0;
  38810. t10 += v * b1;
  38811. t11 += v * b2;
  38812. t12 += v * b3;
  38813. t13 += v * b4;
  38814. t14 += v * b5;
  38815. t15 += v * b6;
  38816. t16 += v * b7;
  38817. t17 += v * b8;
  38818. t18 += v * b9;
  38819. t19 += v * b10;
  38820. t20 += v * b11;
  38821. t21 += v * b12;
  38822. t22 += v * b13;
  38823. t23 += v * b14;
  38824. t24 += v * b15;
  38825. v = a[10];
  38826. t10 += v * b0;
  38827. t11 += v * b1;
  38828. t12 += v * b2;
  38829. t13 += v * b3;
  38830. t14 += v * b4;
  38831. t15 += v * b5;
  38832. t16 += v * b6;
  38833. t17 += v * b7;
  38834. t18 += v * b8;
  38835. t19 += v * b9;
  38836. t20 += v * b10;
  38837. t21 += v * b11;
  38838. t22 += v * b12;
  38839. t23 += v * b13;
  38840. t24 += v * b14;
  38841. t25 += v * b15;
  38842. v = a[11];
  38843. t11 += v * b0;
  38844. t12 += v * b1;
  38845. t13 += v * b2;
  38846. t14 += v * b3;
  38847. t15 += v * b4;
  38848. t16 += v * b5;
  38849. t17 += v * b6;
  38850. t18 += v * b7;
  38851. t19 += v * b8;
  38852. t20 += v * b9;
  38853. t21 += v * b10;
  38854. t22 += v * b11;
  38855. t23 += v * b12;
  38856. t24 += v * b13;
  38857. t25 += v * b14;
  38858. t26 += v * b15;
  38859. v = a[12];
  38860. t12 += v * b0;
  38861. t13 += v * b1;
  38862. t14 += v * b2;
  38863. t15 += v * b3;
  38864. t16 += v * b4;
  38865. t17 += v * b5;
  38866. t18 += v * b6;
  38867. t19 += v * b7;
  38868. t20 += v * b8;
  38869. t21 += v * b9;
  38870. t22 += v * b10;
  38871. t23 += v * b11;
  38872. t24 += v * b12;
  38873. t25 += v * b13;
  38874. t26 += v * b14;
  38875. t27 += v * b15;
  38876. v = a[13];
  38877. t13 += v * b0;
  38878. t14 += v * b1;
  38879. t15 += v * b2;
  38880. t16 += v * b3;
  38881. t17 += v * b4;
  38882. t18 += v * b5;
  38883. t19 += v * b6;
  38884. t20 += v * b7;
  38885. t21 += v * b8;
  38886. t22 += v * b9;
  38887. t23 += v * b10;
  38888. t24 += v * b11;
  38889. t25 += v * b12;
  38890. t26 += v * b13;
  38891. t27 += v * b14;
  38892. t28 += v * b15;
  38893. v = a[14];
  38894. t14 += v * b0;
  38895. t15 += v * b1;
  38896. t16 += v * b2;
  38897. t17 += v * b3;
  38898. t18 += v * b4;
  38899. t19 += v * b5;
  38900. t20 += v * b6;
  38901. t21 += v * b7;
  38902. t22 += v * b8;
  38903. t23 += v * b9;
  38904. t24 += v * b10;
  38905. t25 += v * b11;
  38906. t26 += v * b12;
  38907. t27 += v * b13;
  38908. t28 += v * b14;
  38909. t29 += v * b15;
  38910. v = a[15];
  38911. t15 += v * b0;
  38912. t16 += v * b1;
  38913. t17 += v * b2;
  38914. t18 += v * b3;
  38915. t19 += v * b4;
  38916. t20 += v * b5;
  38917. t21 += v * b6;
  38918. t22 += v * b7;
  38919. t23 += v * b8;
  38920. t24 += v * b9;
  38921. t25 += v * b10;
  38922. t26 += v * b11;
  38923. t27 += v * b12;
  38924. t28 += v * b13;
  38925. t29 += v * b14;
  38926. t30 += v * b15;
  38927. t0 += 38 * t16;
  38928. t1 += 38 * t17;
  38929. t2 += 38 * t18;
  38930. t3 += 38 * t19;
  38931. t4 += 38 * t20;
  38932. t5 += 38 * t21;
  38933. t6 += 38 * t22;
  38934. t7 += 38 * t23;
  38935. t8 += 38 * t24;
  38936. t9 += 38 * t25;
  38937. t10 += 38 * t26;
  38938. t11 += 38 * t27;
  38939. t12 += 38 * t28;
  38940. t13 += 38 * t29;
  38941. t14 += 38 * t30;
  38942. // t15 left as is
  38943. // first car
  38944. c = 1;
  38945. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38946. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38947. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38948. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38949. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38950. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38951. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38952. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38953. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38954. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38955. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38956. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38957. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38958. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38959. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38960. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38961. t0 += c-1 + 37 * (c-1);
  38962. // second car
  38963. c = 1;
  38964. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38965. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38966. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38967. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38968. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38969. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38970. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38971. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38972. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38973. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38974. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38975. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38976. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38977. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38978. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38979. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38980. t0 += c-1 + 37 * (c-1);
  38981. o[ 0] = t0;
  38982. o[ 1] = t1;
  38983. o[ 2] = t2;
  38984. o[ 3] = t3;
  38985. o[ 4] = t4;
  38986. o[ 5] = t5;
  38987. o[ 6] = t6;
  38988. o[ 7] = t7;
  38989. o[ 8] = t8;
  38990. o[ 9] = t9;
  38991. o[10] = t10;
  38992. o[11] = t11;
  38993. o[12] = t12;
  38994. o[13] = t13;
  38995. o[14] = t14;
  38996. o[15] = t15;
  38997. }
  38998. function S(o, a) {
  38999. M(o, a, a);
  39000. }
  39001. function inv25519(o, i) {
  39002. var c = gf();
  39003. var a;
  39004. for (a = 0; a < 16; a++) c[a] = i[a];
  39005. for (a = 253; a >= 0; a--) {
  39006. S(c, c);
  39007. if(a !== 2 && a !== 4) M(c, c, i);
  39008. }
  39009. for (a = 0; a < 16; a++) o[a] = c[a];
  39010. }
  39011. function pow2523(o, i) {
  39012. var c = gf();
  39013. var a;
  39014. for (a = 0; a < 16; a++) c[a] = i[a];
  39015. for (a = 250; a >= 0; a--) {
  39016. S(c, c);
  39017. if(a !== 1) M(c, c, i);
  39018. }
  39019. for (a = 0; a < 16; a++) o[a] = c[a];
  39020. }
  39021. function crypto_scalarmult(q, n, p) {
  39022. var z = new Uint8Array(32);
  39023. var x = new Float64Array(80), r, i;
  39024. var a = gf(), b = gf(), c = gf(),
  39025. d = gf(), e = gf(), f = gf();
  39026. for (i = 0; i < 31; i++) z[i] = n[i];
  39027. z[31]=(n[31]&127)|64;
  39028. z[0]&=248;
  39029. unpack25519(x,p);
  39030. for (i = 0; i < 16; i++) {
  39031. b[i]=x[i];
  39032. d[i]=a[i]=c[i]=0;
  39033. }
  39034. a[0]=d[0]=1;
  39035. for (i=254; i>=0; --i) {
  39036. r=(z[i>>>3]>>>(i&7))&1;
  39037. sel25519(a,b,r);
  39038. sel25519(c,d,r);
  39039. A(e,a,c);
  39040. Z(a,a,c);
  39041. A(c,b,d);
  39042. Z(b,b,d);
  39043. S(d,e);
  39044. S(f,a);
  39045. M(a,c,a);
  39046. M(c,b,e);
  39047. A(e,a,c);
  39048. Z(a,a,c);
  39049. S(b,a);
  39050. Z(c,d,f);
  39051. M(a,c,_121665);
  39052. A(a,a,d);
  39053. M(c,c,a);
  39054. M(a,d,f);
  39055. M(d,b,x);
  39056. S(b,e);
  39057. sel25519(a,b,r);
  39058. sel25519(c,d,r);
  39059. }
  39060. for (i = 0; i < 16; i++) {
  39061. x[i+16]=a[i];
  39062. x[i+32]=c[i];
  39063. x[i+48]=b[i];
  39064. x[i+64]=d[i];
  39065. }
  39066. var x32 = x.subarray(32);
  39067. var x16 = x.subarray(16);
  39068. inv25519(x32,x32);
  39069. M(x16,x16,x32);
  39070. pack25519(q,x16);
  39071. return 0;
  39072. }
  39073. function crypto_scalarmult_base(q, n) {
  39074. return crypto_scalarmult(q, n, _9);
  39075. }
  39076. function crypto_box_keypair(y, x) {
  39077. randombytes(x, 32);
  39078. return crypto_scalarmult_base(y, x);
  39079. }
  39080. function crypto_box_beforenm(k, y, x) {
  39081. var s = new Uint8Array(32);
  39082. crypto_scalarmult(s, x, y);
  39083. return crypto_core_hsalsa20(k, _0, s, sigma);
  39084. }
  39085. var crypto_box_afternm = crypto_secretbox;
  39086. var crypto_box_open_afternm = crypto_secretbox_open;
  39087. function crypto_box(c, m, d, n, y, x) {
  39088. var k = new Uint8Array(32);
  39089. crypto_box_beforenm(k, y, x);
  39090. return crypto_box_afternm(c, m, d, n, k);
  39091. }
  39092. function crypto_box_open(m, c, d, n, y, x) {
  39093. var k = new Uint8Array(32);
  39094. crypto_box_beforenm(k, y, x);
  39095. return crypto_box_open_afternm(m, c, d, n, k);
  39096. }
  39097. var K = [
  39098. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  39099. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  39100. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  39101. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  39102. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  39103. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  39104. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  39105. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  39106. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  39107. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  39108. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  39109. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  39110. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  39111. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  39112. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  39113. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  39114. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  39115. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  39116. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  39117. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  39118. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  39119. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  39120. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  39121. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  39122. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  39123. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  39124. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  39125. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  39126. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  39127. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  39128. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  39129. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  39130. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  39131. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  39132. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  39133. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  39134. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  39135. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  39136. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  39137. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  39138. ];
  39139. function crypto_hashblocks_hl(hh, hl, m, n) {
  39140. var wh = new Int32Array(16), wl = new Int32Array(16),
  39141. bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
  39142. bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
  39143. th, tl, i, j, h, l, a, b, c, d;
  39144. var ah0 = hh[0],
  39145. ah1 = hh[1],
  39146. ah2 = hh[2],
  39147. ah3 = hh[3],
  39148. ah4 = hh[4],
  39149. ah5 = hh[5],
  39150. ah6 = hh[6],
  39151. ah7 = hh[7],
  39152. al0 = hl[0],
  39153. al1 = hl[1],
  39154. al2 = hl[2],
  39155. al3 = hl[3],
  39156. al4 = hl[4],
  39157. al5 = hl[5],
  39158. al6 = hl[6],
  39159. al7 = hl[7];
  39160. var pos = 0;
  39161. while (n >= 128) {
  39162. for (i = 0; i < 16; i++) {
  39163. j = 8 * i + pos;
  39164. wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
  39165. wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
  39166. }
  39167. for (i = 0; i < 80; i++) {
  39168. bh0 = ah0;
  39169. bh1 = ah1;
  39170. bh2 = ah2;
  39171. bh3 = ah3;
  39172. bh4 = ah4;
  39173. bh5 = ah5;
  39174. bh6 = ah6;
  39175. bh7 = ah7;
  39176. bl0 = al0;
  39177. bl1 = al1;
  39178. bl2 = al2;
  39179. bl3 = al3;
  39180. bl4 = al4;
  39181. bl5 = al5;
  39182. bl6 = al6;
  39183. bl7 = al7;
  39184. // add
  39185. h = ah7;
  39186. l = al7;
  39187. a = l & 0xffff; b = l >>> 16;
  39188. c = h & 0xffff; d = h >>> 16;
  39189. // Sigma1
  39190. h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
  39191. l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
  39192. a += l & 0xffff; b += l >>> 16;
  39193. c += h & 0xffff; d += h >>> 16;
  39194. // Ch
  39195. h = (ah4 & ah5) ^ (~ah4 & ah6);
  39196. l = (al4 & al5) ^ (~al4 & al6);
  39197. a += l & 0xffff; b += l >>> 16;
  39198. c += h & 0xffff; d += h >>> 16;
  39199. // K
  39200. h = K[i*2];
  39201. l = K[i*2+1];
  39202. a += l & 0xffff; b += l >>> 16;
  39203. c += h & 0xffff; d += h >>> 16;
  39204. // w
  39205. h = wh[i%16];
  39206. l = wl[i%16];
  39207. a += l & 0xffff; b += l >>> 16;
  39208. c += h & 0xffff; d += h >>> 16;
  39209. b += a >>> 16;
  39210. c += b >>> 16;
  39211. d += c >>> 16;
  39212. th = c & 0xffff | d << 16;
  39213. tl = a & 0xffff | b << 16;
  39214. // add
  39215. h = th;
  39216. l = tl;
  39217. a = l & 0xffff; b = l >>> 16;
  39218. c = h & 0xffff; d = h >>> 16;
  39219. // Sigma0
  39220. h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
  39221. l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
  39222. a += l & 0xffff; b += l >>> 16;
  39223. c += h & 0xffff; d += h >>> 16;
  39224. // Maj
  39225. h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
  39226. l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
  39227. a += l & 0xffff; b += l >>> 16;
  39228. c += h & 0xffff; d += h >>> 16;
  39229. b += a >>> 16;
  39230. c += b >>> 16;
  39231. d += c >>> 16;
  39232. bh7 = (c & 0xffff) | (d << 16);
  39233. bl7 = (a & 0xffff) | (b << 16);
  39234. // add
  39235. h = bh3;
  39236. l = bl3;
  39237. a = l & 0xffff; b = l >>> 16;
  39238. c = h & 0xffff; d = h >>> 16;
  39239. h = th;
  39240. l = tl;
  39241. a += l & 0xffff; b += l >>> 16;
  39242. c += h & 0xffff; d += h >>> 16;
  39243. b += a >>> 16;
  39244. c += b >>> 16;
  39245. d += c >>> 16;
  39246. bh3 = (c & 0xffff) | (d << 16);
  39247. bl3 = (a & 0xffff) | (b << 16);
  39248. ah1 = bh0;
  39249. ah2 = bh1;
  39250. ah3 = bh2;
  39251. ah4 = bh3;
  39252. ah5 = bh4;
  39253. ah6 = bh5;
  39254. ah7 = bh6;
  39255. ah0 = bh7;
  39256. al1 = bl0;
  39257. al2 = bl1;
  39258. al3 = bl2;
  39259. al4 = bl3;
  39260. al5 = bl4;
  39261. al6 = bl5;
  39262. al7 = bl6;
  39263. al0 = bl7;
  39264. if (i%16 === 15) {
  39265. for (j = 0; j < 16; j++) {
  39266. // add
  39267. h = wh[j];
  39268. l = wl[j];
  39269. a = l & 0xffff; b = l >>> 16;
  39270. c = h & 0xffff; d = h >>> 16;
  39271. h = wh[(j+9)%16];
  39272. l = wl[(j+9)%16];
  39273. a += l & 0xffff; b += l >>> 16;
  39274. c += h & 0xffff; d += h >>> 16;
  39275. // sigma0
  39276. th = wh[(j+1)%16];
  39277. tl = wl[(j+1)%16];
  39278. h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
  39279. l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
  39280. a += l & 0xffff; b += l >>> 16;
  39281. c += h & 0xffff; d += h >>> 16;
  39282. // sigma1
  39283. th = wh[(j+14)%16];
  39284. tl = wl[(j+14)%16];
  39285. h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
  39286. l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
  39287. a += l & 0xffff; b += l >>> 16;
  39288. c += h & 0xffff; d += h >>> 16;
  39289. b += a >>> 16;
  39290. c += b >>> 16;
  39291. d += c >>> 16;
  39292. wh[j] = (c & 0xffff) | (d << 16);
  39293. wl[j] = (a & 0xffff) | (b << 16);
  39294. }
  39295. }
  39296. }
  39297. // add
  39298. h = ah0;
  39299. l = al0;
  39300. a = l & 0xffff; b = l >>> 16;
  39301. c = h & 0xffff; d = h >>> 16;
  39302. h = hh[0];
  39303. l = hl[0];
  39304. a += l & 0xffff; b += l >>> 16;
  39305. c += h & 0xffff; d += h >>> 16;
  39306. b += a >>> 16;
  39307. c += b >>> 16;
  39308. d += c >>> 16;
  39309. hh[0] = ah0 = (c & 0xffff) | (d << 16);
  39310. hl[0] = al0 = (a & 0xffff) | (b << 16);
  39311. h = ah1;
  39312. l = al1;
  39313. a = l & 0xffff; b = l >>> 16;
  39314. c = h & 0xffff; d = h >>> 16;
  39315. h = hh[1];
  39316. l = hl[1];
  39317. a += l & 0xffff; b += l >>> 16;
  39318. c += h & 0xffff; d += h >>> 16;
  39319. b += a >>> 16;
  39320. c += b >>> 16;
  39321. d += c >>> 16;
  39322. hh[1] = ah1 = (c & 0xffff) | (d << 16);
  39323. hl[1] = al1 = (a & 0xffff) | (b << 16);
  39324. h = ah2;
  39325. l = al2;
  39326. a = l & 0xffff; b = l >>> 16;
  39327. c = h & 0xffff; d = h >>> 16;
  39328. h = hh[2];
  39329. l = hl[2];
  39330. a += l & 0xffff; b += l >>> 16;
  39331. c += h & 0xffff; d += h >>> 16;
  39332. b += a >>> 16;
  39333. c += b >>> 16;
  39334. d += c >>> 16;
  39335. hh[2] = ah2 = (c & 0xffff) | (d << 16);
  39336. hl[2] = al2 = (a & 0xffff) | (b << 16);
  39337. h = ah3;
  39338. l = al3;
  39339. a = l & 0xffff; b = l >>> 16;
  39340. c = h & 0xffff; d = h >>> 16;
  39341. h = hh[3];
  39342. l = hl[3];
  39343. a += l & 0xffff; b += l >>> 16;
  39344. c += h & 0xffff; d += h >>> 16;
  39345. b += a >>> 16;
  39346. c += b >>> 16;
  39347. d += c >>> 16;
  39348. hh[3] = ah3 = (c & 0xffff) | (d << 16);
  39349. hl[3] = al3 = (a & 0xffff) | (b << 16);
  39350. h = ah4;
  39351. l = al4;
  39352. a = l & 0xffff; b = l >>> 16;
  39353. c = h & 0xffff; d = h >>> 16;
  39354. h = hh[4];
  39355. l = hl[4];
  39356. a += l & 0xffff; b += l >>> 16;
  39357. c += h & 0xffff; d += h >>> 16;
  39358. b += a >>> 16;
  39359. c += b >>> 16;
  39360. d += c >>> 16;
  39361. hh[4] = ah4 = (c & 0xffff) | (d << 16);
  39362. hl[4] = al4 = (a & 0xffff) | (b << 16);
  39363. h = ah5;
  39364. l = al5;
  39365. a = l & 0xffff; b = l >>> 16;
  39366. c = h & 0xffff; d = h >>> 16;
  39367. h = hh[5];
  39368. l = hl[5];
  39369. a += l & 0xffff; b += l >>> 16;
  39370. c += h & 0xffff; d += h >>> 16;
  39371. b += a >>> 16;
  39372. c += b >>> 16;
  39373. d += c >>> 16;
  39374. hh[5] = ah5 = (c & 0xffff) | (d << 16);
  39375. hl[5] = al5 = (a & 0xffff) | (b << 16);
  39376. h = ah6;
  39377. l = al6;
  39378. a = l & 0xffff; b = l >>> 16;
  39379. c = h & 0xffff; d = h >>> 16;
  39380. h = hh[6];
  39381. l = hl[6];
  39382. a += l & 0xffff; b += l >>> 16;
  39383. c += h & 0xffff; d += h >>> 16;
  39384. b += a >>> 16;
  39385. c += b >>> 16;
  39386. d += c >>> 16;
  39387. hh[6] = ah6 = (c & 0xffff) | (d << 16);
  39388. hl[6] = al6 = (a & 0xffff) | (b << 16);
  39389. h = ah7;
  39390. l = al7;
  39391. a = l & 0xffff; b = l >>> 16;
  39392. c = h & 0xffff; d = h >>> 16;
  39393. h = hh[7];
  39394. l = hl[7];
  39395. a += l & 0xffff; b += l >>> 16;
  39396. c += h & 0xffff; d += h >>> 16;
  39397. b += a >>> 16;
  39398. c += b >>> 16;
  39399. d += c >>> 16;
  39400. hh[7] = ah7 = (c & 0xffff) | (d << 16);
  39401. hl[7] = al7 = (a & 0xffff) | (b << 16);
  39402. pos += 128;
  39403. n -= 128;
  39404. }
  39405. return n;
  39406. }
  39407. function crypto_hash(out, m, n) {
  39408. var hh = new Int32Array(8),
  39409. hl = new Int32Array(8),
  39410. x = new Uint8Array(256),
  39411. i, b = n;
  39412. hh[0] = 0x6a09e667;
  39413. hh[1] = 0xbb67ae85;
  39414. hh[2] = 0x3c6ef372;
  39415. hh[3] = 0xa54ff53a;
  39416. hh[4] = 0x510e527f;
  39417. hh[5] = 0x9b05688c;
  39418. hh[6] = 0x1f83d9ab;
  39419. hh[7] = 0x5be0cd19;
  39420. hl[0] = 0xf3bcc908;
  39421. hl[1] = 0x84caa73b;
  39422. hl[2] = 0xfe94f82b;
  39423. hl[3] = 0x5f1d36f1;
  39424. hl[4] = 0xade682d1;
  39425. hl[5] = 0x2b3e6c1f;
  39426. hl[6] = 0xfb41bd6b;
  39427. hl[7] = 0x137e2179;
  39428. crypto_hashblocks_hl(hh, hl, m, n);
  39429. n %= 128;
  39430. for (i = 0; i < n; i++) x[i] = m[b-n+i];
  39431. x[n] = 128;
  39432. n = 256-128*(n<112?1:0);
  39433. x[n-9] = 0;
  39434. ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
  39435. crypto_hashblocks_hl(hh, hl, x, n);
  39436. for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
  39437. return 0;
  39438. }
  39439. function add(p, q) {
  39440. var a = gf(), b = gf(), c = gf(),
  39441. d = gf(), e = gf(), f = gf(),
  39442. g = gf(), h = gf(), t = gf();
  39443. Z(a, p[1], p[0]);
  39444. Z(t, q[1], q[0]);
  39445. M(a, a, t);
  39446. A(b, p[0], p[1]);
  39447. A(t, q[0], q[1]);
  39448. M(b, b, t);
  39449. M(c, p[3], q[3]);
  39450. M(c, c, D2);
  39451. M(d, p[2], q[2]);
  39452. A(d, d, d);
  39453. Z(e, b, a);
  39454. Z(f, d, c);
  39455. A(g, d, c);
  39456. A(h, b, a);
  39457. M(p[0], e, f);
  39458. M(p[1], h, g);
  39459. M(p[2], g, f);
  39460. M(p[3], e, h);
  39461. }
  39462. function cswap(p, q, b) {
  39463. var i;
  39464. for (i = 0; i < 4; i++) {
  39465. sel25519(p[i], q[i], b);
  39466. }
  39467. }
  39468. function pack(r, p) {
  39469. var tx = gf(), ty = gf(), zi = gf();
  39470. inv25519(zi, p[2]);
  39471. M(tx, p[0], zi);
  39472. M(ty, p[1], zi);
  39473. pack25519(r, ty);
  39474. r[31] ^= par25519(tx) << 7;
  39475. }
  39476. function scalarmult(p, q, s) {
  39477. var b, i;
  39478. set25519(p[0], gf0);
  39479. set25519(p[1], gf1);
  39480. set25519(p[2], gf1);
  39481. set25519(p[3], gf0);
  39482. for (i = 255; i >= 0; --i) {
  39483. b = (s[(i/8)|0] >> (i&7)) & 1;
  39484. cswap(p, q, b);
  39485. add(q, p);
  39486. add(p, p);
  39487. cswap(p, q, b);
  39488. }
  39489. }
  39490. function scalarbase(p, s) {
  39491. var q = [gf(), gf(), gf(), gf()];
  39492. set25519(q[0], X);
  39493. set25519(q[1], Y);
  39494. set25519(q[2], gf1);
  39495. M(q[3], X, Y);
  39496. scalarmult(p, q, s);
  39497. }
  39498. function crypto_sign_keypair(pk, sk, seeded) {
  39499. var d = new Uint8Array(64);
  39500. var p = [gf(), gf(), gf(), gf()];
  39501. var i;
  39502. if (!seeded) randombytes(sk, 32);
  39503. crypto_hash(d, sk, 32);
  39504. d[0] &= 248;
  39505. d[31] &= 127;
  39506. d[31] |= 64;
  39507. scalarbase(p, d);
  39508. pack(pk, p);
  39509. for (i = 0; i < 32; i++) sk[i+32] = pk[i];
  39510. return 0;
  39511. }
  39512. 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]);
  39513. function modL(r, x) {
  39514. var carry, i, j, k;
  39515. for (i = 63; i >= 32; --i) {
  39516. carry = 0;
  39517. for (j = i - 32, k = i - 12; j < k; ++j) {
  39518. x[j] += carry - 16 * x[i] * L[j - (i - 32)];
  39519. carry = (x[j] + 128) >> 8;
  39520. x[j] -= carry * 256;
  39521. }
  39522. x[j] += carry;
  39523. x[i] = 0;
  39524. }
  39525. carry = 0;
  39526. for (j = 0; j < 32; j++) {
  39527. x[j] += carry - (x[31] >> 4) * L[j];
  39528. carry = x[j] >> 8;
  39529. x[j] &= 255;
  39530. }
  39531. for (j = 0; j < 32; j++) x[j] -= carry * L[j];
  39532. for (i = 0; i < 32; i++) {
  39533. x[i+1] += x[i] >> 8;
  39534. r[i] = x[i] & 255;
  39535. }
  39536. }
  39537. function reduce(r) {
  39538. var x = new Float64Array(64), i;
  39539. for (i = 0; i < 64; i++) x[i] = r[i];
  39540. for (i = 0; i < 64; i++) r[i] = 0;
  39541. modL(r, x);
  39542. }
  39543. // Note: difference from C - smlen returned, not passed as argument.
  39544. function crypto_sign(sm, m, n, sk) {
  39545. var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
  39546. var i, j, x = new Float64Array(64);
  39547. var p = [gf(), gf(), gf(), gf()];
  39548. crypto_hash(d, sk, 32);
  39549. d[0] &= 248;
  39550. d[31] &= 127;
  39551. d[31] |= 64;
  39552. var smlen = n + 64;
  39553. for (i = 0; i < n; i++) sm[64 + i] = m[i];
  39554. for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
  39555. crypto_hash(r, sm.subarray(32), n+32);
  39556. reduce(r);
  39557. scalarbase(p, r);
  39558. pack(sm, p);
  39559. for (i = 32; i < 64; i++) sm[i] = sk[i];
  39560. crypto_hash(h, sm, n + 64);
  39561. reduce(h);
  39562. for (i = 0; i < 64; i++) x[i] = 0;
  39563. for (i = 0; i < 32; i++) x[i] = r[i];
  39564. for (i = 0; i < 32; i++) {
  39565. for (j = 0; j < 32; j++) {
  39566. x[i+j] += h[i] * d[j];
  39567. }
  39568. }
  39569. modL(sm.subarray(32), x);
  39570. return smlen;
  39571. }
  39572. function unpackneg(r, p) {
  39573. var t = gf(), chk = gf(), num = gf(),
  39574. den = gf(), den2 = gf(), den4 = gf(),
  39575. den6 = gf();
  39576. set25519(r[2], gf1);
  39577. unpack25519(r[1], p);
  39578. S(num, r[1]);
  39579. M(den, num, D);
  39580. Z(num, num, r[2]);
  39581. A(den, r[2], den);
  39582. S(den2, den);
  39583. S(den4, den2);
  39584. M(den6, den4, den2);
  39585. M(t, den6, num);
  39586. M(t, t, den);
  39587. pow2523(t, t);
  39588. M(t, t, num);
  39589. M(t, t, den);
  39590. M(t, t, den);
  39591. M(r[0], t, den);
  39592. S(chk, r[0]);
  39593. M(chk, chk, den);
  39594. if (neq25519(chk, num)) M(r[0], r[0], I);
  39595. S(chk, r[0]);
  39596. M(chk, chk, den);
  39597. if (neq25519(chk, num)) return -1;
  39598. if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
  39599. M(r[3], r[0], r[1]);
  39600. return 0;
  39601. }
  39602. function crypto_sign_open(m, sm, n, pk) {
  39603. var i, mlen;
  39604. var t = new Uint8Array(32), h = new Uint8Array(64);
  39605. var p = [gf(), gf(), gf(), gf()],
  39606. q = [gf(), gf(), gf(), gf()];
  39607. mlen = -1;
  39608. if (n < 64) return -1;
  39609. if (unpackneg(q, pk)) return -1;
  39610. for (i = 0; i < n; i++) m[i] = sm[i];
  39611. for (i = 0; i < 32; i++) m[i+32] = pk[i];
  39612. crypto_hash(h, m, n);
  39613. reduce(h);
  39614. scalarmult(p, q, h);
  39615. scalarbase(q, sm.subarray(32));
  39616. add(p, q);
  39617. pack(t, p);
  39618. n -= 64;
  39619. if (crypto_verify_32(sm, 0, t, 0)) {
  39620. for (i = 0; i < n; i++) m[i] = 0;
  39621. return -1;
  39622. }
  39623. for (i = 0; i < n; i++) m[i] = sm[i + 64];
  39624. mlen = n;
  39625. return mlen;
  39626. }
  39627. var crypto_secretbox_KEYBYTES = 32,
  39628. crypto_secretbox_NONCEBYTES = 24,
  39629. crypto_secretbox_ZEROBYTES = 32,
  39630. crypto_secretbox_BOXZEROBYTES = 16,
  39631. crypto_scalarmult_BYTES = 32,
  39632. crypto_scalarmult_SCALARBYTES = 32,
  39633. crypto_box_PUBLICKEYBYTES = 32,
  39634. crypto_box_SECRETKEYBYTES = 32,
  39635. crypto_box_BEFORENMBYTES = 32,
  39636. crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
  39637. crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
  39638. crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
  39639. crypto_sign_BYTES = 64,
  39640. crypto_sign_PUBLICKEYBYTES = 32,
  39641. crypto_sign_SECRETKEYBYTES = 64,
  39642. crypto_sign_SEEDBYTES = 32,
  39643. crypto_hash_BYTES = 64;
  39644. nacl.lowlevel = {
  39645. crypto_core_hsalsa20: crypto_core_hsalsa20,
  39646. crypto_stream_xor: crypto_stream_xor,
  39647. crypto_stream: crypto_stream,
  39648. crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
  39649. crypto_stream_salsa20: crypto_stream_salsa20,
  39650. crypto_onetimeauth: crypto_onetimeauth,
  39651. crypto_onetimeauth_verify: crypto_onetimeauth_verify,
  39652. crypto_verify_16: crypto_verify_16,
  39653. crypto_verify_32: crypto_verify_32,
  39654. crypto_secretbox: crypto_secretbox,
  39655. crypto_secretbox_open: crypto_secretbox_open,
  39656. crypto_scalarmult: crypto_scalarmult,
  39657. crypto_scalarmult_base: crypto_scalarmult_base,
  39658. crypto_box_beforenm: crypto_box_beforenm,
  39659. crypto_box_afternm: crypto_box_afternm,
  39660. crypto_box: crypto_box,
  39661. crypto_box_open: crypto_box_open,
  39662. crypto_box_keypair: crypto_box_keypair,
  39663. crypto_hash: crypto_hash,
  39664. crypto_sign: crypto_sign,
  39665. crypto_sign_keypair: crypto_sign_keypair,
  39666. crypto_sign_open: crypto_sign_open,
  39667. crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
  39668. crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
  39669. crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
  39670. crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
  39671. crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
  39672. crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
  39673. crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
  39674. crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
  39675. crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
  39676. crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
  39677. crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
  39678. crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
  39679. crypto_sign_BYTES: crypto_sign_BYTES,
  39680. crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
  39681. crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
  39682. crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
  39683. crypto_hash_BYTES: crypto_hash_BYTES
  39684. };
  39685. /* High-level API */
  39686. function checkLengths(k, n) {
  39687. if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
  39688. if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
  39689. }
  39690. function checkBoxLengths(pk, sk) {
  39691. if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
  39692. if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
  39693. }
  39694. function checkArrayTypes() {
  39695. for (var i = 0; i < arguments.length; i++) {
  39696. if (!(arguments[i] instanceof Uint8Array))
  39697. throw new TypeError('unexpected type, use Uint8Array');
  39698. }
  39699. }
  39700. function cleanup(arr) {
  39701. for (var i = 0; i < arr.length; i++) arr[i] = 0;
  39702. }
  39703. nacl.randomBytes = function(n) {
  39704. var b = new Uint8Array(n);
  39705. randombytes(b, n);
  39706. return b;
  39707. };
  39708. nacl.secretbox = function(msg, nonce, key) {
  39709. checkArrayTypes(msg, nonce, key);
  39710. checkLengths(key, nonce);
  39711. var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
  39712. var c = new Uint8Array(m.length);
  39713. for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
  39714. crypto_secretbox(c, m, m.length, nonce, key);
  39715. return c.subarray(crypto_secretbox_BOXZEROBYTES);
  39716. };
  39717. nacl.secretbox.open = function(box, nonce, key) {
  39718. checkArrayTypes(box, nonce, key);
  39719. checkLengths(key, nonce);
  39720. var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
  39721. var m = new Uint8Array(c.length);
  39722. for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
  39723. if (c.length < 32) return null;
  39724. if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
  39725. return m.subarray(crypto_secretbox_ZEROBYTES);
  39726. };
  39727. nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
  39728. nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
  39729. nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
  39730. nacl.scalarMult = function(n, p) {
  39731. checkArrayTypes(n, p);
  39732. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  39733. if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
  39734. var q = new Uint8Array(crypto_scalarmult_BYTES);
  39735. crypto_scalarmult(q, n, p);
  39736. return q;
  39737. };
  39738. nacl.scalarMult.base = function(n) {
  39739. checkArrayTypes(n);
  39740. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  39741. var q = new Uint8Array(crypto_scalarmult_BYTES);
  39742. crypto_scalarmult_base(q, n);
  39743. return q;
  39744. };
  39745. nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
  39746. nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
  39747. nacl.box = function(msg, nonce, publicKey, secretKey) {
  39748. var k = nacl.box.before(publicKey, secretKey);
  39749. return nacl.secretbox(msg, nonce, k);
  39750. };
  39751. nacl.box.before = function(publicKey, secretKey) {
  39752. checkArrayTypes(publicKey, secretKey);
  39753. checkBoxLengths(publicKey, secretKey);
  39754. var k = new Uint8Array(crypto_box_BEFORENMBYTES);
  39755. crypto_box_beforenm(k, publicKey, secretKey);
  39756. return k;
  39757. };
  39758. nacl.box.after = nacl.secretbox;
  39759. nacl.box.open = function(msg, nonce, publicKey, secretKey) {
  39760. var k = nacl.box.before(publicKey, secretKey);
  39761. return nacl.secretbox.open(msg, nonce, k);
  39762. };
  39763. nacl.box.open.after = nacl.secretbox.open;
  39764. nacl.box.keyPair = function() {
  39765. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  39766. var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
  39767. crypto_box_keypair(pk, sk);
  39768. return {publicKey: pk, secretKey: sk};
  39769. };
  39770. nacl.box.keyPair.fromSecretKey = function(secretKey) {
  39771. checkArrayTypes(secretKey);
  39772. if (secretKey.length !== crypto_box_SECRETKEYBYTES)
  39773. throw new Error('bad secret key size');
  39774. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  39775. crypto_scalarmult_base(pk, secretKey);
  39776. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  39777. };
  39778. nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
  39779. nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
  39780. nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
  39781. nacl.box.nonceLength = crypto_box_NONCEBYTES;
  39782. nacl.box.overheadLength = nacl.secretbox.overheadLength;
  39783. nacl.sign = function(msg, secretKey) {
  39784. checkArrayTypes(msg, secretKey);
  39785. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  39786. throw new Error('bad secret key size');
  39787. var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
  39788. crypto_sign(signedMsg, msg, msg.length, secretKey);
  39789. return signedMsg;
  39790. };
  39791. nacl.sign.open = function(signedMsg, publicKey) {
  39792. checkArrayTypes(signedMsg, publicKey);
  39793. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  39794. throw new Error('bad public key size');
  39795. var tmp = new Uint8Array(signedMsg.length);
  39796. var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
  39797. if (mlen < 0) return null;
  39798. var m = new Uint8Array(mlen);
  39799. for (var i = 0; i < m.length; i++) m[i] = tmp[i];
  39800. return m;
  39801. };
  39802. nacl.sign.detached = function(msg, secretKey) {
  39803. var signedMsg = nacl.sign(msg, secretKey);
  39804. var sig = new Uint8Array(crypto_sign_BYTES);
  39805. for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
  39806. return sig;
  39807. };
  39808. nacl.sign.detached.verify = function(msg, sig, publicKey) {
  39809. checkArrayTypes(msg, sig, publicKey);
  39810. if (sig.length !== crypto_sign_BYTES)
  39811. throw new Error('bad signature size');
  39812. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  39813. throw new Error('bad public key size');
  39814. var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
  39815. var m = new Uint8Array(crypto_sign_BYTES + msg.length);
  39816. var i;
  39817. for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
  39818. for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
  39819. return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
  39820. };
  39821. nacl.sign.keyPair = function() {
  39822. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39823. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  39824. crypto_sign_keypair(pk, sk);
  39825. return {publicKey: pk, secretKey: sk};
  39826. };
  39827. nacl.sign.keyPair.fromSecretKey = function(secretKey) {
  39828. checkArrayTypes(secretKey);
  39829. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  39830. throw new Error('bad secret key size');
  39831. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39832. for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
  39833. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  39834. };
  39835. nacl.sign.keyPair.fromSeed = function(seed) {
  39836. checkArrayTypes(seed);
  39837. if (seed.length !== crypto_sign_SEEDBYTES)
  39838. throw new Error('bad seed size');
  39839. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39840. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  39841. for (var i = 0; i < 32; i++) sk[i] = seed[i];
  39842. crypto_sign_keypair(pk, sk, true);
  39843. return {publicKey: pk, secretKey: sk};
  39844. };
  39845. nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
  39846. nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
  39847. nacl.sign.seedLength = crypto_sign_SEEDBYTES;
  39848. nacl.sign.signatureLength = crypto_sign_BYTES;
  39849. nacl.hash = function(msg) {
  39850. checkArrayTypes(msg);
  39851. var h = new Uint8Array(crypto_hash_BYTES);
  39852. crypto_hash(h, msg, msg.length);
  39853. return h;
  39854. };
  39855. nacl.hash.hashLength = crypto_hash_BYTES;
  39856. nacl.verify = function(x, y) {
  39857. checkArrayTypes(x, y);
  39858. // Zero length arguments are considered not equal.
  39859. if (x.length === 0 || y.length === 0) return false;
  39860. if (x.length !== y.length) return false;
  39861. return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
  39862. };
  39863. nacl.setPRNG = function(fn) {
  39864. randombytes = fn;
  39865. };
  39866. (function() {
  39867. // Initialize PRNG if environment provides CSPRNG.
  39868. // If not, methods calling randombytes will throw.
  39869. var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
  39870. if (crypto && crypto.getRandomValues) {
  39871. // Browsers.
  39872. var QUOTA = 65536;
  39873. nacl.setPRNG(function(x, n) {
  39874. var i, v = new Uint8Array(n);
  39875. for (i = 0; i < n; i += QUOTA) {
  39876. crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
  39877. }
  39878. for (i = 0; i < n; i++) x[i] = v[i];
  39879. cleanup(v);
  39880. });
  39881. } else if (true) {
  39882. // Node.js.
  39883. crypto = __webpack_require__(3);
  39884. if (crypto && crypto.randomBytes) {
  39885. nacl.setPRNG(function(x, n) {
  39886. var i, v = crypto.randomBytes(n);
  39887. for (i = 0; i < n; i++) x[i] = v[i];
  39888. cleanup(v);
  39889. });
  39890. }
  39891. }
  39892. })();
  39893. })( true && module.exports ? module.exports : (self.nacl = self.nacl || {}));
  39894. /***/ }),
  39895. /* 1 */
  39896. /***/ (function(module, exports, __webpack_require__) {
  39897. // Written in 2014-2016 by Dmitry Chestnykh and Devi Mandiri.
  39898. // Public domain.
  39899. (function(root, f) {
  39900. 'use strict';
  39901. if ( true && module.exports) module.exports = f();
  39902. else if (root.nacl) root.nacl.util = f();
  39903. else {
  39904. root.nacl = {};
  39905. root.nacl.util = f();
  39906. }
  39907. }(this, function() {
  39908. 'use strict';
  39909. var util = {};
  39910. function validateBase64(s) {
  39911. if (!(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s))) {
  39912. throw new TypeError('invalid encoding');
  39913. }
  39914. }
  39915. util.decodeUTF8 = function(s) {
  39916. if (typeof s !== 'string') throw new TypeError('expected string');
  39917. var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
  39918. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39919. return b;
  39920. };
  39921. util.encodeUTF8 = function(arr) {
  39922. var i, s = [];
  39923. for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
  39924. return decodeURIComponent(escape(s.join('')));
  39925. };
  39926. if (typeof atob === 'undefined') {
  39927. // Node.js
  39928. if (typeof Buffer.from !== 'undefined') {
  39929. // Node v6 and later
  39930. util.encodeBase64 = function (arr) { // v6 and later
  39931. return Buffer.from(arr).toString('base64');
  39932. };
  39933. util.decodeBase64 = function (s) {
  39934. validateBase64(s);
  39935. return new Uint8Array(Array.prototype.slice.call(Buffer.from(s, 'base64'), 0));
  39936. };
  39937. } else {
  39938. // Node earlier than v6
  39939. util.encodeBase64 = function (arr) { // v6 and later
  39940. return (new Buffer(arr)).toString('base64');
  39941. };
  39942. util.decodeBase64 = function(s) {
  39943. validateBase64(s);
  39944. return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
  39945. };
  39946. }
  39947. } else {
  39948. // Browsers
  39949. util.encodeBase64 = function(arr) {
  39950. var i, s = [], len = arr.length;
  39951. for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
  39952. return btoa(s.join(''));
  39953. };
  39954. util.decodeBase64 = function(s) {
  39955. validateBase64(s);
  39956. var i, d = atob(s), b = new Uint8Array(d.length);
  39957. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39958. return b;
  39959. };
  39960. }
  39961. return util;
  39962. }));
  39963. /***/ }),
  39964. /* 2 */
  39965. /***/ (function(module, exports, __webpack_require__) {
  39966. // required so we don't have to do require('pusher').default etc.
  39967. module.exports = __webpack_require__(4).default;
  39968. /***/ }),
  39969. /* 3 */
  39970. /***/ (function(module, exports) {
  39971. /* (ignored) */
  39972. /***/ }),
  39973. /* 4 */
  39974. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  39975. "use strict";
  39976. __webpack_require__.r(__webpack_exports__);
  39977. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_receiver_factory.ts
  39978. var ScriptReceiverFactory = (function () {
  39979. function ScriptReceiverFactory(prefix, name) {
  39980. this.lastId = 0;
  39981. this.prefix = prefix;
  39982. this.name = name;
  39983. }
  39984. ScriptReceiverFactory.prototype.create = function (callback) {
  39985. this.lastId++;
  39986. var number = this.lastId;
  39987. var id = this.prefix + number;
  39988. var name = this.name + "[" + number + "]";
  39989. var called = false;
  39990. var callbackWrapper = function () {
  39991. if (!called) {
  39992. callback.apply(null, arguments);
  39993. called = true;
  39994. }
  39995. };
  39996. this[number] = callbackWrapper;
  39997. return { number: number, id: id, name: name, callback: callbackWrapper };
  39998. };
  39999. ScriptReceiverFactory.prototype.remove = function (receiver) {
  40000. delete this[receiver.number];
  40001. };
  40002. return ScriptReceiverFactory;
  40003. }());
  40004. var ScriptReceivers = new ScriptReceiverFactory("_pusher_script_", "Pusher.ScriptReceivers");
  40005. // CONCATENATED MODULE: ./src/core/defaults.ts
  40006. var Defaults = {
  40007. VERSION: "5.0.3",
  40008. PROTOCOL: 7,
  40009. host: 'ws.pusherapp.com',
  40010. ws_port: 80,
  40011. wss_port: 443,
  40012. ws_path: '',
  40013. sockjs_host: 'sockjs.pusher.com',
  40014. sockjs_http_port: 80,
  40015. sockjs_https_port: 443,
  40016. sockjs_path: '/pusher',
  40017. stats_host: 'stats.pusher.com',
  40018. channel_auth_endpoint: '/pusher/auth',
  40019. channel_auth_transport: 'ajax',
  40020. activity_timeout: 120000,
  40021. pong_timeout: 30000,
  40022. unavailable_timeout: 10000,
  40023. cdn_http: "http://js.pusher.com",
  40024. cdn_https: "https://js.pusher.com",
  40025. dependency_suffix: ""
  40026. };
  40027. /* harmony default export */ var defaults = (Defaults);
  40028. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependency_loader.ts
  40029. var dependency_loader_DependencyLoader = (function () {
  40030. function DependencyLoader(options) {
  40031. this.options = options;
  40032. this.receivers = options.receivers || ScriptReceivers;
  40033. this.loading = {};
  40034. }
  40035. DependencyLoader.prototype.load = function (name, options, callback) {
  40036. var self = this;
  40037. if (self.loading[name] && self.loading[name].length > 0) {
  40038. self.loading[name].push(callback);
  40039. }
  40040. else {
  40041. self.loading[name] = [callback];
  40042. var request = runtime.createScriptRequest(self.getPath(name, options));
  40043. var receiver = self.receivers.create(function (error) {
  40044. self.receivers.remove(receiver);
  40045. if (self.loading[name]) {
  40046. var callbacks = self.loading[name];
  40047. delete self.loading[name];
  40048. var successCallback = function (wasSuccessful) {
  40049. if (!wasSuccessful) {
  40050. request.cleanup();
  40051. }
  40052. };
  40053. for (var i = 0; i < callbacks.length; i++) {
  40054. callbacks[i](error, successCallback);
  40055. }
  40056. }
  40057. });
  40058. request.send(receiver);
  40059. }
  40060. };
  40061. DependencyLoader.prototype.getRoot = function (options) {
  40062. var cdn;
  40063. var protocol = runtime.getDocument().location.protocol;
  40064. if ((options && options.useTLS) || protocol === "https:") {
  40065. cdn = this.options.cdn_https;
  40066. }
  40067. else {
  40068. cdn = this.options.cdn_http;
  40069. }
  40070. return cdn.replace(/\/*$/, "") + "/" + this.options.version;
  40071. };
  40072. DependencyLoader.prototype.getPath = function (name, options) {
  40073. return this.getRoot(options) + '/' + name + this.options.suffix + '.js';
  40074. };
  40075. ;
  40076. return DependencyLoader;
  40077. }());
  40078. /* harmony default export */ var dependency_loader = (dependency_loader_DependencyLoader);
  40079. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependencies.ts
  40080. var DependenciesReceivers = new ScriptReceiverFactory("_pusher_dependencies", "Pusher.DependenciesReceivers");
  40081. var Dependencies = new dependency_loader({
  40082. cdn_http: defaults.cdn_http,
  40083. cdn_https: defaults.cdn_https,
  40084. version: defaults.VERSION,
  40085. suffix: defaults.dependency_suffix,
  40086. receivers: DependenciesReceivers
  40087. });
  40088. // CONCATENATED MODULE: ./src/core/base64.ts
  40089. function encode(s) {
  40090. return btoa(utob(s));
  40091. }
  40092. var fromCharCode = String.fromCharCode;
  40093. var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  40094. var b64tab = {};
  40095. for (var base64_i = 0, l = b64chars.length; base64_i < l; base64_i++) {
  40096. b64tab[b64chars.charAt(base64_i)] = base64_i;
  40097. }
  40098. var cb_utob = function (c) {
  40099. var cc = c.charCodeAt(0);
  40100. return cc < 0x80
  40101. ? c
  40102. : cc < 0x800
  40103. ? fromCharCode(0xc0 | (cc >>> 6)) + fromCharCode(0x80 | (cc & 0x3f))
  40104. : fromCharCode(0xe0 | ((cc >>> 12) & 0x0f)) +
  40105. fromCharCode(0x80 | ((cc >>> 6) & 0x3f)) +
  40106. fromCharCode(0x80 | (cc & 0x3f));
  40107. };
  40108. var utob = function (u) {
  40109. return u.replace(/[^\x00-\x7F]/g, cb_utob);
  40110. };
  40111. var cb_encode = function (ccc) {
  40112. var padlen = [0, 2, 1][ccc.length % 3];
  40113. var ord = (ccc.charCodeAt(0) << 16) |
  40114. ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8) |
  40115. (ccc.length > 2 ? ccc.charCodeAt(2) : 0);
  40116. var chars = [
  40117. b64chars.charAt(ord >>> 18),
  40118. b64chars.charAt((ord >>> 12) & 63),
  40119. padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
  40120. padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
  40121. ];
  40122. return chars.join('');
  40123. };
  40124. var btoa = window.btoa ||
  40125. function (b) {
  40126. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  40127. };
  40128. // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
  40129. var Timer = (function () {
  40130. function Timer(set, clear, delay, callback) {
  40131. var _this = this;
  40132. this.clear = clear;
  40133. this.timer = set(function () {
  40134. if (_this.timer) {
  40135. _this.timer = callback(_this.timer);
  40136. }
  40137. }, delay);
  40138. }
  40139. Timer.prototype.isRunning = function () {
  40140. return this.timer !== null;
  40141. };
  40142. Timer.prototype.ensureAborted = function () {
  40143. if (this.timer) {
  40144. this.clear(this.timer);
  40145. this.timer = null;
  40146. }
  40147. };
  40148. return Timer;
  40149. }());
  40150. /* harmony default export */ var abstract_timer = (Timer);
  40151. // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
  40152. var __extends = (undefined && undefined.__extends) || (function () {
  40153. var extendStatics = function (d, b) {
  40154. extendStatics = Object.setPrototypeOf ||
  40155. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40156. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40157. return extendStatics(d, b);
  40158. };
  40159. return function (d, b) {
  40160. extendStatics(d, b);
  40161. function __() { this.constructor = d; }
  40162. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40163. };
  40164. })();
  40165. function timers_clearTimeout(timer) {
  40166. window.clearTimeout(timer);
  40167. }
  40168. function timers_clearInterval(timer) {
  40169. window.clearInterval(timer);
  40170. }
  40171. var OneOffTimer = (function (_super) {
  40172. __extends(OneOffTimer, _super);
  40173. function OneOffTimer(delay, callback) {
  40174. return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
  40175. callback();
  40176. return null;
  40177. }) || this;
  40178. }
  40179. return OneOffTimer;
  40180. }(abstract_timer));
  40181. var PeriodicTimer = (function (_super) {
  40182. __extends(PeriodicTimer, _super);
  40183. function PeriodicTimer(delay, callback) {
  40184. return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
  40185. callback();
  40186. return timer;
  40187. }) || this;
  40188. }
  40189. return PeriodicTimer;
  40190. }(abstract_timer));
  40191. // CONCATENATED MODULE: ./src/core/util.ts
  40192. var Util = {
  40193. now: function () {
  40194. if (Date.now) {
  40195. return Date.now();
  40196. }
  40197. else {
  40198. return new Date().valueOf();
  40199. }
  40200. },
  40201. defer: function (callback) {
  40202. return new OneOffTimer(0, callback);
  40203. },
  40204. method: function (name) {
  40205. var args = [];
  40206. for (var _i = 1; _i < arguments.length; _i++) {
  40207. args[_i - 1] = arguments[_i];
  40208. }
  40209. var boundArguments = Array.prototype.slice.call(arguments, 1);
  40210. return function (object) {
  40211. return object[name].apply(object, boundArguments.concat(arguments));
  40212. };
  40213. }
  40214. };
  40215. /* harmony default export */ var util = (Util);
  40216. // CONCATENATED MODULE: ./src/core/utils/collections.ts
  40217. function extend(target) {
  40218. var sources = [];
  40219. for (var _i = 1; _i < arguments.length; _i++) {
  40220. sources[_i - 1] = arguments[_i];
  40221. }
  40222. for (var i = 0; i < sources.length; i++) {
  40223. var extensions = sources[i];
  40224. for (var property in extensions) {
  40225. if (extensions[property] && extensions[property].constructor &&
  40226. extensions[property].constructor === Object) {
  40227. target[property] = extend(target[property] || {}, extensions[property]);
  40228. }
  40229. else {
  40230. target[property] = extensions[property];
  40231. }
  40232. }
  40233. }
  40234. return target;
  40235. }
  40236. function stringify() {
  40237. var m = ["Pusher"];
  40238. for (var i = 0; i < arguments.length; i++) {
  40239. if (typeof arguments[i] === "string") {
  40240. m.push(arguments[i]);
  40241. }
  40242. else {
  40243. m.push(safeJSONStringify(arguments[i]));
  40244. }
  40245. }
  40246. return m.join(" : ");
  40247. }
  40248. function arrayIndexOf(array, item) {
  40249. var nativeIndexOf = Array.prototype.indexOf;
  40250. if (array === null) {
  40251. return -1;
  40252. }
  40253. if (nativeIndexOf && array.indexOf === nativeIndexOf) {
  40254. return array.indexOf(item);
  40255. }
  40256. for (var i = 0, l = array.length; i < l; i++) {
  40257. if (array[i] === item) {
  40258. return i;
  40259. }
  40260. }
  40261. return -1;
  40262. }
  40263. function objectApply(object, f) {
  40264. for (var key in object) {
  40265. if (Object.prototype.hasOwnProperty.call(object, key)) {
  40266. f(object[key], key, object);
  40267. }
  40268. }
  40269. }
  40270. function keys(object) {
  40271. var keys = [];
  40272. objectApply(object, function (_, key) {
  40273. keys.push(key);
  40274. });
  40275. return keys;
  40276. }
  40277. function values(object) {
  40278. var values = [];
  40279. objectApply(object, function (value) {
  40280. values.push(value);
  40281. });
  40282. return values;
  40283. }
  40284. function apply(array, f, context) {
  40285. for (var i = 0; i < array.length; i++) {
  40286. f.call(context || window, array[i], i, array);
  40287. }
  40288. }
  40289. function map(array, f) {
  40290. var result = [];
  40291. for (var i = 0; i < array.length; i++) {
  40292. result.push(f(array[i], i, array, result));
  40293. }
  40294. return result;
  40295. }
  40296. function mapObject(object, f) {
  40297. var result = {};
  40298. objectApply(object, function (value, key) {
  40299. result[key] = f(value);
  40300. });
  40301. return result;
  40302. }
  40303. function filter(array, test) {
  40304. test = test || function (value) { return !!value; };
  40305. var result = [];
  40306. for (var i = 0; i < array.length; i++) {
  40307. if (test(array[i], i, array, result)) {
  40308. result.push(array[i]);
  40309. }
  40310. }
  40311. return result;
  40312. }
  40313. function filterObject(object, test) {
  40314. var result = {};
  40315. objectApply(object, function (value, key) {
  40316. if ((test && test(value, key, object, result)) || Boolean(value)) {
  40317. result[key] = value;
  40318. }
  40319. });
  40320. return result;
  40321. }
  40322. function flatten(object) {
  40323. var result = [];
  40324. objectApply(object, function (value, key) {
  40325. result.push([key, value]);
  40326. });
  40327. return result;
  40328. }
  40329. function any(array, test) {
  40330. for (var i = 0; i < array.length; i++) {
  40331. if (test(array[i], i, array)) {
  40332. return true;
  40333. }
  40334. }
  40335. return false;
  40336. }
  40337. function collections_all(array, test) {
  40338. for (var i = 0; i < array.length; i++) {
  40339. if (!test(array[i], i, array)) {
  40340. return false;
  40341. }
  40342. }
  40343. return true;
  40344. }
  40345. function encodeParamsObject(data) {
  40346. return mapObject(data, function (value) {
  40347. if (typeof value === "object") {
  40348. value = safeJSONStringify(value);
  40349. }
  40350. return encodeURIComponent(encode(value.toString()));
  40351. });
  40352. }
  40353. function buildQueryString(data) {
  40354. var params = filterObject(data, function (value) {
  40355. return value !== undefined;
  40356. });
  40357. var query = map(flatten(encodeParamsObject(params)), util.method("join", "=")).join("&");
  40358. return query;
  40359. }
  40360. function decycleObject(object) {
  40361. var objects = [], paths = [];
  40362. return (function derez(value, path) {
  40363. var i, name, nu;
  40364. switch (typeof value) {
  40365. case 'object':
  40366. if (!value) {
  40367. return null;
  40368. }
  40369. for (i = 0; i < objects.length; i += 1) {
  40370. if (objects[i] === value) {
  40371. return { $ref: paths[i] };
  40372. }
  40373. }
  40374. objects.push(value);
  40375. paths.push(path);
  40376. if (Object.prototype.toString.apply(value) === '[object Array]') {
  40377. nu = [];
  40378. for (i = 0; i < value.length; i += 1) {
  40379. nu[i] = derez(value[i], path + '[' + i + ']');
  40380. }
  40381. }
  40382. else {
  40383. nu = {};
  40384. for (name in value) {
  40385. if (Object.prototype.hasOwnProperty.call(value, name)) {
  40386. nu[name] = derez(value[name], path + '[' + JSON.stringify(name) + ']');
  40387. }
  40388. }
  40389. }
  40390. return nu;
  40391. case 'number':
  40392. case 'string':
  40393. case 'boolean':
  40394. return value;
  40395. }
  40396. }(object, '$'));
  40397. }
  40398. function safeJSONStringify(source) {
  40399. try {
  40400. return JSON.stringify(source);
  40401. }
  40402. catch (e) {
  40403. return JSON.stringify(decycleObject(source));
  40404. }
  40405. }
  40406. // CONCATENATED MODULE: ./src/core/logger.ts
  40407. var logger_Logger = (function () {
  40408. function Logger() {
  40409. this.globalLog = function (message) {
  40410. if (window.console && window.console.log) {
  40411. window.console.log(message);
  40412. }
  40413. };
  40414. }
  40415. Logger.prototype.debug = function () {
  40416. var args = [];
  40417. for (var _i = 0; _i < arguments.length; _i++) {
  40418. args[_i] = arguments[_i];
  40419. }
  40420. this.log(this.globalLog, args);
  40421. };
  40422. Logger.prototype.warn = function () {
  40423. var args = [];
  40424. for (var _i = 0; _i < arguments.length; _i++) {
  40425. args[_i] = arguments[_i];
  40426. }
  40427. this.log(this.globalLogWarn, args);
  40428. };
  40429. Logger.prototype.error = function () {
  40430. var args = [];
  40431. for (var _i = 0; _i < arguments.length; _i++) {
  40432. args[_i] = arguments[_i];
  40433. }
  40434. this.log(this.globalLogError, args);
  40435. };
  40436. Logger.prototype.globalLogWarn = function (message) {
  40437. if (window.console && window.console.warn) {
  40438. window.console.warn(message);
  40439. }
  40440. else {
  40441. this.globalLog(message);
  40442. }
  40443. };
  40444. Logger.prototype.globalLogError = function (message) {
  40445. if (window.console && window.console.error) {
  40446. window.console.error(message);
  40447. }
  40448. else {
  40449. this.globalLogWarn(message);
  40450. }
  40451. };
  40452. Logger.prototype.log = function (defaultLoggingFunction) {
  40453. var args = [];
  40454. for (var _i = 1; _i < arguments.length; _i++) {
  40455. args[_i - 1] = arguments[_i];
  40456. }
  40457. var message = stringify.apply(this, arguments);
  40458. if (core_pusher.log) {
  40459. core_pusher.log(message);
  40460. }
  40461. else if (core_pusher.logToConsole) {
  40462. var log = defaultLoggingFunction.bind(this);
  40463. log(message);
  40464. }
  40465. };
  40466. return Logger;
  40467. }());
  40468. /* harmony default export */ var logger = (new logger_Logger());
  40469. // CONCATENATED MODULE: ./src/core/utils/url_store.ts
  40470. var urlStore = {
  40471. baseUrl: "https://pusher.com",
  40472. urls: {
  40473. authenticationEndpoint: {
  40474. path: "/docs/authenticating_users",
  40475. },
  40476. javascriptQuickStart: {
  40477. path: "/docs/javascript_quick_start"
  40478. },
  40479. triggeringClientEvents: {
  40480. path: "/docs/client_api_guide/client_events#trigger-events"
  40481. }
  40482. }
  40483. };
  40484. var buildLogSuffix = function (key) {
  40485. var urlPrefix = "See:";
  40486. var urlObj = urlStore.urls[key];
  40487. if (!urlObj)
  40488. return "";
  40489. var url;
  40490. if (urlObj.fullUrl) {
  40491. url = urlObj.fullUrl;
  40492. }
  40493. else if (urlObj.path) {
  40494. url = urlStore.baseUrl + urlObj.path;
  40495. }
  40496. if (!url)
  40497. return "";
  40498. return urlPrefix + " " + url;
  40499. };
  40500. /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
  40501. // CONCATENATED MODULE: ./src/runtimes/isomorphic/auth/xhr_auth.ts
  40502. var ajax = function (context, socketId, callback) {
  40503. var self = this, xhr;
  40504. xhr = runtime.createXHR();
  40505. xhr.open("POST", self.options.authEndpoint, true);
  40506. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  40507. for (var headerName in this.authOptions.headers) {
  40508. xhr.setRequestHeader(headerName, this.authOptions.headers[headerName]);
  40509. }
  40510. xhr.onreadystatechange = function () {
  40511. if (xhr.readyState === 4) {
  40512. if (xhr.status === 200) {
  40513. var data, parsed = false;
  40514. try {
  40515. data = JSON.parse(xhr.responseText);
  40516. parsed = true;
  40517. }
  40518. catch (e) {
  40519. callback(true, 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + xhr.responseText);
  40520. }
  40521. if (parsed) {
  40522. callback(false, data);
  40523. }
  40524. }
  40525. else {
  40526. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  40527. logger.error('Unable to retrieve auth string from auth endpoint - ' +
  40528. ("received status " + xhr.status + " from " + self.options.authEndpoint + ". ") +
  40529. ("Clients must be authenticated to join private or presence channels. " + suffix));
  40530. callback(true, xhr.status);
  40531. }
  40532. }
  40533. };
  40534. xhr.send(this.composeQuery(socketId));
  40535. return xhr;
  40536. };
  40537. /* harmony default export */ var xhr_auth = (ajax);
  40538. // CONCATENATED MODULE: ./src/runtimes/web/auth/jsonp_auth.ts
  40539. var jsonp = function (context, socketId, callback) {
  40540. if (this.authOptions.headers !== undefined) {
  40541. logger.warn('To send headers with the auth request, you must use AJAX, rather than JSONP.');
  40542. }
  40543. var callbackName = context.nextAuthCallbackID.toString();
  40544. context.nextAuthCallbackID++;
  40545. var document = context.getDocument();
  40546. var script = document.createElement("script");
  40547. context.auth_callbacks[callbackName] = function (data) {
  40548. callback(false, data);
  40549. };
  40550. var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
  40551. script.src = this.options.authEndpoint +
  40552. '?callback=' +
  40553. encodeURIComponent(callback_name) +
  40554. '&' +
  40555. this.composeQuery(socketId);
  40556. var head = document.getElementsByTagName("head")[0] || document.documentElement;
  40557. head.insertBefore(script, head.firstChild);
  40558. };
  40559. /* harmony default export */ var jsonp_auth = (jsonp);
  40560. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_request.ts
  40561. var ScriptRequest = (function () {
  40562. function ScriptRequest(src) {
  40563. this.src = src;
  40564. }
  40565. ScriptRequest.prototype.send = function (receiver) {
  40566. var self = this;
  40567. var errorString = "Error loading " + self.src;
  40568. self.script = document.createElement("script");
  40569. self.script.id = receiver.id;
  40570. self.script.src = self.src;
  40571. self.script.type = "text/javascript";
  40572. self.script.charset = "UTF-8";
  40573. if (self.script.addEventListener) {
  40574. self.script.onerror = function () {
  40575. receiver.callback(errorString);
  40576. };
  40577. self.script.onload = function () {
  40578. receiver.callback(null);
  40579. };
  40580. }
  40581. else {
  40582. self.script.onreadystatechange = function () {
  40583. if (self.script.readyState === 'loaded' ||
  40584. self.script.readyState === 'complete') {
  40585. receiver.callback(null);
  40586. }
  40587. };
  40588. }
  40589. if (self.script.async === undefined && document.attachEvent &&
  40590. /opera/i.test(navigator.userAgent)) {
  40591. self.errorScript = document.createElement("script");
  40592. self.errorScript.id = receiver.id + "_error";
  40593. self.errorScript.text = receiver.name + "('" + errorString + "');";
  40594. self.script.async = self.errorScript.async = false;
  40595. }
  40596. else {
  40597. self.script.async = true;
  40598. }
  40599. var head = document.getElementsByTagName('head')[0];
  40600. head.insertBefore(self.script, head.firstChild);
  40601. if (self.errorScript) {
  40602. head.insertBefore(self.errorScript, self.script.nextSibling);
  40603. }
  40604. };
  40605. ScriptRequest.prototype.cleanup = function () {
  40606. if (this.script) {
  40607. this.script.onload = this.script.onerror = null;
  40608. this.script.onreadystatechange = null;
  40609. }
  40610. if (this.script && this.script.parentNode) {
  40611. this.script.parentNode.removeChild(this.script);
  40612. }
  40613. if (this.errorScript && this.errorScript.parentNode) {
  40614. this.errorScript.parentNode.removeChild(this.errorScript);
  40615. }
  40616. this.script = null;
  40617. this.errorScript = null;
  40618. };
  40619. return ScriptRequest;
  40620. }());
  40621. /* harmony default export */ var script_request = (ScriptRequest);
  40622. // CONCATENATED MODULE: ./src/runtimes/web/dom/jsonp_request.ts
  40623. var jsonp_request_JSONPRequest = (function () {
  40624. function JSONPRequest(url, data) {
  40625. this.url = url;
  40626. this.data = data;
  40627. }
  40628. JSONPRequest.prototype.send = function (receiver) {
  40629. if (this.request) {
  40630. return;
  40631. }
  40632. var query = buildQueryString(this.data);
  40633. var url = this.url + "/" + receiver.number + "?" + query;
  40634. this.request = runtime.createScriptRequest(url);
  40635. this.request.send(receiver);
  40636. };
  40637. JSONPRequest.prototype.cleanup = function () {
  40638. if (this.request) {
  40639. this.request.cleanup();
  40640. }
  40641. };
  40642. return JSONPRequest;
  40643. }());
  40644. /* harmony default export */ var jsonp_request = (jsonp_request_JSONPRequest);
  40645. // CONCATENATED MODULE: ./src/runtimes/web/timeline/jsonp_timeline.ts
  40646. var getAgent = function (sender, useTLS) {
  40647. return function (data, callback) {
  40648. var scheme = "http" + (useTLS ? "s" : "") + "://";
  40649. var url = scheme + (sender.host || sender.options.host) + sender.options.path;
  40650. var request = runtime.createJSONPRequest(url, data);
  40651. var receiver = runtime.ScriptReceivers.create(function (error, result) {
  40652. ScriptReceivers.remove(receiver);
  40653. request.cleanup();
  40654. if (result && result.host) {
  40655. sender.host = result.host;
  40656. }
  40657. if (callback) {
  40658. callback(error, result);
  40659. }
  40660. });
  40661. request.send(receiver);
  40662. };
  40663. };
  40664. var jsonp_timeline_jsonp = {
  40665. name: 'jsonp',
  40666. getAgent: getAgent
  40667. };
  40668. /* harmony default export */ var jsonp_timeline = (jsonp_timeline_jsonp);
  40669. // CONCATENATED MODULE: ./src/core/transports/url_schemes.ts
  40670. function getGenericURL(baseScheme, params, path) {
  40671. var scheme = baseScheme + (params.useTLS ? "s" : "");
  40672. var host = params.useTLS ? params.hostTLS : params.hostNonTLS;
  40673. return scheme + "://" + host + path;
  40674. }
  40675. function getGenericPath(key, queryString) {
  40676. var path = "/app/" + key;
  40677. var query = "?protocol=" + defaults.PROTOCOL +
  40678. "&client=js" +
  40679. "&version=" + defaults.VERSION +
  40680. (queryString ? ("&" + queryString) : "");
  40681. return path + query;
  40682. }
  40683. var ws = {
  40684. getInitial: function (key, params) {
  40685. var path = (params.httpPath || "") + getGenericPath(key, "flash=false");
  40686. return getGenericURL("ws", params, path);
  40687. }
  40688. };
  40689. var http = {
  40690. getInitial: function (key, params) {
  40691. var path = (params.httpPath || "/pusher") + getGenericPath(key);
  40692. return getGenericURL("http", params, path);
  40693. }
  40694. };
  40695. var sockjs = {
  40696. getInitial: function (key, params) {
  40697. return getGenericURL("http", params, params.httpPath || "/pusher");
  40698. },
  40699. getPath: function (key, params) {
  40700. return getGenericPath(key);
  40701. }
  40702. };
  40703. // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
  40704. var callback_registry_CallbackRegistry = (function () {
  40705. function CallbackRegistry() {
  40706. this._callbacks = {};
  40707. }
  40708. CallbackRegistry.prototype.get = function (name) {
  40709. return this._callbacks[prefix(name)];
  40710. };
  40711. CallbackRegistry.prototype.add = function (name, callback, context) {
  40712. var prefixedEventName = prefix(name);
  40713. this._callbacks[prefixedEventName] = this._callbacks[prefixedEventName] || [];
  40714. this._callbacks[prefixedEventName].push({
  40715. fn: callback,
  40716. context: context
  40717. });
  40718. };
  40719. CallbackRegistry.prototype.remove = function (name, callback, context) {
  40720. if (!name && !callback && !context) {
  40721. this._callbacks = {};
  40722. return;
  40723. }
  40724. var names = name ? [prefix(name)] : keys(this._callbacks);
  40725. if (callback || context) {
  40726. this.removeCallback(names, callback, context);
  40727. }
  40728. else {
  40729. this.removeAllCallbacks(names);
  40730. }
  40731. };
  40732. CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
  40733. apply(names, function (name) {
  40734. this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
  40735. return (callback && callback !== binding.fn) ||
  40736. (context && context !== binding.context);
  40737. });
  40738. if (this._callbacks[name].length === 0) {
  40739. delete this._callbacks[name];
  40740. }
  40741. }, this);
  40742. };
  40743. CallbackRegistry.prototype.removeAllCallbacks = function (names) {
  40744. apply(names, function (name) {
  40745. delete this._callbacks[name];
  40746. }, this);
  40747. };
  40748. return CallbackRegistry;
  40749. }());
  40750. /* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
  40751. function prefix(name) {
  40752. return "_" + name;
  40753. }
  40754. // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
  40755. var dispatcher_Dispatcher = (function () {
  40756. function Dispatcher(failThrough) {
  40757. this.callbacks = new callback_registry();
  40758. this.global_callbacks = [];
  40759. this.failThrough = failThrough;
  40760. }
  40761. Dispatcher.prototype.bind = function (eventName, callback, context) {
  40762. this.callbacks.add(eventName, callback, context);
  40763. return this;
  40764. };
  40765. Dispatcher.prototype.bind_global = function (callback) {
  40766. this.global_callbacks.push(callback);
  40767. return this;
  40768. };
  40769. Dispatcher.prototype.unbind = function (eventName, callback, context) {
  40770. this.callbacks.remove(eventName, callback, context);
  40771. return this;
  40772. };
  40773. Dispatcher.prototype.unbind_global = function (callback) {
  40774. if (!callback) {
  40775. this.global_callbacks = [];
  40776. return this;
  40777. }
  40778. this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
  40779. return this;
  40780. };
  40781. Dispatcher.prototype.unbind_all = function () {
  40782. this.unbind();
  40783. this.unbind_global();
  40784. return this;
  40785. };
  40786. Dispatcher.prototype.emit = function (eventName, data, metadata) {
  40787. for (var i = 0; i < this.global_callbacks.length; i++) {
  40788. this.global_callbacks[i](eventName, data);
  40789. }
  40790. var callbacks = this.callbacks.get(eventName);
  40791. var args = [];
  40792. if (metadata) {
  40793. args.push(data, metadata);
  40794. }
  40795. else if (data) {
  40796. args.push(data);
  40797. }
  40798. if (callbacks && callbacks.length > 0) {
  40799. for (var i = 0; i < callbacks.length; i++) {
  40800. callbacks[i].fn.apply(callbacks[i].context || window, args);
  40801. }
  40802. }
  40803. else if (this.failThrough) {
  40804. this.failThrough(eventName, data);
  40805. }
  40806. return this;
  40807. };
  40808. return Dispatcher;
  40809. }());
  40810. /* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
  40811. // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
  40812. var transport_connection_extends = (undefined && undefined.__extends) || (function () {
  40813. var extendStatics = function (d, b) {
  40814. extendStatics = Object.setPrototypeOf ||
  40815. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40816. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40817. return extendStatics(d, b);
  40818. };
  40819. return function (d, b) {
  40820. extendStatics(d, b);
  40821. function __() { this.constructor = d; }
  40822. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40823. };
  40824. })();
  40825. var transport_connection_TransportConnection = (function (_super) {
  40826. transport_connection_extends(TransportConnection, _super);
  40827. function TransportConnection(hooks, name, priority, key, options) {
  40828. var _this = _super.call(this) || this;
  40829. _this.initialize = runtime.transportConnectionInitializer;
  40830. _this.hooks = hooks;
  40831. _this.name = name;
  40832. _this.priority = priority;
  40833. _this.key = key;
  40834. _this.options = options;
  40835. _this.state = "new";
  40836. _this.timeline = options.timeline;
  40837. _this.activityTimeout = options.activityTimeout;
  40838. _this.id = _this.timeline.generateUniqueID();
  40839. return _this;
  40840. }
  40841. TransportConnection.prototype.handlesActivityChecks = function () {
  40842. return Boolean(this.hooks.handlesActivityChecks);
  40843. };
  40844. TransportConnection.prototype.supportsPing = function () {
  40845. return Boolean(this.hooks.supportsPing);
  40846. };
  40847. TransportConnection.prototype.connect = function () {
  40848. var _this = this;
  40849. if (this.socket || this.state !== "initialized") {
  40850. return false;
  40851. }
  40852. var url = this.hooks.urls.getInitial(this.key, this.options);
  40853. try {
  40854. this.socket = this.hooks.getSocket(url, this.options);
  40855. }
  40856. catch (e) {
  40857. util.defer(function () {
  40858. _this.onError(e);
  40859. _this.changeState("closed");
  40860. });
  40861. return false;
  40862. }
  40863. this.bindListeners();
  40864. logger.debug("Connecting", { transport: this.name, url: url });
  40865. this.changeState("connecting");
  40866. return true;
  40867. };
  40868. TransportConnection.prototype.close = function () {
  40869. if (this.socket) {
  40870. this.socket.close();
  40871. return true;
  40872. }
  40873. else {
  40874. return false;
  40875. }
  40876. };
  40877. TransportConnection.prototype.send = function (data) {
  40878. var _this = this;
  40879. if (this.state === "open") {
  40880. util.defer(function () {
  40881. if (_this.socket) {
  40882. _this.socket.send(data);
  40883. }
  40884. });
  40885. return true;
  40886. }
  40887. else {
  40888. return false;
  40889. }
  40890. };
  40891. TransportConnection.prototype.ping = function () {
  40892. if (this.state === "open" && this.supportsPing()) {
  40893. this.socket.ping();
  40894. }
  40895. };
  40896. TransportConnection.prototype.onOpen = function () {
  40897. if (this.hooks.beforeOpen) {
  40898. this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
  40899. }
  40900. this.changeState("open");
  40901. this.socket.onopen = undefined;
  40902. };
  40903. TransportConnection.prototype.onError = function (error) {
  40904. this.emit("error", { type: 'WebSocketError', error: error });
  40905. this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
  40906. };
  40907. TransportConnection.prototype.onClose = function (closeEvent) {
  40908. if (closeEvent) {
  40909. this.changeState("closed", {
  40910. code: closeEvent.code,
  40911. reason: closeEvent.reason,
  40912. wasClean: closeEvent.wasClean
  40913. });
  40914. }
  40915. else {
  40916. this.changeState("closed");
  40917. }
  40918. this.unbindListeners();
  40919. this.socket = undefined;
  40920. };
  40921. TransportConnection.prototype.onMessage = function (message) {
  40922. this.emit("message", message);
  40923. };
  40924. TransportConnection.prototype.onActivity = function () {
  40925. this.emit("activity");
  40926. };
  40927. TransportConnection.prototype.bindListeners = function () {
  40928. var _this = this;
  40929. this.socket.onopen = function () {
  40930. _this.onOpen();
  40931. };
  40932. this.socket.onerror = function (error) {
  40933. _this.onError(error);
  40934. };
  40935. this.socket.onclose = function (closeEvent) {
  40936. _this.onClose(closeEvent);
  40937. };
  40938. this.socket.onmessage = function (message) {
  40939. _this.onMessage(message);
  40940. };
  40941. if (this.supportsPing()) {
  40942. this.socket.onactivity = function () { _this.onActivity(); };
  40943. }
  40944. };
  40945. TransportConnection.prototype.unbindListeners = function () {
  40946. if (this.socket) {
  40947. this.socket.onopen = undefined;
  40948. this.socket.onerror = undefined;
  40949. this.socket.onclose = undefined;
  40950. this.socket.onmessage = undefined;
  40951. if (this.supportsPing()) {
  40952. this.socket.onactivity = undefined;
  40953. }
  40954. }
  40955. };
  40956. TransportConnection.prototype.changeState = function (state, params) {
  40957. this.state = state;
  40958. this.timeline.info(this.buildTimelineMessage({
  40959. state: state,
  40960. params: params
  40961. }));
  40962. this.emit(state, params);
  40963. };
  40964. TransportConnection.prototype.buildTimelineMessage = function (message) {
  40965. return extend({ cid: this.id }, message);
  40966. };
  40967. return TransportConnection;
  40968. }(dispatcher));
  40969. /* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
  40970. // CONCATENATED MODULE: ./src/core/transports/transport.ts
  40971. var transport_Transport = (function () {
  40972. function Transport(hooks) {
  40973. this.hooks = hooks;
  40974. }
  40975. Transport.prototype.isSupported = function (environment) {
  40976. return this.hooks.isSupported(environment);
  40977. };
  40978. Transport.prototype.createConnection = function (name, priority, key, options) {
  40979. return new transport_connection(this.hooks, name, priority, key, options);
  40980. };
  40981. return Transport;
  40982. }());
  40983. /* harmony default export */ var transports_transport = (transport_Transport);
  40984. // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
  40985. var WSTransport = new transports_transport({
  40986. urls: ws,
  40987. handlesActivityChecks: false,
  40988. supportsPing: false,
  40989. isInitialized: function () {
  40990. return Boolean(runtime.getWebSocketAPI());
  40991. },
  40992. isSupported: function () {
  40993. return Boolean(runtime.getWebSocketAPI());
  40994. },
  40995. getSocket: function (url) {
  40996. return runtime.createWebSocket(url);
  40997. }
  40998. });
  40999. var httpConfiguration = {
  41000. urls: http,
  41001. handlesActivityChecks: false,
  41002. supportsPing: true,
  41003. isInitialized: function () {
  41004. return true;
  41005. }
  41006. };
  41007. var streamingConfiguration = extend({ getSocket: function (url) {
  41008. return runtime.HTTPFactory.createStreamingSocket(url);
  41009. }
  41010. }, httpConfiguration);
  41011. var pollingConfiguration = extend({ getSocket: function (url) {
  41012. return runtime.HTTPFactory.createPollingSocket(url);
  41013. }
  41014. }, httpConfiguration);
  41015. var xhrConfiguration = {
  41016. isSupported: function () {
  41017. return runtime.isXHRSupported();
  41018. }
  41019. };
  41020. var XHRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xhrConfiguration));
  41021. var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
  41022. var Transports = {
  41023. ws: WSTransport,
  41024. xhr_streaming: XHRStreamingTransport,
  41025. xhr_polling: XHRPollingTransport
  41026. };
  41027. /* harmony default export */ var transports = (Transports);
  41028. // CONCATENATED MODULE: ./src/runtimes/web/transports/transports.ts
  41029. var SockJSTransport = new transports_transport({
  41030. file: "sockjs",
  41031. urls: sockjs,
  41032. handlesActivityChecks: true,
  41033. supportsPing: false,
  41034. isSupported: function () {
  41035. return true;
  41036. },
  41037. isInitialized: function () {
  41038. return window.SockJS !== undefined;
  41039. },
  41040. getSocket: function (url, options) {
  41041. return new window.SockJS(url, null, {
  41042. js_path: Dependencies.getPath("sockjs", {
  41043. useTLS: options.useTLS
  41044. }),
  41045. ignore_null_origin: options.ignoreNullOrigin
  41046. });
  41047. },
  41048. beforeOpen: function (socket, path) {
  41049. socket.send(JSON.stringify({
  41050. path: path
  41051. }));
  41052. }
  41053. });
  41054. var xdrConfiguration = {
  41055. isSupported: function (environment) {
  41056. var yes = runtime.isXDRSupported(environment.useTLS);
  41057. return yes;
  41058. }
  41059. };
  41060. var XDRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xdrConfiguration));
  41061. var XDRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xdrConfiguration));
  41062. transports.xdr_streaming = XDRStreamingTransport;
  41063. transports.xdr_polling = XDRPollingTransport;
  41064. transports.sockjs = SockJSTransport;
  41065. /* harmony default export */ var transports_transports = (transports);
  41066. // CONCATENATED MODULE: ./src/runtimes/web/net_info.ts
  41067. var net_info_extends = (undefined && undefined.__extends) || (function () {
  41068. var extendStatics = function (d, b) {
  41069. extendStatics = Object.setPrototypeOf ||
  41070. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41071. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41072. return extendStatics(d, b);
  41073. };
  41074. return function (d, b) {
  41075. extendStatics(d, b);
  41076. function __() { this.constructor = d; }
  41077. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41078. };
  41079. })();
  41080. var NetInfo = (function (_super) {
  41081. net_info_extends(NetInfo, _super);
  41082. function NetInfo() {
  41083. var _this = _super.call(this) || this;
  41084. var self = _this;
  41085. if (window.addEventListener !== undefined) {
  41086. window.addEventListener("online", function () {
  41087. self.emit('online');
  41088. }, false);
  41089. window.addEventListener("offline", function () {
  41090. self.emit('offline');
  41091. }, false);
  41092. }
  41093. return _this;
  41094. }
  41095. NetInfo.prototype.isOnline = function () {
  41096. if (window.navigator.onLine === undefined) {
  41097. return true;
  41098. }
  41099. else {
  41100. return window.navigator.onLine;
  41101. }
  41102. };
  41103. return NetInfo;
  41104. }(dispatcher));
  41105. var net_info_Network = new NetInfo();
  41106. // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
  41107. var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
  41108. function AssistantToTheTransportManager(manager, transport, options) {
  41109. this.manager = manager;
  41110. this.transport = transport;
  41111. this.minPingDelay = options.minPingDelay;
  41112. this.maxPingDelay = options.maxPingDelay;
  41113. this.pingDelay = undefined;
  41114. }
  41115. AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
  41116. var _this = this;
  41117. options = extend({}, options, {
  41118. activityTimeout: this.pingDelay
  41119. });
  41120. var connection = this.transport.createConnection(name, priority, key, options);
  41121. var openTimestamp = null;
  41122. var onOpen = function () {
  41123. connection.unbind("open", onOpen);
  41124. connection.bind("closed", onClosed);
  41125. openTimestamp = util.now();
  41126. };
  41127. var onClosed = function (closeEvent) {
  41128. connection.unbind("closed", onClosed);
  41129. if (closeEvent.code === 1002 || closeEvent.code === 1003) {
  41130. _this.manager.reportDeath();
  41131. }
  41132. else if (!closeEvent.wasClean && openTimestamp) {
  41133. var lifespan = util.now() - openTimestamp;
  41134. if (lifespan < 2 * _this.maxPingDelay) {
  41135. _this.manager.reportDeath();
  41136. _this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
  41137. }
  41138. }
  41139. };
  41140. connection.bind("open", onOpen);
  41141. return connection;
  41142. };
  41143. AssistantToTheTransportManager.prototype.isSupported = function (environment) {
  41144. return this.manager.isAlive() && this.transport.isSupported(environment);
  41145. };
  41146. return AssistantToTheTransportManager;
  41147. }());
  41148. /* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
  41149. // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
  41150. var Protocol = {
  41151. decodeMessage: function (messageEvent) {
  41152. try {
  41153. var messageData = JSON.parse(messageEvent.data);
  41154. var pusherEventData = messageData.data;
  41155. if (typeof pusherEventData === 'string') {
  41156. try {
  41157. pusherEventData = JSON.parse(messageData.data);
  41158. }
  41159. catch (e) { }
  41160. }
  41161. var pusherEvent = {
  41162. event: messageData.event,
  41163. channel: messageData.channel,
  41164. data: pusherEventData,
  41165. };
  41166. if (messageData.user_id) {
  41167. pusherEvent.user_id = messageData.user_id;
  41168. }
  41169. return pusherEvent;
  41170. }
  41171. catch (e) {
  41172. throw { type: 'MessageParseError', error: e, data: messageEvent.data };
  41173. }
  41174. },
  41175. encodeMessage: function (event) {
  41176. return JSON.stringify(event);
  41177. },
  41178. processHandshake: function (messageEvent) {
  41179. var message = Protocol.decodeMessage(messageEvent);
  41180. if (message.event === "pusher:connection_established") {
  41181. if (!message.data.activity_timeout) {
  41182. throw "No activity timeout specified in handshake";
  41183. }
  41184. return {
  41185. action: "connected",
  41186. id: message.data.socket_id,
  41187. activityTimeout: message.data.activity_timeout * 1000
  41188. };
  41189. }
  41190. else if (message.event === "pusher:error") {
  41191. return {
  41192. action: this.getCloseAction(message.data),
  41193. error: this.getCloseError(message.data)
  41194. };
  41195. }
  41196. else {
  41197. throw "Invalid handshake";
  41198. }
  41199. },
  41200. getCloseAction: function (closeEvent) {
  41201. if (closeEvent.code < 4000) {
  41202. if (closeEvent.code >= 1002 && closeEvent.code <= 1004) {
  41203. return "backoff";
  41204. }
  41205. else {
  41206. return null;
  41207. }
  41208. }
  41209. else if (closeEvent.code === 4000) {
  41210. return "tls_only";
  41211. }
  41212. else if (closeEvent.code < 4100) {
  41213. return "refused";
  41214. }
  41215. else if (closeEvent.code < 4200) {
  41216. return "backoff";
  41217. }
  41218. else if (closeEvent.code < 4300) {
  41219. return "retry";
  41220. }
  41221. else {
  41222. return "refused";
  41223. }
  41224. },
  41225. getCloseError: function (closeEvent) {
  41226. if (closeEvent.code !== 1000 && closeEvent.code !== 1001) {
  41227. return {
  41228. type: 'PusherError',
  41229. data: {
  41230. code: closeEvent.code,
  41231. message: closeEvent.reason || closeEvent.message
  41232. }
  41233. };
  41234. }
  41235. else {
  41236. return null;
  41237. }
  41238. }
  41239. };
  41240. /* harmony default export */ var protocol_protocol = (Protocol);
  41241. // CONCATENATED MODULE: ./src/core/connection/connection.ts
  41242. var connection_extends = (undefined && undefined.__extends) || (function () {
  41243. var extendStatics = function (d, b) {
  41244. extendStatics = Object.setPrototypeOf ||
  41245. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41246. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41247. return extendStatics(d, b);
  41248. };
  41249. return function (d, b) {
  41250. extendStatics(d, b);
  41251. function __() { this.constructor = d; }
  41252. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41253. };
  41254. })();
  41255. var connection_Connection = (function (_super) {
  41256. connection_extends(Connection, _super);
  41257. function Connection(id, transport) {
  41258. var _this = _super.call(this) || this;
  41259. _this.id = id;
  41260. _this.transport = transport;
  41261. _this.activityTimeout = transport.activityTimeout;
  41262. _this.bindListeners();
  41263. return _this;
  41264. }
  41265. Connection.prototype.handlesActivityChecks = function () {
  41266. return this.transport.handlesActivityChecks();
  41267. };
  41268. Connection.prototype.send = function (data) {
  41269. return this.transport.send(data);
  41270. };
  41271. Connection.prototype.send_event = function (name, data, channel) {
  41272. var event = { event: name, data: data };
  41273. if (channel) {
  41274. event.channel = channel;
  41275. }
  41276. logger.debug('Event sent', event);
  41277. return this.send(protocol_protocol.encodeMessage(event));
  41278. };
  41279. Connection.prototype.ping = function () {
  41280. if (this.transport.supportsPing()) {
  41281. this.transport.ping();
  41282. }
  41283. else {
  41284. this.send_event('pusher:ping', {});
  41285. }
  41286. };
  41287. Connection.prototype.close = function () {
  41288. this.transport.close();
  41289. };
  41290. Connection.prototype.bindListeners = function () {
  41291. var _this = this;
  41292. var listeners = {
  41293. message: function (messageEvent) {
  41294. var pusherEvent;
  41295. try {
  41296. pusherEvent = protocol_protocol.decodeMessage(messageEvent);
  41297. }
  41298. catch (e) {
  41299. _this.emit('error', {
  41300. type: 'MessageParseError',
  41301. error: e,
  41302. data: messageEvent.data
  41303. });
  41304. }
  41305. if (pusherEvent !== undefined) {
  41306. logger.debug('Event recd', pusherEvent);
  41307. switch (pusherEvent.event) {
  41308. case 'pusher:error':
  41309. _this.emit('error', { type: 'PusherError', data: pusherEvent.data });
  41310. break;
  41311. case 'pusher:ping':
  41312. _this.emit("ping");
  41313. break;
  41314. case 'pusher:pong':
  41315. _this.emit("pong");
  41316. break;
  41317. }
  41318. _this.emit('message', pusherEvent);
  41319. }
  41320. },
  41321. activity: function () {
  41322. _this.emit("activity");
  41323. },
  41324. error: function (error) {
  41325. _this.emit("error", { type: "WebSocketError", error: error });
  41326. },
  41327. closed: function (closeEvent) {
  41328. unbindListeners();
  41329. if (closeEvent && closeEvent.code) {
  41330. _this.handleCloseEvent(closeEvent);
  41331. }
  41332. _this.transport = null;
  41333. _this.emit("closed");
  41334. }
  41335. };
  41336. var unbindListeners = function () {
  41337. objectApply(listeners, function (listener, event) {
  41338. _this.transport.unbind(event, listener);
  41339. });
  41340. };
  41341. objectApply(listeners, function (listener, event) {
  41342. _this.transport.bind(event, listener);
  41343. });
  41344. };
  41345. Connection.prototype.handleCloseEvent = function (closeEvent) {
  41346. var action = protocol_protocol.getCloseAction(closeEvent);
  41347. var error = protocol_protocol.getCloseError(closeEvent);
  41348. if (error) {
  41349. this.emit('error', error);
  41350. }
  41351. if (action) {
  41352. this.emit(action, { action: action, error: error });
  41353. }
  41354. };
  41355. return Connection;
  41356. }(dispatcher));
  41357. /* harmony default export */ var connection_connection = (connection_Connection);
  41358. // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
  41359. var handshake_Handshake = (function () {
  41360. function Handshake(transport, callback) {
  41361. this.transport = transport;
  41362. this.callback = callback;
  41363. this.bindListeners();
  41364. }
  41365. Handshake.prototype.close = function () {
  41366. this.unbindListeners();
  41367. this.transport.close();
  41368. };
  41369. Handshake.prototype.bindListeners = function () {
  41370. var _this = this;
  41371. this.onMessage = function (m) {
  41372. _this.unbindListeners();
  41373. var result;
  41374. try {
  41375. result = protocol_protocol.processHandshake(m);
  41376. }
  41377. catch (e) {
  41378. _this.finish("error", { error: e });
  41379. _this.transport.close();
  41380. return;
  41381. }
  41382. if (result.action === "connected") {
  41383. _this.finish("connected", {
  41384. connection: new connection_connection(result.id, _this.transport),
  41385. activityTimeout: result.activityTimeout
  41386. });
  41387. }
  41388. else {
  41389. _this.finish(result.action, { error: result.error });
  41390. _this.transport.close();
  41391. }
  41392. };
  41393. this.onClosed = function (closeEvent) {
  41394. _this.unbindListeners();
  41395. var action = protocol_protocol.getCloseAction(closeEvent) || "backoff";
  41396. var error = protocol_protocol.getCloseError(closeEvent);
  41397. _this.finish(action, { error: error });
  41398. };
  41399. this.transport.bind("message", this.onMessage);
  41400. this.transport.bind("closed", this.onClosed);
  41401. };
  41402. Handshake.prototype.unbindListeners = function () {
  41403. this.transport.unbind("message", this.onMessage);
  41404. this.transport.unbind("closed", this.onClosed);
  41405. };
  41406. Handshake.prototype.finish = function (action, params) {
  41407. this.callback(extend({ transport: this.transport, action: action }, params));
  41408. };
  41409. return Handshake;
  41410. }());
  41411. /* harmony default export */ var connection_handshake = (handshake_Handshake);
  41412. // CONCATENATED MODULE: ./src/core/auth/pusher_authorizer.ts
  41413. var pusher_authorizer_PusherAuthorizer = (function () {
  41414. function PusherAuthorizer(channel, options) {
  41415. this.channel = channel;
  41416. var authTransport = options.authTransport;
  41417. if (typeof runtime.getAuthorizers()[authTransport] === "undefined") {
  41418. throw "'" + authTransport + "' is not a recognized auth transport";
  41419. }
  41420. this.type = authTransport;
  41421. this.options = options;
  41422. this.authOptions = (options || {}).auth || {};
  41423. }
  41424. PusherAuthorizer.prototype.composeQuery = function (socketId) {
  41425. var query = 'socket_id=' + encodeURIComponent(socketId) +
  41426. '&channel_name=' + encodeURIComponent(this.channel.name);
  41427. for (var i in this.authOptions.params) {
  41428. query += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(this.authOptions.params[i]);
  41429. }
  41430. return query;
  41431. };
  41432. PusherAuthorizer.prototype.authorize = function (socketId, callback) {
  41433. PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || runtime.getAuthorizers();
  41434. return PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback);
  41435. };
  41436. return PusherAuthorizer;
  41437. }());
  41438. /* harmony default export */ var pusher_authorizer = (pusher_authorizer_PusherAuthorizer);
  41439. // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
  41440. var timeline_sender_TimelineSender = (function () {
  41441. function TimelineSender(timeline, options) {
  41442. this.timeline = timeline;
  41443. this.options = options || {};
  41444. }
  41445. TimelineSender.prototype.send = function (useTLS, callback) {
  41446. if (this.timeline.isEmpty()) {
  41447. return;
  41448. }
  41449. this.timeline.send(runtime.TimelineTransport.getAgent(this, useTLS), callback);
  41450. };
  41451. return TimelineSender;
  41452. }());
  41453. /* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
  41454. // CONCATENATED MODULE: ./src/core/errors.ts
  41455. var errors_extends = (undefined && undefined.__extends) || (function () {
  41456. var extendStatics = function (d, b) {
  41457. extendStatics = Object.setPrototypeOf ||
  41458. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41459. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41460. return extendStatics(d, b);
  41461. };
  41462. return function (d, b) {
  41463. extendStatics(d, b);
  41464. function __() { this.constructor = d; }
  41465. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41466. };
  41467. })();
  41468. var BadEventName = (function (_super) {
  41469. errors_extends(BadEventName, _super);
  41470. function BadEventName(msg) {
  41471. var _newTarget = this.constructor;
  41472. var _this = _super.call(this, msg) || this;
  41473. Object.setPrototypeOf(_this, _newTarget.prototype);
  41474. return _this;
  41475. }
  41476. return BadEventName;
  41477. }(Error));
  41478. var RequestTimedOut = (function (_super) {
  41479. errors_extends(RequestTimedOut, _super);
  41480. function RequestTimedOut(msg) {
  41481. var _newTarget = this.constructor;
  41482. var _this = _super.call(this, msg) || this;
  41483. Object.setPrototypeOf(_this, _newTarget.prototype);
  41484. return _this;
  41485. }
  41486. return RequestTimedOut;
  41487. }(Error));
  41488. var TransportPriorityTooLow = (function (_super) {
  41489. errors_extends(TransportPriorityTooLow, _super);
  41490. function TransportPriorityTooLow(msg) {
  41491. var _newTarget = this.constructor;
  41492. var _this = _super.call(this, msg) || this;
  41493. Object.setPrototypeOf(_this, _newTarget.prototype);
  41494. return _this;
  41495. }
  41496. return TransportPriorityTooLow;
  41497. }(Error));
  41498. var TransportClosed = (function (_super) {
  41499. errors_extends(TransportClosed, _super);
  41500. function TransportClosed(msg) {
  41501. var _newTarget = this.constructor;
  41502. var _this = _super.call(this, msg) || this;
  41503. Object.setPrototypeOf(_this, _newTarget.prototype);
  41504. return _this;
  41505. }
  41506. return TransportClosed;
  41507. }(Error));
  41508. var UnsupportedFeature = (function (_super) {
  41509. errors_extends(UnsupportedFeature, _super);
  41510. function UnsupportedFeature(msg) {
  41511. var _newTarget = this.constructor;
  41512. var _this = _super.call(this, msg) || this;
  41513. Object.setPrototypeOf(_this, _newTarget.prototype);
  41514. return _this;
  41515. }
  41516. return UnsupportedFeature;
  41517. }(Error));
  41518. var UnsupportedTransport = (function (_super) {
  41519. errors_extends(UnsupportedTransport, _super);
  41520. function UnsupportedTransport(msg) {
  41521. var _newTarget = this.constructor;
  41522. var _this = _super.call(this, msg) || this;
  41523. Object.setPrototypeOf(_this, _newTarget.prototype);
  41524. return _this;
  41525. }
  41526. return UnsupportedTransport;
  41527. }(Error));
  41528. var UnsupportedStrategy = (function (_super) {
  41529. errors_extends(UnsupportedStrategy, _super);
  41530. function UnsupportedStrategy(msg) {
  41531. var _newTarget = this.constructor;
  41532. var _this = _super.call(this, msg) || this;
  41533. Object.setPrototypeOf(_this, _newTarget.prototype);
  41534. return _this;
  41535. }
  41536. return UnsupportedStrategy;
  41537. }(Error));
  41538. // CONCATENATED MODULE: ./src/core/channels/channel.ts
  41539. var channel_extends = (undefined && undefined.__extends) || (function () {
  41540. var extendStatics = function (d, b) {
  41541. extendStatics = Object.setPrototypeOf ||
  41542. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41543. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41544. return extendStatics(d, b);
  41545. };
  41546. return function (d, b) {
  41547. extendStatics(d, b);
  41548. function __() { this.constructor = d; }
  41549. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41550. };
  41551. })();
  41552. var channel_Channel = (function (_super) {
  41553. channel_extends(Channel, _super);
  41554. function Channel(name, pusher) {
  41555. var _this = _super.call(this, function (event, data) {
  41556. logger.debug('No callbacks on ' + name + ' for ' + event);
  41557. }) || this;
  41558. _this.name = name;
  41559. _this.pusher = pusher;
  41560. _this.subscribed = false;
  41561. _this.subscriptionPending = false;
  41562. _this.subscriptionCancelled = false;
  41563. return _this;
  41564. }
  41565. Channel.prototype.authorize = function (socketId, callback) {
  41566. return callback(false, {});
  41567. };
  41568. Channel.prototype.trigger = function (event, data) {
  41569. if (event.indexOf("client-") !== 0) {
  41570. throw new BadEventName("Event '" + event + "' does not start with 'client-'");
  41571. }
  41572. if (!this.subscribed) {
  41573. var suffix = url_store.buildLogSuffix("triggeringClientEvents");
  41574. logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
  41575. }
  41576. return this.pusher.send_event(event, data, this.name);
  41577. };
  41578. Channel.prototype.disconnect = function () {
  41579. this.subscribed = false;
  41580. this.subscriptionPending = false;
  41581. };
  41582. Channel.prototype.handleEvent = function (event) {
  41583. var eventName = event.event;
  41584. var data = event.data;
  41585. if (eventName === "pusher_internal:subscription_succeeded") {
  41586. this.handleSubscriptionSucceededEvent(event);
  41587. }
  41588. else if (eventName.indexOf("pusher_internal:") !== 0) {
  41589. var metadata = {};
  41590. this.emit(eventName, data, metadata);
  41591. }
  41592. };
  41593. Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
  41594. this.subscriptionPending = false;
  41595. this.subscribed = true;
  41596. if (this.subscriptionCancelled) {
  41597. this.pusher.unsubscribe(this.name);
  41598. }
  41599. else {
  41600. this.emit("pusher:subscription_succeeded", event.data);
  41601. }
  41602. };
  41603. Channel.prototype.subscribe = function () {
  41604. var _this = this;
  41605. if (this.subscribed) {
  41606. return;
  41607. }
  41608. this.subscriptionPending = true;
  41609. this.subscriptionCancelled = false;
  41610. this.authorize(this.pusher.connection.socket_id, function (error, data) {
  41611. if (error) {
  41612. logger.error(data);
  41613. _this.emit('pusher:subscription_error', data);
  41614. }
  41615. else {
  41616. _this.pusher.send_event('pusher:subscribe', {
  41617. auth: data.auth,
  41618. channel_data: data.channel_data,
  41619. channel: _this.name
  41620. });
  41621. }
  41622. });
  41623. };
  41624. Channel.prototype.unsubscribe = function () {
  41625. this.subscribed = false;
  41626. this.pusher.send_event('pusher:unsubscribe', {
  41627. channel: this.name
  41628. });
  41629. };
  41630. Channel.prototype.cancelSubscription = function () {
  41631. this.subscriptionCancelled = true;
  41632. };
  41633. Channel.prototype.reinstateSubscription = function () {
  41634. this.subscriptionCancelled = false;
  41635. };
  41636. return Channel;
  41637. }(dispatcher));
  41638. /* harmony default export */ var channels_channel = (channel_Channel);
  41639. // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
  41640. var private_channel_extends = (undefined && undefined.__extends) || (function () {
  41641. var extendStatics = function (d, b) {
  41642. extendStatics = Object.setPrototypeOf ||
  41643. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41644. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41645. return extendStatics(d, b);
  41646. };
  41647. return function (d, b) {
  41648. extendStatics(d, b);
  41649. function __() { this.constructor = d; }
  41650. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41651. };
  41652. })();
  41653. var private_channel_PrivateChannel = (function (_super) {
  41654. private_channel_extends(PrivateChannel, _super);
  41655. function PrivateChannel() {
  41656. return _super !== null && _super.apply(this, arguments) || this;
  41657. }
  41658. PrivateChannel.prototype.authorize = function (socketId, callback) {
  41659. var authorizer = factory.createAuthorizer(this, this.pusher.config);
  41660. return authorizer.authorize(socketId, callback);
  41661. };
  41662. return PrivateChannel;
  41663. }(channels_channel));
  41664. /* harmony default export */ var private_channel = (private_channel_PrivateChannel);
  41665. // CONCATENATED MODULE: ./src/core/channels/members.ts
  41666. var members_Members = (function () {
  41667. function Members() {
  41668. this.reset();
  41669. }
  41670. Members.prototype.get = function (id) {
  41671. if (Object.prototype.hasOwnProperty.call(this.members, id)) {
  41672. return {
  41673. id: id,
  41674. info: this.members[id]
  41675. };
  41676. }
  41677. else {
  41678. return null;
  41679. }
  41680. };
  41681. Members.prototype.each = function (callback) {
  41682. var _this = this;
  41683. objectApply(this.members, function (member, id) {
  41684. callback(_this.get(id));
  41685. });
  41686. };
  41687. Members.prototype.setMyID = function (id) {
  41688. this.myID = id;
  41689. };
  41690. Members.prototype.onSubscription = function (subscriptionData) {
  41691. this.members = subscriptionData.presence.hash;
  41692. this.count = subscriptionData.presence.count;
  41693. this.me = this.get(this.myID);
  41694. };
  41695. Members.prototype.addMember = function (memberData) {
  41696. if (this.get(memberData.user_id) === null) {
  41697. this.count++;
  41698. }
  41699. this.members[memberData.user_id] = memberData.user_info;
  41700. return this.get(memberData.user_id);
  41701. };
  41702. Members.prototype.removeMember = function (memberData) {
  41703. var member = this.get(memberData.user_id);
  41704. if (member) {
  41705. delete this.members[memberData.user_id];
  41706. this.count--;
  41707. }
  41708. return member;
  41709. };
  41710. Members.prototype.reset = function () {
  41711. this.members = {};
  41712. this.count = 0;
  41713. this.myID = null;
  41714. this.me = null;
  41715. };
  41716. return Members;
  41717. }());
  41718. /* harmony default export */ var members = (members_Members);
  41719. // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
  41720. var presence_channel_extends = (undefined && undefined.__extends) || (function () {
  41721. var extendStatics = function (d, b) {
  41722. extendStatics = Object.setPrototypeOf ||
  41723. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41724. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41725. return extendStatics(d, b);
  41726. };
  41727. return function (d, b) {
  41728. extendStatics(d, b);
  41729. function __() { this.constructor = d; }
  41730. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41731. };
  41732. })();
  41733. var presence_channel_PresenceChannel = (function (_super) {
  41734. presence_channel_extends(PresenceChannel, _super);
  41735. function PresenceChannel(name, pusher) {
  41736. var _this = _super.call(this, name, pusher) || this;
  41737. _this.members = new members();
  41738. return _this;
  41739. }
  41740. PresenceChannel.prototype.authorize = function (socketId, callback) {
  41741. var _this = this;
  41742. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  41743. if (!error) {
  41744. if (authData.channel_data === undefined) {
  41745. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  41746. logger.error("Invalid auth response for channel '" + _this.name + "'," +
  41747. ("expected 'channel_data' field. " + suffix));
  41748. callback("Invalid auth response");
  41749. return;
  41750. }
  41751. var channelData = JSON.parse(authData.channel_data);
  41752. _this.members.setMyID(channelData.user_id);
  41753. }
  41754. callback(error, authData);
  41755. });
  41756. };
  41757. PresenceChannel.prototype.handleEvent = function (event) {
  41758. var eventName = event.event;
  41759. if (eventName.indexOf("pusher_internal:") === 0) {
  41760. this.handleInternalEvent(event);
  41761. }
  41762. else {
  41763. var data = event.data;
  41764. var metadata = {};
  41765. if (event.user_id) {
  41766. metadata.user_id = event.user_id;
  41767. }
  41768. this.emit(eventName, data, metadata);
  41769. }
  41770. };
  41771. PresenceChannel.prototype.handleInternalEvent = function (event) {
  41772. var eventName = event.event;
  41773. var data = event.data;
  41774. switch (eventName) {
  41775. case "pusher_internal:subscription_succeeded":
  41776. this.handleSubscriptionSucceededEvent(event);
  41777. break;
  41778. case "pusher_internal:member_added":
  41779. var addedMember = this.members.addMember(data);
  41780. this.emit('pusher:member_added', addedMember);
  41781. break;
  41782. case "pusher_internal:member_removed":
  41783. var removedMember = this.members.removeMember(data);
  41784. if (removedMember) {
  41785. this.emit('pusher:member_removed', removedMember);
  41786. }
  41787. break;
  41788. }
  41789. };
  41790. PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
  41791. this.subscriptionPending = false;
  41792. this.subscribed = true;
  41793. if (this.subscriptionCancelled) {
  41794. this.pusher.unsubscribe(this.name);
  41795. }
  41796. else {
  41797. this.members.onSubscription(event.data);
  41798. this.emit("pusher:subscription_succeeded", this.members);
  41799. }
  41800. };
  41801. PresenceChannel.prototype.disconnect = function () {
  41802. this.members.reset();
  41803. _super.prototype.disconnect.call(this);
  41804. };
  41805. return PresenceChannel;
  41806. }(private_channel));
  41807. /* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
  41808. // EXTERNAL MODULE: ./node_modules/tweetnacl/nacl-fast.js
  41809. var nacl_fast = __webpack_require__(0);
  41810. // EXTERNAL MODULE: ./node_modules/tweetnacl-util/nacl-util.js
  41811. var nacl_util = __webpack_require__(1);
  41812. // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
  41813. var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
  41814. var extendStatics = function (d, b) {
  41815. extendStatics = Object.setPrototypeOf ||
  41816. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41817. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41818. return extendStatics(d, b);
  41819. };
  41820. return function (d, b) {
  41821. extendStatics(d, b);
  41822. function __() { this.constructor = d; }
  41823. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41824. };
  41825. })();
  41826. var encrypted_channel_EncryptedChannel = (function (_super) {
  41827. encrypted_channel_extends(EncryptedChannel, _super);
  41828. function EncryptedChannel() {
  41829. var _this = _super !== null && _super.apply(this, arguments) || this;
  41830. _this.key = null;
  41831. return _this;
  41832. }
  41833. EncryptedChannel.prototype.authorize = function (socketId, callback) {
  41834. var _this = this;
  41835. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  41836. if (error) {
  41837. callback(true, authData);
  41838. return;
  41839. }
  41840. var sharedSecret = authData["shared_secret"];
  41841. if (!sharedSecret) {
  41842. var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name;
  41843. callback(true, errorMsg);
  41844. return;
  41845. }
  41846. _this.key = Object(nacl_util["decodeBase64"])(sharedSecret);
  41847. delete authData["shared_secret"];
  41848. callback(false, authData);
  41849. });
  41850. };
  41851. EncryptedChannel.prototype.trigger = function (event, data) {
  41852. throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
  41853. };
  41854. EncryptedChannel.prototype.handleEvent = function (event) {
  41855. var eventName = event.event;
  41856. var data = event.data;
  41857. if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) {
  41858. _super.prototype.handleEvent.call(this, event);
  41859. return;
  41860. }
  41861. this.handleEncryptedEvent(eventName, data);
  41862. };
  41863. EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
  41864. var _this = this;
  41865. if (!this.key) {
  41866. logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
  41867. return;
  41868. }
  41869. if (!data.ciphertext || !data.nonce) {
  41870. logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data);
  41871. return;
  41872. }
  41873. var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext);
  41874. if (cipherText.length < nacl_fast["secretbox"].overheadLength) {
  41875. logger.error("Expected encrypted event ciphertext length to be " + nacl_fast["secretbox"].overheadLength + ", got: " + cipherText.length);
  41876. return;
  41877. }
  41878. var nonce = Object(nacl_util["decodeBase64"])(data.nonce);
  41879. if (nonce.length < nacl_fast["secretbox"].nonceLength) {
  41880. logger.error("Expected encrypted event nonce length to be " + nacl_fast["secretbox"].nonceLength + ", got: " + nonce.length);
  41881. return;
  41882. }
  41883. var bytes = nacl_fast["secretbox"].open(cipherText, nonce, this.key);
  41884. if (bytes === null) {
  41885. logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
  41886. this.authorize(this.pusher.connection.socket_id, function (error, authData) {
  41887. if (error) {
  41888. logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
  41889. return;
  41890. }
  41891. bytes = nacl_fast["secretbox"].open(cipherText, nonce, _this.key);
  41892. if (bytes === null) {
  41893. logger.error("Failed to decrypt event with new key. Dropping encrypted event");
  41894. return;
  41895. }
  41896. _this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41897. return;
  41898. });
  41899. return;
  41900. }
  41901. this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41902. };
  41903. EncryptedChannel.prototype.emitJSON = function (eventName, data) {
  41904. try {
  41905. this.emit(eventName, JSON.parse(data));
  41906. }
  41907. catch (e) {
  41908. this.emit(eventName, data);
  41909. }
  41910. return this;
  41911. };
  41912. return EncryptedChannel;
  41913. }(private_channel));
  41914. /* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
  41915. // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
  41916. var connection_manager_extends = (undefined && undefined.__extends) || (function () {
  41917. var extendStatics = function (d, b) {
  41918. extendStatics = Object.setPrototypeOf ||
  41919. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41920. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41921. return extendStatics(d, b);
  41922. };
  41923. return function (d, b) {
  41924. extendStatics(d, b);
  41925. function __() { this.constructor = d; }
  41926. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41927. };
  41928. })();
  41929. var connection_manager_ConnectionManager = (function (_super) {
  41930. connection_manager_extends(ConnectionManager, _super);
  41931. function ConnectionManager(key, options) {
  41932. var _this = _super.call(this) || this;
  41933. _this.key = key;
  41934. _this.options = options || {};
  41935. _this.state = "initialized";
  41936. _this.connection = null;
  41937. _this.usingTLS = !!options.useTLS;
  41938. _this.timeline = _this.options.timeline;
  41939. _this.errorCallbacks = _this.buildErrorCallbacks();
  41940. _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
  41941. _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
  41942. var Network = runtime.getNetwork();
  41943. Network.bind("online", function () {
  41944. _this.timeline.info({ netinfo: "online" });
  41945. if (_this.state === "connecting" || _this.state === "unavailable") {
  41946. _this.retryIn(0);
  41947. }
  41948. });
  41949. Network.bind("offline", function () {
  41950. _this.timeline.info({ netinfo: "offline" });
  41951. if (_this.connection) {
  41952. _this.sendActivityCheck();
  41953. }
  41954. });
  41955. _this.updateStrategy();
  41956. return _this;
  41957. }
  41958. ConnectionManager.prototype.connect = function () {
  41959. if (this.connection || this.runner) {
  41960. return;
  41961. }
  41962. if (!this.strategy.isSupported()) {
  41963. this.updateState("failed");
  41964. return;
  41965. }
  41966. this.updateState("connecting");
  41967. this.startConnecting();
  41968. this.setUnavailableTimer();
  41969. };
  41970. ;
  41971. ConnectionManager.prototype.send = function (data) {
  41972. if (this.connection) {
  41973. return this.connection.send(data);
  41974. }
  41975. else {
  41976. return false;
  41977. }
  41978. };
  41979. ;
  41980. ConnectionManager.prototype.send_event = function (name, data, channel) {
  41981. if (this.connection) {
  41982. return this.connection.send_event(name, data, channel);
  41983. }
  41984. else {
  41985. return false;
  41986. }
  41987. };
  41988. ;
  41989. ConnectionManager.prototype.disconnect = function () {
  41990. this.disconnectInternally();
  41991. this.updateState("disconnected");
  41992. };
  41993. ;
  41994. ConnectionManager.prototype.isUsingTLS = function () {
  41995. return this.usingTLS;
  41996. };
  41997. ;
  41998. ConnectionManager.prototype.startConnecting = function () {
  41999. var _this = this;
  42000. var callback = function (error, handshake) {
  42001. if (error) {
  42002. _this.runner = _this.strategy.connect(0, callback);
  42003. }
  42004. else {
  42005. if (handshake.action === "error") {
  42006. _this.emit("error", { type: "HandshakeError", error: handshake.error });
  42007. _this.timeline.error({ handshakeError: handshake.error });
  42008. }
  42009. else {
  42010. _this.abortConnecting();
  42011. _this.handshakeCallbacks[handshake.action](handshake);
  42012. }
  42013. }
  42014. };
  42015. this.runner = this.strategy.connect(0, callback);
  42016. };
  42017. ;
  42018. ConnectionManager.prototype.abortConnecting = function () {
  42019. if (this.runner) {
  42020. this.runner.abort();
  42021. this.runner = null;
  42022. }
  42023. };
  42024. ;
  42025. ConnectionManager.prototype.disconnectInternally = function () {
  42026. this.abortConnecting();
  42027. this.clearRetryTimer();
  42028. this.clearUnavailableTimer();
  42029. if (this.connection) {
  42030. var connection = this.abandonConnection();
  42031. connection.close();
  42032. }
  42033. };
  42034. ;
  42035. ConnectionManager.prototype.updateStrategy = function () {
  42036. this.strategy = this.options.getStrategy({
  42037. key: this.key,
  42038. timeline: this.timeline,
  42039. useTLS: this.usingTLS
  42040. });
  42041. };
  42042. ;
  42043. ConnectionManager.prototype.retryIn = function (delay) {
  42044. var _this = this;
  42045. this.timeline.info({ action: "retry", delay: delay });
  42046. if (delay > 0) {
  42047. this.emit("connecting_in", Math.round(delay / 1000));
  42048. }
  42049. this.retryTimer = new OneOffTimer(delay || 0, function () {
  42050. _this.disconnectInternally();
  42051. _this.connect();
  42052. });
  42053. };
  42054. ;
  42055. ConnectionManager.prototype.clearRetryTimer = function () {
  42056. if (this.retryTimer) {
  42057. this.retryTimer.ensureAborted();
  42058. this.retryTimer = null;
  42059. }
  42060. };
  42061. ;
  42062. ConnectionManager.prototype.setUnavailableTimer = function () {
  42063. var _this = this;
  42064. this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
  42065. _this.updateState("unavailable");
  42066. });
  42067. };
  42068. ;
  42069. ConnectionManager.prototype.clearUnavailableTimer = function () {
  42070. if (this.unavailableTimer) {
  42071. this.unavailableTimer.ensureAborted();
  42072. }
  42073. };
  42074. ;
  42075. ConnectionManager.prototype.sendActivityCheck = function () {
  42076. var _this = this;
  42077. this.stopActivityCheck();
  42078. this.connection.ping();
  42079. this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
  42080. _this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
  42081. _this.retryIn(0);
  42082. });
  42083. };
  42084. ;
  42085. ConnectionManager.prototype.resetActivityCheck = function () {
  42086. var _this = this;
  42087. this.stopActivityCheck();
  42088. if (this.connection && !this.connection.handlesActivityChecks()) {
  42089. this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
  42090. _this.sendActivityCheck();
  42091. });
  42092. }
  42093. };
  42094. ;
  42095. ConnectionManager.prototype.stopActivityCheck = function () {
  42096. if (this.activityTimer) {
  42097. this.activityTimer.ensureAborted();
  42098. }
  42099. };
  42100. ;
  42101. ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
  42102. var _this = this;
  42103. return extend({}, errorCallbacks, {
  42104. message: function (message) {
  42105. _this.resetActivityCheck();
  42106. _this.emit('message', message);
  42107. },
  42108. ping: function () {
  42109. _this.send_event('pusher:pong', {});
  42110. },
  42111. activity: function () {
  42112. _this.resetActivityCheck();
  42113. },
  42114. error: function (error) {
  42115. _this.emit("error", { type: "WebSocketError", error: error });
  42116. },
  42117. closed: function () {
  42118. _this.abandonConnection();
  42119. if (_this.shouldRetry()) {
  42120. _this.retryIn(1000);
  42121. }
  42122. }
  42123. });
  42124. };
  42125. ;
  42126. ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
  42127. var _this = this;
  42128. return extend({}, errorCallbacks, {
  42129. connected: function (handshake) {
  42130. _this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
  42131. _this.clearUnavailableTimer();
  42132. _this.setConnection(handshake.connection);
  42133. _this.socket_id = _this.connection.id;
  42134. _this.updateState("connected", { socket_id: _this.socket_id });
  42135. }
  42136. });
  42137. };
  42138. ;
  42139. ConnectionManager.prototype.buildErrorCallbacks = function () {
  42140. var _this = this;
  42141. var withErrorEmitted = function (callback) {
  42142. return function (result) {
  42143. if (result.error) {
  42144. _this.emit("error", { type: "WebSocketError", error: result.error });
  42145. }
  42146. callback(result);
  42147. };
  42148. };
  42149. return {
  42150. tls_only: withErrorEmitted(function () {
  42151. _this.usingTLS = true;
  42152. _this.updateStrategy();
  42153. _this.retryIn(0);
  42154. }),
  42155. refused: withErrorEmitted(function () {
  42156. _this.disconnect();
  42157. }),
  42158. backoff: withErrorEmitted(function () {
  42159. _this.retryIn(1000);
  42160. }),
  42161. retry: withErrorEmitted(function () {
  42162. _this.retryIn(0);
  42163. })
  42164. };
  42165. };
  42166. ;
  42167. ConnectionManager.prototype.setConnection = function (connection) {
  42168. this.connection = connection;
  42169. for (var event in this.connectionCallbacks) {
  42170. this.connection.bind(event, this.connectionCallbacks[event]);
  42171. }
  42172. this.resetActivityCheck();
  42173. };
  42174. ;
  42175. ConnectionManager.prototype.abandonConnection = function () {
  42176. if (!this.connection) {
  42177. return;
  42178. }
  42179. this.stopActivityCheck();
  42180. for (var event in this.connectionCallbacks) {
  42181. this.connection.unbind(event, this.connectionCallbacks[event]);
  42182. }
  42183. var connection = this.connection;
  42184. this.connection = null;
  42185. return connection;
  42186. };
  42187. ConnectionManager.prototype.updateState = function (newState, data) {
  42188. var previousState = this.state;
  42189. this.state = newState;
  42190. if (previousState !== newState) {
  42191. var newStateDescription = newState;
  42192. if (newStateDescription === "connected") {
  42193. newStateDescription += " with new socket ID " + data.socket_id;
  42194. }
  42195. logger.debug('State changed', previousState + ' -> ' + newStateDescription);
  42196. this.timeline.info({ state: newState, params: data });
  42197. this.emit('state_change', { previous: previousState, current: newState });
  42198. this.emit(newState, data);
  42199. }
  42200. };
  42201. ConnectionManager.prototype.shouldRetry = function () {
  42202. return this.state === "connecting" || this.state === "connected";
  42203. };
  42204. return ConnectionManager;
  42205. }(dispatcher));
  42206. /* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
  42207. // CONCATENATED MODULE: ./src/core/channels/channels.ts
  42208. var channels_Channels = (function () {
  42209. function Channels() {
  42210. this.channels = {};
  42211. }
  42212. Channels.prototype.add = function (name, pusher) {
  42213. if (!this.channels[name]) {
  42214. this.channels[name] = createChannel(name, pusher);
  42215. }
  42216. return this.channels[name];
  42217. };
  42218. Channels.prototype.all = function () {
  42219. return values(this.channels);
  42220. };
  42221. Channels.prototype.find = function (name) {
  42222. return this.channels[name];
  42223. };
  42224. Channels.prototype.remove = function (name) {
  42225. var channel = this.channels[name];
  42226. delete this.channels[name];
  42227. return channel;
  42228. };
  42229. Channels.prototype.disconnect = function () {
  42230. objectApply(this.channels, function (channel) {
  42231. channel.disconnect();
  42232. });
  42233. };
  42234. return Channels;
  42235. }());
  42236. /* harmony default export */ var channels = (channels_Channels);
  42237. function createChannel(name, pusher) {
  42238. if (name.indexOf('private-encrypted-') === 0) {
  42239. if (false) { var errorMsg; }
  42240. return factory.createEncryptedChannel(name, pusher);
  42241. }
  42242. else if (name.indexOf('private-') === 0) {
  42243. return factory.createPrivateChannel(name, pusher);
  42244. }
  42245. else if (name.indexOf('presence-') === 0) {
  42246. return factory.createPresenceChannel(name, pusher);
  42247. }
  42248. else {
  42249. return factory.createChannel(name, pusher);
  42250. }
  42251. }
  42252. // CONCATENATED MODULE: ./src/core/utils/factory.ts
  42253. var Factory = {
  42254. createChannels: function () {
  42255. return new channels();
  42256. },
  42257. createConnectionManager: function (key, options) {
  42258. return new connection_manager(key, options);
  42259. },
  42260. createChannel: function (name, pusher) {
  42261. return new channels_channel(name, pusher);
  42262. },
  42263. createPrivateChannel: function (name, pusher) {
  42264. return new private_channel(name, pusher);
  42265. },
  42266. createPresenceChannel: function (name, pusher) {
  42267. return new presence_channel(name, pusher);
  42268. },
  42269. createEncryptedChannel: function (name, pusher) {
  42270. return new encrypted_channel(name, pusher);
  42271. },
  42272. createTimelineSender: function (timeline, options) {
  42273. return new timeline_sender(timeline, options);
  42274. },
  42275. createAuthorizer: function (channel, options) {
  42276. if (options.authorizer) {
  42277. return options.authorizer(channel, options);
  42278. }
  42279. return new pusher_authorizer(channel, options);
  42280. },
  42281. createHandshake: function (transport, callback) {
  42282. return new connection_handshake(transport, callback);
  42283. },
  42284. createAssistantToTheTransportManager: function (manager, transport, options) {
  42285. return new assistant_to_the_transport_manager(manager, transport, options);
  42286. }
  42287. };
  42288. /* harmony default export */ var factory = (Factory);
  42289. // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
  42290. var transport_manager_TransportManager = (function () {
  42291. function TransportManager(options) {
  42292. this.options = options || {};
  42293. this.livesLeft = this.options.lives || Infinity;
  42294. }
  42295. TransportManager.prototype.getAssistant = function (transport) {
  42296. return factory.createAssistantToTheTransportManager(this, transport, {
  42297. minPingDelay: this.options.minPingDelay,
  42298. maxPingDelay: this.options.maxPingDelay
  42299. });
  42300. };
  42301. TransportManager.prototype.isAlive = function () {
  42302. return this.livesLeft > 0;
  42303. };
  42304. TransportManager.prototype.reportDeath = function () {
  42305. this.livesLeft -= 1;
  42306. };
  42307. return TransportManager;
  42308. }());
  42309. /* harmony default export */ var transport_manager = (transport_manager_TransportManager);
  42310. // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
  42311. var sequential_strategy_SequentialStrategy = (function () {
  42312. function SequentialStrategy(strategies, options) {
  42313. this.strategies = strategies;
  42314. this.loop = Boolean(options.loop);
  42315. this.failFast = Boolean(options.failFast);
  42316. this.timeout = options.timeout;
  42317. this.timeoutLimit = options.timeoutLimit;
  42318. }
  42319. SequentialStrategy.prototype.isSupported = function () {
  42320. return any(this.strategies, util.method("isSupported"));
  42321. };
  42322. SequentialStrategy.prototype.connect = function (minPriority, callback) {
  42323. var _this = this;
  42324. var strategies = this.strategies;
  42325. var current = 0;
  42326. var timeout = this.timeout;
  42327. var runner = null;
  42328. var tryNextStrategy = function (error, handshake) {
  42329. if (handshake) {
  42330. callback(null, handshake);
  42331. }
  42332. else {
  42333. current = current + 1;
  42334. if (_this.loop) {
  42335. current = current % strategies.length;
  42336. }
  42337. if (current < strategies.length) {
  42338. if (timeout) {
  42339. timeout = timeout * 2;
  42340. if (_this.timeoutLimit) {
  42341. timeout = Math.min(timeout, _this.timeoutLimit);
  42342. }
  42343. }
  42344. runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
  42345. }
  42346. else {
  42347. callback(true);
  42348. }
  42349. }
  42350. };
  42351. runner = this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: this.failFast }, tryNextStrategy);
  42352. return {
  42353. abort: function () {
  42354. runner.abort();
  42355. },
  42356. forceMinPriority: function (p) {
  42357. minPriority = p;
  42358. if (runner) {
  42359. runner.forceMinPriority(p);
  42360. }
  42361. }
  42362. };
  42363. };
  42364. SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
  42365. var timer = null;
  42366. var runner = null;
  42367. if (options.timeout > 0) {
  42368. timer = new OneOffTimer(options.timeout, function () {
  42369. runner.abort();
  42370. callback(true);
  42371. });
  42372. }
  42373. runner = strategy.connect(minPriority, function (error, handshake) {
  42374. if (error && timer && timer.isRunning() && !options.failFast) {
  42375. return;
  42376. }
  42377. if (timer) {
  42378. timer.ensureAborted();
  42379. }
  42380. callback(error, handshake);
  42381. });
  42382. return {
  42383. abort: function () {
  42384. if (timer) {
  42385. timer.ensureAborted();
  42386. }
  42387. runner.abort();
  42388. },
  42389. forceMinPriority: function (p) {
  42390. runner.forceMinPriority(p);
  42391. }
  42392. };
  42393. };
  42394. return SequentialStrategy;
  42395. }());
  42396. /* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
  42397. // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
  42398. var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
  42399. function BestConnectedEverStrategy(strategies) {
  42400. this.strategies = strategies;
  42401. }
  42402. BestConnectedEverStrategy.prototype.isSupported = function () {
  42403. return any(this.strategies, util.method("isSupported"));
  42404. };
  42405. BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
  42406. return connect(this.strategies, minPriority, function (i, runners) {
  42407. return function (error, handshake) {
  42408. runners[i].error = error;
  42409. if (error) {
  42410. if (allRunnersFailed(runners)) {
  42411. callback(true);
  42412. }
  42413. return;
  42414. }
  42415. apply(runners, function (runner) {
  42416. runner.forceMinPriority(handshake.transport.priority);
  42417. });
  42418. callback(null, handshake);
  42419. };
  42420. });
  42421. };
  42422. return BestConnectedEverStrategy;
  42423. }());
  42424. /* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
  42425. function connect(strategies, minPriority, callbackBuilder) {
  42426. var runners = map(strategies, function (strategy, i, _, rs) {
  42427. return strategy.connect(minPriority, callbackBuilder(i, rs));
  42428. });
  42429. return {
  42430. abort: function () {
  42431. apply(runners, abortRunner);
  42432. },
  42433. forceMinPriority: function (p) {
  42434. apply(runners, function (runner) {
  42435. runner.forceMinPriority(p);
  42436. });
  42437. }
  42438. };
  42439. }
  42440. function allRunnersFailed(runners) {
  42441. return collections_all(runners, function (runner) {
  42442. return Boolean(runner.error);
  42443. });
  42444. }
  42445. function abortRunner(runner) {
  42446. if (!runner.error && !runner.aborted) {
  42447. runner.abort();
  42448. runner.aborted = true;
  42449. }
  42450. }
  42451. // CONCATENATED MODULE: ./src/core/strategies/cached_strategy.ts
  42452. var cached_strategy_CachedStrategy = (function () {
  42453. function CachedStrategy(strategy, transports, options) {
  42454. this.strategy = strategy;
  42455. this.transports = transports;
  42456. this.ttl = options.ttl || 1800 * 1000;
  42457. this.usingTLS = options.useTLS;
  42458. this.timeline = options.timeline;
  42459. }
  42460. CachedStrategy.prototype.isSupported = function () {
  42461. return this.strategy.isSupported();
  42462. };
  42463. CachedStrategy.prototype.connect = function (minPriority, callback) {
  42464. var usingTLS = this.usingTLS;
  42465. var info = fetchTransportCache(usingTLS);
  42466. var strategies = [this.strategy];
  42467. if (info && info.timestamp + this.ttl >= util.now()) {
  42468. var transport = this.transports[info.transport];
  42469. if (transport) {
  42470. this.timeline.info({
  42471. cached: true,
  42472. transport: info.transport,
  42473. latency: info.latency
  42474. });
  42475. strategies.push(new sequential_strategy([transport], {
  42476. timeout: info.latency * 2 + 1000,
  42477. failFast: true
  42478. }));
  42479. }
  42480. }
  42481. var startTimestamp = util.now();
  42482. var runner = strategies.pop().connect(minPriority, function cb(error, handshake) {
  42483. if (error) {
  42484. flushTransportCache(usingTLS);
  42485. if (strategies.length > 0) {
  42486. startTimestamp = util.now();
  42487. runner = strategies.pop().connect(minPriority, cb);
  42488. }
  42489. else {
  42490. callback(error);
  42491. }
  42492. }
  42493. else {
  42494. storeTransportCache(usingTLS, handshake.transport.name, util.now() - startTimestamp);
  42495. callback(null, handshake);
  42496. }
  42497. });
  42498. return {
  42499. abort: function () {
  42500. runner.abort();
  42501. },
  42502. forceMinPriority: function (p) {
  42503. minPriority = p;
  42504. if (runner) {
  42505. runner.forceMinPriority(p);
  42506. }
  42507. }
  42508. };
  42509. };
  42510. return CachedStrategy;
  42511. }());
  42512. /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
  42513. function getTransportCacheKey(usingTLS) {
  42514. return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS");
  42515. }
  42516. function fetchTransportCache(usingTLS) {
  42517. var storage = runtime.getLocalStorage();
  42518. if (storage) {
  42519. try {
  42520. var serializedCache = storage[getTransportCacheKey(usingTLS)];
  42521. if (serializedCache) {
  42522. return JSON.parse(serializedCache);
  42523. }
  42524. }
  42525. catch (e) {
  42526. flushTransportCache(usingTLS);
  42527. }
  42528. }
  42529. return null;
  42530. }
  42531. function storeTransportCache(usingTLS, transport, latency) {
  42532. var storage = runtime.getLocalStorage();
  42533. if (storage) {
  42534. try {
  42535. storage[getTransportCacheKey(usingTLS)] = safeJSONStringify({
  42536. timestamp: util.now(),
  42537. transport: transport,
  42538. latency: latency
  42539. });
  42540. }
  42541. catch (e) {
  42542. }
  42543. }
  42544. }
  42545. function flushTransportCache(usingTLS) {
  42546. var storage = runtime.getLocalStorage();
  42547. if (storage) {
  42548. try {
  42549. delete storage[getTransportCacheKey(usingTLS)];
  42550. }
  42551. catch (e) {
  42552. }
  42553. }
  42554. }
  42555. // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
  42556. var delayed_strategy_DelayedStrategy = (function () {
  42557. function DelayedStrategy(strategy, _a) {
  42558. var number = _a.delay;
  42559. this.strategy = strategy;
  42560. this.options = { delay: number };
  42561. }
  42562. DelayedStrategy.prototype.isSupported = function () {
  42563. return this.strategy.isSupported();
  42564. };
  42565. DelayedStrategy.prototype.connect = function (minPriority, callback) {
  42566. var strategy = this.strategy;
  42567. var runner;
  42568. var timer = new OneOffTimer(this.options.delay, function () {
  42569. runner = strategy.connect(minPriority, callback);
  42570. });
  42571. return {
  42572. abort: function () {
  42573. timer.ensureAborted();
  42574. if (runner) {
  42575. runner.abort();
  42576. }
  42577. },
  42578. forceMinPriority: function (p) {
  42579. minPriority = p;
  42580. if (runner) {
  42581. runner.forceMinPriority(p);
  42582. }
  42583. }
  42584. };
  42585. };
  42586. return DelayedStrategy;
  42587. }());
  42588. /* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
  42589. // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
  42590. var IfStrategy = (function () {
  42591. function IfStrategy(test, trueBranch, falseBranch) {
  42592. this.test = test;
  42593. this.trueBranch = trueBranch;
  42594. this.falseBranch = falseBranch;
  42595. }
  42596. IfStrategy.prototype.isSupported = function () {
  42597. var branch = this.test() ? this.trueBranch : this.falseBranch;
  42598. return branch.isSupported();
  42599. };
  42600. IfStrategy.prototype.connect = function (minPriority, callback) {
  42601. var branch = this.test() ? this.trueBranch : this.falseBranch;
  42602. return branch.connect(minPriority, callback);
  42603. };
  42604. return IfStrategy;
  42605. }());
  42606. /* harmony default export */ var if_strategy = (IfStrategy);
  42607. // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
  42608. var FirstConnectedStrategy = (function () {
  42609. function FirstConnectedStrategy(strategy) {
  42610. this.strategy = strategy;
  42611. }
  42612. FirstConnectedStrategy.prototype.isSupported = function () {
  42613. return this.strategy.isSupported();
  42614. };
  42615. FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
  42616. var runner = this.strategy.connect(minPriority, function (error, handshake) {
  42617. if (handshake) {
  42618. runner.abort();
  42619. }
  42620. callback(error, handshake);
  42621. });
  42622. return runner;
  42623. };
  42624. return FirstConnectedStrategy;
  42625. }());
  42626. /* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
  42627. // CONCATENATED MODULE: ./src/runtimes/web/default_strategy.ts
  42628. function testSupportsStrategy(strategy) {
  42629. return function () {
  42630. return strategy.isSupported();
  42631. };
  42632. }
  42633. var getDefaultStrategy = function (config, defineTransport) {
  42634. var definedTransports = {};
  42635. function defineTransportStrategy(name, type, priority, options, manager) {
  42636. var transport = defineTransport(config, name, type, priority, options, manager);
  42637. definedTransports[name] = transport;
  42638. return transport;
  42639. }
  42640. var ws_options = {
  42641. hostNonTLS: config.wsHost + ":" + config.wsPort,
  42642. hostTLS: config.wsHost + ":" + config.wssPort,
  42643. httpPath: config.wsPath
  42644. };
  42645. var wss_options = extend({}, ws_options, {
  42646. useTLS: true
  42647. });
  42648. var sockjs_options = {
  42649. hostNonTLS: config.httpHost + ":" + config.httpPort,
  42650. hostTLS: config.httpHost + ":" + config.httpsPort,
  42651. httpPath: config.httpPath
  42652. };
  42653. var timeouts = {
  42654. loop: true,
  42655. timeout: 15000,
  42656. timeoutLimit: 60000
  42657. };
  42658. var ws_manager = new transport_manager({
  42659. lives: 2,
  42660. minPingDelay: 10000,
  42661. maxPingDelay: config.activity_timeout
  42662. });
  42663. var streaming_manager = new transport_manager({
  42664. lives: 2,
  42665. minPingDelay: 10000,
  42666. maxPingDelay: config.activity_timeout
  42667. });
  42668. var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager);
  42669. var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager);
  42670. var sockjs_transport = defineTransportStrategy("sockjs", "sockjs", 1, sockjs_options);
  42671. var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, sockjs_options, streaming_manager);
  42672. var xdr_streaming_transport = defineTransportStrategy("xdr_streaming", "xdr_streaming", 1, sockjs_options, streaming_manager);
  42673. var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, sockjs_options);
  42674. var xdr_polling_transport = defineTransportStrategy("xdr_polling", "xdr_polling", 1, sockjs_options);
  42675. var ws_loop = new sequential_strategy([ws_transport], timeouts);
  42676. var wss_loop = new sequential_strategy([wss_transport], timeouts);
  42677. var sockjs_loop = new sequential_strategy([sockjs_transport], timeouts);
  42678. var streaming_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)], timeouts);
  42679. var polling_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)], timeouts);
  42680. 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);
  42681. var http_fallback_loop = new if_strategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
  42682. var wsStrategy;
  42683. if (config.useTLS) {
  42684. wsStrategy = new best_connected_ever_strategy([ws_loop, new delayed_strategy(http_fallback_loop, { delay: 2000 })]);
  42685. }
  42686. else {
  42687. wsStrategy = new best_connected_ever_strategy([
  42688. ws_loop,
  42689. new delayed_strategy(wss_loop, { delay: 2000 }),
  42690. new delayed_strategy(http_fallback_loop, { delay: 5000 })
  42691. ]);
  42692. }
  42693. return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
  42694. ttl: 1800000,
  42695. timeline: config.timeline,
  42696. useTLS: config.useTLS
  42697. });
  42698. };
  42699. /* harmony default export */ var default_strategy = (getDefaultStrategy);
  42700. // CONCATENATED MODULE: ./src/runtimes/web/transports/transport_connection_initializer.ts
  42701. /* harmony default export */ var transport_connection_initializer = (function () {
  42702. var self = this;
  42703. self.timeline.info(self.buildTimelineMessage({
  42704. transport: self.name + (self.options.useTLS ? "s" : "")
  42705. }));
  42706. if (self.hooks.isInitialized()) {
  42707. self.changeState("initialized");
  42708. }
  42709. else if (self.hooks.file) {
  42710. self.changeState("initializing");
  42711. Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function (error, callback) {
  42712. if (self.hooks.isInitialized()) {
  42713. self.changeState("initialized");
  42714. callback(true);
  42715. }
  42716. else {
  42717. if (error) {
  42718. self.onError(error);
  42719. }
  42720. self.onClose();
  42721. callback(false);
  42722. }
  42723. });
  42724. }
  42725. else {
  42726. self.onClose();
  42727. }
  42728. });
  42729. // CONCATENATED MODULE: ./src/runtimes/web/http/http_xdomain_request.ts
  42730. var http_xdomain_request_hooks = {
  42731. getRequest: function (socket) {
  42732. var xdr = new window.XDomainRequest();
  42733. xdr.ontimeout = function () {
  42734. socket.emit("error", new RequestTimedOut());
  42735. socket.close();
  42736. };
  42737. xdr.onerror = function (e) {
  42738. socket.emit("error", e);
  42739. socket.close();
  42740. };
  42741. xdr.onprogress = function () {
  42742. if (xdr.responseText && xdr.responseText.length > 0) {
  42743. socket.onChunk(200, xdr.responseText);
  42744. }
  42745. };
  42746. xdr.onload = function () {
  42747. if (xdr.responseText && xdr.responseText.length > 0) {
  42748. socket.onChunk(200, xdr.responseText);
  42749. }
  42750. socket.emit("finished", 200);
  42751. socket.close();
  42752. };
  42753. return xdr;
  42754. },
  42755. abortRequest: function (xdr) {
  42756. xdr.ontimeout = xdr.onerror = xdr.onprogress = xdr.onload = null;
  42757. xdr.abort();
  42758. }
  42759. };
  42760. /* harmony default export */ var http_xdomain_request = (http_xdomain_request_hooks);
  42761. // CONCATENATED MODULE: ./src/core/http/http_request.ts
  42762. var http_request_extends = (undefined && undefined.__extends) || (function () {
  42763. var extendStatics = function (d, b) {
  42764. extendStatics = Object.setPrototypeOf ||
  42765. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  42766. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  42767. return extendStatics(d, b);
  42768. };
  42769. return function (d, b) {
  42770. extendStatics(d, b);
  42771. function __() { this.constructor = d; }
  42772. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  42773. };
  42774. })();
  42775. var MAX_BUFFER_LENGTH = 256 * 1024;
  42776. var http_request_HTTPRequest = (function (_super) {
  42777. http_request_extends(HTTPRequest, _super);
  42778. function HTTPRequest(hooks, method, url) {
  42779. var _this = _super.call(this) || this;
  42780. _this.hooks = hooks;
  42781. _this.method = method;
  42782. _this.url = url;
  42783. return _this;
  42784. }
  42785. HTTPRequest.prototype.start = function (payload) {
  42786. var _this = this;
  42787. this.position = 0;
  42788. this.xhr = this.hooks.getRequest(this);
  42789. this.unloader = function () {
  42790. _this.close();
  42791. };
  42792. runtime.addUnloadListener(this.unloader);
  42793. this.xhr.open(this.method, this.url, true);
  42794. if (this.xhr.setRequestHeader) {
  42795. this.xhr.setRequestHeader("Content-Type", "application/json");
  42796. }
  42797. this.xhr.send(payload);
  42798. };
  42799. HTTPRequest.prototype.close = function () {
  42800. if (this.unloader) {
  42801. runtime.removeUnloadListener(this.unloader);
  42802. this.unloader = null;
  42803. }
  42804. if (this.xhr) {
  42805. this.hooks.abortRequest(this.xhr);
  42806. this.xhr = null;
  42807. }
  42808. };
  42809. HTTPRequest.prototype.onChunk = function (status, data) {
  42810. while (true) {
  42811. var chunk = this.advanceBuffer(data);
  42812. if (chunk) {
  42813. this.emit("chunk", { status: status, data: chunk });
  42814. }
  42815. else {
  42816. break;
  42817. }
  42818. }
  42819. if (this.isBufferTooLong(data)) {
  42820. this.emit("buffer_too_long");
  42821. }
  42822. };
  42823. HTTPRequest.prototype.advanceBuffer = function (buffer) {
  42824. var unreadData = buffer.slice(this.position);
  42825. var endOfLinePosition = unreadData.indexOf("\n");
  42826. if (endOfLinePosition !== -1) {
  42827. this.position += endOfLinePosition + 1;
  42828. return unreadData.slice(0, endOfLinePosition);
  42829. }
  42830. else {
  42831. return null;
  42832. }
  42833. };
  42834. HTTPRequest.prototype.isBufferTooLong = function (buffer) {
  42835. return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
  42836. };
  42837. return HTTPRequest;
  42838. }(dispatcher));
  42839. /* harmony default export */ var http_request = (http_request_HTTPRequest);
  42840. // CONCATENATED MODULE: ./src/core/http/state.ts
  42841. var State;
  42842. (function (State) {
  42843. State[State["CONNECTING"] = 0] = "CONNECTING";
  42844. State[State["OPEN"] = 1] = "OPEN";
  42845. State[State["CLOSED"] = 3] = "CLOSED";
  42846. })(State || (State = {}));
  42847. /* harmony default export */ var state = (State);
  42848. // CONCATENATED MODULE: ./src/core/http/http_socket.ts
  42849. var autoIncrement = 1;
  42850. var http_socket_HTTPSocket = (function () {
  42851. function HTTPSocket(hooks, url) {
  42852. this.hooks = hooks;
  42853. this.session = randomNumber(1000) + "/" + randomString(8);
  42854. this.location = getLocation(url);
  42855. this.readyState = state.CONNECTING;
  42856. this.openStream();
  42857. }
  42858. HTTPSocket.prototype.send = function (payload) {
  42859. return this.sendRaw(JSON.stringify([payload]));
  42860. };
  42861. HTTPSocket.prototype.ping = function () {
  42862. this.hooks.sendHeartbeat(this);
  42863. };
  42864. HTTPSocket.prototype.close = function (code, reason) {
  42865. this.onClose(code, reason, true);
  42866. };
  42867. HTTPSocket.prototype.sendRaw = function (payload) {
  42868. if (this.readyState === state.OPEN) {
  42869. try {
  42870. runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload);
  42871. return true;
  42872. }
  42873. catch (e) {
  42874. return false;
  42875. }
  42876. }
  42877. else {
  42878. return false;
  42879. }
  42880. };
  42881. HTTPSocket.prototype.reconnect = function () {
  42882. this.closeStream();
  42883. this.openStream();
  42884. };
  42885. ;
  42886. HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
  42887. this.closeStream();
  42888. this.readyState = state.CLOSED;
  42889. if (this.onclose) {
  42890. this.onclose({
  42891. code: code,
  42892. reason: reason,
  42893. wasClean: wasClean
  42894. });
  42895. }
  42896. };
  42897. HTTPSocket.prototype.onChunk = function (chunk) {
  42898. if (chunk.status !== 200) {
  42899. return;
  42900. }
  42901. if (this.readyState === state.OPEN) {
  42902. this.onActivity();
  42903. }
  42904. var payload;
  42905. var type = chunk.data.slice(0, 1);
  42906. switch (type) {
  42907. case 'o':
  42908. payload = JSON.parse(chunk.data.slice(1) || '{}');
  42909. this.onOpen(payload);
  42910. break;
  42911. case 'a':
  42912. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42913. for (var i = 0; i < payload.length; i++) {
  42914. this.onEvent(payload[i]);
  42915. }
  42916. break;
  42917. case 'm':
  42918. payload = JSON.parse(chunk.data.slice(1) || 'null');
  42919. this.onEvent(payload);
  42920. break;
  42921. case 'h':
  42922. this.hooks.onHeartbeat(this);
  42923. break;
  42924. case 'c':
  42925. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42926. this.onClose(payload[0], payload[1], true);
  42927. break;
  42928. }
  42929. };
  42930. HTTPSocket.prototype.onOpen = function (options) {
  42931. if (this.readyState === state.CONNECTING) {
  42932. if (options && options.hostname) {
  42933. this.location.base = replaceHost(this.location.base, options.hostname);
  42934. }
  42935. this.readyState = state.OPEN;
  42936. if (this.onopen) {
  42937. this.onopen();
  42938. }
  42939. }
  42940. else {
  42941. this.onClose(1006, "Server lost session", true);
  42942. }
  42943. };
  42944. HTTPSocket.prototype.onEvent = function (event) {
  42945. if (this.readyState === state.OPEN && this.onmessage) {
  42946. this.onmessage({ data: event });
  42947. }
  42948. };
  42949. HTTPSocket.prototype.onActivity = function () {
  42950. if (this.onactivity) {
  42951. this.onactivity();
  42952. }
  42953. };
  42954. HTTPSocket.prototype.onError = function (error) {
  42955. if (this.onerror) {
  42956. this.onerror(error);
  42957. }
  42958. };
  42959. HTTPSocket.prototype.openStream = function () {
  42960. var _this = this;
  42961. this.stream = runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
  42962. this.stream.bind("chunk", function (chunk) {
  42963. _this.onChunk(chunk);
  42964. });
  42965. this.stream.bind("finished", function (status) {
  42966. _this.hooks.onFinished(_this, status);
  42967. });
  42968. this.stream.bind("buffer_too_long", function () {
  42969. _this.reconnect();
  42970. });
  42971. try {
  42972. this.stream.start();
  42973. }
  42974. catch (error) {
  42975. util.defer(function () {
  42976. _this.onError(error);
  42977. _this.onClose(1006, "Could not start streaming", false);
  42978. });
  42979. }
  42980. };
  42981. HTTPSocket.prototype.closeStream = function () {
  42982. if (this.stream) {
  42983. this.stream.unbind_all();
  42984. this.stream.close();
  42985. this.stream = null;
  42986. }
  42987. };
  42988. return HTTPSocket;
  42989. }());
  42990. function getLocation(url) {
  42991. var parts = /([^\?]*)\/*(\??.*)/.exec(url);
  42992. return {
  42993. base: parts[1],
  42994. queryString: parts[2]
  42995. };
  42996. }
  42997. function getSendURL(url, session) {
  42998. return url.base + "/" + session + "/xhr_send";
  42999. }
  43000. function getUniqueURL(url) {
  43001. var separator = (url.indexOf('?') === -1) ? "?" : "&";
  43002. return url + separator + "t=" + (+new Date()) + "&n=" + autoIncrement++;
  43003. }
  43004. function replaceHost(url, hostname) {
  43005. var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
  43006. return urlParts[1] + hostname + urlParts[3];
  43007. }
  43008. function randomNumber(max) {
  43009. return Math.floor(Math.random() * max);
  43010. }
  43011. function randomString(length) {
  43012. var result = [];
  43013. for (var i = 0; i < length; i++) {
  43014. result.push(randomNumber(32).toString(32));
  43015. }
  43016. return result.join('');
  43017. }
  43018. /* harmony default export */ var http_socket = (http_socket_HTTPSocket);
  43019. // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts
  43020. var http_streaming_socket_hooks = {
  43021. getReceiveURL: function (url, session) {
  43022. return url.base + "/" + session + "/xhr_streaming" + url.queryString;
  43023. },
  43024. onHeartbeat: function (socket) {
  43025. socket.sendRaw("[]");
  43026. },
  43027. sendHeartbeat: function (socket) {
  43028. socket.sendRaw("[]");
  43029. },
  43030. onFinished: function (socket, status) {
  43031. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  43032. }
  43033. };
  43034. /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks);
  43035. // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts
  43036. var http_polling_socket_hooks = {
  43037. getReceiveURL: function (url, session) {
  43038. return url.base + "/" + session + "/xhr" + url.queryString;
  43039. },
  43040. onHeartbeat: function () {
  43041. },
  43042. sendHeartbeat: function (socket) {
  43043. socket.sendRaw("[]");
  43044. },
  43045. onFinished: function (socket, status) {
  43046. if (status === 200) {
  43047. socket.reconnect();
  43048. }
  43049. else {
  43050. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  43051. }
  43052. }
  43053. };
  43054. /* harmony default export */ var http_polling_socket = (http_polling_socket_hooks);
  43055. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http_xhr_request.ts
  43056. var http_xhr_request_hooks = {
  43057. getRequest: function (socket) {
  43058. var Constructor = runtime.getXHRAPI();
  43059. var xhr = new Constructor();
  43060. xhr.onreadystatechange = xhr.onprogress = function () {
  43061. switch (xhr.readyState) {
  43062. case 3:
  43063. if (xhr.responseText && xhr.responseText.length > 0) {
  43064. socket.onChunk(xhr.status, xhr.responseText);
  43065. }
  43066. break;
  43067. case 4:
  43068. if (xhr.responseText && xhr.responseText.length > 0) {
  43069. socket.onChunk(xhr.status, xhr.responseText);
  43070. }
  43071. socket.emit("finished", xhr.status);
  43072. socket.close();
  43073. break;
  43074. }
  43075. };
  43076. return xhr;
  43077. },
  43078. abortRequest: function (xhr) {
  43079. xhr.onreadystatechange = null;
  43080. xhr.abort();
  43081. }
  43082. };
  43083. /* harmony default export */ var http_xhr_request = (http_xhr_request_hooks);
  43084. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http.ts
  43085. var HTTP = {
  43086. createStreamingSocket: function (url) {
  43087. return this.createSocket(http_streaming_socket, url);
  43088. },
  43089. createPollingSocket: function (url) {
  43090. return this.createSocket(http_polling_socket, url);
  43091. },
  43092. createSocket: function (hooks, url) {
  43093. return new http_socket(hooks, url);
  43094. },
  43095. createXHR: function (method, url) {
  43096. return this.createRequest(http_xhr_request, method, url);
  43097. },
  43098. createRequest: function (hooks, method, url) {
  43099. return new http_request(hooks, method, url);
  43100. }
  43101. };
  43102. /* harmony default export */ var http_http = (HTTP);
  43103. // CONCATENATED MODULE: ./src/runtimes/web/http/http.ts
  43104. http_http.createXDR = function (method, url) {
  43105. return this.createRequest(http_xdomain_request, method, url);
  43106. };
  43107. /* harmony default export */ var web_http_http = (http_http);
  43108. // CONCATENATED MODULE: ./src/runtimes/web/runtime.ts
  43109. var Runtime = {
  43110. nextAuthCallbackID: 1,
  43111. auth_callbacks: {},
  43112. ScriptReceivers: ScriptReceivers,
  43113. DependenciesReceivers: DependenciesReceivers,
  43114. getDefaultStrategy: default_strategy,
  43115. Transports: transports_transports,
  43116. transportConnectionInitializer: transport_connection_initializer,
  43117. HTTPFactory: web_http_http,
  43118. TimelineTransport: jsonp_timeline,
  43119. getXHRAPI: function () {
  43120. return window.XMLHttpRequest;
  43121. },
  43122. getWebSocketAPI: function () {
  43123. return window.WebSocket || window.MozWebSocket;
  43124. },
  43125. setup: function (PusherClass) {
  43126. var _this = this;
  43127. window.Pusher = PusherClass;
  43128. var initializeOnDocumentBody = function () {
  43129. _this.onDocumentBody(PusherClass.ready);
  43130. };
  43131. if (!window.JSON) {
  43132. Dependencies.load("json2", {}, initializeOnDocumentBody);
  43133. }
  43134. else {
  43135. initializeOnDocumentBody();
  43136. }
  43137. },
  43138. getDocument: function () {
  43139. return document;
  43140. },
  43141. getProtocol: function () {
  43142. return this.getDocument().location.protocol;
  43143. },
  43144. getAuthorizers: function () {
  43145. return { ajax: xhr_auth, jsonp: jsonp_auth };
  43146. },
  43147. onDocumentBody: function (callback) {
  43148. var _this = this;
  43149. if (document.body) {
  43150. callback();
  43151. }
  43152. else {
  43153. setTimeout(function () {
  43154. _this.onDocumentBody(callback);
  43155. }, 0);
  43156. }
  43157. },
  43158. createJSONPRequest: function (url, data) {
  43159. return new jsonp_request(url, data);
  43160. },
  43161. createScriptRequest: function (src) {
  43162. return new script_request(src);
  43163. },
  43164. getLocalStorage: function () {
  43165. try {
  43166. return window.localStorage;
  43167. }
  43168. catch (e) {
  43169. return undefined;
  43170. }
  43171. },
  43172. createXHR: function () {
  43173. if (this.getXHRAPI()) {
  43174. return this.createXMLHttpRequest();
  43175. }
  43176. else {
  43177. return this.createMicrosoftXHR();
  43178. }
  43179. },
  43180. createXMLHttpRequest: function () {
  43181. var Constructor = this.getXHRAPI();
  43182. return new Constructor();
  43183. },
  43184. createMicrosoftXHR: function () {
  43185. return new ActiveXObject("Microsoft.XMLHTTP");
  43186. },
  43187. getNetwork: function () {
  43188. return net_info_Network;
  43189. },
  43190. createWebSocket: function (url) {
  43191. var Constructor = this.getWebSocketAPI();
  43192. return new Constructor(url);
  43193. },
  43194. createSocketRequest: function (method, url) {
  43195. if (this.isXHRSupported()) {
  43196. return this.HTTPFactory.createXHR(method, url);
  43197. }
  43198. else if (this.isXDRSupported(url.indexOf("https:") === 0)) {
  43199. return this.HTTPFactory.createXDR(method, url);
  43200. }
  43201. else {
  43202. throw "Cross-origin HTTP requests are not supported";
  43203. }
  43204. },
  43205. isXHRSupported: function () {
  43206. var Constructor = this.getXHRAPI();
  43207. return Boolean(Constructor) && (new Constructor()).withCredentials !== undefined;
  43208. },
  43209. isXDRSupported: function (useTLS) {
  43210. var protocol = useTLS ? "https:" : "http:";
  43211. var documentProtocol = this.getProtocol();
  43212. return Boolean((window['XDomainRequest'])) && documentProtocol === protocol;
  43213. },
  43214. addUnloadListener: function (listener) {
  43215. if (window.addEventListener !== undefined) {
  43216. window.addEventListener("unload", listener, false);
  43217. }
  43218. else if (window.attachEvent !== undefined) {
  43219. window.attachEvent("onunload", listener);
  43220. }
  43221. },
  43222. removeUnloadListener: function (listener) {
  43223. if (window.addEventListener !== undefined) {
  43224. window.removeEventListener("unload", listener, false);
  43225. }
  43226. else if (window.detachEvent !== undefined) {
  43227. window.detachEvent("onunload", listener);
  43228. }
  43229. }
  43230. };
  43231. /* harmony default export */ var runtime = (Runtime);
  43232. // CONCATENATED MODULE: ./src/core/timeline/level.ts
  43233. var TimelineLevel;
  43234. (function (TimelineLevel) {
  43235. TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
  43236. TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
  43237. TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
  43238. })(TimelineLevel || (TimelineLevel = {}));
  43239. /* harmony default export */ var timeline_level = (TimelineLevel);
  43240. // CONCATENATED MODULE: ./src/core/timeline/timeline.ts
  43241. var timeline_Timeline = (function () {
  43242. function Timeline(key, session, options) {
  43243. this.key = key;
  43244. this.session = session;
  43245. this.events = [];
  43246. this.options = options || {};
  43247. this.sent = 0;
  43248. this.uniqueID = 0;
  43249. }
  43250. Timeline.prototype.log = function (level, event) {
  43251. if (level <= this.options.level) {
  43252. this.events.push(extend({}, event, { timestamp: util.now() }));
  43253. if (this.options.limit && this.events.length > this.options.limit) {
  43254. this.events.shift();
  43255. }
  43256. }
  43257. };
  43258. Timeline.prototype.error = function (event) {
  43259. this.log(timeline_level.ERROR, event);
  43260. };
  43261. Timeline.prototype.info = function (event) {
  43262. this.log(timeline_level.INFO, event);
  43263. };
  43264. Timeline.prototype.debug = function (event) {
  43265. this.log(timeline_level.DEBUG, event);
  43266. };
  43267. Timeline.prototype.isEmpty = function () {
  43268. return this.events.length === 0;
  43269. };
  43270. Timeline.prototype.send = function (sendfn, callback) {
  43271. var _this = this;
  43272. var data = extend({
  43273. session: this.session,
  43274. bundle: this.sent + 1,
  43275. key: this.key,
  43276. lib: "js",
  43277. version: this.options.version,
  43278. cluster: this.options.cluster,
  43279. features: this.options.features,
  43280. timeline: this.events
  43281. }, this.options.params);
  43282. this.events = [];
  43283. sendfn(data, function (error, result) {
  43284. if (!error) {
  43285. _this.sent++;
  43286. }
  43287. if (callback) {
  43288. callback(error, result);
  43289. }
  43290. });
  43291. return true;
  43292. };
  43293. Timeline.prototype.generateUniqueID = function () {
  43294. this.uniqueID++;
  43295. return this.uniqueID;
  43296. };
  43297. return Timeline;
  43298. }());
  43299. /* harmony default export */ var timeline_timeline = (timeline_Timeline);
  43300. // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
  43301. var transport_strategy_TransportStrategy = (function () {
  43302. function TransportStrategy(name, priority, transport, options) {
  43303. this.name = name;
  43304. this.priority = priority;
  43305. this.transport = transport;
  43306. this.options = options || {};
  43307. }
  43308. TransportStrategy.prototype.isSupported = function () {
  43309. return this.transport.isSupported({
  43310. useTLS: this.options.useTLS
  43311. });
  43312. };
  43313. TransportStrategy.prototype.connect = function (minPriority, callback) {
  43314. var _this = this;
  43315. if (!this.isSupported()) {
  43316. return failAttempt(new UnsupportedStrategy(), callback);
  43317. }
  43318. else if (this.priority < minPriority) {
  43319. return failAttempt(new TransportPriorityTooLow(), callback);
  43320. }
  43321. var connected = false;
  43322. var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options);
  43323. var handshake = null;
  43324. var onInitialized = function () {
  43325. transport.unbind("initialized", onInitialized);
  43326. transport.connect();
  43327. };
  43328. var onOpen = function () {
  43329. handshake = factory.createHandshake(transport, function (result) {
  43330. connected = true;
  43331. unbindListeners();
  43332. callback(null, result);
  43333. });
  43334. };
  43335. var onError = function (error) {
  43336. unbindListeners();
  43337. callback(error);
  43338. };
  43339. var onClosed = function () {
  43340. unbindListeners();
  43341. var serializedTransport;
  43342. serializedTransport = safeJSONStringify(transport);
  43343. callback(new TransportClosed(serializedTransport));
  43344. };
  43345. var unbindListeners = function () {
  43346. transport.unbind("initialized", onInitialized);
  43347. transport.unbind("open", onOpen);
  43348. transport.unbind("error", onError);
  43349. transport.unbind("closed", onClosed);
  43350. };
  43351. transport.bind("initialized", onInitialized);
  43352. transport.bind("open", onOpen);
  43353. transport.bind("error", onError);
  43354. transport.bind("closed", onClosed);
  43355. transport.initialize();
  43356. return {
  43357. abort: function () {
  43358. if (connected) {
  43359. return;
  43360. }
  43361. unbindListeners();
  43362. if (handshake) {
  43363. handshake.close();
  43364. }
  43365. else {
  43366. transport.close();
  43367. }
  43368. },
  43369. forceMinPriority: function (p) {
  43370. if (connected) {
  43371. return;
  43372. }
  43373. if (_this.priority < p) {
  43374. if (handshake) {
  43375. handshake.close();
  43376. }
  43377. else {
  43378. transport.close();
  43379. }
  43380. }
  43381. }
  43382. };
  43383. };
  43384. return TransportStrategy;
  43385. }());
  43386. /* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
  43387. function failAttempt(error, callback) {
  43388. util.defer(function () {
  43389. callback(error);
  43390. });
  43391. return {
  43392. abort: function () { },
  43393. forceMinPriority: function () { }
  43394. };
  43395. }
  43396. // CONCATENATED MODULE: ./src/core/strategies/strategy_builder.ts
  43397. var strategy_builder_Transports = runtime.Transports;
  43398. var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
  43399. var transportClass = strategy_builder_Transports[type];
  43400. if (!transportClass) {
  43401. throw new UnsupportedTransport(type);
  43402. }
  43403. var enabled = (!config.enabledTransports ||
  43404. arrayIndexOf(config.enabledTransports, name) !== -1) &&
  43405. (!config.disabledTransports ||
  43406. arrayIndexOf(config.disabledTransports, name) === -1);
  43407. var transport;
  43408. if (enabled) {
  43409. transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, extend({
  43410. key: config.key,
  43411. useTLS: config.useTLS,
  43412. timeline: config.timeline,
  43413. ignoreNullOrigin: config.ignoreNullOrigin
  43414. }, options));
  43415. }
  43416. else {
  43417. transport = strategy_builder_UnsupportedStrategy;
  43418. }
  43419. return transport;
  43420. };
  43421. var strategy_builder_UnsupportedStrategy = {
  43422. isSupported: function () {
  43423. return false;
  43424. },
  43425. connect: function (_, callback) {
  43426. var deferred = util.defer(function () {
  43427. callback(new UnsupportedStrategy());
  43428. });
  43429. return {
  43430. abort: function () {
  43431. deferred.ensureAborted();
  43432. },
  43433. forceMinPriority: function () { }
  43434. };
  43435. }
  43436. };
  43437. // CONCATENATED MODULE: ./src/core/config.ts
  43438. var getGlobalConfig = function () {
  43439. return {
  43440. wsHost: defaults.host,
  43441. wsPort: defaults.ws_port,
  43442. wssPort: defaults.wss_port,
  43443. wsPath: defaults.ws_path,
  43444. httpHost: defaults.sockjs_host,
  43445. httpPort: defaults.sockjs_http_port,
  43446. httpsPort: defaults.sockjs_https_port,
  43447. httpPath: defaults.sockjs_path,
  43448. statsHost: defaults.stats_host,
  43449. authEndpoint: defaults.channel_auth_endpoint,
  43450. authTransport: defaults.channel_auth_transport,
  43451. activity_timeout: defaults.activity_timeout,
  43452. pong_timeout: defaults.pong_timeout,
  43453. unavailable_timeout: defaults.unavailable_timeout
  43454. };
  43455. };
  43456. var getClusterConfig = function (clusterName) {
  43457. return {
  43458. wsHost: 'ws-' + clusterName + '.pusher.com',
  43459. httpHost: 'sockjs-' + clusterName + '.pusher.com'
  43460. };
  43461. };
  43462. // CONCATENATED MODULE: ./src/core/pusher.ts
  43463. var pusher_Pusher = (function () {
  43464. function Pusher(app_key, options) {
  43465. var _this = this;
  43466. checkAppKey(app_key);
  43467. options = options || {};
  43468. if (!options.cluster && !(options.wsHost || options.httpHost)) {
  43469. var suffix = url_store.buildLogSuffix('javascriptQuickStart');
  43470. logger.warn("You should always specify a cluster when connecting. " + suffix);
  43471. }
  43472. this.key = app_key;
  43473. this.config = extend(getGlobalConfig(), options.cluster ? getClusterConfig(options.cluster) : {}, options);
  43474. this.channels = factory.createChannels();
  43475. this.global_emitter = new dispatcher();
  43476. this.sessionID = Math.floor(Math.random() * 1000000000);
  43477. this.timeline = new timeline_timeline(this.key, this.sessionID, {
  43478. cluster: this.config.cluster,
  43479. features: Pusher.getClientFeatures(),
  43480. params: this.config.timelineParams || {},
  43481. limit: 50,
  43482. level: timeline_level.INFO,
  43483. version: defaults.VERSION
  43484. });
  43485. if (!this.config.disableStats) {
  43486. this.timelineSender = factory.createTimelineSender(this.timeline, {
  43487. host: this.config.statsHost,
  43488. path: '/timeline/v2/' + runtime.TimelineTransport.name
  43489. });
  43490. }
  43491. var getStrategy = function (options) {
  43492. var config = extend({}, _this.config, options);
  43493. return runtime.getDefaultStrategy(config, strategy_builder_defineTransport);
  43494. };
  43495. this.connection = factory.createConnectionManager(this.key, extend({
  43496. getStrategy: getStrategy,
  43497. timeline: this.timeline,
  43498. activityTimeout: this.config.activity_timeout,
  43499. pongTimeout: this.config.pong_timeout,
  43500. unavailableTimeout: this.config.unavailable_timeout
  43501. }, this.config, { useTLS: this.shouldUseTLS() }));
  43502. this.connection.bind('connected', function () {
  43503. _this.subscribeAll();
  43504. if (_this.timelineSender) {
  43505. _this.timelineSender.send(_this.connection.isUsingTLS());
  43506. }
  43507. });
  43508. this.connection.bind('message', function (event) {
  43509. var eventName = event.event;
  43510. var internal = eventName.indexOf('pusher_internal:') === 0;
  43511. if (event.channel) {
  43512. var channel = _this.channel(event.channel);
  43513. if (channel) {
  43514. channel.handleEvent(event);
  43515. }
  43516. }
  43517. if (!internal) {
  43518. _this.global_emitter.emit(event.event, event.data);
  43519. }
  43520. });
  43521. this.connection.bind('connecting', function () {
  43522. _this.channels.disconnect();
  43523. });
  43524. this.connection.bind('disconnected', function () {
  43525. _this.channels.disconnect();
  43526. });
  43527. this.connection.bind('error', function (err) {
  43528. logger.warn(err);
  43529. });
  43530. Pusher.instances.push(this);
  43531. this.timeline.info({ instances: Pusher.instances.length });
  43532. if (Pusher.isReady) {
  43533. this.connect();
  43534. }
  43535. }
  43536. Pusher.ready = function () {
  43537. Pusher.isReady = true;
  43538. for (var i = 0, l = Pusher.instances.length; i < l; i++) {
  43539. Pusher.instances[i].connect();
  43540. }
  43541. };
  43542. Pusher.getClientFeatures = function () {
  43543. return keys(filterObject({ ws: runtime.Transports.ws }, function (t) {
  43544. return t.isSupported({});
  43545. }));
  43546. };
  43547. Pusher.prototype.channel = function (name) {
  43548. return this.channels.find(name);
  43549. };
  43550. Pusher.prototype.allChannels = function () {
  43551. return this.channels.all();
  43552. };
  43553. Pusher.prototype.connect = function () {
  43554. this.connection.connect();
  43555. if (this.timelineSender) {
  43556. if (!this.timelineSenderTimer) {
  43557. var usingTLS = this.connection.isUsingTLS();
  43558. var timelineSender = this.timelineSender;
  43559. this.timelineSenderTimer = new PeriodicTimer(60000, function () {
  43560. timelineSender.send(usingTLS);
  43561. });
  43562. }
  43563. }
  43564. };
  43565. Pusher.prototype.disconnect = function () {
  43566. this.connection.disconnect();
  43567. if (this.timelineSenderTimer) {
  43568. this.timelineSenderTimer.ensureAborted();
  43569. this.timelineSenderTimer = null;
  43570. }
  43571. };
  43572. Pusher.prototype.bind = function (event_name, callback, context) {
  43573. this.global_emitter.bind(event_name, callback, context);
  43574. return this;
  43575. };
  43576. Pusher.prototype.unbind = function (event_name, callback, context) {
  43577. this.global_emitter.unbind(event_name, callback, context);
  43578. return this;
  43579. };
  43580. Pusher.prototype.bind_global = function (callback) {
  43581. this.global_emitter.bind_global(callback);
  43582. return this;
  43583. };
  43584. Pusher.prototype.unbind_global = function (callback) {
  43585. this.global_emitter.unbind_global(callback);
  43586. return this;
  43587. };
  43588. Pusher.prototype.unbind_all = function (callback) {
  43589. this.global_emitter.unbind_all();
  43590. return this;
  43591. };
  43592. Pusher.prototype.subscribeAll = function () {
  43593. var channelName;
  43594. for (channelName in this.channels.channels) {
  43595. if (this.channels.channels.hasOwnProperty(channelName)) {
  43596. this.subscribe(channelName);
  43597. }
  43598. }
  43599. };
  43600. Pusher.prototype.subscribe = function (channel_name) {
  43601. var channel = this.channels.add(channel_name, this);
  43602. if (channel.subscriptionPending && channel.subscriptionCancelled) {
  43603. channel.reinstateSubscription();
  43604. }
  43605. else if (!channel.subscriptionPending &&
  43606. this.connection.state === 'connected') {
  43607. channel.subscribe();
  43608. }
  43609. return channel;
  43610. };
  43611. Pusher.prototype.unsubscribe = function (channel_name) {
  43612. var channel = this.channels.find(channel_name);
  43613. if (channel && channel.subscriptionPending) {
  43614. channel.cancelSubscription();
  43615. }
  43616. else {
  43617. channel = this.channels.remove(channel_name);
  43618. if (channel && this.connection.state === 'connected') {
  43619. channel.unsubscribe();
  43620. }
  43621. }
  43622. };
  43623. Pusher.prototype.send_event = function (event_name, data, channel) {
  43624. return this.connection.send_event(event_name, data, channel);
  43625. };
  43626. Pusher.prototype.shouldUseTLS = function () {
  43627. if (runtime.getProtocol() === 'https:') {
  43628. return true;
  43629. }
  43630. else if (this.config.forceTLS === true) {
  43631. return true;
  43632. }
  43633. else {
  43634. return Boolean(this.config.encrypted);
  43635. }
  43636. };
  43637. Pusher.instances = [];
  43638. Pusher.isReady = false;
  43639. Pusher.logToConsole = false;
  43640. Pusher.Runtime = runtime;
  43641. Pusher.ScriptReceivers = runtime.ScriptReceivers;
  43642. Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
  43643. Pusher.auth_callbacks = runtime.auth_callbacks;
  43644. return Pusher;
  43645. }());
  43646. /* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
  43647. function checkAppKey(key) {
  43648. if (key === null || key === undefined) {
  43649. throw 'You must pass your app key when you instantiate Pusher.';
  43650. }
  43651. }
  43652. runtime.setup(pusher_Pusher);
  43653. /***/ })
  43654. /******/ ]);
  43655. });
  43656. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  43657. /***/ }),
  43658. /***/ "./node_modules/setimmediate/setImmediate.js":
  43659. /*!***************************************************!*\
  43660. !*** ./node_modules/setimmediate/setImmediate.js ***!
  43661. \***************************************************/
  43662. /*! no static exports found */
  43663. /***/ (function(module, exports, __webpack_require__) {
  43664. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  43665. "use strict";
  43666. if (global.setImmediate) {
  43667. return;
  43668. }
  43669. var nextHandle = 1; // Spec says greater than zero
  43670. var tasksByHandle = {};
  43671. var currentlyRunningATask = false;
  43672. var doc = global.document;
  43673. var registerImmediate;
  43674. function setImmediate(callback) {
  43675. // Callback can either be a function or a string
  43676. if (typeof callback !== "function") {
  43677. callback = new Function("" + callback);
  43678. }
  43679. // Copy function arguments
  43680. var args = new Array(arguments.length - 1);
  43681. for (var i = 0; i < args.length; i++) {
  43682. args[i] = arguments[i + 1];
  43683. }
  43684. // Store and register the task
  43685. var task = { callback: callback, args: args };
  43686. tasksByHandle[nextHandle] = task;
  43687. registerImmediate(nextHandle);
  43688. return nextHandle++;
  43689. }
  43690. function clearImmediate(handle) {
  43691. delete tasksByHandle[handle];
  43692. }
  43693. function run(task) {
  43694. var callback = task.callback;
  43695. var args = task.args;
  43696. switch (args.length) {
  43697. case 0:
  43698. callback();
  43699. break;
  43700. case 1:
  43701. callback(args[0]);
  43702. break;
  43703. case 2:
  43704. callback(args[0], args[1]);
  43705. break;
  43706. case 3:
  43707. callback(args[0], args[1], args[2]);
  43708. break;
  43709. default:
  43710. callback.apply(undefined, args);
  43711. break;
  43712. }
  43713. }
  43714. function runIfPresent(handle) {
  43715. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  43716. // So if we're currently running a task, we'll need to delay this invocation.
  43717. if (currentlyRunningATask) {
  43718. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  43719. // "too much recursion" error.
  43720. setTimeout(runIfPresent, 0, handle);
  43721. } else {
  43722. var task = tasksByHandle[handle];
  43723. if (task) {
  43724. currentlyRunningATask = true;
  43725. try {
  43726. run(task);
  43727. } finally {
  43728. clearImmediate(handle);
  43729. currentlyRunningATask = false;
  43730. }
  43731. }
  43732. }
  43733. }
  43734. function installNextTickImplementation() {
  43735. registerImmediate = function(handle) {
  43736. process.nextTick(function () { runIfPresent(handle); });
  43737. };
  43738. }
  43739. function canUsePostMessage() {
  43740. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  43741. // where `global.postMessage` means something completely different and can't be used for this purpose.
  43742. if (global.postMessage && !global.importScripts) {
  43743. var postMessageIsAsynchronous = true;
  43744. var oldOnMessage = global.onmessage;
  43745. global.onmessage = function() {
  43746. postMessageIsAsynchronous = false;
  43747. };
  43748. global.postMessage("", "*");
  43749. global.onmessage = oldOnMessage;
  43750. return postMessageIsAsynchronous;
  43751. }
  43752. }
  43753. function installPostMessageImplementation() {
  43754. // Installs an event handler on `global` for the `message` event: see
  43755. // * https://developer.mozilla.org/en/DOM/window.postMessage
  43756. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  43757. var messagePrefix = "setImmediate$" + Math.random() + "$";
  43758. var onGlobalMessage = function(event) {
  43759. if (event.source === global &&
  43760. typeof event.data === "string" &&
  43761. event.data.indexOf(messagePrefix) === 0) {
  43762. runIfPresent(+event.data.slice(messagePrefix.length));
  43763. }
  43764. };
  43765. if (global.addEventListener) {
  43766. global.addEventListener("message", onGlobalMessage, false);
  43767. } else {
  43768. global.attachEvent("onmessage", onGlobalMessage);
  43769. }
  43770. registerImmediate = function(handle) {
  43771. global.postMessage(messagePrefix + handle, "*");
  43772. };
  43773. }
  43774. function installMessageChannelImplementation() {
  43775. var channel = new MessageChannel();
  43776. channel.port1.onmessage = function(event) {
  43777. var handle = event.data;
  43778. runIfPresent(handle);
  43779. };
  43780. registerImmediate = function(handle) {
  43781. channel.port2.postMessage(handle);
  43782. };
  43783. }
  43784. function installReadyStateChangeImplementation() {
  43785. var html = doc.documentElement;
  43786. registerImmediate = function(handle) {
  43787. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  43788. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  43789. var script = doc.createElement("script");
  43790. script.onreadystatechange = function () {
  43791. runIfPresent(handle);
  43792. script.onreadystatechange = null;
  43793. html.removeChild(script);
  43794. script = null;
  43795. };
  43796. html.appendChild(script);
  43797. };
  43798. }
  43799. function installSetTimeoutImplementation() {
  43800. registerImmediate = function(handle) {
  43801. setTimeout(runIfPresent, 0, handle);
  43802. };
  43803. }
  43804. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  43805. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  43806. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  43807. // Don't get fooled by e.g. browserify environments.
  43808. if ({}.toString.call(global.process) === "[object process]") {
  43809. // For Node.js before 0.9
  43810. installNextTickImplementation();
  43811. } else if (canUsePostMessage()) {
  43812. // For non-IE10 modern browsers
  43813. installPostMessageImplementation();
  43814. } else if (global.MessageChannel) {
  43815. // For web workers, where supported
  43816. installMessageChannelImplementation();
  43817. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  43818. // For IE 6–8
  43819. installReadyStateChangeImplementation();
  43820. } else {
  43821. // For older browsers
  43822. installSetTimeoutImplementation();
  43823. }
  43824. attachTo.setImmediate = setImmediate;
  43825. attachTo.clearImmediate = clearImmediate;
  43826. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  43827. /* 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")))
  43828. /***/ }),
  43829. /***/ "./node_modules/style-loader/index.js!./node_modules/css-loader/index.js?!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css&":
  43830. /*!***********************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
  43831. !*** ./node_modules/style-loader!./node_modules/css-loader??ref--6-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--6-2!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css& ***!
  43832. \***********************************************************************************************************************************************************************************************************************************************************************************************************************************/
  43833. /*! no static exports found */
  43834. /***/ (function(module, exports, __webpack_require__) {
  43835. var content = __webpack_require__(/*! !../../../node_modules/css-loader??ref--6-1!../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../node_modules/postcss-loader/src??ref--6-2!../../../node_modules/vue-loader/lib??vue-loader-options!./CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css& */ "./node_modules/css-loader/index.js?!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css&");
  43836. if(typeof content === 'string') content = [[module.i, content, '']];
  43837. var transform;
  43838. var insertInto;
  43839. var options = {"hmr":true}
  43840. options.transform = transform
  43841. options.insertInto = undefined;
  43842. var update = __webpack_require__(/*! ../../../node_modules/style-loader/lib/addStyles.js */ "./node_modules/style-loader/lib/addStyles.js")(content, options);
  43843. if(content.locals) module.exports = content.locals;
  43844. if(false) {}
  43845. /***/ }),
  43846. /***/ "./node_modules/style-loader/index.js!./node_modules/css-loader/index.js?!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css&":
  43847. /*!************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
  43848. !*** ./node_modules/style-loader!./node_modules/css-loader??ref--6-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--6-2!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css& ***!
  43849. \************************************************************************************************************************************************************************************************************************************************************************************************************************/
  43850. /*! no static exports found */
  43851. /***/ (function(module, exports, __webpack_require__) {
  43852. var content = __webpack_require__(/*! !../../../node_modules/css-loader??ref--6-1!../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../node_modules/postcss-loader/src??ref--6-2!../../../node_modules/vue-loader/lib??vue-loader-options!./Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css& */ "./node_modules/css-loader/index.js?!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css&");
  43853. if(typeof content === 'string') content = [[module.i, content, '']];
  43854. var transform;
  43855. var insertInto;
  43856. var options = {"hmr":true}
  43857. options.transform = transform
  43858. options.insertInto = undefined;
  43859. var update = __webpack_require__(/*! ../../../node_modules/style-loader/lib/addStyles.js */ "./node_modules/style-loader/lib/addStyles.js")(content, options);
  43860. if(content.locals) module.exports = content.locals;
  43861. if(false) {}
  43862. /***/ }),
  43863. /***/ "./node_modules/style-loader/lib/addStyles.js":
  43864. /*!****************************************************!*\
  43865. !*** ./node_modules/style-loader/lib/addStyles.js ***!
  43866. \****************************************************/
  43867. /*! no static exports found */
  43868. /***/ (function(module, exports, __webpack_require__) {
  43869. /*
  43870. MIT License http://www.opensource.org/licenses/mit-license.php
  43871. Author Tobias Koppers @sokra
  43872. */
  43873. var stylesInDom = {};
  43874. var memoize = function (fn) {
  43875. var memo;
  43876. return function () {
  43877. if (typeof memo === "undefined") memo = fn.apply(this, arguments);
  43878. return memo;
  43879. };
  43880. };
  43881. var isOldIE = memoize(function () {
  43882. // Test for IE <= 9 as proposed by Browserhacks
  43883. // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805
  43884. // Tests for existence of standard globals is to allow style-loader
  43885. // to operate correctly into non-standard environments
  43886. // @see https://github.com/webpack-contrib/style-loader/issues/177
  43887. return window && document && document.all && !window.atob;
  43888. });
  43889. var getTarget = function (target, parent) {
  43890. if (parent){
  43891. return parent.querySelector(target);
  43892. }
  43893. return document.querySelector(target);
  43894. };
  43895. var getElement = (function (fn) {
  43896. var memo = {};
  43897. return function(target, parent) {
  43898. // If passing function in options, then use it for resolve "head" element.
  43899. // Useful for Shadow Root style i.e
  43900. // {
  43901. // insertInto: function () { return document.querySelector("#foo").shadowRoot }
  43902. // }
  43903. if (typeof target === 'function') {
  43904. return target();
  43905. }
  43906. if (typeof memo[target] === "undefined") {
  43907. var styleTarget = getTarget.call(this, target, parent);
  43908. // Special case to return head of iframe instead of iframe itself
  43909. if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
  43910. try {
  43911. // This will throw an exception if access to iframe is blocked
  43912. // due to cross-origin restrictions
  43913. styleTarget = styleTarget.contentDocument.head;
  43914. } catch(e) {
  43915. styleTarget = null;
  43916. }
  43917. }
  43918. memo[target] = styleTarget;
  43919. }
  43920. return memo[target]
  43921. };
  43922. })();
  43923. var singleton = null;
  43924. var singletonCounter = 0;
  43925. var stylesInsertedAtTop = [];
  43926. var fixUrls = __webpack_require__(/*! ./urls */ "./node_modules/style-loader/lib/urls.js");
  43927. module.exports = function(list, options) {
  43928. if (typeof DEBUG !== "undefined" && DEBUG) {
  43929. if (typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
  43930. }
  43931. options = options || {};
  43932. options.attrs = typeof options.attrs === "object" ? options.attrs : {};
  43933. // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
  43934. // tags it will allow on a page
  43935. if (!options.singleton && typeof options.singleton !== "boolean") options.singleton = isOldIE();
  43936. // By default, add <style> tags to the <head> element
  43937. if (!options.insertInto) options.insertInto = "head";
  43938. // By default, add <style> tags to the bottom of the target
  43939. if (!options.insertAt) options.insertAt = "bottom";
  43940. var styles = listToStyles(list, options);
  43941. addStylesToDom(styles, options);
  43942. return function update (newList) {
  43943. var mayRemove = [];
  43944. for (var i = 0; i < styles.length; i++) {
  43945. var item = styles[i];
  43946. var domStyle = stylesInDom[item.id];
  43947. domStyle.refs--;
  43948. mayRemove.push(domStyle);
  43949. }
  43950. if(newList) {
  43951. var newStyles = listToStyles(newList, options);
  43952. addStylesToDom(newStyles, options);
  43953. }
  43954. for (var i = 0; i < mayRemove.length; i++) {
  43955. var domStyle = mayRemove[i];
  43956. if(domStyle.refs === 0) {
  43957. for (var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j]();
  43958. delete stylesInDom[domStyle.id];
  43959. }
  43960. }
  43961. };
  43962. };
  43963. function addStylesToDom (styles, options) {
  43964. for (var i = 0; i < styles.length; i++) {
  43965. var item = styles[i];
  43966. var domStyle = stylesInDom[item.id];
  43967. if(domStyle) {
  43968. domStyle.refs++;
  43969. for(var j = 0; j < domStyle.parts.length; j++) {
  43970. domStyle.parts[j](item.parts[j]);
  43971. }
  43972. for(; j < item.parts.length; j++) {
  43973. domStyle.parts.push(addStyle(item.parts[j], options));
  43974. }
  43975. } else {
  43976. var parts = [];
  43977. for(var j = 0; j < item.parts.length; j++) {
  43978. parts.push(addStyle(item.parts[j], options));
  43979. }
  43980. stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
  43981. }
  43982. }
  43983. }
  43984. function listToStyles (list, options) {
  43985. var styles = [];
  43986. var newStyles = {};
  43987. for (var i = 0; i < list.length; i++) {
  43988. var item = list[i];
  43989. var id = options.base ? item[0] + options.base : item[0];
  43990. var css = item[1];
  43991. var media = item[2];
  43992. var sourceMap = item[3];
  43993. var part = {css: css, media: media, sourceMap: sourceMap};
  43994. if(!newStyles[id]) styles.push(newStyles[id] = {id: id, parts: [part]});
  43995. else newStyles[id].parts.push(part);
  43996. }
  43997. return styles;
  43998. }
  43999. function insertStyleElement (options, style) {
  44000. var target = getElement(options.insertInto)
  44001. if (!target) {
  44002. throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");
  44003. }
  44004. var lastStyleElementInsertedAtTop = stylesInsertedAtTop[stylesInsertedAtTop.length - 1];
  44005. if (options.insertAt === "top") {
  44006. if (!lastStyleElementInsertedAtTop) {
  44007. target.insertBefore(style, target.firstChild);
  44008. } else if (lastStyleElementInsertedAtTop.nextSibling) {
  44009. target.insertBefore(style, lastStyleElementInsertedAtTop.nextSibling);
  44010. } else {
  44011. target.appendChild(style);
  44012. }
  44013. stylesInsertedAtTop.push(style);
  44014. } else if (options.insertAt === "bottom") {
  44015. target.appendChild(style);
  44016. } else if (typeof options.insertAt === "object" && options.insertAt.before) {
  44017. var nextSibling = getElement(options.insertAt.before, target);
  44018. target.insertBefore(style, nextSibling);
  44019. } else {
  44020. throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");
  44021. }
  44022. }
  44023. function removeStyleElement (style) {
  44024. if (style.parentNode === null) return false;
  44025. style.parentNode.removeChild(style);
  44026. var idx = stylesInsertedAtTop.indexOf(style);
  44027. if(idx >= 0) {
  44028. stylesInsertedAtTop.splice(idx, 1);
  44029. }
  44030. }
  44031. function createStyleElement (options) {
  44032. var style = document.createElement("style");
  44033. if(options.attrs.type === undefined) {
  44034. options.attrs.type = "text/css";
  44035. }
  44036. if(options.attrs.nonce === undefined) {
  44037. var nonce = getNonce();
  44038. if (nonce) {
  44039. options.attrs.nonce = nonce;
  44040. }
  44041. }
  44042. addAttrs(style, options.attrs);
  44043. insertStyleElement(options, style);
  44044. return style;
  44045. }
  44046. function createLinkElement (options) {
  44047. var link = document.createElement("link");
  44048. if(options.attrs.type === undefined) {
  44049. options.attrs.type = "text/css";
  44050. }
  44051. options.attrs.rel = "stylesheet";
  44052. addAttrs(link, options.attrs);
  44053. insertStyleElement(options, link);
  44054. return link;
  44055. }
  44056. function addAttrs (el, attrs) {
  44057. Object.keys(attrs).forEach(function (key) {
  44058. el.setAttribute(key, attrs[key]);
  44059. });
  44060. }
  44061. function getNonce() {
  44062. if (false) {}
  44063. return __webpack_require__.nc;
  44064. }
  44065. function addStyle (obj, options) {
  44066. var style, update, remove, result;
  44067. // If a transform function was defined, run it on the css
  44068. if (options.transform && obj.css) {
  44069. result = typeof options.transform === 'function'
  44070. ? options.transform(obj.css)
  44071. : options.transform.default(obj.css);
  44072. if (result) {
  44073. // If transform returns a value, use that instead of the original css.
  44074. // This allows running runtime transformations on the css.
  44075. obj.css = result;
  44076. } else {
  44077. // If the transform function returns a falsy value, don't add this css.
  44078. // This allows conditional loading of css
  44079. return function() {
  44080. // noop
  44081. };
  44082. }
  44083. }
  44084. if (options.singleton) {
  44085. var styleIndex = singletonCounter++;
  44086. style = singleton || (singleton = createStyleElement(options));
  44087. update = applyToSingletonTag.bind(null, style, styleIndex, false);
  44088. remove = applyToSingletonTag.bind(null, style, styleIndex, true);
  44089. } else if (
  44090. obj.sourceMap &&
  44091. typeof URL === "function" &&
  44092. typeof URL.createObjectURL === "function" &&
  44093. typeof URL.revokeObjectURL === "function" &&
  44094. typeof Blob === "function" &&
  44095. typeof btoa === "function"
  44096. ) {
  44097. style = createLinkElement(options);
  44098. update = updateLink.bind(null, style, options);
  44099. remove = function () {
  44100. removeStyleElement(style);
  44101. if(style.href) URL.revokeObjectURL(style.href);
  44102. };
  44103. } else {
  44104. style = createStyleElement(options);
  44105. update = applyToTag.bind(null, style);
  44106. remove = function () {
  44107. removeStyleElement(style);
  44108. };
  44109. }
  44110. update(obj);
  44111. return function updateStyle (newObj) {
  44112. if (newObj) {
  44113. if (
  44114. newObj.css === obj.css &&
  44115. newObj.media === obj.media &&
  44116. newObj.sourceMap === obj.sourceMap
  44117. ) {
  44118. return;
  44119. }
  44120. update(obj = newObj);
  44121. } else {
  44122. remove();
  44123. }
  44124. };
  44125. }
  44126. var replaceText = (function () {
  44127. var textStore = [];
  44128. return function (index, replacement) {
  44129. textStore[index] = replacement;
  44130. return textStore.filter(Boolean).join('\n');
  44131. };
  44132. })();
  44133. function applyToSingletonTag (style, index, remove, obj) {
  44134. var css = remove ? "" : obj.css;
  44135. if (style.styleSheet) {
  44136. style.styleSheet.cssText = replaceText(index, css);
  44137. } else {
  44138. var cssNode = document.createTextNode(css);
  44139. var childNodes = style.childNodes;
  44140. if (childNodes[index]) style.removeChild(childNodes[index]);
  44141. if (childNodes.length) {
  44142. style.insertBefore(cssNode, childNodes[index]);
  44143. } else {
  44144. style.appendChild(cssNode);
  44145. }
  44146. }
  44147. }
  44148. function applyToTag (style, obj) {
  44149. var css = obj.css;
  44150. var media = obj.media;
  44151. if(media) {
  44152. style.setAttribute("media", media)
  44153. }
  44154. if(style.styleSheet) {
  44155. style.styleSheet.cssText = css;
  44156. } else {
  44157. while(style.firstChild) {
  44158. style.removeChild(style.firstChild);
  44159. }
  44160. style.appendChild(document.createTextNode(css));
  44161. }
  44162. }
  44163. function updateLink (link, options, obj) {
  44164. var css = obj.css;
  44165. var sourceMap = obj.sourceMap;
  44166. /*
  44167. If convertToAbsoluteUrls isn't defined, but sourcemaps are enabled
  44168. and there is no publicPath defined then lets turn convertToAbsoluteUrls
  44169. on by default. Otherwise default to the convertToAbsoluteUrls option
  44170. directly
  44171. */
  44172. var autoFixUrls = options.convertToAbsoluteUrls === undefined && sourceMap;
  44173. if (options.convertToAbsoluteUrls || autoFixUrls) {
  44174. css = fixUrls(css);
  44175. }
  44176. if (sourceMap) {
  44177. // http://stackoverflow.com/a/26603875
  44178. css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
  44179. }
  44180. var blob = new Blob([css], { type: "text/css" });
  44181. var oldSrc = link.href;
  44182. link.href = URL.createObjectURL(blob);
  44183. if(oldSrc) URL.revokeObjectURL(oldSrc);
  44184. }
  44185. /***/ }),
  44186. /***/ "./node_modules/style-loader/lib/urls.js":
  44187. /*!***********************************************!*\
  44188. !*** ./node_modules/style-loader/lib/urls.js ***!
  44189. \***********************************************/
  44190. /*! no static exports found */
  44191. /***/ (function(module, exports) {
  44192. /**
  44193. * When source maps are enabled, `style-loader` uses a link element with a data-uri to
  44194. * embed the css on the page. This breaks all relative urls because now they are relative to a
  44195. * bundle instead of the current page.
  44196. *
  44197. * One solution is to only use full urls, but that may be impossible.
  44198. *
  44199. * Instead, this function "fixes" the relative urls to be absolute according to the current page location.
  44200. *
  44201. * A rudimentary test suite is located at `test/fixUrls.js` and can be run via the `npm test` command.
  44202. *
  44203. */
  44204. module.exports = function (css) {
  44205. // get current location
  44206. var location = typeof window !== "undefined" && window.location;
  44207. if (!location) {
  44208. throw new Error("fixUrls requires window.location");
  44209. }
  44210. // blank or null?
  44211. if (!css || typeof css !== "string") {
  44212. return css;
  44213. }
  44214. var baseUrl = location.protocol + "//" + location.host;
  44215. var currentDir = baseUrl + location.pathname.replace(/\/[^\/]*$/, "/");
  44216. // convert each url(...)
  44217. /*
  44218. This regular expression is just a way to recursively match brackets within
  44219. a string.
  44220. /url\s*\( = Match on the word "url" with any whitespace after it and then a parens
  44221. ( = Start a capturing group
  44222. (?: = Start a non-capturing group
  44223. [^)(] = Match anything that isn't a parentheses
  44224. | = OR
  44225. \( = Match a start parentheses
  44226. (?: = Start another non-capturing groups
  44227. [^)(]+ = Match anything that isn't a parentheses
  44228. | = OR
  44229. \( = Match a start parentheses
  44230. [^)(]* = Match anything that isn't a parentheses
  44231. \) = Match a end parentheses
  44232. ) = End Group
  44233. *\) = Match anything and then a close parens
  44234. ) = Close non-capturing group
  44235. * = Match anything
  44236. ) = Close capturing group
  44237. \) = Match a close parens
  44238. /gi = Get all matches, not the first. Be case insensitive.
  44239. */
  44240. var fixedCss = css.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function(fullMatch, origUrl) {
  44241. // strip quotes (if they exist)
  44242. var unquotedOrigUrl = origUrl
  44243. .trim()
  44244. .replace(/^"(.*)"$/, function(o, $1){ return $1; })
  44245. .replace(/^'(.*)'$/, function(o, $1){ return $1; });
  44246. // already a full url? no change
  44247. if (/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(unquotedOrigUrl)) {
  44248. return fullMatch;
  44249. }
  44250. // convert the url to a full url
  44251. var newUrl;
  44252. if (unquotedOrigUrl.indexOf("//") === 0) {
  44253. //TODO: should we add protocol?
  44254. newUrl = unquotedOrigUrl;
  44255. } else if (unquotedOrigUrl.indexOf("/") === 0) {
  44256. // path should be relative to the base url
  44257. newUrl = baseUrl + unquotedOrigUrl; // already starts with '/'
  44258. } else {
  44259. // path should be relative to current directory
  44260. newUrl = currentDir + unquotedOrigUrl.replace(/^\.\//, ""); // Strip leading './'
  44261. }
  44262. // send back the fixed url(...)
  44263. return "url(" + JSON.stringify(newUrl) + ")";
  44264. });
  44265. // send back the fixed css
  44266. return fixedCss;
  44267. };
  44268. /***/ }),
  44269. /***/ "./node_modules/timers-browserify/main.js":
  44270. /*!************************************************!*\
  44271. !*** ./node_modules/timers-browserify/main.js ***!
  44272. \************************************************/
  44273. /*! no static exports found */
  44274. /***/ (function(module, exports, __webpack_require__) {
  44275. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  44276. (typeof self !== "undefined" && self) ||
  44277. window;
  44278. var apply = Function.prototype.apply;
  44279. // DOM APIs, for completeness
  44280. exports.setTimeout = function() {
  44281. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  44282. };
  44283. exports.setInterval = function() {
  44284. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  44285. };
  44286. exports.clearTimeout =
  44287. exports.clearInterval = function(timeout) {
  44288. if (timeout) {
  44289. timeout.close();
  44290. }
  44291. };
  44292. function Timeout(id, clearFn) {
  44293. this._id = id;
  44294. this._clearFn = clearFn;
  44295. }
  44296. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  44297. Timeout.prototype.close = function() {
  44298. this._clearFn.call(scope, this._id);
  44299. };
  44300. // Does not start the time, just sets up the members needed.
  44301. exports.enroll = function(item, msecs) {
  44302. clearTimeout(item._idleTimeoutId);
  44303. item._idleTimeout = msecs;
  44304. };
  44305. exports.unenroll = function(item) {
  44306. clearTimeout(item._idleTimeoutId);
  44307. item._idleTimeout = -1;
  44308. };
  44309. exports._unrefActive = exports.active = function(item) {
  44310. clearTimeout(item._idleTimeoutId);
  44311. var msecs = item._idleTimeout;
  44312. if (msecs >= 0) {
  44313. item._idleTimeoutId = setTimeout(function onTimeout() {
  44314. if (item._onTimeout)
  44315. item._onTimeout();
  44316. }, msecs);
  44317. }
  44318. };
  44319. // setimmediate attaches itself to the global object
  44320. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  44321. // On some exotic environments, it's not clear which object `setimmediate` was
  44322. // able to install onto. Search each possibility in the same order as the
  44323. // `setimmediate` library.
  44324. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  44325. (typeof global !== "undefined" && global.setImmediate) ||
  44326. (this && this.setImmediate);
  44327. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  44328. (typeof global !== "undefined" && global.clearImmediate) ||
  44329. (this && this.clearImmediate);
  44330. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  44331. /***/ }),
  44332. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AssetInfo.vue?vue&type=template&id=f949323a&":
  44333. /*!************************************************************************************************************************************************************************************************************!*\
  44334. !*** ./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=f949323a& ***!
  44335. \************************************************************************************************************************************************************************************************************/
  44336. /*! exports provided: render, staticRenderFns */
  44337. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44338. "use strict";
  44339. __webpack_require__.r(__webpack_exports__);
  44340. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44341. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44342. var render = function() {
  44343. var _vm = this
  44344. var _h = _vm.$createElement
  44345. var _c = _vm._self._c || _h
  44346. return _c(
  44347. "div",
  44348. [
  44349. _c("asset-info-edit-modal", {
  44350. attrs: {
  44351. "modal-id": "asset" + _vm.asset.pcid + "editModal",
  44352. "populate-with": _vm.asset
  44353. }
  44354. }),
  44355. _vm._v(" "),
  44356. _c("h4", { staticClass: "text-center" }, [
  44357. _vm._v(
  44358. _vm._s(this.asset.pcmanu) + " " + _vm._s(this.asset.pcmake) + " - "
  44359. ),
  44360. _c("small", { staticClass: "text-muted" }, [
  44361. _vm._v(_vm._s(this.asset.pcnickname))
  44362. ])
  44363. ]),
  44364. _vm._v(" "),
  44365. _c("p", [_vm._v("OS: " + _vm._s(this.asset.pcextra[2]))]),
  44366. _vm._v(" "),
  44367. _c("p", [_vm._v("S/N: " + _vm._s(this.asset.pcextra[104]))]),
  44368. _vm._v(" "),
  44369. _c("p", [_vm._v("CPU: " + _vm._s(this.asset.pcextra[101]))]),
  44370. _vm._v(" "),
  44371. _c("p", [_vm._v("RAM: " + _vm._s(this.asset.pcextra[100]))]),
  44372. _vm._v(" "),
  44373. _c("p", [_vm._v("Graphics: " + _vm._s(this.asset.pcextra[4]))]),
  44374. _vm._v(" "),
  44375. _c(
  44376. "button",
  44377. {
  44378. staticClass: "btn btn-primary",
  44379. attrs: {
  44380. type: "button",
  44381. "data-toggle": "modal",
  44382. "data-target": "#asset" + _vm.asset.pcid + "editModal"
  44383. }
  44384. },
  44385. [_vm._v("Edit")]
  44386. )
  44387. ],
  44388. 1
  44389. )
  44390. }
  44391. var staticRenderFns = []
  44392. render._withStripped = true
  44393. /***/ }),
  44394. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AssetInfoEditModal.vue?vue&type=template&id=24c98bd0&":
  44395. /*!*********************************************************************************************************************************************************************************************************************!*\
  44396. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/AssetInfoEditModal.vue?vue&type=template&id=24c98bd0& ***!
  44397. \*********************************************************************************************************************************************************************************************************************/
  44398. /*! exports provided: render, staticRenderFns */
  44399. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44400. "use strict";
  44401. __webpack_require__.r(__webpack_exports__);
  44402. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44403. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44404. var render = function() {
  44405. var _vm = this
  44406. var _h = _vm.$createElement
  44407. var _c = _vm._self._c || _h
  44408. return _c(
  44409. "modal",
  44410. {
  44411. attrs: {
  44412. id: _vm.modalId,
  44413. tabindex: "-1",
  44414. role: "dialog",
  44415. "aria-labelledby": _vm.modalId + "Label"
  44416. }
  44417. },
  44418. [
  44419. _c(
  44420. "h5",
  44421. {
  44422. staticClass: "modal-title",
  44423. attrs: { slot: "header", id: _vm.modalId + "Label" },
  44424. slot: "header"
  44425. },
  44426. [_vm._v("\n Edit Work Order Information\n ")]
  44427. ),
  44428. _vm._v(" "),
  44429. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44430. _c("div", { staticClass: "form-group" }, [
  44431. _c("label", { attrs: { for: "manufacturer" } }, [
  44432. _vm._v("Manufacturer")
  44433. ]),
  44434. _vm._v(" "),
  44435. _c("input", {
  44436. directives: [
  44437. {
  44438. name: "model",
  44439. rawName: "v-model",
  44440. value: _vm.asset.pcmanu,
  44441. expression: "asset.pcmanu"
  44442. }
  44443. ],
  44444. staticClass: "form-control",
  44445. attrs: { type: "text", name: "manufacturer", id: "manufacturer" },
  44446. domProps: { value: _vm.asset.pcmanu },
  44447. on: {
  44448. input: function($event) {
  44449. if ($event.target.composing) {
  44450. return
  44451. }
  44452. _vm.$set(_vm.asset, "pcmanu", $event.target.value)
  44453. }
  44454. }
  44455. })
  44456. ]),
  44457. _vm._v(" "),
  44458. _c("div", { staticClass: "form-group" }, [
  44459. _c("label", { attrs: { for: "make" } }, [_vm._v("Make")]),
  44460. _vm._v(" "),
  44461. _c("input", {
  44462. directives: [
  44463. {
  44464. name: "model",
  44465. rawName: "v-model",
  44466. value: _vm.asset.pcmake,
  44467. expression: "asset.pcmake"
  44468. }
  44469. ],
  44470. staticClass: "form-control",
  44471. attrs: { type: "text", name: "make", id: "make" },
  44472. domProps: { value: _vm.asset.pcmake },
  44473. on: {
  44474. input: function($event) {
  44475. if ($event.target.composing) {
  44476. return
  44477. }
  44478. _vm.$set(_vm.asset, "pcmake", $event.target.value)
  44479. }
  44480. }
  44481. })
  44482. ]),
  44483. _vm._v(" "),
  44484. _c("div", { staticClass: "form-group" }, [
  44485. _c("label", { attrs: { for: "nickname" } }, [_vm._v("Nickname")]),
  44486. _vm._v(" "),
  44487. _c("input", {
  44488. directives: [
  44489. {
  44490. name: "model",
  44491. rawName: "v-model",
  44492. value: _vm.asset.pcnickname,
  44493. expression: "asset.pcnickname"
  44494. }
  44495. ],
  44496. staticClass: "form-control",
  44497. attrs: { type: "text", name: "nickname", id: "nickname" },
  44498. domProps: { value: _vm.asset.pcnickname },
  44499. on: {
  44500. input: function($event) {
  44501. if ($event.target.composing) {
  44502. return
  44503. }
  44504. _vm.$set(_vm.asset, "pcnickname", $event.target.value)
  44505. }
  44506. }
  44507. })
  44508. ]),
  44509. _vm._v(" "),
  44510. _c("div", { staticClass: "form-group" }, [
  44511. _c("label", { attrs: { for: "os" } }, [_vm._v("OS")]),
  44512. _vm._v(" "),
  44513. _c("input", {
  44514. directives: [
  44515. {
  44516. name: "model",
  44517. rawName: "v-model",
  44518. value: _vm.asset.pcextra[2],
  44519. expression: "asset.pcextra[2]"
  44520. }
  44521. ],
  44522. staticClass: "form-control",
  44523. attrs: { type: "text", name: "os", id: "os" },
  44524. domProps: { value: _vm.asset.pcextra[2] },
  44525. on: {
  44526. input: function($event) {
  44527. if ($event.target.composing) {
  44528. return
  44529. }
  44530. _vm.$set(_vm.asset.pcextra, 2, $event.target.value)
  44531. }
  44532. }
  44533. })
  44534. ]),
  44535. _vm._v(" "),
  44536. _c("div", { staticClass: "form-group" }, [
  44537. _c("label", { attrs: { for: "serial" } }, [_vm._v("Serial Number")]),
  44538. _vm._v(" "),
  44539. _c("input", {
  44540. directives: [
  44541. {
  44542. name: "model",
  44543. rawName: "v-model",
  44544. value: _vm.asset.pcextra[104],
  44545. expression: "asset.pcextra[104]"
  44546. }
  44547. ],
  44548. staticClass: "form-control",
  44549. attrs: { type: "text", id: "serial", name: "serial" },
  44550. domProps: { value: _vm.asset.pcextra[104] },
  44551. on: {
  44552. input: function($event) {
  44553. if ($event.target.composing) {
  44554. return
  44555. }
  44556. _vm.$set(_vm.asset.pcextra, 104, $event.target.value)
  44557. }
  44558. }
  44559. })
  44560. ]),
  44561. _vm._v(" "),
  44562. _c("div", { staticClass: "form-group" }, [
  44563. _c("label", { attrs: { for: "cpu" } }, [_vm._v("CPU")]),
  44564. _vm._v(" "),
  44565. _c("input", {
  44566. directives: [
  44567. {
  44568. name: "model",
  44569. rawName: "v-model",
  44570. value: _vm.asset.pcextra[101],
  44571. expression: "asset.pcextra[101]"
  44572. }
  44573. ],
  44574. staticClass: "form-control",
  44575. attrs: { type: "text", id: "cpu", name: "cpu" },
  44576. domProps: { value: _vm.asset.pcextra[101] },
  44577. on: {
  44578. input: function($event) {
  44579. if ($event.target.composing) {
  44580. return
  44581. }
  44582. _vm.$set(_vm.asset.pcextra, 101, $event.target.value)
  44583. }
  44584. }
  44585. })
  44586. ]),
  44587. _vm._v(" "),
  44588. _c("div", { staticClass: "form-group" }, [
  44589. _c("label", { attrs: { for: "ram" } }, [_vm._v("RAM")]),
  44590. _vm._v(" "),
  44591. _c("input", {
  44592. directives: [
  44593. {
  44594. name: "model",
  44595. rawName: "v-model",
  44596. value: _vm.asset.pcextra[100],
  44597. expression: "asset.pcextra[100]"
  44598. }
  44599. ],
  44600. staticClass: "form-control",
  44601. attrs: { type: "text", name: "ram", id: "ram" },
  44602. domProps: { value: _vm.asset.pcextra[100] },
  44603. on: {
  44604. input: function($event) {
  44605. if ($event.target.composing) {
  44606. return
  44607. }
  44608. _vm.$set(_vm.asset.pcextra, 100, $event.target.value)
  44609. }
  44610. }
  44611. })
  44612. ]),
  44613. _vm._v(" "),
  44614. _c("div", { staticClass: "form-group" }, [
  44615. _c("label", { attrs: { for: "graphics" } }, [_vm._v("Graphics")]),
  44616. _vm._v(" "),
  44617. _c("input", {
  44618. directives: [
  44619. {
  44620. name: "model",
  44621. rawName: "v-model",
  44622. value: _vm.asset.pcextra[4],
  44623. expression: "asset.pcextra[4]"
  44624. }
  44625. ],
  44626. staticClass: "form-control",
  44627. attrs: { type: "text", name: "graphics", id: "grapics" },
  44628. domProps: { value: _vm.asset.pcextra[4] },
  44629. on: {
  44630. input: function($event) {
  44631. if ($event.target.composing) {
  44632. return
  44633. }
  44634. _vm.$set(_vm.asset.pcextra, 4, $event.target.value)
  44635. }
  44636. }
  44637. })
  44638. ])
  44639. ]),
  44640. _vm._v(" "),
  44641. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44642. _c(
  44643. "button",
  44644. {
  44645. staticClass: "btn btn-secondary",
  44646. attrs: { type: "button", "data-dismiss": "modal" }
  44647. },
  44648. [_vm._v("Close")]
  44649. ),
  44650. _vm._v(" "),
  44651. _c(
  44652. "button",
  44653. {
  44654. staticClass: "btn btn-primary",
  44655. attrs: { type: "button" },
  44656. on: {
  44657. click: function($event) {
  44658. return _vm.updateAsset()
  44659. }
  44660. }
  44661. },
  44662. [
  44663. !_vm.assetSaving
  44664. ? _c("div", [_vm._v("Save")])
  44665. : _c("circle-spinner", { attrs: { size: 2 } })
  44666. ],
  44667. 1
  44668. )
  44669. ])
  44670. ]
  44671. )
  44672. }
  44673. var staticRenderFns = []
  44674. render._withStripped = true
  44675. /***/ }),
  44676. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56&":
  44677. /*!*****************************************************************************************************************************************************************************************************************************!*\
  44678. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56& ***!
  44679. \*****************************************************************************************************************************************************************************************************************************/
  44680. /*! exports provided: render, staticRenderFns */
  44681. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44682. "use strict";
  44683. __webpack_require__.r(__webpack_exports__);
  44684. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44685. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44686. var render = function() {
  44687. var _vm = this
  44688. var _h = _vm.$createElement
  44689. var _c = _vm._self._c || _h
  44690. return _c("div", { staticClass: "dropdown", class: { open: _vm.open } }, [
  44691. _c("div", { staticClass: "input-group" }, [
  44692. _c("input", {
  44693. directives: [
  44694. {
  44695. name: "model",
  44696. rawName: "v-model",
  44697. value: _vm.searchText,
  44698. expression: "searchText"
  44699. }
  44700. ],
  44701. staticClass: "form-control",
  44702. attrs: { type: "text" },
  44703. domProps: { value: _vm.searchText },
  44704. on: {
  44705. input: [
  44706. function($event) {
  44707. if ($event.target.composing) {
  44708. return
  44709. }
  44710. _vm.searchText = $event.target.value
  44711. },
  44712. _vm.searchChanged
  44713. ]
  44714. }
  44715. }),
  44716. _vm._v(" "),
  44717. _c("div", { staticClass: "form-group-append" }, [
  44718. _c(
  44719. "a",
  44720. {
  44721. staticClass: "toggle input-group-text bg-primary text-light",
  44722. on: {
  44723. mousedown: function($event) {
  44724. $event.preventDefault()
  44725. },
  44726. click: function($event) {
  44727. return _vm.setOpen(!_vm.open)
  44728. }
  44729. }
  44730. },
  44731. [
  44732. _c("span", { staticClass: "arrow-up" }, [_vm._v("▲")]),
  44733. _vm._v(" "),
  44734. _c("span", { staticClass: "arrow-down" }, [_vm._v("▼")])
  44735. ]
  44736. )
  44737. ])
  44738. ]),
  44739. _vm._v(" "),
  44740. _c(
  44741. "ul",
  44742. { staticClass: "suggestion-list list-unstyled" },
  44743. _vm._l(_vm.matches, function(suggestion, index) {
  44744. return _c(
  44745. "li",
  44746. {
  44747. key: index,
  44748. on: {
  44749. mousedown: function($event) {
  44750. $event.preventDefault()
  44751. },
  44752. click: function($event) {
  44753. return _vm.suggestionSelected(suggestion)
  44754. }
  44755. }
  44756. },
  44757. [_vm._v("\n " + _vm._s(suggestion[1]) + "\n ")]
  44758. )
  44759. }),
  44760. 0
  44761. )
  44762. ])
  44763. }
  44764. var staticRenderFns = []
  44765. render._withStripped = true
  44766. /***/ }),
  44767. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true&":
  44768. /*!****************************************************************************************************************************************************************************************************************************!*\
  44769. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true& ***!
  44770. \****************************************************************************************************************************************************************************************************************************/
  44771. /*! exports provided: render, staticRenderFns */
  44772. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44773. "use strict";
  44774. __webpack_require__.r(__webpack_exports__);
  44775. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44776. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44777. var render = function() {
  44778. var _vm = this
  44779. var _h = _vm.$createElement
  44780. var _c = _vm._self._c || _h
  44781. return _c(
  44782. "div",
  44783. {
  44784. staticClass: "loader",
  44785. style: {
  44786. fontSize: _vm.size + "px",
  44787. borderLeft: "1.1em solid " + _vm.color
  44788. }
  44789. },
  44790. [_vm._v("Loading...")]
  44791. )
  44792. }
  44793. var staticRenderFns = []
  44794. render._withStripped = true
  44795. /***/ }),
  44796. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/Credential.vue?vue&type=template&id=58b8dcfc&":
  44797. /*!*************************************************************************************************************************************************************************************************************!*\
  44798. !*** ./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=58b8dcfc& ***!
  44799. \*************************************************************************************************************************************************************************************************************/
  44800. /*! exports provided: render, staticRenderFns */
  44801. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44802. "use strict";
  44803. __webpack_require__.r(__webpack_exports__);
  44804. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44805. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44806. var render = function() {
  44807. var _vm = this
  44808. var _h = _vm.$createElement
  44809. var _c = _vm._self._c || _h
  44810. return _c(
  44811. "div",
  44812. { staticClass: "bg-lightgray m-1 p-2 border rounded container-fluid" },
  44813. [
  44814. _c("credential-form-modal", {
  44815. attrs: {
  44816. descriptions: _vm.creddescList,
  44817. "modal-id": "credential" + this.data.credid + "editModal",
  44818. populateWith: this.data
  44819. }
  44820. }),
  44821. _vm._v(" "),
  44822. _c(
  44823. "modal",
  44824. {
  44825. attrs: {
  44826. id: "credential" + this.data.credid + "deleteModal",
  44827. tabindex: "-1"
  44828. }
  44829. },
  44830. [
  44831. _c(
  44832. "h5",
  44833. {
  44834. staticClass: "modal-title",
  44835. attrs: {
  44836. slot: "header",
  44837. id: "credential" + this.data.credid + "deleteModalLabel"
  44838. },
  44839. slot: "header"
  44840. },
  44841. [_vm._v("\r\n Delete Credential\r\n ")]
  44842. ),
  44843. _vm._v(" "),
  44844. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44845. _vm._v("\r\n Are you sure?\r\n ")
  44846. ]),
  44847. _vm._v(" "),
  44848. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44849. _c(
  44850. "button",
  44851. {
  44852. staticClass: "btn btn-secondary",
  44853. attrs: { type: "button", "data-dismiss": "modal" }
  44854. },
  44855. [_vm._v("Cancel")]
  44856. ),
  44857. _vm._v(" "),
  44858. _c(
  44859. "button",
  44860. {
  44861. staticClass: "btn btn-danger",
  44862. attrs: { type: "button" },
  44863. on: {
  44864. click: function($event) {
  44865. return _vm.deleteCredential()
  44866. }
  44867. }
  44868. },
  44869. [
  44870. !_vm.credentialDeleting
  44871. ? _c("div", [_vm._v("Confirm")])
  44872. : _c("circle-spinner", { attrs: { size: 2 } })
  44873. ],
  44874. 1
  44875. )
  44876. ])
  44877. ]
  44878. ),
  44879. _vm._v(" "),
  44880. _c("div", { staticClass: "row no-gutters" }, [
  44881. _c("div", { staticClass: "h5 col-3 text-left" }, [
  44882. _vm._v(_vm._s(this.data.creddesc))
  44883. ]),
  44884. _vm._v(" "),
  44885. _c("div", { staticClass: "col-9 text-right" }, [
  44886. _vm._v(_vm._s(this.data.creddate))
  44887. ])
  44888. ]),
  44889. _vm._v(" "),
  44890. _c("div", { staticClass: "row" }, [
  44891. _c("div", { staticClass: "col-lg-9" }, [
  44892. _c("div", [
  44893. _vm._m(0),
  44894. _vm._v(" "),
  44895. _c("input", {
  44896. staticClass: "border-0 credential",
  44897. attrs: {
  44898. type: "text",
  44899. id: "username" + this.data.credid,
  44900. readonly: ""
  44901. },
  44902. domProps: { value: this.data.creduser }
  44903. }),
  44904. _vm._v(" "),
  44905. _c(
  44906. "button",
  44907. {
  44908. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  44909. attrs: {
  44910. id: "btn-username" + this.data.credid,
  44911. "data-clipboard-target": "#username" + this.data.credid
  44912. }
  44913. },
  44914. [_c("i", { staticClass: "far fa-clone" })]
  44915. )
  44916. ]),
  44917. _vm._v(" "),
  44918. _c("div", [
  44919. _vm._m(1),
  44920. _vm._v(" "),
  44921. _c("input", {
  44922. staticClass: "border-0 credential",
  44923. attrs: {
  44924. type: "text",
  44925. id: "password" + this.data.credid,
  44926. readonly: ""
  44927. },
  44928. domProps: { value: this.data.credpass }
  44929. }),
  44930. _vm._v(" "),
  44931. _c(
  44932. "button",
  44933. {
  44934. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  44935. attrs: {
  44936. id: "btn-password" + this.data.credid,
  44937. "data-clipboard-target": "#password" + this.data.credid
  44938. }
  44939. },
  44940. [_c("i", { staticClass: "far fa-clone" })]
  44941. )
  44942. ])
  44943. ]),
  44944. _vm._v(" "),
  44945. _c(
  44946. "div",
  44947. {
  44948. staticClass: "btn-group col-lg-2 align-self-end w-25 w-lg-auto",
  44949. attrs: { role: "group", "aria-label": "Edit and Delete" }
  44950. },
  44951. [
  44952. _c(
  44953. "button",
  44954. {
  44955. staticClass: "btn btn-sm btn-secondary p-lg-1",
  44956. attrs: {
  44957. type: "button",
  44958. "data-toggle": "modal",
  44959. "data-target": "#credential" + this.data.credid + "editModal"
  44960. }
  44961. },
  44962. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  44963. ),
  44964. _vm._v(" "),
  44965. _c(
  44966. "button",
  44967. {
  44968. staticClass: "btn btn-sm btn-danger p-lg-1",
  44969. attrs: {
  44970. type: "button",
  44971. "data-toggle": "modal",
  44972. "data-target":
  44973. "#credential" + this.data.credid + "deleteModal"
  44974. }
  44975. },
  44976. [_c("i", { staticClass: "fas fa-fw fa-trash-alt" })]
  44977. )
  44978. ]
  44979. )
  44980. ])
  44981. ],
  44982. 1
  44983. )
  44984. }
  44985. var staticRenderFns = [
  44986. function() {
  44987. var _vm = this
  44988. var _h = _vm.$createElement
  44989. var _c = _vm._self._c || _h
  44990. return _c("label", { attrs: { for: "username" } }, [
  44991. _c("i", { staticClass: "fas fa-fw fa-user" })
  44992. ])
  44993. },
  44994. function() {
  44995. var _vm = this
  44996. var _h = _vm.$createElement
  44997. var _c = _vm._self._c || _h
  44998. return _c("label", { attrs: { for: "password" } }, [
  44999. _c("i", { staticClass: "fas fa-fw fa-key" })
  45000. ])
  45001. }
  45002. ]
  45003. render._withStripped = true
  45004. /***/ }),
  45005. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CredentialFormModal.vue?vue&type=template&id=3cdb3697&":
  45006. /*!**********************************************************************************************************************************************************************************************************************!*\
  45007. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/CredentialFormModal.vue?vue&type=template&id=3cdb3697& ***!
  45008. \**********************************************************************************************************************************************************************************************************************/
  45009. /*! exports provided: render, staticRenderFns */
  45010. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45011. "use strict";
  45012. __webpack_require__.r(__webpack_exports__);
  45013. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45014. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45015. var render = function() {
  45016. var _vm = this
  45017. var _h = _vm.$createElement
  45018. var _c = _vm._self._c || _h
  45019. return _c(
  45020. "modal",
  45021. {
  45022. attrs: {
  45023. id: _vm.id,
  45024. tabindex: "-1",
  45025. role: "dialog",
  45026. "aria-labelledby": _vm.id + "Label"
  45027. }
  45028. },
  45029. [
  45030. _c(
  45031. "h5",
  45032. {
  45033. staticClass: "modal-title",
  45034. attrs: { slot: "header", id: _vm.id + "Label" },
  45035. slot: "header"
  45036. },
  45037. [_vm._v("\n Edit Credential\n ")]
  45038. ),
  45039. _vm._v(" "),
  45040. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  45041. _c(
  45042. "div",
  45043. { staticClass: "form" },
  45044. [
  45045. _c("autocomplete-custom-dropdown", {
  45046. attrs: {
  45047. options: _vm.descriptions,
  45048. value: _vm.creddesc,
  45049. "allow-custom": true
  45050. },
  45051. model: {
  45052. value: _vm.creddesc,
  45053. callback: function($$v) {
  45054. _vm.creddesc = $$v
  45055. },
  45056. expression: "creddesc"
  45057. }
  45058. })
  45059. ],
  45060. 1
  45061. ),
  45062. _vm._v(" "),
  45063. _c("div", { staticClass: "form-group" }, [
  45064. _c("label", { attrs: { for: "newusername" } }, [_vm._v("Username")]),
  45065. _vm._v(" "),
  45066. _c("input", {
  45067. directives: [
  45068. {
  45069. name: "model",
  45070. rawName: "v-model",
  45071. value: _vm.data.creduser,
  45072. expression: "data.creduser"
  45073. }
  45074. ],
  45075. staticClass: "form-control credential",
  45076. attrs: {
  45077. type: "text",
  45078. name: "newusername" + _vm.data.credid,
  45079. id: "newusername" + _vm.data.credid
  45080. },
  45081. domProps: { value: _vm.data.creduser },
  45082. on: {
  45083. input: function($event) {
  45084. if ($event.target.composing) {
  45085. return
  45086. }
  45087. _vm.$set(_vm.data, "creduser", $event.target.value)
  45088. }
  45089. }
  45090. })
  45091. ]),
  45092. _vm._v(" "),
  45093. _c("div", { staticClass: "form-group" }, [
  45094. _c("label", { attrs: { for: "newpassword" } }, [_vm._v("Password")]),
  45095. _vm._v(" "),
  45096. _c("input", {
  45097. directives: [
  45098. {
  45099. name: "model",
  45100. rawName: "v-model",
  45101. value: _vm.data.credpass,
  45102. expression: "data.credpass"
  45103. }
  45104. ],
  45105. staticClass: "form-control credential",
  45106. attrs: {
  45107. type: "text",
  45108. name: "newpassword" + _vm.data.credid,
  45109. id: "newpassword" + _vm.data.credid
  45110. },
  45111. domProps: { value: _vm.data.credpass },
  45112. on: {
  45113. input: function($event) {
  45114. if ($event.target.composing) {
  45115. return
  45116. }
  45117. _vm.$set(_vm.data, "credpass", $event.target.value)
  45118. }
  45119. }
  45120. }),
  45121. _vm._v(" "),
  45122. _c(
  45123. "button",
  45124. {
  45125. staticClass: "btn btn-secondary",
  45126. attrs: { type: "button" },
  45127. on: {
  45128. click: function($event) {
  45129. return _vm.getRandomPassword(_vm.data.credid)
  45130. }
  45131. }
  45132. },
  45133. [_vm._v("Generate Random")]
  45134. )
  45135. ]),
  45136. _vm._v(" "),
  45137. _c("div", { staticClass: "form-group" })
  45138. ]),
  45139. _vm._v(" "),
  45140. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  45141. _c(
  45142. "button",
  45143. {
  45144. staticClass: "btn btn-secondary",
  45145. attrs: { type: "button", "data-dismiss": "modal" }
  45146. },
  45147. [_vm._v("Close")]
  45148. ),
  45149. _vm._v(" "),
  45150. _c(
  45151. "button",
  45152. {
  45153. staticClass: "btn btn-primary",
  45154. attrs: { type: "button" },
  45155. on: {
  45156. click: function($event) {
  45157. return _vm.updateCredential()
  45158. }
  45159. }
  45160. },
  45161. [
  45162. !_vm.credentialSaving
  45163. ? _c("div", [_vm._v("Save")])
  45164. : _c("circle-spinner", { attrs: { size: 2 } })
  45165. ],
  45166. 1
  45167. )
  45168. ])
  45169. ]
  45170. )
  45171. }
  45172. var staticRenderFns = []
  45173. render._withStripped = true
  45174. /***/ }),
  45175. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CredentialList.vue?vue&type=template&id=7264bb80&":
  45176. /*!*****************************************************************************************************************************************************************************************************************!*\
  45177. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/CredentialList.vue?vue&type=template&id=7264bb80& ***!
  45178. \*****************************************************************************************************************************************************************************************************************/
  45179. /*! exports provided: render, staticRenderFns */
  45180. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45181. "use strict";
  45182. __webpack_require__.r(__webpack_exports__);
  45183. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45184. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45185. var render = function() {
  45186. var _vm = this
  45187. var _h = _vm.$createElement
  45188. var _c = _vm._self._c || _h
  45189. return _c(
  45190. "div",
  45191. [
  45192. _c("credential-form-modal", {
  45193. attrs: {
  45194. "modal-id": "newCredentialModal",
  45195. descriptions: _vm.creddescList,
  45196. create: true,
  45197. pcid: _vm.pcid
  45198. }
  45199. }),
  45200. _vm._v(" "),
  45201. _c(
  45202. "button",
  45203. {
  45204. staticClass: "btn btn-primary",
  45205. attrs: {
  45206. type: "button",
  45207. "data-toggle": "modal",
  45208. "data-target": "#newCredentialModal"
  45209. }
  45210. },
  45211. [_vm._v("New Credential")]
  45212. ),
  45213. _vm._v(" "),
  45214. _vm._l(_vm.credentials, function(credential) {
  45215. return _c(
  45216. "div",
  45217. { key: credential.credid },
  45218. [
  45219. _c("credential", {
  45220. attrs: { credential: credential, descriptions: _vm.creddescList }
  45221. })
  45222. ],
  45223. 1
  45224. )
  45225. })
  45226. ],
  45227. 2
  45228. )
  45229. }
  45230. var staticRenderFns = []
  45231. render._withStripped = true
  45232. /***/ }),
  45233. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ErrorList.vue?vue&type=template&id=48c089eb&":
  45234. /*!************************************************************************************************************************************************************************************************************!*\
  45235. !*** ./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=48c089eb& ***!
  45236. \************************************************************************************************************************************************************************************************************/
  45237. /*! exports provided: render, staticRenderFns */
  45238. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45239. "use strict";
  45240. __webpack_require__.r(__webpack_exports__);
  45241. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45242. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45243. var render = function() {
  45244. var _vm = this
  45245. var _h = _vm.$createElement
  45246. var _c = _vm._self._c || _h
  45247. return _c(
  45248. "ul",
  45249. { staticClass: "list-unstyled" },
  45250. _vm._l(_vm.errorList, function(error) {
  45251. return _c("li", { key: error, staticClass: "text-danger" }, [
  45252. _vm._v(" " + _vm._s(error) + " ")
  45253. ])
  45254. }),
  45255. 0
  45256. )
  45257. }
  45258. var staticRenderFns = []
  45259. render._withStripped = true
  45260. /***/ }),
  45261. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/Modal.vue?vue&type=template&id=53ab54d2&":
  45262. /*!********************************************************************************************************************************************************************************************************!*\
  45263. !*** ./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=53ab54d2& ***!
  45264. \********************************************************************************************************************************************************************************************************/
  45265. /*! exports provided: render, staticRenderFns */
  45266. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45267. "use strict";
  45268. __webpack_require__.r(__webpack_exports__);
  45269. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45270. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45271. var render = function() {
  45272. var _vm = this
  45273. var _h = _vm.$createElement
  45274. var _c = _vm._self._c || _h
  45275. return _c("div", { staticClass: "modal fade" }, [
  45276. _c(
  45277. "div",
  45278. { staticClass: "modal-dialog modal-lg", attrs: { role: "document" } },
  45279. [
  45280. _c("div", { staticClass: "modal-content" }, [
  45281. _c(
  45282. "div",
  45283. { staticClass: "modal-header" },
  45284. [_vm._m(0), _vm._v(" "), _vm._t("header")],
  45285. 2
  45286. ),
  45287. _vm._v(" "),
  45288. _c("div", { staticClass: "modal-body" }, [_vm._t("body")], 2),
  45289. _vm._v(" "),
  45290. _c("div", { staticClass: "modal-footer" }, [_vm._t("footer")], 2)
  45291. ])
  45292. ]
  45293. )
  45294. ])
  45295. }
  45296. var staticRenderFns = [
  45297. function() {
  45298. var _vm = this
  45299. var _h = _vm.$createElement
  45300. var _c = _vm._self._c || _h
  45301. return _c(
  45302. "button",
  45303. {
  45304. staticClass: "close",
  45305. attrs: {
  45306. type: "button",
  45307. "data-dismiss": "modal",
  45308. "aria-label": "Close"
  45309. }
  45310. },
  45311. [_c("span", { attrs: { "aria-hidden": "true" } }, [_vm._v("×")])]
  45312. )
  45313. }
  45314. ]
  45315. render._withStripped = true
  45316. /***/ }),
  45317. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/NoteFormModal.vue?vue&type=template&id=1391a09c&":
  45318. /*!****************************************************************************************************************************************************************************************************************!*\
  45319. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/NoteFormModal.vue?vue&type=template&id=1391a09c& ***!
  45320. \****************************************************************************************************************************************************************************************************************/
  45321. /*! exports provided: render, staticRenderFns */
  45322. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45323. "use strict";
  45324. __webpack_require__.r(__webpack_exports__);
  45325. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45326. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45327. var render = function() {
  45328. var _vm = this
  45329. var _h = _vm.$createElement
  45330. var _c = _vm._self._c || _h
  45331. return _c(
  45332. "modal",
  45333. {
  45334. attrs: {
  45335. id: _vm.modalId,
  45336. tabindex: "-1",
  45337. role: "dialog",
  45338. "aria-labelledby": _vm.modalId + "Label"
  45339. }
  45340. },
  45341. [
  45342. _c(
  45343. "h5",
  45344. {
  45345. staticClass: "modal-title",
  45346. attrs: { slot: "header", id: _vm.modalId + "Label" },
  45347. slot: "header"
  45348. },
  45349. [_vm._v("\n Edit Note\n ")]
  45350. ),
  45351. _vm._v(" "),
  45352. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  45353. _c("div", { staticClass: "form-group" }, [
  45354. _c("label", { attrs: { for: "content" } }, [_vm._v("Content")]),
  45355. _vm._v(" "),
  45356. _c("textarea", {
  45357. directives: [
  45358. {
  45359. name: "model",
  45360. rawName: "v-model",
  45361. value: _vm.note.thenote,
  45362. expression: "note.thenote"
  45363. }
  45364. ],
  45365. staticClass: "form-control",
  45366. attrs: {
  45367. name: "content" + _vm.note.noteid,
  45368. id: "content" + _vm.note.noteid
  45369. },
  45370. domProps: { value: _vm.note.thenote },
  45371. on: {
  45372. input: function($event) {
  45373. if ($event.target.composing) {
  45374. return
  45375. }
  45376. _vm.$set(_vm.note, "thenote", $event.target.value)
  45377. }
  45378. }
  45379. })
  45380. ])
  45381. ]),
  45382. _vm._v(" "),
  45383. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  45384. _c(
  45385. "button",
  45386. {
  45387. staticClass: "btn btn-secondary",
  45388. attrs: { type: "button", "data-dismiss": "modal" }
  45389. },
  45390. [_vm._v("Close")]
  45391. ),
  45392. _vm._v(" "),
  45393. _c(
  45394. "button",
  45395. {
  45396. staticClass: "btn btn-primary",
  45397. attrs: { type: "button" },
  45398. on: {
  45399. click: function($event) {
  45400. return _vm.updateNote(_vm.note)
  45401. }
  45402. }
  45403. },
  45404. [_vm._v("Save")]
  45405. )
  45406. ])
  45407. ]
  45408. )
  45409. }
  45410. var staticRenderFns = []
  45411. render._withStripped = true
  45412. /***/ }),
  45413. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/Notes.vue?vue&type=template&id=3d897ee6&":
  45414. /*!********************************************************************************************************************************************************************************************************!*\
  45415. !*** ./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=3d897ee6& ***!
  45416. \********************************************************************************************************************************************************************************************************/
  45417. /*! exports provided: render, staticRenderFns */
  45418. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45419. "use strict";
  45420. __webpack_require__.r(__webpack_exports__);
  45421. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45422. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45423. var render = function() {
  45424. var _vm = this
  45425. var _h = _vm.$createElement
  45426. var _c = _vm._self._c || _h
  45427. return _c(
  45428. "ul",
  45429. { staticClass: "list-unstyled" },
  45430. [
  45431. _c("div", { staticClass: "row" }, [
  45432. _c(
  45433. "div",
  45434. {
  45435. staticClass:
  45436. "col-md-2 d-flex justify-content-center justify-content-md-start"
  45437. },
  45438. [
  45439. _c(
  45440. "button",
  45441. {
  45442. staticClass: "btn btn-primary m-2",
  45443. attrs: {
  45444. type: "button",
  45445. "data-toggle": "collapse",
  45446. "data-target": "#note" + _vm.noteType + "add"
  45447. }
  45448. },
  45449. [
  45450. _c("i", { staticClass: "fas fa-fw fa-plus" }),
  45451. _vm._v(" Add New Note")
  45452. ]
  45453. )
  45454. ]
  45455. ),
  45456. _vm._v(" "),
  45457. _c("div", { staticClass: "col-md-10" }, [
  45458. _c(
  45459. "div",
  45460. {
  45461. staticClass: "collapse",
  45462. attrs: { id: "note" + _vm.noteType + "add" }
  45463. },
  45464. [
  45465. _c(
  45466. "div",
  45467. {
  45468. staticClass:
  45469. "d-flex flex-wrap flex-md-nowrap justify-content-center"
  45470. },
  45471. [
  45472. _c("textarea", {
  45473. directives: [
  45474. {
  45475. name: "model",
  45476. rawName: "v-model",
  45477. value: _vm.newNote.thenote,
  45478. expression: "newNote.thenote"
  45479. }
  45480. ],
  45481. staticClass: "form-control",
  45482. attrs: {
  45483. name: "newnote" + _vm.noteType,
  45484. id: "newnote" + _vm.noteType
  45485. },
  45486. domProps: { value: _vm.newNote.thenote },
  45487. on: {
  45488. input: function($event) {
  45489. if ($event.target.composing) {
  45490. return
  45491. }
  45492. _vm.$set(_vm.newNote, "thenote", $event.target.value)
  45493. }
  45494. }
  45495. }),
  45496. _vm._v(" "),
  45497. _c(
  45498. "button",
  45499. {
  45500. staticClass: "btn btn-secondary m-2",
  45501. attrs: { type: "button" },
  45502. on: {
  45503. click: function($event) {
  45504. return _vm.createNote()
  45505. }
  45506. }
  45507. },
  45508. [_vm._v("Save")]
  45509. )
  45510. ]
  45511. )
  45512. ]
  45513. )
  45514. ])
  45515. ]),
  45516. _vm._v(" "),
  45517. _vm._l(this.notes, function(note, index) {
  45518. return _c(
  45519. "li",
  45520. { key: index, staticClass: "row no-gutters mb-2" },
  45521. [
  45522. _c("note-form-modal", {
  45523. attrs: {
  45524. "modal-id": "note" + note.noteid + "editModal",
  45525. "populate-with": note
  45526. }
  45527. }),
  45528. _vm._v(" "),
  45529. _c(
  45530. "div",
  45531. {
  45532. staticClass: "col-md-1 d-flex flex-column mx-md-3",
  45533. class: _vm.noteOrders[index]
  45534. },
  45535. [
  45536. _c("div", { staticClass: "text-center p-0 m-0" }, [
  45537. _vm._v(_vm._s(note.noteuser))
  45538. ]),
  45539. _vm._v(" "),
  45540. _c(
  45541. "div",
  45542. { staticClass: "text-muted text-small text-center p-0 m-0" },
  45543. [_vm._v(_vm._s(_vm.getHRDate(note.notetime)))]
  45544. ),
  45545. _vm._v(" "),
  45546. _c(
  45547. "div",
  45548. { staticClass: "btn-group justify-content-center p-0 m-0" },
  45549. [
  45550. _vm.authusername === note.noteuser ||
  45551. _vm.authusername === "admin"
  45552. ? [
  45553. _c(
  45554. "button",
  45555. {
  45556. staticClass: "btn btn-sm btn-primary m-1",
  45557. attrs: {
  45558. "data-toggle": "modal",
  45559. "data-target":
  45560. "#note" + note.noteid + "editModal"
  45561. }
  45562. },
  45563. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  45564. ),
  45565. _vm._v(" "),
  45566. _vm._m(0, true),
  45567. _vm._v(" "),
  45568. _vm._m(1, true)
  45569. ]
  45570. : _vm._e()
  45571. ],
  45572. 2
  45573. )
  45574. ]
  45575. ),
  45576. _vm._v(" "),
  45577. _c("div", { staticClass: "col-md-10" }, [
  45578. _c("div", { staticClass: "card m-2" }, [
  45579. _c("div", { staticClass: "card-body p-2" }, [
  45580. _vm._v(
  45581. "\n " +
  45582. _vm._s(note.thenote) +
  45583. "\n "
  45584. )
  45585. ])
  45586. ])
  45587. ])
  45588. ],
  45589. 1
  45590. )
  45591. })
  45592. ],
  45593. 2
  45594. )
  45595. }
  45596. var staticRenderFns = [
  45597. function() {
  45598. var _vm = this
  45599. var _h = _vm.$createElement
  45600. var _c = _vm._self._c || _h
  45601. return _c("button", { staticClass: "btn btn-sm btn-danger m-1" }, [
  45602. _c("i", { staticClass: "fas fa-fw fa-trash-alt" })
  45603. ])
  45604. },
  45605. function() {
  45606. var _vm = this
  45607. var _h = _vm.$createElement
  45608. var _c = _vm._self._c || _h
  45609. return _c("button", { staticClass: "btn btn-sm btn-primary m-1" }, [
  45610. _c("i", { staticClass: "fa fa-fw fa-random" })
  45611. ])
  45612. }
  45613. ]
  45614. render._withStripped = true
  45615. /***/ }),
  45616. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WoInfoEditModal.vue?vue&type=template&id=352dd7a2&":
  45617. /*!******************************************************************************************************************************************************************************************************************!*\
  45618. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/WoInfoEditModal.vue?vue&type=template&id=352dd7a2& ***!
  45619. \******************************************************************************************************************************************************************************************************************/
  45620. /*! exports provided: render, staticRenderFns */
  45621. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45622. "use strict";
  45623. __webpack_require__.r(__webpack_exports__);
  45624. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45625. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45626. var render = function() {
  45627. var _vm = this
  45628. var _h = _vm.$createElement
  45629. var _c = _vm._self._c || _h
  45630. return _c(
  45631. "modal",
  45632. {
  45633. attrs: {
  45634. id: _vm.id,
  45635. tabindex: "-1",
  45636. role: "dialog",
  45637. "aria-labelledby": _vm.id + "Label"
  45638. }
  45639. },
  45640. [
  45641. _c(
  45642. "h5",
  45643. {
  45644. staticClass: "modal-title",
  45645. attrs: { slot: "header", id: _vm.id + "Label" },
  45646. slot: "header"
  45647. },
  45648. [_vm._v("\r\n Edit Work Order Information\r\n ")]
  45649. ),
  45650. _vm._v(" "),
  45651. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  45652. _c(
  45653. "div",
  45654. { staticClass: "form-group" },
  45655. [
  45656. _c("label", { attrs: { for: "probdesc" } }, [
  45657. _vm._v("Problem Description")
  45658. ]),
  45659. _vm._v(" "),
  45660. _c("textarea", {
  45661. directives: [
  45662. {
  45663. name: "model",
  45664. rawName: "v-model",
  45665. value: _vm.data.probdesc,
  45666. expression: "data.probdesc"
  45667. }
  45668. ],
  45669. class: {
  45670. "form-control": true,
  45671. "is-invalid": _vm.errors.probdesc
  45672. },
  45673. attrs: { id: "probdesc", name: "probdesc" },
  45674. domProps: { value: _vm.data.probdesc },
  45675. on: {
  45676. input: function($event) {
  45677. if ($event.target.composing) {
  45678. return
  45679. }
  45680. _vm.$set(_vm.data, "probdesc", $event.target.value)
  45681. }
  45682. }
  45683. }),
  45684. _vm._v(" "),
  45685. _c("error-list", { attrs: { errors: _vm.errors.probdesc } })
  45686. ],
  45687. 1
  45688. ),
  45689. _vm._v(" "),
  45690. _c(
  45691. "div",
  45692. { staticClass: "form-group" },
  45693. [
  45694. _c("label", { attrs: { for: "suggested" } }, [
  45695. _vm._v("Suggested Solution")
  45696. ]),
  45697. _vm._v(" "),
  45698. _c("textarea", {
  45699. directives: [
  45700. {
  45701. name: "model",
  45702. rawName: "v-model",
  45703. value: _vm.data.suggested,
  45704. expression: "data.suggested"
  45705. }
  45706. ],
  45707. class: {
  45708. "form-control": true,
  45709. "is-invalid": _vm.errors.suggested
  45710. },
  45711. attrs: { id: "suggested", name: "suggested" },
  45712. domProps: { value: _vm.data.suggested },
  45713. on: {
  45714. input: function($event) {
  45715. if ($event.target.composing) {
  45716. return
  45717. }
  45718. _vm.$set(_vm.data, "suggested", $event.target.value)
  45719. }
  45720. }
  45721. }),
  45722. _vm._v(" "),
  45723. _c("error-list", { attrs: { errors: _vm.errors.suggested } })
  45724. ],
  45725. 1
  45726. ),
  45727. _vm._v(" "),
  45728. _c(
  45729. "div",
  45730. { staticClass: "form-group" },
  45731. [
  45732. _c("label", { attrs: { for: "storelist" } }, [_vm._v("Store")]),
  45733. _vm._v(" "),
  45734. _c("autocomplete-custom-dropdown", {
  45735. attrs: { options: _vm.storeList, value: this.store },
  45736. model: {
  45737. value: _vm.store,
  45738. callback: function($$v) {
  45739. _vm.store = $$v
  45740. },
  45741. expression: "store"
  45742. }
  45743. })
  45744. ],
  45745. 1
  45746. )
  45747. ]),
  45748. _vm._v(" "),
  45749. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  45750. _c(
  45751. "button",
  45752. {
  45753. staticClass: "btn btn-secondary",
  45754. attrs: { type: "button", "data-dismiss": "modal" }
  45755. },
  45756. [_vm._v("Close")]
  45757. ),
  45758. _vm._v(" "),
  45759. _c(
  45760. "button",
  45761. {
  45762. staticClass: "btn btn-primary",
  45763. attrs: { type: "button" },
  45764. on: {
  45765. click: function($event) {
  45766. return _vm.updateWorkOrder()
  45767. }
  45768. }
  45769. },
  45770. [
  45771. !_vm.woInfoSaving
  45772. ? _c("div", [_vm._v("Save")])
  45773. : _c("circle-spinner", { attrs: { size: 2 } })
  45774. ],
  45775. 1
  45776. )
  45777. ])
  45778. ]
  45779. )
  45780. }
  45781. var staticRenderFns = []
  45782. render._withStripped = true
  45783. /***/ }),
  45784. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WorkOrderInfo.vue?vue&type=template&id=50116330&":
  45785. /*!****************************************************************************************************************************************************************************************************************!*\
  45786. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/WorkOrderInfo.vue?vue&type=template&id=50116330& ***!
  45787. \****************************************************************************************************************************************************************************************************************/
  45788. /*! exports provided: render, staticRenderFns */
  45789. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45790. "use strict";
  45791. __webpack_require__.r(__webpack_exports__);
  45792. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45793. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45794. var render = function() {
  45795. var _vm = this
  45796. var _h = _vm.$createElement
  45797. var _c = _vm._self._c || _h
  45798. return _c(
  45799. "div",
  45800. [
  45801. _c("wo-info-edit-modal", {
  45802. attrs: {
  45803. "modal-id": "workordereditModal",
  45804. "populate-with": _vm.workOrder,
  45805. "store-list": this.storeList
  45806. }
  45807. }),
  45808. _vm._v(" "),
  45809. _c("p", [
  45810. _c("i", { staticClass: "fas fa-fw fa-info-circle" }),
  45811. _vm._v(" "),
  45812. _c("span", {
  45813. domProps: { textContent: _vm._s(_vm.workOrder.probdesc) }
  45814. })
  45815. ]),
  45816. _vm._v(" "),
  45817. _c("p", [
  45818. _c("i", { staticClass: "far fa-fw fa-lightbulb" }),
  45819. _vm._v(" "),
  45820. _c("span", {
  45821. domProps: { textContent: _vm._s(_vm.workOrder.suggested) }
  45822. })
  45823. ]),
  45824. _vm._v(" "),
  45825. _c("p", [
  45826. _c("i", { staticClass: "fas fa-fw fa-paste" }),
  45827. _vm._v(" "),
  45828. _c("span", { domProps: { textContent: _vm._s(_vm.workOrder.woid) } })
  45829. ]),
  45830. _vm._v(" "),
  45831. _c("p", [
  45832. _c("i", { staticClass: "fas fa-fw fa-building" }),
  45833. _vm._v(" "),
  45834. _c("span", [_vm._v(_vm._s(_vm.storeList[_vm.workOrder.storeid]))])
  45835. ]),
  45836. _vm._v(" "),
  45837. _c("p", [
  45838. _c("i", { staticClass: "fas fa-fw fa-sign-in-alt" }),
  45839. _vm._v(" "),
  45840. _c(
  45841. "span",
  45842. {
  45843. staticClass: "dashed-underline",
  45844. attrs: {
  45845. "data-toggle": "tooltip",
  45846. "data-placement": "bottom",
  45847. title: this.getHRDate(_vm.workOrder.dropdate)
  45848. }
  45849. },
  45850. [
  45851. _vm._v(
  45852. "\n " +
  45853. _vm._s(
  45854. Math.floor(this.daysSinceToday(_vm.workOrder.dropdate))
  45855. ) +
  45856. " days ago\n "
  45857. )
  45858. ]
  45859. )
  45860. ]),
  45861. _vm._v(" "),
  45862. _c("p", [
  45863. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  45864. _vm._v(" "),
  45865. !this.isZero(_vm.workOrder.pickupdate)
  45866. ? _c(
  45867. "span",
  45868. {
  45869. staticClass: "dashed-underline",
  45870. attrs: {
  45871. "data-toggle": "tooltip",
  45872. "data-placement": "bottom",
  45873. title: this.getHRDate(_vm.workOrder.pickupdate)
  45874. }
  45875. },
  45876. [
  45877. _vm._v(
  45878. "\n " +
  45879. _vm._s(
  45880. Math.floor(this.daysSinceToday(_vm.workOrder.pickupdate))
  45881. ) +
  45882. " days ago\n "
  45883. )
  45884. ]
  45885. )
  45886. : _vm._e()
  45887. ]),
  45888. _vm._v(" "),
  45889. _c(
  45890. "button",
  45891. {
  45892. staticClass: "btn btn-primary",
  45893. attrs: {
  45894. type: "button",
  45895. "data-toggle": "modal",
  45896. "data-target": "#workordereditModal"
  45897. }
  45898. },
  45899. [_vm._v("Edit")]
  45900. )
  45901. ],
  45902. 1
  45903. )
  45904. }
  45905. var staticRenderFns = []
  45906. render._withStripped = true
  45907. /***/ }),
  45908. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/App.vue?vue&type=template&id=91ac6b5c&":
  45909. /*!*************************************************************************************************************************************************************************************************!*\
  45910. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/App.vue?vue&type=template&id=91ac6b5c& ***!
  45911. \*************************************************************************************************************************************************************************************************/
  45912. /*! exports provided: render, staticRenderFns */
  45913. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45914. "use strict";
  45915. __webpack_require__.r(__webpack_exports__);
  45916. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45917. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45918. var render = function() {
  45919. var _vm = this
  45920. var _h = _vm.$createElement
  45921. var _c = _vm._self._c || _h
  45922. return _c("div", [
  45923. _c(
  45924. "nav",
  45925. {
  45926. staticClass:
  45927. "navbar navbar-expand navbar-dark bg-primary text-light shadow-sm"
  45928. },
  45929. [
  45930. _c(
  45931. "div",
  45932. { staticClass: "container-fluid" },
  45933. [
  45934. _c(
  45935. "router-link",
  45936. { staticClass: "navbar-brand", attrs: { to: { name: "home" } } },
  45937. [_vm._v("\n UPCCRT\n ")]
  45938. ),
  45939. _vm._v(" "),
  45940. _vm._m(0),
  45941. _vm._v(" "),
  45942. _c(
  45943. "div",
  45944. {
  45945. staticClass: "collapse navbar-collapse",
  45946. attrs: { id: "navbarSupportedContent" }
  45947. },
  45948. [
  45949. _c("ul", { staticClass: "navbar-nav mr-auto text-center" }, [
  45950. _vm._m(1),
  45951. _vm._v(" "),
  45952. _vm._m(2),
  45953. _vm._v(" "),
  45954. _c(
  45955. "li",
  45956. { staticClass: "nav-item" },
  45957. [
  45958. _c(
  45959. "router-link",
  45960. {
  45961. staticClass: "nav-link",
  45962. attrs: { to: { name: "dashboard" } }
  45963. },
  45964. [
  45965. _c("i", { staticClass: "fas fa-tachometer-alt" }),
  45966. _vm._v(" "),
  45967. _c(
  45968. "span",
  45969. { staticClass: "d-none d-sm-block d-md-inline" },
  45970. [_vm._v("Dashboard")]
  45971. )
  45972. ]
  45973. )
  45974. ],
  45975. 1
  45976. ),
  45977. _vm._v(" "),
  45978. _vm._m(3)
  45979. ]),
  45980. _vm._v(" "),
  45981. _c(
  45982. "ul",
  45983. { staticClass: "navbar-nav ml-auto" },
  45984. [
  45985. !_vm.isLoggedIn
  45986. ? _c(
  45987. "router-link",
  45988. {
  45989. staticClass: "nav-link",
  45990. attrs: { to: { name: "login" } }
  45991. },
  45992. [_vm._v("Login")]
  45993. )
  45994. : _vm._e(),
  45995. _vm._v(" "),
  45996. _vm.isLoggedIn
  45997. ? _c("li", { staticClass: "nav-link" }, [
  45998. _vm._v(_vm._s(_vm.username))
  45999. ])
  46000. : _vm._e(),
  46001. _vm._v(" "),
  46002. _vm.isLoggedIn
  46003. ? _c(
  46004. "router-link",
  46005. {
  46006. staticClass: "nav-link",
  46007. attrs: { to: { name: "home" } }
  46008. },
  46009. [_vm._v("Home")]
  46010. )
  46011. : _vm._e()
  46012. ],
  46013. 1
  46014. )
  46015. ]
  46016. )
  46017. ],
  46018. 1
  46019. )
  46020. ]
  46021. ),
  46022. _vm._v(" "),
  46023. _c("main", { staticClass: "py-4" }, [_c("router-view")], 1)
  46024. ])
  46025. }
  46026. var staticRenderFns = [
  46027. function() {
  46028. var _vm = this
  46029. var _h = _vm.$createElement
  46030. var _c = _vm._self._c || _h
  46031. return _c(
  46032. "button",
  46033. {
  46034. staticClass: "navbar-toggler",
  46035. attrs: {
  46036. type: "button",
  46037. "data-toggle": "collapse",
  46038. "data-target": "#navbarSupportedContent",
  46039. "aria-controls": "navbarSupportedContent",
  46040. "aria-expanded": "false"
  46041. }
  46042. },
  46043. [_c("span", { staticClass: "navbar-toggler-icon" })]
  46044. )
  46045. },
  46046. function() {
  46047. var _vm = this
  46048. var _h = _vm.$createElement
  46049. var _c = _vm._self._c || _h
  46050. return _c("li", { staticClass: "nav-item" }, [
  46051. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  46052. _c("i", { staticClass: "fas fa-sign-in-alt" }),
  46053. _vm._v(" "),
  46054. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  46055. _vm._v("Check-In")
  46056. ])
  46057. ])
  46058. ])
  46059. },
  46060. function() {
  46061. var _vm = this
  46062. var _h = _vm.$createElement
  46063. var _c = _vm._self._c || _h
  46064. return _c("li", { staticClass: "nav-item" }, [
  46065. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  46066. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  46067. _vm._v(" "),
  46068. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  46069. _vm._v("Check-Out")
  46070. ])
  46071. ])
  46072. ])
  46073. },
  46074. function() {
  46075. var _vm = this
  46076. var _h = _vm.$createElement
  46077. var _c = _vm._self._c || _h
  46078. return _c("li", { staticClass: "nav-item" }, [
  46079. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  46080. _c("i", { staticClass: "fas fa-chart-bar" }),
  46081. _vm._v(" "),
  46082. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  46083. _vm._v("Reports")
  46084. ])
  46085. ])
  46086. ])
  46087. }
  46088. ]
  46089. render._withStripped = true
  46090. /***/ }),
  46091. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6&":
  46092. /*!*******************************************************************************************************************************************************************************************************!*\
  46093. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6& ***!
  46094. \*******************************************************************************************************************************************************************************************************/
  46095. /*! exports provided: render, staticRenderFns */
  46096. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46097. "use strict";
  46098. __webpack_require__.r(__webpack_exports__);
  46099. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  46100. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  46101. var render = function() {
  46102. var _vm = this
  46103. var _h = _vm.$createElement
  46104. var _c = _vm._self._c || _h
  46105. return _c("div", { staticClass: "container" }, [
  46106. _c("div", { staticClass: "row justify-content-center" }, [
  46107. !_vm.isLoading
  46108. ? _c(
  46109. "div",
  46110. { staticClass: "col-md-12" },
  46111. _vm._l(_vm.workOrders, function(workOrder, index) {
  46112. return _c(
  46113. "div",
  46114. { key: workOrder.woid, staticClass: "col-md-4" },
  46115. [
  46116. _c("div", { staticClass: "card" }, [
  46117. _c(
  46118. "div",
  46119. { staticClass: "card-header" },
  46120. [
  46121. _c(
  46122. "router-link",
  46123. {
  46124. staticClass: "h4 card-title",
  46125. attrs: {
  46126. to: {
  46127. name: "workorders",
  46128. params: { id: workOrder.woid }
  46129. }
  46130. }
  46131. },
  46132. [_vm._v(_vm._s(workOrder.woid))]
  46133. )
  46134. ],
  46135. 1
  46136. ),
  46137. _vm._v(" "),
  46138. _c("div", { staticClass: "card-body card-body-dark" }, [
  46139. _c("div", [
  46140. _vm._v(
  46141. "\n " +
  46142. _vm._s(workOrder.probdesc) +
  46143. "\n "
  46144. )
  46145. ]),
  46146. _vm._v(" "),
  46147. _c("div", [
  46148. _vm._v(
  46149. "\n " +
  46150. _vm._s(workOrder.suggested) +
  46151. "\n "
  46152. )
  46153. ])
  46154. ])
  46155. ])
  46156. ]
  46157. )
  46158. }),
  46159. 0
  46160. )
  46161. : _c(
  46162. "div",
  46163. { staticClass: "col-md-12" },
  46164. [_c("circle-spinner", { attrs: { color: "#663399" } })],
  46165. 1
  46166. )
  46167. ])
  46168. ])
  46169. }
  46170. var staticRenderFns = []
  46171. render._withStripped = true
  46172. /***/ }),
  46173. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Login.vue?vue&type=template&id=12f5395a&":
  46174. /*!***************************************************************************************************************************************************************************************************!*\
  46175. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/Login.vue?vue&type=template&id=12f5395a& ***!
  46176. \***************************************************************************************************************************************************************************************************/
  46177. /*! exports provided: render, staticRenderFns */
  46178. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46179. "use strict";
  46180. __webpack_require__.r(__webpack_exports__);
  46181. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  46182. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  46183. var render = function() {
  46184. var _vm = this
  46185. var _h = _vm.$createElement
  46186. var _c = _vm._self._c || _h
  46187. return _c("div", { staticClass: "container" }, [
  46188. _c("div", { staticClass: "row justify-content-center" }, [
  46189. _c("div", { staticClass: "col-md-8" }, [
  46190. _c("div", { staticClass: "card card-default" }, [
  46191. _c("div", { staticClass: "card-header" }, [_vm._v("Login")]),
  46192. _vm._v(" "),
  46193. _c("div", { staticClass: "card-body" }, [
  46194. _c("form", { attrs: { method: "POST", action: "/login" } }, [
  46195. _c("div", { staticClass: "form-group row" }, [
  46196. _c(
  46197. "label",
  46198. {
  46199. staticClass: "col-sm-4 col-form-label text-md-right",
  46200. attrs: { for: "username" }
  46201. },
  46202. [_vm._v("Username")]
  46203. ),
  46204. _vm._v(" "),
  46205. _c("div", { staticClass: "col-md-6" }, [
  46206. _c("input", {
  46207. directives: [
  46208. {
  46209. name: "model",
  46210. rawName: "v-model",
  46211. value: _vm.username,
  46212. expression: "username"
  46213. }
  46214. ],
  46215. staticClass: "form-control",
  46216. attrs: {
  46217. id: "username",
  46218. type: "username",
  46219. required: "",
  46220. autofocus: ""
  46221. },
  46222. domProps: { value: _vm.username },
  46223. on: {
  46224. input: function($event) {
  46225. if ($event.target.composing) {
  46226. return
  46227. }
  46228. _vm.username = $event.target.value
  46229. }
  46230. }
  46231. })
  46232. ])
  46233. ]),
  46234. _vm._v(" "),
  46235. _c("div", { staticClass: "form-group row" }, [
  46236. _c(
  46237. "label",
  46238. {
  46239. staticClass: "col-md-4 col-form-label text-md-right",
  46240. attrs: { for: "password" }
  46241. },
  46242. [_vm._v("Password")]
  46243. ),
  46244. _vm._v(" "),
  46245. _c("div", { staticClass: "col-md-6" }, [
  46246. _c("input", {
  46247. directives: [
  46248. {
  46249. name: "model",
  46250. rawName: "v-model",
  46251. value: _vm.password,
  46252. expression: "password"
  46253. }
  46254. ],
  46255. staticClass: "form-control",
  46256. attrs: { id: "password", type: "password", required: "" },
  46257. domProps: { value: _vm.password },
  46258. on: {
  46259. input: function($event) {
  46260. if ($event.target.composing) {
  46261. return
  46262. }
  46263. _vm.password = $event.target.value
  46264. }
  46265. }
  46266. })
  46267. ])
  46268. ]),
  46269. _vm._v(" "),
  46270. _c("div", { staticClass: "form-group row mb-0" }, [
  46271. _c("div", { staticClass: "col-md-8 offset-md-4" }, [
  46272. _c(
  46273. "button",
  46274. {
  46275. staticClass: "btn btn-primary",
  46276. attrs: { type: "submit" },
  46277. on: { click: _vm.handleSubmit }
  46278. },
  46279. [
  46280. _vm._v(
  46281. "\n Login\n "
  46282. )
  46283. ]
  46284. )
  46285. ])
  46286. ])
  46287. ])
  46288. ])
  46289. ])
  46290. ])
  46291. ])
  46292. ])
  46293. }
  46294. var staticRenderFns = []
  46295. render._withStripped = true
  46296. /***/ }),
  46297. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true&":
  46298. /*!*****************************************************************************************************************************************************************************************************************!*\
  46299. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true& ***!
  46300. \*****************************************************************************************************************************************************************************************************************/
  46301. /*! exports provided: render, staticRenderFns */
  46302. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46303. "use strict";
  46304. __webpack_require__.r(__webpack_exports__);
  46305. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  46306. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  46307. var render = function() {
  46308. var _vm = this
  46309. var _h = _vm.$createElement
  46310. var _c = _vm._self._c || _h
  46311. return _vm._m(0)
  46312. }
  46313. var staticRenderFns = [
  46314. function() {
  46315. var _vm = this
  46316. var _h = _vm.$createElement
  46317. var _c = _vm._self._c || _h
  46318. return _c("div", { staticClass: "flex-center position-ref full-height" }, [
  46319. _c("div", { staticClass: "content" }, [
  46320. _c("div", { staticClass: "m-b-md" }, [
  46321. _c("h2", { staticClass: "title m-b-md" }, [
  46322. _vm._v("\n UPCCRT\n ")
  46323. ]),
  46324. _vm._v(" "),
  46325. _c("h3", [
  46326. _vm._v(
  46327. "\n University PC Care Repair Tracker\n "
  46328. )
  46329. ])
  46330. ])
  46331. ])
  46332. ])
  46333. }
  46334. ]
  46335. render._withStripped = true
  46336. /***/ }),
  46337. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/WorkOrder.vue?vue&type=template&id=17837e2e&":
  46338. /*!*******************************************************************************************************************************************************************************************************!*\
  46339. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/WorkOrder.vue?vue&type=template&id=17837e2e& ***!
  46340. \*******************************************************************************************************************************************************************************************************/
  46341. /*! exports provided: render, staticRenderFns */
  46342. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46343. "use strict";
  46344. __webpack_require__.r(__webpack_exports__);
  46345. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  46346. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  46347. var render = function() {
  46348. var _vm = this
  46349. var _h = _vm.$createElement
  46350. var _c = _vm._self._c || _h
  46351. return _c("div", { staticClass: "container-fluid" }, [
  46352. _c("div", { staticClass: "row my-3" }, [
  46353. _c("div", { staticClass: "col-lg-6" }, [
  46354. _c("div", { staticClass: "card h-100" }, [
  46355. _vm._m(0),
  46356. _vm._v(" "),
  46357. _c("div", { staticClass: "card-body" }, [
  46358. _c("div", { staticClass: "tab-content" }, [
  46359. _c(
  46360. "div",
  46361. {
  46362. staticClass: "tab-pane active",
  46363. attrs: {
  46364. id: "assetinfo",
  46365. role: "tabpanel",
  46366. "aria-labelledby": "assetinfo-tab"
  46367. }
  46368. },
  46369. [
  46370. !_vm.assetLoading
  46371. ? _c("asset-info", { attrs: { asset: _vm.asset } })
  46372. : _c("circle-spinner", { attrs: { color: "#663399" } })
  46373. ],
  46374. 1
  46375. ),
  46376. _vm._v(" "),
  46377. _c(
  46378. "div",
  46379. {
  46380. staticClass: "tab-pane",
  46381. attrs: {
  46382. id: "credentials",
  46383. role: "tabpanel",
  46384. "aria-labelledby": "credentials-tab"
  46385. }
  46386. },
  46387. [
  46388. !_vm.credentialsLoading && !_vm.credentialDescriptionsLoading
  46389. ? _c("credential-list", {
  46390. attrs: {
  46391. credentials: _vm.credentials,
  46392. descriptions: _vm.credentialDescriptions,
  46393. pcid: _vm.asset.pcid
  46394. }
  46395. })
  46396. : _c("circle-spinner", { attrs: { color: "#663399" } })
  46397. ],
  46398. 1
  46399. )
  46400. ])
  46401. ])
  46402. ])
  46403. ]),
  46404. _vm._v(" "),
  46405. _c("div", { staticClass: "col-lg-6" }, [
  46406. _c("div", { staticClass: "card h-100" }, [
  46407. _vm._m(1),
  46408. _vm._v(" "),
  46409. _c("div", { staticClass: "card-body" }, [
  46410. _c("div", { staticClass: "tab-content" }, [
  46411. _c(
  46412. "div",
  46413. {
  46414. staticClass: "tab-pane active",
  46415. attrs: {
  46416. id: "workordersumm",
  46417. role: "tabpanel",
  46418. "aria-labelledby": "workordersumm-tab"
  46419. }
  46420. },
  46421. [
  46422. !_vm.woLoading && !_vm.storesLoading
  46423. ? _c("work-order-info", {
  46424. attrs: {
  46425. "work-order": _vm.workOrder,
  46426. stores: _vm.stores
  46427. }
  46428. })
  46429. : _c("circle-spinner", { attrs: { color: "#663399" } })
  46430. ],
  46431. 1
  46432. ),
  46433. _vm._v(" "),
  46434. _c(
  46435. "div",
  46436. {
  46437. staticClass: "tab-pane",
  46438. attrs: {
  46439. id: "attachments",
  46440. role: "tabpanel",
  46441. "aria-labelledby": "attachments-tab"
  46442. }
  46443. },
  46444. [
  46445. _vm._v(
  46446. "\n TODO 2\n "
  46447. )
  46448. ]
  46449. )
  46450. ])
  46451. ])
  46452. ])
  46453. ])
  46454. ]),
  46455. _vm._v(" "),
  46456. _c("div", { staticClass: "row my-3 no-gutters" }, [
  46457. _c("div", { staticClass: "col-12" }, [
  46458. _c("div", { staticClass: "card" }, [
  46459. _c(
  46460. "div",
  46461. { staticClass: "card-body" },
  46462. [
  46463. _c("h5", { staticClass: "card-title" }, [
  46464. _vm._v("Customer Notes")
  46465. ]),
  46466. _vm._v(" "),
  46467. !_vm.workOrderNotesLoading
  46468. ? _c("notes", {
  46469. attrs: {
  46470. notes: _vm.publicNotes,
  46471. authusername: _vm.authUser,
  46472. "note-type": 0,
  46473. woid: _vm.id
  46474. }
  46475. })
  46476. : _c("circle-spinner", { attrs: { color: "#663399" } })
  46477. ],
  46478. 1
  46479. )
  46480. ])
  46481. ])
  46482. ]),
  46483. _vm._v(" "),
  46484. _c("div", { staticClass: "row my-3 no-gutters" }, [
  46485. _c("div", { staticClass: "col-12" }, [
  46486. _c("div", { staticClass: "card" }, [
  46487. _c(
  46488. "div",
  46489. { staticClass: "card-body" },
  46490. [
  46491. _c("h5", { staticClass: "card-title" }, [
  46492. _vm._v("Private/Billing Notes")
  46493. ]),
  46494. _vm._v(" "),
  46495. !_vm.workOrderNotesLoading
  46496. ? _c("notes", {
  46497. attrs: {
  46498. notes: _vm.privateNotes,
  46499. authusername: _vm.authUser,
  46500. "note-type": 1,
  46501. woid: _vm.id
  46502. }
  46503. })
  46504. : _c("circle-spinner", { attrs: { color: "#663399" } })
  46505. ],
  46506. 1
  46507. )
  46508. ])
  46509. ])
  46510. ])
  46511. ])
  46512. }
  46513. var staticRenderFns = [
  46514. function() {
  46515. var _vm = this
  46516. var _h = _vm.$createElement
  46517. var _c = _vm._self._c || _h
  46518. return _c("div", { staticClass: "card-header text-right" }, [
  46519. _c(
  46520. "button",
  46521. {
  46522. staticClass: "btn btn-default xs-toggle",
  46523. attrs: {
  46524. type: "button",
  46525. "data-toggle": "collapse",
  46526. "data-target": "#assetTab"
  46527. }
  46528. },
  46529. [
  46530. _c("span", { staticClass: "sr-only" }, [_vm._v("Toggle Navigation")]),
  46531. _vm._v(" "),
  46532. _c("span", { staticClass: "icon-bar" }),
  46533. _vm._v(" "),
  46534. _c("span", { staticClass: "icon-bar" }),
  46535. _vm._v(" "),
  46536. _c("span", { staticClass: "icon-bar" })
  46537. ]
  46538. ),
  46539. _vm._v(" "),
  46540. _c(
  46541. "ul",
  46542. {
  46543. staticClass:
  46544. "nav nav-pills card-header-pills nav-justified xs-collapse collapse",
  46545. attrs: { id: "assetTab", role: "tablist" }
  46546. },
  46547. [
  46548. _c("li", { staticClass: "nav-item" }, [
  46549. _c(
  46550. "a",
  46551. {
  46552. staticClass: "nav-link active",
  46553. attrs: {
  46554. id: "assetinfo-tab",
  46555. "data-toggle": "pill",
  46556. href: "#assetinfo",
  46557. role: "tab",
  46558. "aria-controls": "assetinfo",
  46559. "aria-selected": "true"
  46560. }
  46561. },
  46562. [_vm._v("Hardware")]
  46563. )
  46564. ]),
  46565. _vm._v(" "),
  46566. _c("li", { staticClass: "nav-item" }, [
  46567. _c(
  46568. "a",
  46569. {
  46570. staticClass: "nav-link",
  46571. attrs: {
  46572. id: "credentials-tab",
  46573. "data-toggle": "pill",
  46574. href: "#credentials",
  46575. role: "tab",
  46576. "aria-controls": "credentials",
  46577. "aria-selected": "false"
  46578. }
  46579. },
  46580. [_vm._v("Credentials")]
  46581. )
  46582. ])
  46583. ]
  46584. )
  46585. ])
  46586. },
  46587. function() {
  46588. var _vm = this
  46589. var _h = _vm.$createElement
  46590. var _c = _vm._self._c || _h
  46591. return _c("div", { staticClass: "card-header text-right" }, [
  46592. _c(
  46593. "button",
  46594. {
  46595. staticClass: "btn btn-default xs-toggle",
  46596. attrs: {
  46597. type: "button",
  46598. "data-toggle": "collapse",
  46599. "data-target": "#workorderTab"
  46600. }
  46601. },
  46602. [
  46603. _c("span", { staticClass: "sr-only" }, [_vm._v("Toggle Navigation")]),
  46604. _vm._v(" "),
  46605. _c("span", { staticClass: "icon-bar" }),
  46606. _vm._v(" "),
  46607. _c("span", { staticClass: "icon-bar" }),
  46608. _vm._v(" "),
  46609. _c("span", { staticClass: "icon-bar" })
  46610. ]
  46611. ),
  46612. _vm._v(" "),
  46613. _c(
  46614. "ul",
  46615. {
  46616. staticClass:
  46617. "nav nav-pills card-header-pills nav-justified xs-collapse collapse",
  46618. attrs: { id: "workorderTab", role: "tablist" }
  46619. },
  46620. [
  46621. _c("li", { staticClass: "nav-item" }, [
  46622. _c(
  46623. "a",
  46624. {
  46625. staticClass: "nav-link active",
  46626. attrs: {
  46627. id: "workordersumm-tab",
  46628. "data-toggle": "pill",
  46629. href: "#workordersumm",
  46630. role: "tab",
  46631. "aria-controls": "workordersumm",
  46632. "aria-selected": "true"
  46633. }
  46634. },
  46635. [_vm._v("Summary")]
  46636. )
  46637. ]),
  46638. _vm._v(" "),
  46639. _c("li", { staticClass: "nav-item" }, [
  46640. _c(
  46641. "a",
  46642. {
  46643. staticClass: "nav-link",
  46644. attrs: {
  46645. id: "attachments-tab",
  46646. "data-toggle": "pill",
  46647. href: "#attachments",
  46648. role: "tab",
  46649. "aria-controls": "attachments",
  46650. "aria-selected": "false"
  46651. }
  46652. },
  46653. [_vm._v("Attachments")]
  46654. )
  46655. ])
  46656. ]
  46657. )
  46658. ])
  46659. }
  46660. ]
  46661. render._withStripped = true
  46662. /***/ }),
  46663. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  46664. /*!********************************************************************!*\
  46665. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  46666. \********************************************************************/
  46667. /*! exports provided: default */
  46668. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46669. "use strict";
  46670. __webpack_require__.r(__webpack_exports__);
  46671. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  46672. /* globals __VUE_SSR_CONTEXT__ */
  46673. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  46674. // This module is a runtime utility for cleaner component module output and will
  46675. // be included in the final webpack user bundle.
  46676. function normalizeComponent (
  46677. scriptExports,
  46678. render,
  46679. staticRenderFns,
  46680. functionalTemplate,
  46681. injectStyles,
  46682. scopeId,
  46683. moduleIdentifier, /* server only */
  46684. shadowMode /* vue-cli only */
  46685. ) {
  46686. // Vue.extend constructor export interop
  46687. var options = typeof scriptExports === 'function'
  46688. ? scriptExports.options
  46689. : scriptExports
  46690. // render functions
  46691. if (render) {
  46692. options.render = render
  46693. options.staticRenderFns = staticRenderFns
  46694. options._compiled = true
  46695. }
  46696. // functional template
  46697. if (functionalTemplate) {
  46698. options.functional = true
  46699. }
  46700. // scopedId
  46701. if (scopeId) {
  46702. options._scopeId = 'data-v-' + scopeId
  46703. }
  46704. var hook
  46705. if (moduleIdentifier) { // server build
  46706. hook = function (context) {
  46707. // 2.3 injection
  46708. context =
  46709. context || // cached call
  46710. (this.$vnode && this.$vnode.ssrContext) || // stateful
  46711. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  46712. // 2.2 with runInNewContext: true
  46713. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  46714. context = __VUE_SSR_CONTEXT__
  46715. }
  46716. // inject component styles
  46717. if (injectStyles) {
  46718. injectStyles.call(this, context)
  46719. }
  46720. // register component module identifier for async chunk inferrence
  46721. if (context && context._registeredComponents) {
  46722. context._registeredComponents.add(moduleIdentifier)
  46723. }
  46724. }
  46725. // used by ssr in case component is cached and beforeCreate
  46726. // never gets called
  46727. options._ssrRegister = hook
  46728. } else if (injectStyles) {
  46729. hook = shadowMode
  46730. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  46731. : injectStyles
  46732. }
  46733. if (hook) {
  46734. if (options.functional) {
  46735. // for template-only hot-reload because in that case the render fn doesn't
  46736. // go through the normalizer
  46737. options._injectStyles = hook
  46738. // register for functioal component in vue file
  46739. var originalRender = options.render
  46740. options.render = function renderWithStyleInjection (h, context) {
  46741. hook.call(context)
  46742. return originalRender(h, context)
  46743. }
  46744. } else {
  46745. // inject component registration as beforeCreate hook
  46746. var existing = options.beforeCreate
  46747. options.beforeCreate = existing
  46748. ? [].concat(existing, hook)
  46749. : [hook]
  46750. }
  46751. }
  46752. return {
  46753. exports: scriptExports,
  46754. options: options
  46755. }
  46756. }
  46757. /***/ }),
  46758. /***/ "./node_modules/vue-router/dist/vue-router.esm.js":
  46759. /*!********************************************************!*\
  46760. !*** ./node_modules/vue-router/dist/vue-router.esm.js ***!
  46761. \********************************************************/
  46762. /*! exports provided: default */
  46763. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46764. "use strict";
  46765. __webpack_require__.r(__webpack_exports__);
  46766. /*!
  46767. * vue-router v3.1.6
  46768. * (c) 2020 Evan You
  46769. * @license MIT
  46770. */
  46771. /* */
  46772. function assert (condition, message) {
  46773. if (!condition) {
  46774. throw new Error(("[vue-router] " + message))
  46775. }
  46776. }
  46777. function warn (condition, message) {
  46778. if ( true && !condition) {
  46779. typeof console !== 'undefined' && console.warn(("[vue-router] " + message));
  46780. }
  46781. }
  46782. function isError (err) {
  46783. return Object.prototype.toString.call(err).indexOf('Error') > -1
  46784. }
  46785. function isExtendedError (constructor, err) {
  46786. return (
  46787. err instanceof constructor ||
  46788. // _name is to support IE9 too
  46789. (err && (err.name === constructor.name || err._name === constructor._name))
  46790. )
  46791. }
  46792. function extend (a, b) {
  46793. for (var key in b) {
  46794. a[key] = b[key];
  46795. }
  46796. return a
  46797. }
  46798. var View = {
  46799. name: 'RouterView',
  46800. functional: true,
  46801. props: {
  46802. name: {
  46803. type: String,
  46804. default: 'default'
  46805. }
  46806. },
  46807. render: function render (_, ref) {
  46808. var props = ref.props;
  46809. var children = ref.children;
  46810. var parent = ref.parent;
  46811. var data = ref.data;
  46812. // used by devtools to display a router-view badge
  46813. data.routerView = true;
  46814. // directly use parent context's createElement() function
  46815. // so that components rendered by router-view can resolve named slots
  46816. var h = parent.$createElement;
  46817. var name = props.name;
  46818. var route = parent.$route;
  46819. var cache = parent._routerViewCache || (parent._routerViewCache = {});
  46820. // determine current view depth, also check to see if the tree
  46821. // has been toggled inactive but kept-alive.
  46822. var depth = 0;
  46823. var inactive = false;
  46824. while (parent && parent._routerRoot !== parent) {
  46825. var vnodeData = parent.$vnode ? parent.$vnode.data : {};
  46826. if (vnodeData.routerView) {
  46827. depth++;
  46828. }
  46829. if (vnodeData.keepAlive && parent._directInactive && parent._inactive) {
  46830. inactive = true;
  46831. }
  46832. parent = parent.$parent;
  46833. }
  46834. data.routerViewDepth = depth;
  46835. // render previous view if the tree is inactive and kept-alive
  46836. if (inactive) {
  46837. var cachedData = cache[name];
  46838. var cachedComponent = cachedData && cachedData.component;
  46839. if (cachedComponent) {
  46840. // #2301
  46841. // pass props
  46842. if (cachedData.configProps) {
  46843. fillPropsinData(cachedComponent, data, cachedData.route, cachedData.configProps);
  46844. }
  46845. return h(cachedComponent, data, children)
  46846. } else {
  46847. // render previous empty view
  46848. return h()
  46849. }
  46850. }
  46851. var matched = route.matched[depth];
  46852. var component = matched && matched.components[name];
  46853. // render empty node if no matched route or no config component
  46854. if (!matched || !component) {
  46855. cache[name] = null;
  46856. return h()
  46857. }
  46858. // cache component
  46859. cache[name] = { component: component };
  46860. // attach instance registration hook
  46861. // this will be called in the instance's injected lifecycle hooks
  46862. data.registerRouteInstance = function (vm, val) {
  46863. // val could be undefined for unregistration
  46864. var current = matched.instances[name];
  46865. if (
  46866. (val && current !== vm) ||
  46867. (!val && current === vm)
  46868. ) {
  46869. matched.instances[name] = val;
  46870. }
  46871. }
  46872. // also register instance in prepatch hook
  46873. // in case the same component instance is reused across different routes
  46874. ;(data.hook || (data.hook = {})).prepatch = function (_, vnode) {
  46875. matched.instances[name] = vnode.componentInstance;
  46876. };
  46877. // register instance in init hook
  46878. // in case kept-alive component be actived when routes changed
  46879. data.hook.init = function (vnode) {
  46880. if (vnode.data.keepAlive &&
  46881. vnode.componentInstance &&
  46882. vnode.componentInstance !== matched.instances[name]
  46883. ) {
  46884. matched.instances[name] = vnode.componentInstance;
  46885. }
  46886. };
  46887. var configProps = matched.props && matched.props[name];
  46888. // save route and configProps in cachce
  46889. if (configProps) {
  46890. extend(cache[name], {
  46891. route: route,
  46892. configProps: configProps
  46893. });
  46894. fillPropsinData(component, data, route, configProps);
  46895. }
  46896. return h(component, data, children)
  46897. }
  46898. };
  46899. function fillPropsinData (component, data, route, configProps) {
  46900. // resolve props
  46901. var propsToPass = data.props = resolveProps(route, configProps);
  46902. if (propsToPass) {
  46903. // clone to prevent mutation
  46904. propsToPass = data.props = extend({}, propsToPass);
  46905. // pass non-declared props as attrs
  46906. var attrs = data.attrs = data.attrs || {};
  46907. for (var key in propsToPass) {
  46908. if (!component.props || !(key in component.props)) {
  46909. attrs[key] = propsToPass[key];
  46910. delete propsToPass[key];
  46911. }
  46912. }
  46913. }
  46914. }
  46915. function resolveProps (route, config) {
  46916. switch (typeof config) {
  46917. case 'undefined':
  46918. return
  46919. case 'object':
  46920. return config
  46921. case 'function':
  46922. return config(route)
  46923. case 'boolean':
  46924. return config ? route.params : undefined
  46925. default:
  46926. if (true) {
  46927. warn(
  46928. false,
  46929. "props in \"" + (route.path) + "\" is a " + (typeof config) + ", " +
  46930. "expecting an object, function or boolean."
  46931. );
  46932. }
  46933. }
  46934. }
  46935. /* */
  46936. var encodeReserveRE = /[!'()*]/g;
  46937. var encodeReserveReplacer = function (c) { return '%' + c.charCodeAt(0).toString(16); };
  46938. var commaRE = /%2C/g;
  46939. // fixed encodeURIComponent which is more conformant to RFC3986:
  46940. // - escapes [!'()*]
  46941. // - preserve commas
  46942. var encode = function (str) { return encodeURIComponent(str)
  46943. .replace(encodeReserveRE, encodeReserveReplacer)
  46944. .replace(commaRE, ','); };
  46945. var decode = decodeURIComponent;
  46946. function resolveQuery (
  46947. query,
  46948. extraQuery,
  46949. _parseQuery
  46950. ) {
  46951. if ( extraQuery === void 0 ) extraQuery = {};
  46952. var parse = _parseQuery || parseQuery;
  46953. var parsedQuery;
  46954. try {
  46955. parsedQuery = parse(query || '');
  46956. } catch (e) {
  46957. true && warn(false, e.message);
  46958. parsedQuery = {};
  46959. }
  46960. for (var key in extraQuery) {
  46961. parsedQuery[key] = extraQuery[key];
  46962. }
  46963. return parsedQuery
  46964. }
  46965. function parseQuery (query) {
  46966. var res = {};
  46967. query = query.trim().replace(/^(\?|#|&)/, '');
  46968. if (!query) {
  46969. return res
  46970. }
  46971. query.split('&').forEach(function (param) {
  46972. var parts = param.replace(/\+/g, ' ').split('=');
  46973. var key = decode(parts.shift());
  46974. var val = parts.length > 0
  46975. ? decode(parts.join('='))
  46976. : null;
  46977. if (res[key] === undefined) {
  46978. res[key] = val;
  46979. } else if (Array.isArray(res[key])) {
  46980. res[key].push(val);
  46981. } else {
  46982. res[key] = [res[key], val];
  46983. }
  46984. });
  46985. return res
  46986. }
  46987. function stringifyQuery (obj) {
  46988. var res = obj ? Object.keys(obj).map(function (key) {
  46989. var val = obj[key];
  46990. if (val === undefined) {
  46991. return ''
  46992. }
  46993. if (val === null) {
  46994. return encode(key)
  46995. }
  46996. if (Array.isArray(val)) {
  46997. var result = [];
  46998. val.forEach(function (val2) {
  46999. if (val2 === undefined) {
  47000. return
  47001. }
  47002. if (val2 === null) {
  47003. result.push(encode(key));
  47004. } else {
  47005. result.push(encode(key) + '=' + encode(val2));
  47006. }
  47007. });
  47008. return result.join('&')
  47009. }
  47010. return encode(key) + '=' + encode(val)
  47011. }).filter(function (x) { return x.length > 0; }).join('&') : null;
  47012. return res ? ("?" + res) : ''
  47013. }
  47014. /* */
  47015. var trailingSlashRE = /\/?$/;
  47016. function createRoute (
  47017. record,
  47018. location,
  47019. redirectedFrom,
  47020. router
  47021. ) {
  47022. var stringifyQuery = router && router.options.stringifyQuery;
  47023. var query = location.query || {};
  47024. try {
  47025. query = clone(query);
  47026. } catch (e) {}
  47027. var route = {
  47028. name: location.name || (record && record.name),
  47029. meta: (record && record.meta) || {},
  47030. path: location.path || '/',
  47031. hash: location.hash || '',
  47032. query: query,
  47033. params: location.params || {},
  47034. fullPath: getFullPath(location, stringifyQuery),
  47035. matched: record ? formatMatch(record) : []
  47036. };
  47037. if (redirectedFrom) {
  47038. route.redirectedFrom = getFullPath(redirectedFrom, stringifyQuery);
  47039. }
  47040. return Object.freeze(route)
  47041. }
  47042. function clone (value) {
  47043. if (Array.isArray(value)) {
  47044. return value.map(clone)
  47045. } else if (value && typeof value === 'object') {
  47046. var res = {};
  47047. for (var key in value) {
  47048. res[key] = clone(value[key]);
  47049. }
  47050. return res
  47051. } else {
  47052. return value
  47053. }
  47054. }
  47055. // the starting route that represents the initial state
  47056. var START = createRoute(null, {
  47057. path: '/'
  47058. });
  47059. function formatMatch (record) {
  47060. var res = [];
  47061. while (record) {
  47062. res.unshift(record);
  47063. record = record.parent;
  47064. }
  47065. return res
  47066. }
  47067. function getFullPath (
  47068. ref,
  47069. _stringifyQuery
  47070. ) {
  47071. var path = ref.path;
  47072. var query = ref.query; if ( query === void 0 ) query = {};
  47073. var hash = ref.hash; if ( hash === void 0 ) hash = '';
  47074. var stringify = _stringifyQuery || stringifyQuery;
  47075. return (path || '/') + stringify(query) + hash
  47076. }
  47077. function isSameRoute (a, b) {
  47078. if (b === START) {
  47079. return a === b
  47080. } else if (!b) {
  47081. return false
  47082. } else if (a.path && b.path) {
  47083. return (
  47084. a.path.replace(trailingSlashRE, '') === b.path.replace(trailingSlashRE, '') &&
  47085. a.hash === b.hash &&
  47086. isObjectEqual(a.query, b.query)
  47087. )
  47088. } else if (a.name && b.name) {
  47089. return (
  47090. a.name === b.name &&
  47091. a.hash === b.hash &&
  47092. isObjectEqual(a.query, b.query) &&
  47093. isObjectEqual(a.params, b.params)
  47094. )
  47095. } else {
  47096. return false
  47097. }
  47098. }
  47099. function isObjectEqual (a, b) {
  47100. if ( a === void 0 ) a = {};
  47101. if ( b === void 0 ) b = {};
  47102. // handle null value #1566
  47103. if (!a || !b) { return a === b }
  47104. var aKeys = Object.keys(a);
  47105. var bKeys = Object.keys(b);
  47106. if (aKeys.length !== bKeys.length) {
  47107. return false
  47108. }
  47109. return aKeys.every(function (key) {
  47110. var aVal = a[key];
  47111. var bVal = b[key];
  47112. // check nested equality
  47113. if (typeof aVal === 'object' && typeof bVal === 'object') {
  47114. return isObjectEqual(aVal, bVal)
  47115. }
  47116. return String(aVal) === String(bVal)
  47117. })
  47118. }
  47119. function isIncludedRoute (current, target) {
  47120. return (
  47121. current.path.replace(trailingSlashRE, '/').indexOf(
  47122. target.path.replace(trailingSlashRE, '/')
  47123. ) === 0 &&
  47124. (!target.hash || current.hash === target.hash) &&
  47125. queryIncludes(current.query, target.query)
  47126. )
  47127. }
  47128. function queryIncludes (current, target) {
  47129. for (var key in target) {
  47130. if (!(key in current)) {
  47131. return false
  47132. }
  47133. }
  47134. return true
  47135. }
  47136. /* */
  47137. function resolvePath (
  47138. relative,
  47139. base,
  47140. append
  47141. ) {
  47142. var firstChar = relative.charAt(0);
  47143. if (firstChar === '/') {
  47144. return relative
  47145. }
  47146. if (firstChar === '?' || firstChar === '#') {
  47147. return base + relative
  47148. }
  47149. var stack = base.split('/');
  47150. // remove trailing segment if:
  47151. // - not appending
  47152. // - appending to trailing slash (last segment is empty)
  47153. if (!append || !stack[stack.length - 1]) {
  47154. stack.pop();
  47155. }
  47156. // resolve relative path
  47157. var segments = relative.replace(/^\//, '').split('/');
  47158. for (var i = 0; i < segments.length; i++) {
  47159. var segment = segments[i];
  47160. if (segment === '..') {
  47161. stack.pop();
  47162. } else if (segment !== '.') {
  47163. stack.push(segment);
  47164. }
  47165. }
  47166. // ensure leading slash
  47167. if (stack[0] !== '') {
  47168. stack.unshift('');
  47169. }
  47170. return stack.join('/')
  47171. }
  47172. function parsePath (path) {
  47173. var hash = '';
  47174. var query = '';
  47175. var hashIndex = path.indexOf('#');
  47176. if (hashIndex >= 0) {
  47177. hash = path.slice(hashIndex);
  47178. path = path.slice(0, hashIndex);
  47179. }
  47180. var queryIndex = path.indexOf('?');
  47181. if (queryIndex >= 0) {
  47182. query = path.slice(queryIndex + 1);
  47183. path = path.slice(0, queryIndex);
  47184. }
  47185. return {
  47186. path: path,
  47187. query: query,
  47188. hash: hash
  47189. }
  47190. }
  47191. function cleanPath (path) {
  47192. return path.replace(/\/\//g, '/')
  47193. }
  47194. var isarray = Array.isArray || function (arr) {
  47195. return Object.prototype.toString.call(arr) == '[object Array]';
  47196. };
  47197. /**
  47198. * Expose `pathToRegexp`.
  47199. */
  47200. var pathToRegexp_1 = pathToRegexp;
  47201. var parse_1 = parse;
  47202. var compile_1 = compile;
  47203. var tokensToFunction_1 = tokensToFunction;
  47204. var tokensToRegExp_1 = tokensToRegExp;
  47205. /**
  47206. * The main path matching regexp utility.
  47207. *
  47208. * @type {RegExp}
  47209. */
  47210. var PATH_REGEXP = new RegExp([
  47211. // Match escaped characters that would otherwise appear in future matches.
  47212. // This allows the user to escape special characters that won't transform.
  47213. '(\\\\.)',
  47214. // Match Express-style parameters and un-named parameters with a prefix
  47215. // and optional suffixes. Matches appear as:
  47216. //
  47217. // "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined]
  47218. // "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined]
  47219. // "/*" => ["/", undefined, undefined, undefined, undefined, "*"]
  47220. '([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))'
  47221. ].join('|'), 'g');
  47222. /**
  47223. * Parse a string for the raw tokens.
  47224. *
  47225. * @param {string} str
  47226. * @param {Object=} options
  47227. * @return {!Array}
  47228. */
  47229. function parse (str, options) {
  47230. var tokens = [];
  47231. var key = 0;
  47232. var index = 0;
  47233. var path = '';
  47234. var defaultDelimiter = options && options.delimiter || '/';
  47235. var res;
  47236. while ((res = PATH_REGEXP.exec(str)) != null) {
  47237. var m = res[0];
  47238. var escaped = res[1];
  47239. var offset = res.index;
  47240. path += str.slice(index, offset);
  47241. index = offset + m.length;
  47242. // Ignore already escaped sequences.
  47243. if (escaped) {
  47244. path += escaped[1];
  47245. continue
  47246. }
  47247. var next = str[index];
  47248. var prefix = res[2];
  47249. var name = res[3];
  47250. var capture = res[4];
  47251. var group = res[5];
  47252. var modifier = res[6];
  47253. var asterisk = res[7];
  47254. // Push the current path onto the tokens.
  47255. if (path) {
  47256. tokens.push(path);
  47257. path = '';
  47258. }
  47259. var partial = prefix != null && next != null && next !== prefix;
  47260. var repeat = modifier === '+' || modifier === '*';
  47261. var optional = modifier === '?' || modifier === '*';
  47262. var delimiter = res[2] || defaultDelimiter;
  47263. var pattern = capture || group;
  47264. tokens.push({
  47265. name: name || key++,
  47266. prefix: prefix || '',
  47267. delimiter: delimiter,
  47268. optional: optional,
  47269. repeat: repeat,
  47270. partial: partial,
  47271. asterisk: !!asterisk,
  47272. pattern: pattern ? escapeGroup(pattern) : (asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?')
  47273. });
  47274. }
  47275. // Match any characters still remaining.
  47276. if (index < str.length) {
  47277. path += str.substr(index);
  47278. }
  47279. // If the path exists, push it onto the end.
  47280. if (path) {
  47281. tokens.push(path);
  47282. }
  47283. return tokens
  47284. }
  47285. /**
  47286. * Compile a string to a template function for the path.
  47287. *
  47288. * @param {string} str
  47289. * @param {Object=} options
  47290. * @return {!function(Object=, Object=)}
  47291. */
  47292. function compile (str, options) {
  47293. return tokensToFunction(parse(str, options))
  47294. }
  47295. /**
  47296. * Prettier encoding of URI path segments.
  47297. *
  47298. * @param {string}
  47299. * @return {string}
  47300. */
  47301. function encodeURIComponentPretty (str) {
  47302. return encodeURI(str).replace(/[\/?#]/g, function (c) {
  47303. return '%' + c.charCodeAt(0).toString(16).toUpperCase()
  47304. })
  47305. }
  47306. /**
  47307. * Encode the asterisk parameter. Similar to `pretty`, but allows slashes.
  47308. *
  47309. * @param {string}
  47310. * @return {string}
  47311. */
  47312. function encodeAsterisk (str) {
  47313. return encodeURI(str).replace(/[?#]/g, function (c) {
  47314. return '%' + c.charCodeAt(0).toString(16).toUpperCase()
  47315. })
  47316. }
  47317. /**
  47318. * Expose a method for transforming tokens into the path function.
  47319. */
  47320. function tokensToFunction (tokens) {
  47321. // Compile all the tokens into regexps.
  47322. var matches = new Array(tokens.length);
  47323. // Compile all the patterns before compilation.
  47324. for (var i = 0; i < tokens.length; i++) {
  47325. if (typeof tokens[i] === 'object') {
  47326. matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');
  47327. }
  47328. }
  47329. return function (obj, opts) {
  47330. var path = '';
  47331. var data = obj || {};
  47332. var options = opts || {};
  47333. var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;
  47334. for (var i = 0; i < tokens.length; i++) {
  47335. var token = tokens[i];
  47336. if (typeof token === 'string') {
  47337. path += token;
  47338. continue
  47339. }
  47340. var value = data[token.name];
  47341. var segment;
  47342. if (value == null) {
  47343. if (token.optional) {
  47344. // Prepend partial segment prefixes.
  47345. if (token.partial) {
  47346. path += token.prefix;
  47347. }
  47348. continue
  47349. } else {
  47350. throw new TypeError('Expected "' + token.name + '" to be defined')
  47351. }
  47352. }
  47353. if (isarray(value)) {
  47354. if (!token.repeat) {
  47355. throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`')
  47356. }
  47357. if (value.length === 0) {
  47358. if (token.optional) {
  47359. continue
  47360. } else {
  47361. throw new TypeError('Expected "' + token.name + '" to not be empty')
  47362. }
  47363. }
  47364. for (var j = 0; j < value.length; j++) {
  47365. segment = encode(value[j]);
  47366. if (!matches[i].test(segment)) {
  47367. throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`')
  47368. }
  47369. path += (j === 0 ? token.prefix : token.delimiter) + segment;
  47370. }
  47371. continue
  47372. }
  47373. segment = token.asterisk ? encodeAsterisk(value) : encode(value);
  47374. if (!matches[i].test(segment)) {
  47375. throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"')
  47376. }
  47377. path += token.prefix + segment;
  47378. }
  47379. return path
  47380. }
  47381. }
  47382. /**
  47383. * Escape a regular expression string.
  47384. *
  47385. * @param {string} str
  47386. * @return {string}
  47387. */
  47388. function escapeString (str) {
  47389. return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1')
  47390. }
  47391. /**
  47392. * Escape the capturing group by escaping special characters and meaning.
  47393. *
  47394. * @param {string} group
  47395. * @return {string}
  47396. */
  47397. function escapeGroup (group) {
  47398. return group.replace(/([=!:$\/()])/g, '\\$1')
  47399. }
  47400. /**
  47401. * Attach the keys as a property of the regexp.
  47402. *
  47403. * @param {!RegExp} re
  47404. * @param {Array} keys
  47405. * @return {!RegExp}
  47406. */
  47407. function attachKeys (re, keys) {
  47408. re.keys = keys;
  47409. return re
  47410. }
  47411. /**
  47412. * Get the flags for a regexp from the options.
  47413. *
  47414. * @param {Object} options
  47415. * @return {string}
  47416. */
  47417. function flags (options) {
  47418. return options.sensitive ? '' : 'i'
  47419. }
  47420. /**
  47421. * Pull out keys from a regexp.
  47422. *
  47423. * @param {!RegExp} path
  47424. * @param {!Array} keys
  47425. * @return {!RegExp}
  47426. */
  47427. function regexpToRegexp (path, keys) {
  47428. // Use a negative lookahead to match only capturing groups.
  47429. var groups = path.source.match(/\((?!\?)/g);
  47430. if (groups) {
  47431. for (var i = 0; i < groups.length; i++) {
  47432. keys.push({
  47433. name: i,
  47434. prefix: null,
  47435. delimiter: null,
  47436. optional: false,
  47437. repeat: false,
  47438. partial: false,
  47439. asterisk: false,
  47440. pattern: null
  47441. });
  47442. }
  47443. }
  47444. return attachKeys(path, keys)
  47445. }
  47446. /**
  47447. * Transform an array into a regexp.
  47448. *
  47449. * @param {!Array} path
  47450. * @param {Array} keys
  47451. * @param {!Object} options
  47452. * @return {!RegExp}
  47453. */
  47454. function arrayToRegexp (path, keys, options) {
  47455. var parts = [];
  47456. for (var i = 0; i < path.length; i++) {
  47457. parts.push(pathToRegexp(path[i], keys, options).source);
  47458. }
  47459. var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options));
  47460. return attachKeys(regexp, keys)
  47461. }
  47462. /**
  47463. * Create a path regexp from string input.
  47464. *
  47465. * @param {string} path
  47466. * @param {!Array} keys
  47467. * @param {!Object} options
  47468. * @return {!RegExp}
  47469. */
  47470. function stringToRegexp (path, keys, options) {
  47471. return tokensToRegExp(parse(path, options), keys, options)
  47472. }
  47473. /**
  47474. * Expose a function for taking tokens and returning a RegExp.
  47475. *
  47476. * @param {!Array} tokens
  47477. * @param {(Array|Object)=} keys
  47478. * @param {Object=} options
  47479. * @return {!RegExp}
  47480. */
  47481. function tokensToRegExp (tokens, keys, options) {
  47482. if (!isarray(keys)) {
  47483. options = /** @type {!Object} */ (keys || options);
  47484. keys = [];
  47485. }
  47486. options = options || {};
  47487. var strict = options.strict;
  47488. var end = options.end !== false;
  47489. var route = '';
  47490. // Iterate over the tokens and create our regexp string.
  47491. for (var i = 0; i < tokens.length; i++) {
  47492. var token = tokens[i];
  47493. if (typeof token === 'string') {
  47494. route += escapeString(token);
  47495. } else {
  47496. var prefix = escapeString(token.prefix);
  47497. var capture = '(?:' + token.pattern + ')';
  47498. keys.push(token);
  47499. if (token.repeat) {
  47500. capture += '(?:' + prefix + capture + ')*';
  47501. }
  47502. if (token.optional) {
  47503. if (!token.partial) {
  47504. capture = '(?:' + prefix + '(' + capture + '))?';
  47505. } else {
  47506. capture = prefix + '(' + capture + ')?';
  47507. }
  47508. } else {
  47509. capture = prefix + '(' + capture + ')';
  47510. }
  47511. route += capture;
  47512. }
  47513. }
  47514. var delimiter = escapeString(options.delimiter || '/');
  47515. var endsWithDelimiter = route.slice(-delimiter.length) === delimiter;
  47516. // In non-strict mode we allow a slash at the end of match. If the path to
  47517. // match already ends with a slash, we remove it for consistency. The slash
  47518. // is valid at the end of a path match, not in the middle. This is important
  47519. // in non-ending mode, where "/test/" shouldn't match "/test//route".
  47520. if (!strict) {
  47521. route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + '(?:' + delimiter + '(?=$))?';
  47522. }
  47523. if (end) {
  47524. route += '$';
  47525. } else {
  47526. // In non-ending mode, we need the capturing groups to match as much as
  47527. // possible by using a positive lookahead to the end or next path segment.
  47528. route += strict && endsWithDelimiter ? '' : '(?=' + delimiter + '|$)';
  47529. }
  47530. return attachKeys(new RegExp('^' + route, flags(options)), keys)
  47531. }
  47532. /**
  47533. * Normalize the given path string, returning a regular expression.
  47534. *
  47535. * An empty array can be passed in for the keys, which will hold the
  47536. * placeholder key descriptions. For example, using `/user/:id`, `keys` will
  47537. * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.
  47538. *
  47539. * @param {(string|RegExp|Array)} path
  47540. * @param {(Array|Object)=} keys
  47541. * @param {Object=} options
  47542. * @return {!RegExp}
  47543. */
  47544. function pathToRegexp (path, keys, options) {
  47545. if (!isarray(keys)) {
  47546. options = /** @type {!Object} */ (keys || options);
  47547. keys = [];
  47548. }
  47549. options = options || {};
  47550. if (path instanceof RegExp) {
  47551. return regexpToRegexp(path, /** @type {!Array} */ (keys))
  47552. }
  47553. if (isarray(path)) {
  47554. return arrayToRegexp(/** @type {!Array} */ (path), /** @type {!Array} */ (keys), options)
  47555. }
  47556. return stringToRegexp(/** @type {string} */ (path), /** @type {!Array} */ (keys), options)
  47557. }
  47558. pathToRegexp_1.parse = parse_1;
  47559. pathToRegexp_1.compile = compile_1;
  47560. pathToRegexp_1.tokensToFunction = tokensToFunction_1;
  47561. pathToRegexp_1.tokensToRegExp = tokensToRegExp_1;
  47562. /* */
  47563. // $flow-disable-line
  47564. var regexpCompileCache = Object.create(null);
  47565. function fillParams (
  47566. path,
  47567. params,
  47568. routeMsg
  47569. ) {
  47570. params = params || {};
  47571. try {
  47572. var filler =
  47573. regexpCompileCache[path] ||
  47574. (regexpCompileCache[path] = pathToRegexp_1.compile(path));
  47575. // Fix #2505 resolving asterisk routes { name: 'not-found', params: { pathMatch: '/not-found' }}
  47576. // and fix #3106 so that you can work with location descriptor object having params.pathMatch equal to empty string
  47577. if (typeof params.pathMatch === 'string') { params[0] = params.pathMatch; }
  47578. return filler(params, { pretty: true })
  47579. } catch (e) {
  47580. if (true) {
  47581. // Fix #3072 no warn if `pathMatch` is string
  47582. warn(typeof params.pathMatch === 'string', ("missing param for " + routeMsg + ": " + (e.message)));
  47583. }
  47584. return ''
  47585. } finally {
  47586. // delete the 0 if it was added
  47587. delete params[0];
  47588. }
  47589. }
  47590. /* */
  47591. function normalizeLocation (
  47592. raw,
  47593. current,
  47594. append,
  47595. router
  47596. ) {
  47597. var next = typeof raw === 'string' ? { path: raw } : raw;
  47598. // named target
  47599. if (next._normalized) {
  47600. return next
  47601. } else if (next.name) {
  47602. next = extend({}, raw);
  47603. var params = next.params;
  47604. if (params && typeof params === 'object') {
  47605. next.params = extend({}, params);
  47606. }
  47607. return next
  47608. }
  47609. // relative params
  47610. if (!next.path && next.params && current) {
  47611. next = extend({}, next);
  47612. next._normalized = true;
  47613. var params$1 = extend(extend({}, current.params), next.params);
  47614. if (current.name) {
  47615. next.name = current.name;
  47616. next.params = params$1;
  47617. } else if (current.matched.length) {
  47618. var rawPath = current.matched[current.matched.length - 1].path;
  47619. next.path = fillParams(rawPath, params$1, ("path " + (current.path)));
  47620. } else if (true) {
  47621. warn(false, "relative params navigation requires a current route.");
  47622. }
  47623. return next
  47624. }
  47625. var parsedPath = parsePath(next.path || '');
  47626. var basePath = (current && current.path) || '/';
  47627. var path = parsedPath.path
  47628. ? resolvePath(parsedPath.path, basePath, append || next.append)
  47629. : basePath;
  47630. var query = resolveQuery(
  47631. parsedPath.query,
  47632. next.query,
  47633. router && router.options.parseQuery
  47634. );
  47635. var hash = next.hash || parsedPath.hash;
  47636. if (hash && hash.charAt(0) !== '#') {
  47637. hash = "#" + hash;
  47638. }
  47639. return {
  47640. _normalized: true,
  47641. path: path,
  47642. query: query,
  47643. hash: hash
  47644. }
  47645. }
  47646. /* */
  47647. // work around weird flow bug
  47648. var toTypes = [String, Object];
  47649. var eventTypes = [String, Array];
  47650. var noop = function () {};
  47651. var Link = {
  47652. name: 'RouterLink',
  47653. props: {
  47654. to: {
  47655. type: toTypes,
  47656. required: true
  47657. },
  47658. tag: {
  47659. type: String,
  47660. default: 'a'
  47661. },
  47662. exact: Boolean,
  47663. append: Boolean,
  47664. replace: Boolean,
  47665. activeClass: String,
  47666. exactActiveClass: String,
  47667. event: {
  47668. type: eventTypes,
  47669. default: 'click'
  47670. }
  47671. },
  47672. render: function render (h) {
  47673. var this$1 = this;
  47674. var router = this.$router;
  47675. var current = this.$route;
  47676. var ref = router.resolve(
  47677. this.to,
  47678. current,
  47679. this.append
  47680. );
  47681. var location = ref.location;
  47682. var route = ref.route;
  47683. var href = ref.href;
  47684. var classes = {};
  47685. var globalActiveClass = router.options.linkActiveClass;
  47686. var globalExactActiveClass = router.options.linkExactActiveClass;
  47687. // Support global empty active class
  47688. var activeClassFallback =
  47689. globalActiveClass == null ? 'router-link-active' : globalActiveClass;
  47690. var exactActiveClassFallback =
  47691. globalExactActiveClass == null
  47692. ? 'router-link-exact-active'
  47693. : globalExactActiveClass;
  47694. var activeClass =
  47695. this.activeClass == null ? activeClassFallback : this.activeClass;
  47696. var exactActiveClass =
  47697. this.exactActiveClass == null
  47698. ? exactActiveClassFallback
  47699. : this.exactActiveClass;
  47700. var compareTarget = route.redirectedFrom
  47701. ? createRoute(null, normalizeLocation(route.redirectedFrom), null, router)
  47702. : route;
  47703. classes[exactActiveClass] = isSameRoute(current, compareTarget);
  47704. classes[activeClass] = this.exact
  47705. ? classes[exactActiveClass]
  47706. : isIncludedRoute(current, compareTarget);
  47707. var handler = function (e) {
  47708. if (guardEvent(e)) {
  47709. if (this$1.replace) {
  47710. router.replace(location, noop);
  47711. } else {
  47712. router.push(location, noop);
  47713. }
  47714. }
  47715. };
  47716. var on = { click: guardEvent };
  47717. if (Array.isArray(this.event)) {
  47718. this.event.forEach(function (e) {
  47719. on[e] = handler;
  47720. });
  47721. } else {
  47722. on[this.event] = handler;
  47723. }
  47724. var data = { class: classes };
  47725. var scopedSlot =
  47726. !this.$scopedSlots.$hasNormal &&
  47727. this.$scopedSlots.default &&
  47728. this.$scopedSlots.default({
  47729. href: href,
  47730. route: route,
  47731. navigate: handler,
  47732. isActive: classes[activeClass],
  47733. isExactActive: classes[exactActiveClass]
  47734. });
  47735. if (scopedSlot) {
  47736. if (scopedSlot.length === 1) {
  47737. return scopedSlot[0]
  47738. } else if (scopedSlot.length > 1 || !scopedSlot.length) {
  47739. if (true) {
  47740. warn(
  47741. false,
  47742. ("RouterLink with to=\"" + (this.to) + "\" is trying to use a scoped slot but it didn't provide exactly one child. Wrapping the content with a span element.")
  47743. );
  47744. }
  47745. return scopedSlot.length === 0 ? h() : h('span', {}, scopedSlot)
  47746. }
  47747. }
  47748. if (this.tag === 'a') {
  47749. data.on = on;
  47750. data.attrs = { href: href };
  47751. } else {
  47752. // find the first <a> child and apply listener and href
  47753. var a = findAnchor(this.$slots.default);
  47754. if (a) {
  47755. // in case the <a> is a static node
  47756. a.isStatic = false;
  47757. var aData = (a.data = extend({}, a.data));
  47758. aData.on = aData.on || {};
  47759. // transform existing events in both objects into arrays so we can push later
  47760. for (var event in aData.on) {
  47761. var handler$1 = aData.on[event];
  47762. if (event in on) {
  47763. aData.on[event] = Array.isArray(handler$1) ? handler$1 : [handler$1];
  47764. }
  47765. }
  47766. // append new listeners for router-link
  47767. for (var event$1 in on) {
  47768. if (event$1 in aData.on) {
  47769. // on[event] is always a function
  47770. aData.on[event$1].push(on[event$1]);
  47771. } else {
  47772. aData.on[event$1] = handler;
  47773. }
  47774. }
  47775. var aAttrs = (a.data.attrs = extend({}, a.data.attrs));
  47776. aAttrs.href = href;
  47777. } else {
  47778. // doesn't have <a> child, apply listener to self
  47779. data.on = on;
  47780. }
  47781. }
  47782. return h(this.tag, data, this.$slots.default)
  47783. }
  47784. };
  47785. function guardEvent (e) {
  47786. // don't redirect with control keys
  47787. if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) { return }
  47788. // don't redirect when preventDefault called
  47789. if (e.defaultPrevented) { return }
  47790. // don't redirect on right click
  47791. if (e.button !== undefined && e.button !== 0) { return }
  47792. // don't redirect if `target="_blank"`
  47793. if (e.currentTarget && e.currentTarget.getAttribute) {
  47794. var target = e.currentTarget.getAttribute('target');
  47795. if (/\b_blank\b/i.test(target)) { return }
  47796. }
  47797. // this may be a Weex event which doesn't have this method
  47798. if (e.preventDefault) {
  47799. e.preventDefault();
  47800. }
  47801. return true
  47802. }
  47803. function findAnchor (children) {
  47804. if (children) {
  47805. var child;
  47806. for (var i = 0; i < children.length; i++) {
  47807. child = children[i];
  47808. if (child.tag === 'a') {
  47809. return child
  47810. }
  47811. if (child.children && (child = findAnchor(child.children))) {
  47812. return child
  47813. }
  47814. }
  47815. }
  47816. }
  47817. var _Vue;
  47818. function install (Vue) {
  47819. if (install.installed && _Vue === Vue) { return }
  47820. install.installed = true;
  47821. _Vue = Vue;
  47822. var isDef = function (v) { return v !== undefined; };
  47823. var registerInstance = function (vm, callVal) {
  47824. var i = vm.$options._parentVnode;
  47825. if (isDef(i) && isDef(i = i.data) && isDef(i = i.registerRouteInstance)) {
  47826. i(vm, callVal);
  47827. }
  47828. };
  47829. Vue.mixin({
  47830. beforeCreate: function beforeCreate () {
  47831. if (isDef(this.$options.router)) {
  47832. this._routerRoot = this;
  47833. this._router = this.$options.router;
  47834. this._router.init(this);
  47835. Vue.util.defineReactive(this, '_route', this._router.history.current);
  47836. } else {
  47837. this._routerRoot = (this.$parent && this.$parent._routerRoot) || this;
  47838. }
  47839. registerInstance(this, this);
  47840. },
  47841. destroyed: function destroyed () {
  47842. registerInstance(this);
  47843. }
  47844. });
  47845. Object.defineProperty(Vue.prototype, '$router', {
  47846. get: function get () { return this._routerRoot._router }
  47847. });
  47848. Object.defineProperty(Vue.prototype, '$route', {
  47849. get: function get () { return this._routerRoot._route }
  47850. });
  47851. Vue.component('RouterView', View);
  47852. Vue.component('RouterLink', Link);
  47853. var strats = Vue.config.optionMergeStrategies;
  47854. // use the same hook merging strategy for route hooks
  47855. strats.beforeRouteEnter = strats.beforeRouteLeave = strats.beforeRouteUpdate = strats.created;
  47856. }
  47857. /* */
  47858. var inBrowser = typeof window !== 'undefined';
  47859. /* */
  47860. function createRouteMap (
  47861. routes,
  47862. oldPathList,
  47863. oldPathMap,
  47864. oldNameMap
  47865. ) {
  47866. // the path list is used to control path matching priority
  47867. var pathList = oldPathList || [];
  47868. // $flow-disable-line
  47869. var pathMap = oldPathMap || Object.create(null);
  47870. // $flow-disable-line
  47871. var nameMap = oldNameMap || Object.create(null);
  47872. routes.forEach(function (route) {
  47873. addRouteRecord(pathList, pathMap, nameMap, route);
  47874. });
  47875. // ensure wildcard routes are always at the end
  47876. for (var i = 0, l = pathList.length; i < l; i++) {
  47877. if (pathList[i] === '*') {
  47878. pathList.push(pathList.splice(i, 1)[0]);
  47879. l--;
  47880. i--;
  47881. }
  47882. }
  47883. if (true) {
  47884. // warn if routes do not include leading slashes
  47885. var found = pathList
  47886. // check for missing leading slash
  47887. .filter(function (path) { return path && path.charAt(0) !== '*' && path.charAt(0) !== '/'; });
  47888. if (found.length > 0) {
  47889. var pathNames = found.map(function (path) { return ("- " + path); }).join('\n');
  47890. warn(false, ("Non-nested routes must include a leading slash character. Fix the following routes: \n" + pathNames));
  47891. }
  47892. }
  47893. return {
  47894. pathList: pathList,
  47895. pathMap: pathMap,
  47896. nameMap: nameMap
  47897. }
  47898. }
  47899. function addRouteRecord (
  47900. pathList,
  47901. pathMap,
  47902. nameMap,
  47903. route,
  47904. parent,
  47905. matchAs
  47906. ) {
  47907. var path = route.path;
  47908. var name = route.name;
  47909. if (true) {
  47910. assert(path != null, "\"path\" is required in a route configuration.");
  47911. assert(
  47912. typeof route.component !== 'string',
  47913. "route config \"component\" for path: " + (String(
  47914. path || name
  47915. )) + " cannot be a " + "string id. Use an actual component instead."
  47916. );
  47917. }
  47918. var pathToRegexpOptions =
  47919. route.pathToRegexpOptions || {};
  47920. var normalizedPath = normalizePath(path, parent, pathToRegexpOptions.strict);
  47921. if (typeof route.caseSensitive === 'boolean') {
  47922. pathToRegexpOptions.sensitive = route.caseSensitive;
  47923. }
  47924. var record = {
  47925. path: normalizedPath,
  47926. regex: compileRouteRegex(normalizedPath, pathToRegexpOptions),
  47927. components: route.components || { default: route.component },
  47928. instances: {},
  47929. name: name,
  47930. parent: parent,
  47931. matchAs: matchAs,
  47932. redirect: route.redirect,
  47933. beforeEnter: route.beforeEnter,
  47934. meta: route.meta || {},
  47935. props:
  47936. route.props == null
  47937. ? {}
  47938. : route.components
  47939. ? route.props
  47940. : { default: route.props }
  47941. };
  47942. if (route.children) {
  47943. // Warn if route is named, does not redirect and has a default child route.
  47944. // If users navigate to this route by name, the default child will
  47945. // not be rendered (GH Issue #629)
  47946. if (true) {
  47947. if (
  47948. route.name &&
  47949. !route.redirect &&
  47950. route.children.some(function (child) { return /^\/?$/.test(child.path); })
  47951. ) {
  47952. warn(
  47953. false,
  47954. "Named Route '" + (route.name) + "' has a default child route. " +
  47955. "When navigating to this named route (:to=\"{name: '" + (route.name) + "'\"), " +
  47956. "the default child route will not be rendered. Remove the name from " +
  47957. "this route and use the name of the default child route for named " +
  47958. "links instead."
  47959. );
  47960. }
  47961. }
  47962. route.children.forEach(function (child) {
  47963. var childMatchAs = matchAs
  47964. ? cleanPath((matchAs + "/" + (child.path)))
  47965. : undefined;
  47966. addRouteRecord(pathList, pathMap, nameMap, child, record, childMatchAs);
  47967. });
  47968. }
  47969. if (!pathMap[record.path]) {
  47970. pathList.push(record.path);
  47971. pathMap[record.path] = record;
  47972. }
  47973. if (route.alias !== undefined) {
  47974. var aliases = Array.isArray(route.alias) ? route.alias : [route.alias];
  47975. for (var i = 0; i < aliases.length; ++i) {
  47976. var alias = aliases[i];
  47977. if ( true && alias === path) {
  47978. warn(
  47979. false,
  47980. ("Found an alias with the same value as the path: \"" + path + "\". You have to remove that alias. It will be ignored in development.")
  47981. );
  47982. // skip in dev to make it work
  47983. continue
  47984. }
  47985. var aliasRoute = {
  47986. path: alias,
  47987. children: route.children
  47988. };
  47989. addRouteRecord(
  47990. pathList,
  47991. pathMap,
  47992. nameMap,
  47993. aliasRoute,
  47994. parent,
  47995. record.path || '/' // matchAs
  47996. );
  47997. }
  47998. }
  47999. if (name) {
  48000. if (!nameMap[name]) {
  48001. nameMap[name] = record;
  48002. } else if ( true && !matchAs) {
  48003. warn(
  48004. false,
  48005. "Duplicate named routes definition: " +
  48006. "{ name: \"" + name + "\", path: \"" + (record.path) + "\" }"
  48007. );
  48008. }
  48009. }
  48010. }
  48011. function compileRouteRegex (
  48012. path,
  48013. pathToRegexpOptions
  48014. ) {
  48015. var regex = pathToRegexp_1(path, [], pathToRegexpOptions);
  48016. if (true) {
  48017. var keys = Object.create(null);
  48018. regex.keys.forEach(function (key) {
  48019. warn(
  48020. !keys[key.name],
  48021. ("Duplicate param keys in route with path: \"" + path + "\"")
  48022. );
  48023. keys[key.name] = true;
  48024. });
  48025. }
  48026. return regex
  48027. }
  48028. function normalizePath (
  48029. path,
  48030. parent,
  48031. strict
  48032. ) {
  48033. if (!strict) { path = path.replace(/\/$/, ''); }
  48034. if (path[0] === '/') { return path }
  48035. if (parent == null) { return path }
  48036. return cleanPath(((parent.path) + "/" + path))
  48037. }
  48038. /* */
  48039. function createMatcher (
  48040. routes,
  48041. router
  48042. ) {
  48043. var ref = createRouteMap(routes);
  48044. var pathList = ref.pathList;
  48045. var pathMap = ref.pathMap;
  48046. var nameMap = ref.nameMap;
  48047. function addRoutes (routes) {
  48048. createRouteMap(routes, pathList, pathMap, nameMap);
  48049. }
  48050. function match (
  48051. raw,
  48052. currentRoute,
  48053. redirectedFrom
  48054. ) {
  48055. var location = normalizeLocation(raw, currentRoute, false, router);
  48056. var name = location.name;
  48057. if (name) {
  48058. var record = nameMap[name];
  48059. if (true) {
  48060. warn(record, ("Route with name '" + name + "' does not exist"));
  48061. }
  48062. if (!record) { return _createRoute(null, location) }
  48063. var paramNames = record.regex.keys
  48064. .filter(function (key) { return !key.optional; })
  48065. .map(function (key) { return key.name; });
  48066. if (typeof location.params !== 'object') {
  48067. location.params = {};
  48068. }
  48069. if (currentRoute && typeof currentRoute.params === 'object') {
  48070. for (var key in currentRoute.params) {
  48071. if (!(key in location.params) && paramNames.indexOf(key) > -1) {
  48072. location.params[key] = currentRoute.params[key];
  48073. }
  48074. }
  48075. }
  48076. location.path = fillParams(record.path, location.params, ("named route \"" + name + "\""));
  48077. return _createRoute(record, location, redirectedFrom)
  48078. } else if (location.path) {
  48079. location.params = {};
  48080. for (var i = 0; i < pathList.length; i++) {
  48081. var path = pathList[i];
  48082. var record$1 = pathMap[path];
  48083. if (matchRoute(record$1.regex, location.path, location.params)) {
  48084. return _createRoute(record$1, location, redirectedFrom)
  48085. }
  48086. }
  48087. }
  48088. // no match
  48089. return _createRoute(null, location)
  48090. }
  48091. function redirect (
  48092. record,
  48093. location
  48094. ) {
  48095. var originalRedirect = record.redirect;
  48096. var redirect = typeof originalRedirect === 'function'
  48097. ? originalRedirect(createRoute(record, location, null, router))
  48098. : originalRedirect;
  48099. if (typeof redirect === 'string') {
  48100. redirect = { path: redirect };
  48101. }
  48102. if (!redirect || typeof redirect !== 'object') {
  48103. if (true) {
  48104. warn(
  48105. false, ("invalid redirect option: " + (JSON.stringify(redirect)))
  48106. );
  48107. }
  48108. return _createRoute(null, location)
  48109. }
  48110. var re = redirect;
  48111. var name = re.name;
  48112. var path = re.path;
  48113. var query = location.query;
  48114. var hash = location.hash;
  48115. var params = location.params;
  48116. query = re.hasOwnProperty('query') ? re.query : query;
  48117. hash = re.hasOwnProperty('hash') ? re.hash : hash;
  48118. params = re.hasOwnProperty('params') ? re.params : params;
  48119. if (name) {
  48120. // resolved named direct
  48121. var targetRecord = nameMap[name];
  48122. if (true) {
  48123. assert(targetRecord, ("redirect failed: named route \"" + name + "\" not found."));
  48124. }
  48125. return match({
  48126. _normalized: true,
  48127. name: name,
  48128. query: query,
  48129. hash: hash,
  48130. params: params
  48131. }, undefined, location)
  48132. } else if (path) {
  48133. // 1. resolve relative redirect
  48134. var rawPath = resolveRecordPath(path, record);
  48135. // 2. resolve params
  48136. var resolvedPath = fillParams(rawPath, params, ("redirect route with path \"" + rawPath + "\""));
  48137. // 3. rematch with existing query and hash
  48138. return match({
  48139. _normalized: true,
  48140. path: resolvedPath,
  48141. query: query,
  48142. hash: hash
  48143. }, undefined, location)
  48144. } else {
  48145. if (true) {
  48146. warn(false, ("invalid redirect option: " + (JSON.stringify(redirect))));
  48147. }
  48148. return _createRoute(null, location)
  48149. }
  48150. }
  48151. function alias (
  48152. record,
  48153. location,
  48154. matchAs
  48155. ) {
  48156. var aliasedPath = fillParams(matchAs, location.params, ("aliased route with path \"" + matchAs + "\""));
  48157. var aliasedMatch = match({
  48158. _normalized: true,
  48159. path: aliasedPath
  48160. });
  48161. if (aliasedMatch) {
  48162. var matched = aliasedMatch.matched;
  48163. var aliasedRecord = matched[matched.length - 1];
  48164. location.params = aliasedMatch.params;
  48165. return _createRoute(aliasedRecord, location)
  48166. }
  48167. return _createRoute(null, location)
  48168. }
  48169. function _createRoute (
  48170. record,
  48171. location,
  48172. redirectedFrom
  48173. ) {
  48174. if (record && record.redirect) {
  48175. return redirect(record, redirectedFrom || location)
  48176. }
  48177. if (record && record.matchAs) {
  48178. return alias(record, location, record.matchAs)
  48179. }
  48180. return createRoute(record, location, redirectedFrom, router)
  48181. }
  48182. return {
  48183. match: match,
  48184. addRoutes: addRoutes
  48185. }
  48186. }
  48187. function matchRoute (
  48188. regex,
  48189. path,
  48190. params
  48191. ) {
  48192. var m = path.match(regex);
  48193. if (!m) {
  48194. return false
  48195. } else if (!params) {
  48196. return true
  48197. }
  48198. for (var i = 1, len = m.length; i < len; ++i) {
  48199. var key = regex.keys[i - 1];
  48200. var val = typeof m[i] === 'string' ? decodeURIComponent(m[i]) : m[i];
  48201. if (key) {
  48202. // Fix #1994: using * with props: true generates a param named 0
  48203. params[key.name || 'pathMatch'] = val;
  48204. }
  48205. }
  48206. return true
  48207. }
  48208. function resolveRecordPath (path, record) {
  48209. return resolvePath(path, record.parent ? record.parent.path : '/', true)
  48210. }
  48211. /* */
  48212. // use User Timing api (if present) for more accurate key precision
  48213. var Time =
  48214. inBrowser && window.performance && window.performance.now
  48215. ? window.performance
  48216. : Date;
  48217. function genStateKey () {
  48218. return Time.now().toFixed(3)
  48219. }
  48220. var _key = genStateKey();
  48221. function getStateKey () {
  48222. return _key
  48223. }
  48224. function setStateKey (key) {
  48225. return (_key = key)
  48226. }
  48227. /* */
  48228. var positionStore = Object.create(null);
  48229. function setupScroll () {
  48230. // Fix for #1585 for Firefox
  48231. // Fix for #2195 Add optional third attribute to workaround a bug in safari https://bugs.webkit.org/show_bug.cgi?id=182678
  48232. // Fix for #2774 Support for apps loaded from Windows file shares not mapped to network drives: replaced location.origin with
  48233. // window.location.protocol + '//' + window.location.host
  48234. // location.host contains the port and location.hostname doesn't
  48235. var protocolAndPath = window.location.protocol + '//' + window.location.host;
  48236. var absolutePath = window.location.href.replace(protocolAndPath, '');
  48237. // preserve existing history state as it could be overriden by the user
  48238. var stateCopy = extend({}, window.history.state);
  48239. stateCopy.key = getStateKey();
  48240. window.history.replaceState(stateCopy, '', absolutePath);
  48241. window.addEventListener('popstate', function (e) {
  48242. saveScrollPosition();
  48243. if (e.state && e.state.key) {
  48244. setStateKey(e.state.key);
  48245. }
  48246. });
  48247. }
  48248. function handleScroll (
  48249. router,
  48250. to,
  48251. from,
  48252. isPop
  48253. ) {
  48254. if (!router.app) {
  48255. return
  48256. }
  48257. var behavior = router.options.scrollBehavior;
  48258. if (!behavior) {
  48259. return
  48260. }
  48261. if (true) {
  48262. assert(typeof behavior === 'function', "scrollBehavior must be a function");
  48263. }
  48264. // wait until re-render finishes before scrolling
  48265. router.app.$nextTick(function () {
  48266. var position = getScrollPosition();
  48267. var shouldScroll = behavior.call(
  48268. router,
  48269. to,
  48270. from,
  48271. isPop ? position : null
  48272. );
  48273. if (!shouldScroll) {
  48274. return
  48275. }
  48276. if (typeof shouldScroll.then === 'function') {
  48277. shouldScroll
  48278. .then(function (shouldScroll) {
  48279. scrollToPosition((shouldScroll), position);
  48280. })
  48281. .catch(function (err) {
  48282. if (true) {
  48283. assert(false, err.toString());
  48284. }
  48285. });
  48286. } else {
  48287. scrollToPosition(shouldScroll, position);
  48288. }
  48289. });
  48290. }
  48291. function saveScrollPosition () {
  48292. var key = getStateKey();
  48293. if (key) {
  48294. positionStore[key] = {
  48295. x: window.pageXOffset,
  48296. y: window.pageYOffset
  48297. };
  48298. }
  48299. }
  48300. function getScrollPosition () {
  48301. var key = getStateKey();
  48302. if (key) {
  48303. return positionStore[key]
  48304. }
  48305. }
  48306. function getElementPosition (el, offset) {
  48307. var docEl = document.documentElement;
  48308. var docRect = docEl.getBoundingClientRect();
  48309. var elRect = el.getBoundingClientRect();
  48310. return {
  48311. x: elRect.left - docRect.left - offset.x,
  48312. y: elRect.top - docRect.top - offset.y
  48313. }
  48314. }
  48315. function isValidPosition (obj) {
  48316. return isNumber(obj.x) || isNumber(obj.y)
  48317. }
  48318. function normalizePosition (obj) {
  48319. return {
  48320. x: isNumber(obj.x) ? obj.x : window.pageXOffset,
  48321. y: isNumber(obj.y) ? obj.y : window.pageYOffset
  48322. }
  48323. }
  48324. function normalizeOffset (obj) {
  48325. return {
  48326. x: isNumber(obj.x) ? obj.x : 0,
  48327. y: isNumber(obj.y) ? obj.y : 0
  48328. }
  48329. }
  48330. function isNumber (v) {
  48331. return typeof v === 'number'
  48332. }
  48333. var hashStartsWithNumberRE = /^#\d/;
  48334. function scrollToPosition (shouldScroll, position) {
  48335. var isObject = typeof shouldScroll === 'object';
  48336. if (isObject && typeof shouldScroll.selector === 'string') {
  48337. // getElementById would still fail if the selector contains a more complicated query like #main[data-attr]
  48338. // but at the same time, it doesn't make much sense to select an element with an id and an extra selector
  48339. var el = hashStartsWithNumberRE.test(shouldScroll.selector) // $flow-disable-line
  48340. ? document.getElementById(shouldScroll.selector.slice(1)) // $flow-disable-line
  48341. : document.querySelector(shouldScroll.selector);
  48342. if (el) {
  48343. var offset =
  48344. shouldScroll.offset && typeof shouldScroll.offset === 'object'
  48345. ? shouldScroll.offset
  48346. : {};
  48347. offset = normalizeOffset(offset);
  48348. position = getElementPosition(el, offset);
  48349. } else if (isValidPosition(shouldScroll)) {
  48350. position = normalizePosition(shouldScroll);
  48351. }
  48352. } else if (isObject && isValidPosition(shouldScroll)) {
  48353. position = normalizePosition(shouldScroll);
  48354. }
  48355. if (position) {
  48356. window.scrollTo(position.x, position.y);
  48357. }
  48358. }
  48359. /* */
  48360. var supportsPushState =
  48361. inBrowser &&
  48362. (function () {
  48363. var ua = window.navigator.userAgent;
  48364. if (
  48365. (ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) &&
  48366. ua.indexOf('Mobile Safari') !== -1 &&
  48367. ua.indexOf('Chrome') === -1 &&
  48368. ua.indexOf('Windows Phone') === -1
  48369. ) {
  48370. return false
  48371. }
  48372. return window.history && 'pushState' in window.history
  48373. })();
  48374. function pushState (url, replace) {
  48375. saveScrollPosition();
  48376. // try...catch the pushState call to get around Safari
  48377. // DOM Exception 18 where it limits to 100 pushState calls
  48378. var history = window.history;
  48379. try {
  48380. if (replace) {
  48381. // preserve existing history state as it could be overriden by the user
  48382. var stateCopy = extend({}, history.state);
  48383. stateCopy.key = getStateKey();
  48384. history.replaceState(stateCopy, '', url);
  48385. } else {
  48386. history.pushState({ key: setStateKey(genStateKey()) }, '', url);
  48387. }
  48388. } catch (e) {
  48389. window.location[replace ? 'replace' : 'assign'](url);
  48390. }
  48391. }
  48392. function replaceState (url) {
  48393. pushState(url, true);
  48394. }
  48395. /* */
  48396. function runQueue (queue, fn, cb) {
  48397. var step = function (index) {
  48398. if (index >= queue.length) {
  48399. cb();
  48400. } else {
  48401. if (queue[index]) {
  48402. fn(queue[index], function () {
  48403. step(index + 1);
  48404. });
  48405. } else {
  48406. step(index + 1);
  48407. }
  48408. }
  48409. };
  48410. step(0);
  48411. }
  48412. /* */
  48413. function resolveAsyncComponents (matched) {
  48414. return function (to, from, next) {
  48415. var hasAsync = false;
  48416. var pending = 0;
  48417. var error = null;
  48418. flatMapComponents(matched, function (def, _, match, key) {
  48419. // if it's a function and doesn't have cid attached,
  48420. // assume it's an async component resolve function.
  48421. // we are not using Vue's default async resolving mechanism because
  48422. // we want to halt the navigation until the incoming component has been
  48423. // resolved.
  48424. if (typeof def === 'function' && def.cid === undefined) {
  48425. hasAsync = true;
  48426. pending++;
  48427. var resolve = once(function (resolvedDef) {
  48428. if (isESModule(resolvedDef)) {
  48429. resolvedDef = resolvedDef.default;
  48430. }
  48431. // save resolved on async factory in case it's used elsewhere
  48432. def.resolved = typeof resolvedDef === 'function'
  48433. ? resolvedDef
  48434. : _Vue.extend(resolvedDef);
  48435. match.components[key] = resolvedDef;
  48436. pending--;
  48437. if (pending <= 0) {
  48438. next();
  48439. }
  48440. });
  48441. var reject = once(function (reason) {
  48442. var msg = "Failed to resolve async component " + key + ": " + reason;
  48443. true && warn(false, msg);
  48444. if (!error) {
  48445. error = isError(reason)
  48446. ? reason
  48447. : new Error(msg);
  48448. next(error);
  48449. }
  48450. });
  48451. var res;
  48452. try {
  48453. res = def(resolve, reject);
  48454. } catch (e) {
  48455. reject(e);
  48456. }
  48457. if (res) {
  48458. if (typeof res.then === 'function') {
  48459. res.then(resolve, reject);
  48460. } else {
  48461. // new syntax in Vue 2.3
  48462. var comp = res.component;
  48463. if (comp && typeof comp.then === 'function') {
  48464. comp.then(resolve, reject);
  48465. }
  48466. }
  48467. }
  48468. }
  48469. });
  48470. if (!hasAsync) { next(); }
  48471. }
  48472. }
  48473. function flatMapComponents (
  48474. matched,
  48475. fn
  48476. ) {
  48477. return flatten(matched.map(function (m) {
  48478. return Object.keys(m.components).map(function (key) { return fn(
  48479. m.components[key],
  48480. m.instances[key],
  48481. m, key
  48482. ); })
  48483. }))
  48484. }
  48485. function flatten (arr) {
  48486. return Array.prototype.concat.apply([], arr)
  48487. }
  48488. var hasSymbol =
  48489. typeof Symbol === 'function' &&
  48490. typeof Symbol.toStringTag === 'symbol';
  48491. function isESModule (obj) {
  48492. return obj.__esModule || (hasSymbol && obj[Symbol.toStringTag] === 'Module')
  48493. }
  48494. // in Webpack 2, require.ensure now also returns a Promise
  48495. // so the resolve/reject functions may get called an extra time
  48496. // if the user uses an arrow function shorthand that happens to
  48497. // return that Promise.
  48498. function once (fn) {
  48499. var called = false;
  48500. return function () {
  48501. var args = [], len = arguments.length;
  48502. while ( len-- ) args[ len ] = arguments[ len ];
  48503. if (called) { return }
  48504. called = true;
  48505. return fn.apply(this, args)
  48506. }
  48507. }
  48508. var NavigationDuplicated = /*@__PURE__*/(function (Error) {
  48509. function NavigationDuplicated (normalizedLocation) {
  48510. Error.call(this);
  48511. this.name = this._name = 'NavigationDuplicated';
  48512. // passing the message to super() doesn't seem to work in the transpiled version
  48513. this.message = "Navigating to current location (\"" + (normalizedLocation.fullPath) + "\") is not allowed";
  48514. // add a stack property so services like Sentry can correctly display it
  48515. Object.defineProperty(this, 'stack', {
  48516. value: new Error().stack,
  48517. writable: true,
  48518. configurable: true
  48519. });
  48520. // we could also have used
  48521. // Error.captureStackTrace(this, this.constructor)
  48522. // but it only exists on node and chrome
  48523. }
  48524. if ( Error ) NavigationDuplicated.__proto__ = Error;
  48525. NavigationDuplicated.prototype = Object.create( Error && Error.prototype );
  48526. NavigationDuplicated.prototype.constructor = NavigationDuplicated;
  48527. return NavigationDuplicated;
  48528. }(Error));
  48529. // support IE9
  48530. NavigationDuplicated._name = 'NavigationDuplicated';
  48531. /* */
  48532. var History = function History (router, base) {
  48533. this.router = router;
  48534. this.base = normalizeBase(base);
  48535. // start with a route object that stands for "nowhere"
  48536. this.current = START;
  48537. this.pending = null;
  48538. this.ready = false;
  48539. this.readyCbs = [];
  48540. this.readyErrorCbs = [];
  48541. this.errorCbs = [];
  48542. };
  48543. History.prototype.listen = function listen (cb) {
  48544. this.cb = cb;
  48545. };
  48546. History.prototype.onReady = function onReady (cb, errorCb) {
  48547. if (this.ready) {
  48548. cb();
  48549. } else {
  48550. this.readyCbs.push(cb);
  48551. if (errorCb) {
  48552. this.readyErrorCbs.push(errorCb);
  48553. }
  48554. }
  48555. };
  48556. History.prototype.onError = function onError (errorCb) {
  48557. this.errorCbs.push(errorCb);
  48558. };
  48559. History.prototype.transitionTo = function transitionTo (
  48560. location,
  48561. onComplete,
  48562. onAbort
  48563. ) {
  48564. var this$1 = this;
  48565. var route = this.router.match(location, this.current);
  48566. this.confirmTransition(
  48567. route,
  48568. function () {
  48569. this$1.updateRoute(route);
  48570. onComplete && onComplete(route);
  48571. this$1.ensureURL();
  48572. // fire ready cbs once
  48573. if (!this$1.ready) {
  48574. this$1.ready = true;
  48575. this$1.readyCbs.forEach(function (cb) {
  48576. cb(route);
  48577. });
  48578. }
  48579. },
  48580. function (err) {
  48581. if (onAbort) {
  48582. onAbort(err);
  48583. }
  48584. if (err && !this$1.ready) {
  48585. this$1.ready = true;
  48586. this$1.readyErrorCbs.forEach(function (cb) {
  48587. cb(err);
  48588. });
  48589. }
  48590. }
  48591. );
  48592. };
  48593. History.prototype.confirmTransition = function confirmTransition (route, onComplete, onAbort) {
  48594. var this$1 = this;
  48595. var current = this.current;
  48596. var abort = function (err) {
  48597. // after merging https://github.com/vuejs/vue-router/pull/2771 we
  48598. // When the user navigates through history through back/forward buttons
  48599. // we do not want to throw the error. We only throw it if directly calling
  48600. // push/replace. That's why it's not included in isError
  48601. if (!isExtendedError(NavigationDuplicated, err) && isError(err)) {
  48602. if (this$1.errorCbs.length) {
  48603. this$1.errorCbs.forEach(function (cb) {
  48604. cb(err);
  48605. });
  48606. } else {
  48607. warn(false, 'uncaught error during route navigation:');
  48608. console.error(err);
  48609. }
  48610. }
  48611. onAbort && onAbort(err);
  48612. };
  48613. if (
  48614. isSameRoute(route, current) &&
  48615. // in the case the route map has been dynamically appended to
  48616. route.matched.length === current.matched.length
  48617. ) {
  48618. this.ensureURL();
  48619. return abort(new NavigationDuplicated(route))
  48620. }
  48621. var ref = resolveQueue(
  48622. this.current.matched,
  48623. route.matched
  48624. );
  48625. var updated = ref.updated;
  48626. var deactivated = ref.deactivated;
  48627. var activated = ref.activated;
  48628. var queue = [].concat(
  48629. // in-component leave guards
  48630. extractLeaveGuards(deactivated),
  48631. // global before hooks
  48632. this.router.beforeHooks,
  48633. // in-component update hooks
  48634. extractUpdateHooks(updated),
  48635. // in-config enter guards
  48636. activated.map(function (m) { return m.beforeEnter; }),
  48637. // async components
  48638. resolveAsyncComponents(activated)
  48639. );
  48640. this.pending = route;
  48641. var iterator = function (hook, next) {
  48642. if (this$1.pending !== route) {
  48643. return abort()
  48644. }
  48645. try {
  48646. hook(route, current, function (to) {
  48647. if (to === false || isError(to)) {
  48648. // next(false) -> abort navigation, ensure current URL
  48649. this$1.ensureURL(true);
  48650. abort(to);
  48651. } else if (
  48652. typeof to === 'string' ||
  48653. (typeof to === 'object' &&
  48654. (typeof to.path === 'string' || typeof to.name === 'string'))
  48655. ) {
  48656. // next('/') or next({ path: '/' }) -> redirect
  48657. abort();
  48658. if (typeof to === 'object' && to.replace) {
  48659. this$1.replace(to);
  48660. } else {
  48661. this$1.push(to);
  48662. }
  48663. } else {
  48664. // confirm transition and pass on the value
  48665. next(to);
  48666. }
  48667. });
  48668. } catch (e) {
  48669. abort(e);
  48670. }
  48671. };
  48672. runQueue(queue, iterator, function () {
  48673. var postEnterCbs = [];
  48674. var isValid = function () { return this$1.current === route; };
  48675. // wait until async components are resolved before
  48676. // extracting in-component enter guards
  48677. var enterGuards = extractEnterGuards(activated, postEnterCbs, isValid);
  48678. var queue = enterGuards.concat(this$1.router.resolveHooks);
  48679. runQueue(queue, iterator, function () {
  48680. if (this$1.pending !== route) {
  48681. return abort()
  48682. }
  48683. this$1.pending = null;
  48684. onComplete(route);
  48685. if (this$1.router.app) {
  48686. this$1.router.app.$nextTick(function () {
  48687. postEnterCbs.forEach(function (cb) {
  48688. cb();
  48689. });
  48690. });
  48691. }
  48692. });
  48693. });
  48694. };
  48695. History.prototype.updateRoute = function updateRoute (route) {
  48696. var prev = this.current;
  48697. this.current = route;
  48698. this.cb && this.cb(route);
  48699. this.router.afterHooks.forEach(function (hook) {
  48700. hook && hook(route, prev);
  48701. });
  48702. };
  48703. function normalizeBase (base) {
  48704. if (!base) {
  48705. if (inBrowser) {
  48706. // respect <base> tag
  48707. var baseEl = document.querySelector('base');
  48708. base = (baseEl && baseEl.getAttribute('href')) || '/';
  48709. // strip full URL origin
  48710. base = base.replace(/^https?:\/\/[^\/]+/, '');
  48711. } else {
  48712. base = '/';
  48713. }
  48714. }
  48715. // make sure there's the starting slash
  48716. if (base.charAt(0) !== '/') {
  48717. base = '/' + base;
  48718. }
  48719. // remove trailing slash
  48720. return base.replace(/\/$/, '')
  48721. }
  48722. function resolveQueue (
  48723. current,
  48724. next
  48725. ) {
  48726. var i;
  48727. var max = Math.max(current.length, next.length);
  48728. for (i = 0; i < max; i++) {
  48729. if (current[i] !== next[i]) {
  48730. break
  48731. }
  48732. }
  48733. return {
  48734. updated: next.slice(0, i),
  48735. activated: next.slice(i),
  48736. deactivated: current.slice(i)
  48737. }
  48738. }
  48739. function extractGuards (
  48740. records,
  48741. name,
  48742. bind,
  48743. reverse
  48744. ) {
  48745. var guards = flatMapComponents(records, function (def, instance, match, key) {
  48746. var guard = extractGuard(def, name);
  48747. if (guard) {
  48748. return Array.isArray(guard)
  48749. ? guard.map(function (guard) { return bind(guard, instance, match, key); })
  48750. : bind(guard, instance, match, key)
  48751. }
  48752. });
  48753. return flatten(reverse ? guards.reverse() : guards)
  48754. }
  48755. function extractGuard (
  48756. def,
  48757. key
  48758. ) {
  48759. if (typeof def !== 'function') {
  48760. // extend now so that global mixins are applied.
  48761. def = _Vue.extend(def);
  48762. }
  48763. return def.options[key]
  48764. }
  48765. function extractLeaveGuards (deactivated) {
  48766. return extractGuards(deactivated, 'beforeRouteLeave', bindGuard, true)
  48767. }
  48768. function extractUpdateHooks (updated) {
  48769. return extractGuards(updated, 'beforeRouteUpdate', bindGuard)
  48770. }
  48771. function bindGuard (guard, instance) {
  48772. if (instance) {
  48773. return function boundRouteGuard () {
  48774. return guard.apply(instance, arguments)
  48775. }
  48776. }
  48777. }
  48778. function extractEnterGuards (
  48779. activated,
  48780. cbs,
  48781. isValid
  48782. ) {
  48783. return extractGuards(
  48784. activated,
  48785. 'beforeRouteEnter',
  48786. function (guard, _, match, key) {
  48787. return bindEnterGuard(guard, match, key, cbs, isValid)
  48788. }
  48789. )
  48790. }
  48791. function bindEnterGuard (
  48792. guard,
  48793. match,
  48794. key,
  48795. cbs,
  48796. isValid
  48797. ) {
  48798. return function routeEnterGuard (to, from, next) {
  48799. return guard(to, from, function (cb) {
  48800. if (typeof cb === 'function') {
  48801. cbs.push(function () {
  48802. // #750
  48803. // if a router-view is wrapped with an out-in transition,
  48804. // the instance may not have been registered at this time.
  48805. // we will need to poll for registration until current route
  48806. // is no longer valid.
  48807. poll(cb, match.instances, key, isValid);
  48808. });
  48809. }
  48810. next(cb);
  48811. })
  48812. }
  48813. }
  48814. function poll (
  48815. cb, // somehow flow cannot infer this is a function
  48816. instances,
  48817. key,
  48818. isValid
  48819. ) {
  48820. if (
  48821. instances[key] &&
  48822. !instances[key]._isBeingDestroyed // do not reuse being destroyed instance
  48823. ) {
  48824. cb(instances[key]);
  48825. } else if (isValid()) {
  48826. setTimeout(function () {
  48827. poll(cb, instances, key, isValid);
  48828. }, 16);
  48829. }
  48830. }
  48831. /* */
  48832. var HTML5History = /*@__PURE__*/(function (History) {
  48833. function HTML5History (router, base) {
  48834. var this$1 = this;
  48835. History.call(this, router, base);
  48836. var expectScroll = router.options.scrollBehavior;
  48837. var supportsScroll = supportsPushState && expectScroll;
  48838. if (supportsScroll) {
  48839. setupScroll();
  48840. }
  48841. var initLocation = getLocation(this.base);
  48842. window.addEventListener('popstate', function (e) {
  48843. var current = this$1.current;
  48844. // Avoiding first `popstate` event dispatched in some browsers but first
  48845. // history route not updated since async guard at the same time.
  48846. var location = getLocation(this$1.base);
  48847. if (this$1.current === START && location === initLocation) {
  48848. return
  48849. }
  48850. this$1.transitionTo(location, function (route) {
  48851. if (supportsScroll) {
  48852. handleScroll(router, route, current, true);
  48853. }
  48854. });
  48855. });
  48856. }
  48857. if ( History ) HTML5History.__proto__ = History;
  48858. HTML5History.prototype = Object.create( History && History.prototype );
  48859. HTML5History.prototype.constructor = HTML5History;
  48860. HTML5History.prototype.go = function go (n) {
  48861. window.history.go(n);
  48862. };
  48863. HTML5History.prototype.push = function push (location, onComplete, onAbort) {
  48864. var this$1 = this;
  48865. var ref = this;
  48866. var fromRoute = ref.current;
  48867. this.transitionTo(location, function (route) {
  48868. pushState(cleanPath(this$1.base + route.fullPath));
  48869. handleScroll(this$1.router, route, fromRoute, false);
  48870. onComplete && onComplete(route);
  48871. }, onAbort);
  48872. };
  48873. HTML5History.prototype.replace = function replace (location, onComplete, onAbort) {
  48874. var this$1 = this;
  48875. var ref = this;
  48876. var fromRoute = ref.current;
  48877. this.transitionTo(location, function (route) {
  48878. replaceState(cleanPath(this$1.base + route.fullPath));
  48879. handleScroll(this$1.router, route, fromRoute, false);
  48880. onComplete && onComplete(route);
  48881. }, onAbort);
  48882. };
  48883. HTML5History.prototype.ensureURL = function ensureURL (push) {
  48884. if (getLocation(this.base) !== this.current.fullPath) {
  48885. var current = cleanPath(this.base + this.current.fullPath);
  48886. push ? pushState(current) : replaceState(current);
  48887. }
  48888. };
  48889. HTML5History.prototype.getCurrentLocation = function getCurrentLocation () {
  48890. return getLocation(this.base)
  48891. };
  48892. return HTML5History;
  48893. }(History));
  48894. function getLocation (base) {
  48895. var path = decodeURI(window.location.pathname);
  48896. if (base && path.indexOf(base) === 0) {
  48897. path = path.slice(base.length);
  48898. }
  48899. return (path || '/') + window.location.search + window.location.hash
  48900. }
  48901. /* */
  48902. var HashHistory = /*@__PURE__*/(function (History) {
  48903. function HashHistory (router, base, fallback) {
  48904. History.call(this, router, base);
  48905. // check history fallback deeplinking
  48906. if (fallback && checkFallback(this.base)) {
  48907. return
  48908. }
  48909. ensureSlash();
  48910. }
  48911. if ( History ) HashHistory.__proto__ = History;
  48912. HashHistory.prototype = Object.create( History && History.prototype );
  48913. HashHistory.prototype.constructor = HashHistory;
  48914. // this is delayed until the app mounts
  48915. // to avoid the hashchange listener being fired too early
  48916. HashHistory.prototype.setupListeners = function setupListeners () {
  48917. var this$1 = this;
  48918. var router = this.router;
  48919. var expectScroll = router.options.scrollBehavior;
  48920. var supportsScroll = supportsPushState && expectScroll;
  48921. if (supportsScroll) {
  48922. setupScroll();
  48923. }
  48924. window.addEventListener(
  48925. supportsPushState ? 'popstate' : 'hashchange',
  48926. function () {
  48927. var current = this$1.current;
  48928. if (!ensureSlash()) {
  48929. return
  48930. }
  48931. this$1.transitionTo(getHash(), function (route) {
  48932. if (supportsScroll) {
  48933. handleScroll(this$1.router, route, current, true);
  48934. }
  48935. if (!supportsPushState) {
  48936. replaceHash(route.fullPath);
  48937. }
  48938. });
  48939. }
  48940. );
  48941. };
  48942. HashHistory.prototype.push = function push (location, onComplete, onAbort) {
  48943. var this$1 = this;
  48944. var ref = this;
  48945. var fromRoute = ref.current;
  48946. this.transitionTo(
  48947. location,
  48948. function (route) {
  48949. pushHash(route.fullPath);
  48950. handleScroll(this$1.router, route, fromRoute, false);
  48951. onComplete && onComplete(route);
  48952. },
  48953. onAbort
  48954. );
  48955. };
  48956. HashHistory.prototype.replace = function replace (location, onComplete, onAbort) {
  48957. var this$1 = this;
  48958. var ref = this;
  48959. var fromRoute = ref.current;
  48960. this.transitionTo(
  48961. location,
  48962. function (route) {
  48963. replaceHash(route.fullPath);
  48964. handleScroll(this$1.router, route, fromRoute, false);
  48965. onComplete && onComplete(route);
  48966. },
  48967. onAbort
  48968. );
  48969. };
  48970. HashHistory.prototype.go = function go (n) {
  48971. window.history.go(n);
  48972. };
  48973. HashHistory.prototype.ensureURL = function ensureURL (push) {
  48974. var current = this.current.fullPath;
  48975. if (getHash() !== current) {
  48976. push ? pushHash(current) : replaceHash(current);
  48977. }
  48978. };
  48979. HashHistory.prototype.getCurrentLocation = function getCurrentLocation () {
  48980. return getHash()
  48981. };
  48982. return HashHistory;
  48983. }(History));
  48984. function checkFallback (base) {
  48985. var location = getLocation(base);
  48986. if (!/^\/#/.test(location)) {
  48987. window.location.replace(cleanPath(base + '/#' + location));
  48988. return true
  48989. }
  48990. }
  48991. function ensureSlash () {
  48992. var path = getHash();
  48993. if (path.charAt(0) === '/') {
  48994. return true
  48995. }
  48996. replaceHash('/' + path);
  48997. return false
  48998. }
  48999. function getHash () {
  49000. // We can't use window.location.hash here because it's not
  49001. // consistent across browsers - Firefox will pre-decode it!
  49002. var href = window.location.href;
  49003. var index = href.indexOf('#');
  49004. // empty path
  49005. if (index < 0) { return '' }
  49006. href = href.slice(index + 1);
  49007. // decode the hash but not the search or hash
  49008. // as search(query) is already decoded
  49009. // https://github.com/vuejs/vue-router/issues/2708
  49010. var searchIndex = href.indexOf('?');
  49011. if (searchIndex < 0) {
  49012. var hashIndex = href.indexOf('#');
  49013. if (hashIndex > -1) {
  49014. href = decodeURI(href.slice(0, hashIndex)) + href.slice(hashIndex);
  49015. } else { href = decodeURI(href); }
  49016. } else {
  49017. href = decodeURI(href.slice(0, searchIndex)) + href.slice(searchIndex);
  49018. }
  49019. return href
  49020. }
  49021. function getUrl (path) {
  49022. var href = window.location.href;
  49023. var i = href.indexOf('#');
  49024. var base = i >= 0 ? href.slice(0, i) : href;
  49025. return (base + "#" + path)
  49026. }
  49027. function pushHash (path) {
  49028. if (supportsPushState) {
  49029. pushState(getUrl(path));
  49030. } else {
  49031. window.location.hash = path;
  49032. }
  49033. }
  49034. function replaceHash (path) {
  49035. if (supportsPushState) {
  49036. replaceState(getUrl(path));
  49037. } else {
  49038. window.location.replace(getUrl(path));
  49039. }
  49040. }
  49041. /* */
  49042. var AbstractHistory = /*@__PURE__*/(function (History) {
  49043. function AbstractHistory (router, base) {
  49044. History.call(this, router, base);
  49045. this.stack = [];
  49046. this.index = -1;
  49047. }
  49048. if ( History ) AbstractHistory.__proto__ = History;
  49049. AbstractHistory.prototype = Object.create( History && History.prototype );
  49050. AbstractHistory.prototype.constructor = AbstractHistory;
  49051. AbstractHistory.prototype.push = function push (location, onComplete, onAbort) {
  49052. var this$1 = this;
  49053. this.transitionTo(
  49054. location,
  49055. function (route) {
  49056. this$1.stack = this$1.stack.slice(0, this$1.index + 1).concat(route);
  49057. this$1.index++;
  49058. onComplete && onComplete(route);
  49059. },
  49060. onAbort
  49061. );
  49062. };
  49063. AbstractHistory.prototype.replace = function replace (location, onComplete, onAbort) {
  49064. var this$1 = this;
  49065. this.transitionTo(
  49066. location,
  49067. function (route) {
  49068. this$1.stack = this$1.stack.slice(0, this$1.index).concat(route);
  49069. onComplete && onComplete(route);
  49070. },
  49071. onAbort
  49072. );
  49073. };
  49074. AbstractHistory.prototype.go = function go (n) {
  49075. var this$1 = this;
  49076. var targetIndex = this.index + n;
  49077. if (targetIndex < 0 || targetIndex >= this.stack.length) {
  49078. return
  49079. }
  49080. var route = this.stack[targetIndex];
  49081. this.confirmTransition(
  49082. route,
  49083. function () {
  49084. this$1.index = targetIndex;
  49085. this$1.updateRoute(route);
  49086. },
  49087. function (err) {
  49088. if (isExtendedError(NavigationDuplicated, err)) {
  49089. this$1.index = targetIndex;
  49090. }
  49091. }
  49092. );
  49093. };
  49094. AbstractHistory.prototype.getCurrentLocation = function getCurrentLocation () {
  49095. var current = this.stack[this.stack.length - 1];
  49096. return current ? current.fullPath : '/'
  49097. };
  49098. AbstractHistory.prototype.ensureURL = function ensureURL () {
  49099. // noop
  49100. };
  49101. return AbstractHistory;
  49102. }(History));
  49103. /* */
  49104. var VueRouter = function VueRouter (options) {
  49105. if ( options === void 0 ) options = {};
  49106. this.app = null;
  49107. this.apps = [];
  49108. this.options = options;
  49109. this.beforeHooks = [];
  49110. this.resolveHooks = [];
  49111. this.afterHooks = [];
  49112. this.matcher = createMatcher(options.routes || [], this);
  49113. var mode = options.mode || 'hash';
  49114. this.fallback = mode === 'history' && !supportsPushState && options.fallback !== false;
  49115. if (this.fallback) {
  49116. mode = 'hash';
  49117. }
  49118. if (!inBrowser) {
  49119. mode = 'abstract';
  49120. }
  49121. this.mode = mode;
  49122. switch (mode) {
  49123. case 'history':
  49124. this.history = new HTML5History(this, options.base);
  49125. break
  49126. case 'hash':
  49127. this.history = new HashHistory(this, options.base, this.fallback);
  49128. break
  49129. case 'abstract':
  49130. this.history = new AbstractHistory(this, options.base);
  49131. break
  49132. default:
  49133. if (true) {
  49134. assert(false, ("invalid mode: " + mode));
  49135. }
  49136. }
  49137. };
  49138. var prototypeAccessors = { currentRoute: { configurable: true } };
  49139. VueRouter.prototype.match = function match (
  49140. raw,
  49141. current,
  49142. redirectedFrom
  49143. ) {
  49144. return this.matcher.match(raw, current, redirectedFrom)
  49145. };
  49146. prototypeAccessors.currentRoute.get = function () {
  49147. return this.history && this.history.current
  49148. };
  49149. VueRouter.prototype.init = function init (app /* Vue component instance */) {
  49150. var this$1 = this;
  49151. true && assert(
  49152. install.installed,
  49153. "not installed. Make sure to call `Vue.use(VueRouter)` " +
  49154. "before creating root instance."
  49155. );
  49156. this.apps.push(app);
  49157. // set up app destroyed handler
  49158. // https://github.com/vuejs/vue-router/issues/2639
  49159. app.$once('hook:destroyed', function () {
  49160. // clean out app from this.apps array once destroyed
  49161. var index = this$1.apps.indexOf(app);
  49162. if (index > -1) { this$1.apps.splice(index, 1); }
  49163. // ensure we still have a main app or null if no apps
  49164. // we do not release the router so it can be reused
  49165. if (this$1.app === app) { this$1.app = this$1.apps[0] || null; }
  49166. });
  49167. // main app previously initialized
  49168. // return as we don't need to set up new history listener
  49169. if (this.app) {
  49170. return
  49171. }
  49172. this.app = app;
  49173. var history = this.history;
  49174. if (history instanceof HTML5History) {
  49175. history.transitionTo(history.getCurrentLocation());
  49176. } else if (history instanceof HashHistory) {
  49177. var setupHashListener = function () {
  49178. history.setupListeners();
  49179. };
  49180. history.transitionTo(
  49181. history.getCurrentLocation(),
  49182. setupHashListener,
  49183. setupHashListener
  49184. );
  49185. }
  49186. history.listen(function (route) {
  49187. this$1.apps.forEach(function (app) {
  49188. app._route = route;
  49189. });
  49190. });
  49191. };
  49192. VueRouter.prototype.beforeEach = function beforeEach (fn) {
  49193. return registerHook(this.beforeHooks, fn)
  49194. };
  49195. VueRouter.prototype.beforeResolve = function beforeResolve (fn) {
  49196. return registerHook(this.resolveHooks, fn)
  49197. };
  49198. VueRouter.prototype.afterEach = function afterEach (fn) {
  49199. return registerHook(this.afterHooks, fn)
  49200. };
  49201. VueRouter.prototype.onReady = function onReady (cb, errorCb) {
  49202. this.history.onReady(cb, errorCb);
  49203. };
  49204. VueRouter.prototype.onError = function onError (errorCb) {
  49205. this.history.onError(errorCb);
  49206. };
  49207. VueRouter.prototype.push = function push (location, onComplete, onAbort) {
  49208. var this$1 = this;
  49209. // $flow-disable-line
  49210. if (!onComplete && !onAbort && typeof Promise !== 'undefined') {
  49211. return new Promise(function (resolve, reject) {
  49212. this$1.history.push(location, resolve, reject);
  49213. })
  49214. } else {
  49215. this.history.push(location, onComplete, onAbort);
  49216. }
  49217. };
  49218. VueRouter.prototype.replace = function replace (location, onComplete, onAbort) {
  49219. var this$1 = this;
  49220. // $flow-disable-line
  49221. if (!onComplete && !onAbort && typeof Promise !== 'undefined') {
  49222. return new Promise(function (resolve, reject) {
  49223. this$1.history.replace(location, resolve, reject);
  49224. })
  49225. } else {
  49226. this.history.replace(location, onComplete, onAbort);
  49227. }
  49228. };
  49229. VueRouter.prototype.go = function go (n) {
  49230. this.history.go(n);
  49231. };
  49232. VueRouter.prototype.back = function back () {
  49233. this.go(-1);
  49234. };
  49235. VueRouter.prototype.forward = function forward () {
  49236. this.go(1);
  49237. };
  49238. VueRouter.prototype.getMatchedComponents = function getMatchedComponents (to) {
  49239. var route = to
  49240. ? to.matched
  49241. ? to
  49242. : this.resolve(to).route
  49243. : this.currentRoute;
  49244. if (!route) {
  49245. return []
  49246. }
  49247. return [].concat.apply([], route.matched.map(function (m) {
  49248. return Object.keys(m.components).map(function (key) {
  49249. return m.components[key]
  49250. })
  49251. }))
  49252. };
  49253. VueRouter.prototype.resolve = function resolve (
  49254. to,
  49255. current,
  49256. append
  49257. ) {
  49258. current = current || this.history.current;
  49259. var location = normalizeLocation(
  49260. to,
  49261. current,
  49262. append,
  49263. this
  49264. );
  49265. var route = this.match(location, current);
  49266. var fullPath = route.redirectedFrom || route.fullPath;
  49267. var base = this.history.base;
  49268. var href = createHref(base, fullPath, this.mode);
  49269. return {
  49270. location: location,
  49271. route: route,
  49272. href: href,
  49273. // for backwards compat
  49274. normalizedTo: location,
  49275. resolved: route
  49276. }
  49277. };
  49278. VueRouter.prototype.addRoutes = function addRoutes (routes) {
  49279. this.matcher.addRoutes(routes);
  49280. if (this.history.current !== START) {
  49281. this.history.transitionTo(this.history.getCurrentLocation());
  49282. }
  49283. };
  49284. Object.defineProperties( VueRouter.prototype, prototypeAccessors );
  49285. function registerHook (list, fn) {
  49286. list.push(fn);
  49287. return function () {
  49288. var i = list.indexOf(fn);
  49289. if (i > -1) { list.splice(i, 1); }
  49290. }
  49291. }
  49292. function createHref (base, fullPath, mode) {
  49293. var path = mode === 'hash' ? '#' + fullPath : fullPath;
  49294. return base ? cleanPath(base + '/' + path) : path
  49295. }
  49296. VueRouter.install = install;
  49297. VueRouter.version = '3.1.6';
  49298. if (inBrowser && window.Vue) {
  49299. window.Vue.use(VueRouter);
  49300. }
  49301. /* harmony default export */ __webpack_exports__["default"] = (VueRouter);
  49302. /***/ }),
  49303. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  49304. /*!*************************************************!*\
  49305. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  49306. \*************************************************/
  49307. /*! no static exports found */
  49308. /***/ (function(module, exports, __webpack_require__) {
  49309. "use strict";
  49310. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  49311. * Vue.js v2.6.11
  49312. * (c) 2014-2019 Evan You
  49313. * Released under the MIT License.
  49314. */
  49315. /* */
  49316. var emptyObject = Object.freeze({});
  49317. // These helpers produce better VM code in JS engines due to their
  49318. // explicitness and function inlining.
  49319. function isUndef (v) {
  49320. return v === undefined || v === null
  49321. }
  49322. function isDef (v) {
  49323. return v !== undefined && v !== null
  49324. }
  49325. function isTrue (v) {
  49326. return v === true
  49327. }
  49328. function isFalse (v) {
  49329. return v === false
  49330. }
  49331. /**
  49332. * Check if value is primitive.
  49333. */
  49334. function isPrimitive (value) {
  49335. return (
  49336. typeof value === 'string' ||
  49337. typeof value === 'number' ||
  49338. // $flow-disable-line
  49339. typeof value === 'symbol' ||
  49340. typeof value === 'boolean'
  49341. )
  49342. }
  49343. /**
  49344. * Quick object check - this is primarily used to tell
  49345. * Objects from primitive values when we know the value
  49346. * is a JSON-compliant type.
  49347. */
  49348. function isObject (obj) {
  49349. return obj !== null && typeof obj === 'object'
  49350. }
  49351. /**
  49352. * Get the raw type string of a value, e.g., [object Object].
  49353. */
  49354. var _toString = Object.prototype.toString;
  49355. function toRawType (value) {
  49356. return _toString.call(value).slice(8, -1)
  49357. }
  49358. /**
  49359. * Strict object type check. Only returns true
  49360. * for plain JavaScript objects.
  49361. */
  49362. function isPlainObject (obj) {
  49363. return _toString.call(obj) === '[object Object]'
  49364. }
  49365. function isRegExp (v) {
  49366. return _toString.call(v) === '[object RegExp]'
  49367. }
  49368. /**
  49369. * Check if val is a valid array index.
  49370. */
  49371. function isValidArrayIndex (val) {
  49372. var n = parseFloat(String(val));
  49373. return n >= 0 && Math.floor(n) === n && isFinite(val)
  49374. }
  49375. function isPromise (val) {
  49376. return (
  49377. isDef(val) &&
  49378. typeof val.then === 'function' &&
  49379. typeof val.catch === 'function'
  49380. )
  49381. }
  49382. /**
  49383. * Convert a value to a string that is actually rendered.
  49384. */
  49385. function toString (val) {
  49386. return val == null
  49387. ? ''
  49388. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  49389. ? JSON.stringify(val, null, 2)
  49390. : String(val)
  49391. }
  49392. /**
  49393. * Convert an input value to a number for persistence.
  49394. * If the conversion fails, return original string.
  49395. */
  49396. function toNumber (val) {
  49397. var n = parseFloat(val);
  49398. return isNaN(n) ? val : n
  49399. }
  49400. /**
  49401. * Make a map and return a function for checking if a key
  49402. * is in that map.
  49403. */
  49404. function makeMap (
  49405. str,
  49406. expectsLowerCase
  49407. ) {
  49408. var map = Object.create(null);
  49409. var list = str.split(',');
  49410. for (var i = 0; i < list.length; i++) {
  49411. map[list[i]] = true;
  49412. }
  49413. return expectsLowerCase
  49414. ? function (val) { return map[val.toLowerCase()]; }
  49415. : function (val) { return map[val]; }
  49416. }
  49417. /**
  49418. * Check if a tag is a built-in tag.
  49419. */
  49420. var isBuiltInTag = makeMap('slot,component', true);
  49421. /**
  49422. * Check if an attribute is a reserved attribute.
  49423. */
  49424. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  49425. /**
  49426. * Remove an item from an array.
  49427. */
  49428. function remove (arr, item) {
  49429. if (arr.length) {
  49430. var index = arr.indexOf(item);
  49431. if (index > -1) {
  49432. return arr.splice(index, 1)
  49433. }
  49434. }
  49435. }
  49436. /**
  49437. * Check whether an object has the property.
  49438. */
  49439. var hasOwnProperty = Object.prototype.hasOwnProperty;
  49440. function hasOwn (obj, key) {
  49441. return hasOwnProperty.call(obj, key)
  49442. }
  49443. /**
  49444. * Create a cached version of a pure function.
  49445. */
  49446. function cached (fn) {
  49447. var cache = Object.create(null);
  49448. return (function cachedFn (str) {
  49449. var hit = cache[str];
  49450. return hit || (cache[str] = fn(str))
  49451. })
  49452. }
  49453. /**
  49454. * Camelize a hyphen-delimited string.
  49455. */
  49456. var camelizeRE = /-(\w)/g;
  49457. var camelize = cached(function (str) {
  49458. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  49459. });
  49460. /**
  49461. * Capitalize a string.
  49462. */
  49463. var capitalize = cached(function (str) {
  49464. return str.charAt(0).toUpperCase() + str.slice(1)
  49465. });
  49466. /**
  49467. * Hyphenate a camelCase string.
  49468. */
  49469. var hyphenateRE = /\B([A-Z])/g;
  49470. var hyphenate = cached(function (str) {
  49471. return str.replace(hyphenateRE, '-$1').toLowerCase()
  49472. });
  49473. /**
  49474. * Simple bind polyfill for environments that do not support it,
  49475. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  49476. * since native bind is now performant enough in most browsers.
  49477. * But removing it would mean breaking code that was able to run in
  49478. * PhantomJS 1.x, so this must be kept for backward compatibility.
  49479. */
  49480. /* istanbul ignore next */
  49481. function polyfillBind (fn, ctx) {
  49482. function boundFn (a) {
  49483. var l = arguments.length;
  49484. return l
  49485. ? l > 1
  49486. ? fn.apply(ctx, arguments)
  49487. : fn.call(ctx, a)
  49488. : fn.call(ctx)
  49489. }
  49490. boundFn._length = fn.length;
  49491. return boundFn
  49492. }
  49493. function nativeBind (fn, ctx) {
  49494. return fn.bind(ctx)
  49495. }
  49496. var bind = Function.prototype.bind
  49497. ? nativeBind
  49498. : polyfillBind;
  49499. /**
  49500. * Convert an Array-like object to a real Array.
  49501. */
  49502. function toArray (list, start) {
  49503. start = start || 0;
  49504. var i = list.length - start;
  49505. var ret = new Array(i);
  49506. while (i--) {
  49507. ret[i] = list[i + start];
  49508. }
  49509. return ret
  49510. }
  49511. /**
  49512. * Mix properties into target object.
  49513. */
  49514. function extend (to, _from) {
  49515. for (var key in _from) {
  49516. to[key] = _from[key];
  49517. }
  49518. return to
  49519. }
  49520. /**
  49521. * Merge an Array of Objects into a single Object.
  49522. */
  49523. function toObject (arr) {
  49524. var res = {};
  49525. for (var i = 0; i < arr.length; i++) {
  49526. if (arr[i]) {
  49527. extend(res, arr[i]);
  49528. }
  49529. }
  49530. return res
  49531. }
  49532. /* eslint-disable no-unused-vars */
  49533. /**
  49534. * Perform no operation.
  49535. * Stubbing args to make Flow happy without leaving useless transpiled code
  49536. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  49537. */
  49538. function noop (a, b, c) {}
  49539. /**
  49540. * Always return false.
  49541. */
  49542. var no = function (a, b, c) { return false; };
  49543. /* eslint-enable no-unused-vars */
  49544. /**
  49545. * Return the same value.
  49546. */
  49547. var identity = function (_) { return _; };
  49548. /**
  49549. * Generate a string containing static keys from compiler modules.
  49550. */
  49551. function genStaticKeys (modules) {
  49552. return modules.reduce(function (keys, m) {
  49553. return keys.concat(m.staticKeys || [])
  49554. }, []).join(',')
  49555. }
  49556. /**
  49557. * Check if two values are loosely equal - that is,
  49558. * if they are plain objects, do they have the same shape?
  49559. */
  49560. function looseEqual (a, b) {
  49561. if (a === b) { return true }
  49562. var isObjectA = isObject(a);
  49563. var isObjectB = isObject(b);
  49564. if (isObjectA && isObjectB) {
  49565. try {
  49566. var isArrayA = Array.isArray(a);
  49567. var isArrayB = Array.isArray(b);
  49568. if (isArrayA && isArrayB) {
  49569. return a.length === b.length && a.every(function (e, i) {
  49570. return looseEqual(e, b[i])
  49571. })
  49572. } else if (a instanceof Date && b instanceof Date) {
  49573. return a.getTime() === b.getTime()
  49574. } else if (!isArrayA && !isArrayB) {
  49575. var keysA = Object.keys(a);
  49576. var keysB = Object.keys(b);
  49577. return keysA.length === keysB.length && keysA.every(function (key) {
  49578. return looseEqual(a[key], b[key])
  49579. })
  49580. } else {
  49581. /* istanbul ignore next */
  49582. return false
  49583. }
  49584. } catch (e) {
  49585. /* istanbul ignore next */
  49586. return false
  49587. }
  49588. } else if (!isObjectA && !isObjectB) {
  49589. return String(a) === String(b)
  49590. } else {
  49591. return false
  49592. }
  49593. }
  49594. /**
  49595. * Return the first index at which a loosely equal value can be
  49596. * found in the array (if value is a plain object, the array must
  49597. * contain an object of the same shape), or -1 if it is not present.
  49598. */
  49599. function looseIndexOf (arr, val) {
  49600. for (var i = 0; i < arr.length; i++) {
  49601. if (looseEqual(arr[i], val)) { return i }
  49602. }
  49603. return -1
  49604. }
  49605. /**
  49606. * Ensure a function is called only once.
  49607. */
  49608. function once (fn) {
  49609. var called = false;
  49610. return function () {
  49611. if (!called) {
  49612. called = true;
  49613. fn.apply(this, arguments);
  49614. }
  49615. }
  49616. }
  49617. var SSR_ATTR = 'data-server-rendered';
  49618. var ASSET_TYPES = [
  49619. 'component',
  49620. 'directive',
  49621. 'filter'
  49622. ];
  49623. var LIFECYCLE_HOOKS = [
  49624. 'beforeCreate',
  49625. 'created',
  49626. 'beforeMount',
  49627. 'mounted',
  49628. 'beforeUpdate',
  49629. 'updated',
  49630. 'beforeDestroy',
  49631. 'destroyed',
  49632. 'activated',
  49633. 'deactivated',
  49634. 'errorCaptured',
  49635. 'serverPrefetch'
  49636. ];
  49637. /* */
  49638. var config = ({
  49639. /**
  49640. * Option merge strategies (used in core/util/options)
  49641. */
  49642. // $flow-disable-line
  49643. optionMergeStrategies: Object.create(null),
  49644. /**
  49645. * Whether to suppress warnings.
  49646. */
  49647. silent: false,
  49648. /**
  49649. * Show production mode tip message on boot?
  49650. */
  49651. productionTip: "development" !== 'production',
  49652. /**
  49653. * Whether to enable devtools
  49654. */
  49655. devtools: "development" !== 'production',
  49656. /**
  49657. * Whether to record perf
  49658. */
  49659. performance: false,
  49660. /**
  49661. * Error handler for watcher errors
  49662. */
  49663. errorHandler: null,
  49664. /**
  49665. * Warn handler for watcher warns
  49666. */
  49667. warnHandler: null,
  49668. /**
  49669. * Ignore certain custom elements
  49670. */
  49671. ignoredElements: [],
  49672. /**
  49673. * Custom user key aliases for v-on
  49674. */
  49675. // $flow-disable-line
  49676. keyCodes: Object.create(null),
  49677. /**
  49678. * Check if a tag is reserved so that it cannot be registered as a
  49679. * component. This is platform-dependent and may be overwritten.
  49680. */
  49681. isReservedTag: no,
  49682. /**
  49683. * Check if an attribute is reserved so that it cannot be used as a component
  49684. * prop. This is platform-dependent and may be overwritten.
  49685. */
  49686. isReservedAttr: no,
  49687. /**
  49688. * Check if a tag is an unknown element.
  49689. * Platform-dependent.
  49690. */
  49691. isUnknownElement: no,
  49692. /**
  49693. * Get the namespace of an element
  49694. */
  49695. getTagNamespace: noop,
  49696. /**
  49697. * Parse the real tag name for the specific platform.
  49698. */
  49699. parsePlatformTagName: identity,
  49700. /**
  49701. * Check if an attribute must be bound using property, e.g. value
  49702. * Platform-dependent.
  49703. */
  49704. mustUseProp: no,
  49705. /**
  49706. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  49707. * This will significantly reduce performance if set to false.
  49708. */
  49709. async: true,
  49710. /**
  49711. * Exposed for legacy reasons
  49712. */
  49713. _lifecycleHooks: LIFECYCLE_HOOKS
  49714. });
  49715. /* */
  49716. /**
  49717. * unicode letters used for parsing html tags, component names and property paths.
  49718. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  49719. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  49720. */
  49721. 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/;
  49722. /**
  49723. * Check if a string starts with $ or _
  49724. */
  49725. function isReserved (str) {
  49726. var c = (str + '').charCodeAt(0);
  49727. return c === 0x24 || c === 0x5F
  49728. }
  49729. /**
  49730. * Define a property.
  49731. */
  49732. function def (obj, key, val, enumerable) {
  49733. Object.defineProperty(obj, key, {
  49734. value: val,
  49735. enumerable: !!enumerable,
  49736. writable: true,
  49737. configurable: true
  49738. });
  49739. }
  49740. /**
  49741. * Parse simple path.
  49742. */
  49743. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  49744. function parsePath (path) {
  49745. if (bailRE.test(path)) {
  49746. return
  49747. }
  49748. var segments = path.split('.');
  49749. return function (obj) {
  49750. for (var i = 0; i < segments.length; i++) {
  49751. if (!obj) { return }
  49752. obj = obj[segments[i]];
  49753. }
  49754. return obj
  49755. }
  49756. }
  49757. /* */
  49758. // can we use __proto__?
  49759. var hasProto = '__proto__' in {};
  49760. // Browser environment sniffing
  49761. var inBrowser = typeof window !== 'undefined';
  49762. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  49763. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  49764. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  49765. var isIE = UA && /msie|trident/.test(UA);
  49766. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  49767. var isEdge = UA && UA.indexOf('edge/') > 0;
  49768. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  49769. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  49770. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  49771. var isPhantomJS = UA && /phantomjs/.test(UA);
  49772. var isFF = UA && UA.match(/firefox\/(\d+)/);
  49773. // Firefox has a "watch" function on Object.prototype...
  49774. var nativeWatch = ({}).watch;
  49775. var supportsPassive = false;
  49776. if (inBrowser) {
  49777. try {
  49778. var opts = {};
  49779. Object.defineProperty(opts, 'passive', ({
  49780. get: function get () {
  49781. /* istanbul ignore next */
  49782. supportsPassive = true;
  49783. }
  49784. })); // https://github.com/facebook/flow/issues/285
  49785. window.addEventListener('test-passive', null, opts);
  49786. } catch (e) {}
  49787. }
  49788. // this needs to be lazy-evaled because vue may be required before
  49789. // vue-server-renderer can set VUE_ENV
  49790. var _isServer;
  49791. var isServerRendering = function () {
  49792. if (_isServer === undefined) {
  49793. /* istanbul ignore if */
  49794. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  49795. // detect presence of vue-server-renderer and avoid
  49796. // Webpack shimming the process
  49797. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  49798. } else {
  49799. _isServer = false;
  49800. }
  49801. }
  49802. return _isServer
  49803. };
  49804. // detect devtools
  49805. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  49806. /* istanbul ignore next */
  49807. function isNative (Ctor) {
  49808. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  49809. }
  49810. var hasSymbol =
  49811. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  49812. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  49813. var _Set;
  49814. /* istanbul ignore if */ // $flow-disable-line
  49815. if (typeof Set !== 'undefined' && isNative(Set)) {
  49816. // use native Set when available.
  49817. _Set = Set;
  49818. } else {
  49819. // a non-standard Set polyfill that only works with primitive keys.
  49820. _Set = /*@__PURE__*/(function () {
  49821. function Set () {
  49822. this.set = Object.create(null);
  49823. }
  49824. Set.prototype.has = function has (key) {
  49825. return this.set[key] === true
  49826. };
  49827. Set.prototype.add = function add (key) {
  49828. this.set[key] = true;
  49829. };
  49830. Set.prototype.clear = function clear () {
  49831. this.set = Object.create(null);
  49832. };
  49833. return Set;
  49834. }());
  49835. }
  49836. /* */
  49837. var warn = noop;
  49838. var tip = noop;
  49839. var generateComponentTrace = (noop); // work around flow check
  49840. var formatComponentName = (noop);
  49841. {
  49842. var hasConsole = typeof console !== 'undefined';
  49843. var classifyRE = /(?:^|[-_])(\w)/g;
  49844. var classify = function (str) { return str
  49845. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  49846. .replace(/[-_]/g, ''); };
  49847. warn = function (msg, vm) {
  49848. var trace = vm ? generateComponentTrace(vm) : '';
  49849. if (config.warnHandler) {
  49850. config.warnHandler.call(null, msg, vm, trace);
  49851. } else if (hasConsole && (!config.silent)) {
  49852. console.error(("[Vue warn]: " + msg + trace));
  49853. }
  49854. };
  49855. tip = function (msg, vm) {
  49856. if (hasConsole && (!config.silent)) {
  49857. console.warn("[Vue tip]: " + msg + (
  49858. vm ? generateComponentTrace(vm) : ''
  49859. ));
  49860. }
  49861. };
  49862. formatComponentName = function (vm, includeFile) {
  49863. if (vm.$root === vm) {
  49864. return '<Root>'
  49865. }
  49866. var options = typeof vm === 'function' && vm.cid != null
  49867. ? vm.options
  49868. : vm._isVue
  49869. ? vm.$options || vm.constructor.options
  49870. : vm;
  49871. var name = options.name || options._componentTag;
  49872. var file = options.__file;
  49873. if (!name && file) {
  49874. var match = file.match(/([^/\\]+)\.vue$/);
  49875. name = match && match[1];
  49876. }
  49877. return (
  49878. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  49879. (file && includeFile !== false ? (" at " + file) : '')
  49880. )
  49881. };
  49882. var repeat = function (str, n) {
  49883. var res = '';
  49884. while (n) {
  49885. if (n % 2 === 1) { res += str; }
  49886. if (n > 1) { str += str; }
  49887. n >>= 1;
  49888. }
  49889. return res
  49890. };
  49891. generateComponentTrace = function (vm) {
  49892. if (vm._isVue && vm.$parent) {
  49893. var tree = [];
  49894. var currentRecursiveSequence = 0;
  49895. while (vm) {
  49896. if (tree.length > 0) {
  49897. var last = tree[tree.length - 1];
  49898. if (last.constructor === vm.constructor) {
  49899. currentRecursiveSequence++;
  49900. vm = vm.$parent;
  49901. continue
  49902. } else if (currentRecursiveSequence > 0) {
  49903. tree[tree.length - 1] = [last, currentRecursiveSequence];
  49904. currentRecursiveSequence = 0;
  49905. }
  49906. }
  49907. tree.push(vm);
  49908. vm = vm.$parent;
  49909. }
  49910. return '\n\nfound in\n\n' + tree
  49911. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  49912. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  49913. : formatComponentName(vm))); })
  49914. .join('\n')
  49915. } else {
  49916. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  49917. }
  49918. };
  49919. }
  49920. /* */
  49921. var uid = 0;
  49922. /**
  49923. * A dep is an observable that can have multiple
  49924. * directives subscribing to it.
  49925. */
  49926. var Dep = function Dep () {
  49927. this.id = uid++;
  49928. this.subs = [];
  49929. };
  49930. Dep.prototype.addSub = function addSub (sub) {
  49931. this.subs.push(sub);
  49932. };
  49933. Dep.prototype.removeSub = function removeSub (sub) {
  49934. remove(this.subs, sub);
  49935. };
  49936. Dep.prototype.depend = function depend () {
  49937. if (Dep.target) {
  49938. Dep.target.addDep(this);
  49939. }
  49940. };
  49941. Dep.prototype.notify = function notify () {
  49942. // stabilize the subscriber list first
  49943. var subs = this.subs.slice();
  49944. if (!config.async) {
  49945. // subs aren't sorted in scheduler if not running async
  49946. // we need to sort them now to make sure they fire in correct
  49947. // order
  49948. subs.sort(function (a, b) { return a.id - b.id; });
  49949. }
  49950. for (var i = 0, l = subs.length; i < l; i++) {
  49951. subs[i].update();
  49952. }
  49953. };
  49954. // The current target watcher being evaluated.
  49955. // This is globally unique because only one watcher
  49956. // can be evaluated at a time.
  49957. Dep.target = null;
  49958. var targetStack = [];
  49959. function pushTarget (target) {
  49960. targetStack.push(target);
  49961. Dep.target = target;
  49962. }
  49963. function popTarget () {
  49964. targetStack.pop();
  49965. Dep.target = targetStack[targetStack.length - 1];
  49966. }
  49967. /* */
  49968. var VNode = function VNode (
  49969. tag,
  49970. data,
  49971. children,
  49972. text,
  49973. elm,
  49974. context,
  49975. componentOptions,
  49976. asyncFactory
  49977. ) {
  49978. this.tag = tag;
  49979. this.data = data;
  49980. this.children = children;
  49981. this.text = text;
  49982. this.elm = elm;
  49983. this.ns = undefined;
  49984. this.context = context;
  49985. this.fnContext = undefined;
  49986. this.fnOptions = undefined;
  49987. this.fnScopeId = undefined;
  49988. this.key = data && data.key;
  49989. this.componentOptions = componentOptions;
  49990. this.componentInstance = undefined;
  49991. this.parent = undefined;
  49992. this.raw = false;
  49993. this.isStatic = false;
  49994. this.isRootInsert = true;
  49995. this.isComment = false;
  49996. this.isCloned = false;
  49997. this.isOnce = false;
  49998. this.asyncFactory = asyncFactory;
  49999. this.asyncMeta = undefined;
  50000. this.isAsyncPlaceholder = false;
  50001. };
  50002. var prototypeAccessors = { child: { configurable: true } };
  50003. // DEPRECATED: alias for componentInstance for backwards compat.
  50004. /* istanbul ignore next */
  50005. prototypeAccessors.child.get = function () {
  50006. return this.componentInstance
  50007. };
  50008. Object.defineProperties( VNode.prototype, prototypeAccessors );
  50009. var createEmptyVNode = function (text) {
  50010. if ( text === void 0 ) text = '';
  50011. var node = new VNode();
  50012. node.text = text;
  50013. node.isComment = true;
  50014. return node
  50015. };
  50016. function createTextVNode (val) {
  50017. return new VNode(undefined, undefined, undefined, String(val))
  50018. }
  50019. // optimized shallow clone
  50020. // used for static nodes and slot nodes because they may be reused across
  50021. // multiple renders, cloning them avoids errors when DOM manipulations rely
  50022. // on their elm reference.
  50023. function cloneVNode (vnode) {
  50024. var cloned = new VNode(
  50025. vnode.tag,
  50026. vnode.data,
  50027. // #7975
  50028. // clone children array to avoid mutating original in case of cloning
  50029. // a child.
  50030. vnode.children && vnode.children.slice(),
  50031. vnode.text,
  50032. vnode.elm,
  50033. vnode.context,
  50034. vnode.componentOptions,
  50035. vnode.asyncFactory
  50036. );
  50037. cloned.ns = vnode.ns;
  50038. cloned.isStatic = vnode.isStatic;
  50039. cloned.key = vnode.key;
  50040. cloned.isComment = vnode.isComment;
  50041. cloned.fnContext = vnode.fnContext;
  50042. cloned.fnOptions = vnode.fnOptions;
  50043. cloned.fnScopeId = vnode.fnScopeId;
  50044. cloned.asyncMeta = vnode.asyncMeta;
  50045. cloned.isCloned = true;
  50046. return cloned
  50047. }
  50048. /*
  50049. * not type checking this file because flow doesn't play well with
  50050. * dynamically accessing methods on Array prototype
  50051. */
  50052. var arrayProto = Array.prototype;
  50053. var arrayMethods = Object.create(arrayProto);
  50054. var methodsToPatch = [
  50055. 'push',
  50056. 'pop',
  50057. 'shift',
  50058. 'unshift',
  50059. 'splice',
  50060. 'sort',
  50061. 'reverse'
  50062. ];
  50063. /**
  50064. * Intercept mutating methods and emit events
  50065. */
  50066. methodsToPatch.forEach(function (method) {
  50067. // cache original method
  50068. var original = arrayProto[method];
  50069. def(arrayMethods, method, function mutator () {
  50070. var args = [], len = arguments.length;
  50071. while ( len-- ) args[ len ] = arguments[ len ];
  50072. var result = original.apply(this, args);
  50073. var ob = this.__ob__;
  50074. var inserted;
  50075. switch (method) {
  50076. case 'push':
  50077. case 'unshift':
  50078. inserted = args;
  50079. break
  50080. case 'splice':
  50081. inserted = args.slice(2);
  50082. break
  50083. }
  50084. if (inserted) { ob.observeArray(inserted); }
  50085. // notify change
  50086. ob.dep.notify();
  50087. return result
  50088. });
  50089. });
  50090. /* */
  50091. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  50092. /**
  50093. * In some cases we may want to disable observation inside a component's
  50094. * update computation.
  50095. */
  50096. var shouldObserve = true;
  50097. function toggleObserving (value) {
  50098. shouldObserve = value;
  50099. }
  50100. /**
  50101. * Observer class that is attached to each observed
  50102. * object. Once attached, the observer converts the target
  50103. * object's property keys into getter/setters that
  50104. * collect dependencies and dispatch updates.
  50105. */
  50106. var Observer = function Observer (value) {
  50107. this.value = value;
  50108. this.dep = new Dep();
  50109. this.vmCount = 0;
  50110. def(value, '__ob__', this);
  50111. if (Array.isArray(value)) {
  50112. if (hasProto) {
  50113. protoAugment(value, arrayMethods);
  50114. } else {
  50115. copyAugment(value, arrayMethods, arrayKeys);
  50116. }
  50117. this.observeArray(value);
  50118. } else {
  50119. this.walk(value);
  50120. }
  50121. };
  50122. /**
  50123. * Walk through all properties and convert them into
  50124. * getter/setters. This method should only be called when
  50125. * value type is Object.
  50126. */
  50127. Observer.prototype.walk = function walk (obj) {
  50128. var keys = Object.keys(obj);
  50129. for (var i = 0; i < keys.length; i++) {
  50130. defineReactive$$1(obj, keys[i]);
  50131. }
  50132. };
  50133. /**
  50134. * Observe a list of Array items.
  50135. */
  50136. Observer.prototype.observeArray = function observeArray (items) {
  50137. for (var i = 0, l = items.length; i < l; i++) {
  50138. observe(items[i]);
  50139. }
  50140. };
  50141. // helpers
  50142. /**
  50143. * Augment a target Object or Array by intercepting
  50144. * the prototype chain using __proto__
  50145. */
  50146. function protoAugment (target, src) {
  50147. /* eslint-disable no-proto */
  50148. target.__proto__ = src;
  50149. /* eslint-enable no-proto */
  50150. }
  50151. /**
  50152. * Augment a target Object or Array by defining
  50153. * hidden properties.
  50154. */
  50155. /* istanbul ignore next */
  50156. function copyAugment (target, src, keys) {
  50157. for (var i = 0, l = keys.length; i < l; i++) {
  50158. var key = keys[i];
  50159. def(target, key, src[key]);
  50160. }
  50161. }
  50162. /**
  50163. * Attempt to create an observer instance for a value,
  50164. * returns the new observer if successfully observed,
  50165. * or the existing observer if the value already has one.
  50166. */
  50167. function observe (value, asRootData) {
  50168. if (!isObject(value) || value instanceof VNode) {
  50169. return
  50170. }
  50171. var ob;
  50172. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  50173. ob = value.__ob__;
  50174. } else if (
  50175. shouldObserve &&
  50176. !isServerRendering() &&
  50177. (Array.isArray(value) || isPlainObject(value)) &&
  50178. Object.isExtensible(value) &&
  50179. !value._isVue
  50180. ) {
  50181. ob = new Observer(value);
  50182. }
  50183. if (asRootData && ob) {
  50184. ob.vmCount++;
  50185. }
  50186. return ob
  50187. }
  50188. /**
  50189. * Define a reactive property on an Object.
  50190. */
  50191. function defineReactive$$1 (
  50192. obj,
  50193. key,
  50194. val,
  50195. customSetter,
  50196. shallow
  50197. ) {
  50198. var dep = new Dep();
  50199. var property = Object.getOwnPropertyDescriptor(obj, key);
  50200. if (property && property.configurable === false) {
  50201. return
  50202. }
  50203. // cater for pre-defined getter/setters
  50204. var getter = property && property.get;
  50205. var setter = property && property.set;
  50206. if ((!getter || setter) && arguments.length === 2) {
  50207. val = obj[key];
  50208. }
  50209. var childOb = !shallow && observe(val);
  50210. Object.defineProperty(obj, key, {
  50211. enumerable: true,
  50212. configurable: true,
  50213. get: function reactiveGetter () {
  50214. var value = getter ? getter.call(obj) : val;
  50215. if (Dep.target) {
  50216. dep.depend();
  50217. if (childOb) {
  50218. childOb.dep.depend();
  50219. if (Array.isArray(value)) {
  50220. dependArray(value);
  50221. }
  50222. }
  50223. }
  50224. return value
  50225. },
  50226. set: function reactiveSetter (newVal) {
  50227. var value = getter ? getter.call(obj) : val;
  50228. /* eslint-disable no-self-compare */
  50229. if (newVal === value || (newVal !== newVal && value !== value)) {
  50230. return
  50231. }
  50232. /* eslint-enable no-self-compare */
  50233. if (customSetter) {
  50234. customSetter();
  50235. }
  50236. // #7981: for accessor properties without setter
  50237. if (getter && !setter) { return }
  50238. if (setter) {
  50239. setter.call(obj, newVal);
  50240. } else {
  50241. val = newVal;
  50242. }
  50243. childOb = !shallow && observe(newVal);
  50244. dep.notify();
  50245. }
  50246. });
  50247. }
  50248. /**
  50249. * Set a property on an object. Adds the new property and
  50250. * triggers change notification if the property doesn't
  50251. * already exist.
  50252. */
  50253. function set (target, key, val) {
  50254. if (isUndef(target) || isPrimitive(target)
  50255. ) {
  50256. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  50257. }
  50258. if (Array.isArray(target) && isValidArrayIndex(key)) {
  50259. target.length = Math.max(target.length, key);
  50260. target.splice(key, 1, val);
  50261. return val
  50262. }
  50263. if (key in target && !(key in Object.prototype)) {
  50264. target[key] = val;
  50265. return val
  50266. }
  50267. var ob = (target).__ob__;
  50268. if (target._isVue || (ob && ob.vmCount)) {
  50269. warn(
  50270. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  50271. 'at runtime - declare it upfront in the data option.'
  50272. );
  50273. return val
  50274. }
  50275. if (!ob) {
  50276. target[key] = val;
  50277. return val
  50278. }
  50279. defineReactive$$1(ob.value, key, val);
  50280. ob.dep.notify();
  50281. return val
  50282. }
  50283. /**
  50284. * Delete a property and trigger change if necessary.
  50285. */
  50286. function del (target, key) {
  50287. if (isUndef(target) || isPrimitive(target)
  50288. ) {
  50289. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  50290. }
  50291. if (Array.isArray(target) && isValidArrayIndex(key)) {
  50292. target.splice(key, 1);
  50293. return
  50294. }
  50295. var ob = (target).__ob__;
  50296. if (target._isVue || (ob && ob.vmCount)) {
  50297. warn(
  50298. 'Avoid deleting properties on a Vue instance or its root $data ' +
  50299. '- just set it to null.'
  50300. );
  50301. return
  50302. }
  50303. if (!hasOwn(target, key)) {
  50304. return
  50305. }
  50306. delete target[key];
  50307. if (!ob) {
  50308. return
  50309. }
  50310. ob.dep.notify();
  50311. }
  50312. /**
  50313. * Collect dependencies on array elements when the array is touched, since
  50314. * we cannot intercept array element access like property getters.
  50315. */
  50316. function dependArray (value) {
  50317. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  50318. e = value[i];
  50319. e && e.__ob__ && e.__ob__.dep.depend();
  50320. if (Array.isArray(e)) {
  50321. dependArray(e);
  50322. }
  50323. }
  50324. }
  50325. /* */
  50326. /**
  50327. * Option overwriting strategies are functions that handle
  50328. * how to merge a parent option value and a child option
  50329. * value into the final value.
  50330. */
  50331. var strats = config.optionMergeStrategies;
  50332. /**
  50333. * Options with restrictions
  50334. */
  50335. {
  50336. strats.el = strats.propsData = function (parent, child, vm, key) {
  50337. if (!vm) {
  50338. warn(
  50339. "option \"" + key + "\" can only be used during instance " +
  50340. 'creation with the `new` keyword.'
  50341. );
  50342. }
  50343. return defaultStrat(parent, child)
  50344. };
  50345. }
  50346. /**
  50347. * Helper that recursively merges two data objects together.
  50348. */
  50349. function mergeData (to, from) {
  50350. if (!from) { return to }
  50351. var key, toVal, fromVal;
  50352. var keys = hasSymbol
  50353. ? Reflect.ownKeys(from)
  50354. : Object.keys(from);
  50355. for (var i = 0; i < keys.length; i++) {
  50356. key = keys[i];
  50357. // in case the object is already observed...
  50358. if (key === '__ob__') { continue }
  50359. toVal = to[key];
  50360. fromVal = from[key];
  50361. if (!hasOwn(to, key)) {
  50362. set(to, key, fromVal);
  50363. } else if (
  50364. toVal !== fromVal &&
  50365. isPlainObject(toVal) &&
  50366. isPlainObject(fromVal)
  50367. ) {
  50368. mergeData(toVal, fromVal);
  50369. }
  50370. }
  50371. return to
  50372. }
  50373. /**
  50374. * Data
  50375. */
  50376. function mergeDataOrFn (
  50377. parentVal,
  50378. childVal,
  50379. vm
  50380. ) {
  50381. if (!vm) {
  50382. // in a Vue.extend merge, both should be functions
  50383. if (!childVal) {
  50384. return parentVal
  50385. }
  50386. if (!parentVal) {
  50387. return childVal
  50388. }
  50389. // when parentVal & childVal are both present,
  50390. // we need to return a function that returns the
  50391. // merged result of both functions... no need to
  50392. // check if parentVal is a function here because
  50393. // it has to be a function to pass previous merges.
  50394. return function mergedDataFn () {
  50395. return mergeData(
  50396. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  50397. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  50398. )
  50399. }
  50400. } else {
  50401. return function mergedInstanceDataFn () {
  50402. // instance merge
  50403. var instanceData = typeof childVal === 'function'
  50404. ? childVal.call(vm, vm)
  50405. : childVal;
  50406. var defaultData = typeof parentVal === 'function'
  50407. ? parentVal.call(vm, vm)
  50408. : parentVal;
  50409. if (instanceData) {
  50410. return mergeData(instanceData, defaultData)
  50411. } else {
  50412. return defaultData
  50413. }
  50414. }
  50415. }
  50416. }
  50417. strats.data = function (
  50418. parentVal,
  50419. childVal,
  50420. vm
  50421. ) {
  50422. if (!vm) {
  50423. if (childVal && typeof childVal !== 'function') {
  50424. warn(
  50425. 'The "data" option should be a function ' +
  50426. 'that returns a per-instance value in component ' +
  50427. 'definitions.',
  50428. vm
  50429. );
  50430. return parentVal
  50431. }
  50432. return mergeDataOrFn(parentVal, childVal)
  50433. }
  50434. return mergeDataOrFn(parentVal, childVal, vm)
  50435. };
  50436. /**
  50437. * Hooks and props are merged as arrays.
  50438. */
  50439. function mergeHook (
  50440. parentVal,
  50441. childVal
  50442. ) {
  50443. var res = childVal
  50444. ? parentVal
  50445. ? parentVal.concat(childVal)
  50446. : Array.isArray(childVal)
  50447. ? childVal
  50448. : [childVal]
  50449. : parentVal;
  50450. return res
  50451. ? dedupeHooks(res)
  50452. : res
  50453. }
  50454. function dedupeHooks (hooks) {
  50455. var res = [];
  50456. for (var i = 0; i < hooks.length; i++) {
  50457. if (res.indexOf(hooks[i]) === -1) {
  50458. res.push(hooks[i]);
  50459. }
  50460. }
  50461. return res
  50462. }
  50463. LIFECYCLE_HOOKS.forEach(function (hook) {
  50464. strats[hook] = mergeHook;
  50465. });
  50466. /**
  50467. * Assets
  50468. *
  50469. * When a vm is present (instance creation), we need to do
  50470. * a three-way merge between constructor options, instance
  50471. * options and parent options.
  50472. */
  50473. function mergeAssets (
  50474. parentVal,
  50475. childVal,
  50476. vm,
  50477. key
  50478. ) {
  50479. var res = Object.create(parentVal || null);
  50480. if (childVal) {
  50481. assertObjectType(key, childVal, vm);
  50482. return extend(res, childVal)
  50483. } else {
  50484. return res
  50485. }
  50486. }
  50487. ASSET_TYPES.forEach(function (type) {
  50488. strats[type + 's'] = mergeAssets;
  50489. });
  50490. /**
  50491. * Watchers.
  50492. *
  50493. * Watchers hashes should not overwrite one
  50494. * another, so we merge them as arrays.
  50495. */
  50496. strats.watch = function (
  50497. parentVal,
  50498. childVal,
  50499. vm,
  50500. key
  50501. ) {
  50502. // work around Firefox's Object.prototype.watch...
  50503. if (parentVal === nativeWatch) { parentVal = undefined; }
  50504. if (childVal === nativeWatch) { childVal = undefined; }
  50505. /* istanbul ignore if */
  50506. if (!childVal) { return Object.create(parentVal || null) }
  50507. {
  50508. assertObjectType(key, childVal, vm);
  50509. }
  50510. if (!parentVal) { return childVal }
  50511. var ret = {};
  50512. extend(ret, parentVal);
  50513. for (var key$1 in childVal) {
  50514. var parent = ret[key$1];
  50515. var child = childVal[key$1];
  50516. if (parent && !Array.isArray(parent)) {
  50517. parent = [parent];
  50518. }
  50519. ret[key$1] = parent
  50520. ? parent.concat(child)
  50521. : Array.isArray(child) ? child : [child];
  50522. }
  50523. return ret
  50524. };
  50525. /**
  50526. * Other object hashes.
  50527. */
  50528. strats.props =
  50529. strats.methods =
  50530. strats.inject =
  50531. strats.computed = function (
  50532. parentVal,
  50533. childVal,
  50534. vm,
  50535. key
  50536. ) {
  50537. if (childVal && "development" !== 'production') {
  50538. assertObjectType(key, childVal, vm);
  50539. }
  50540. if (!parentVal) { return childVal }
  50541. var ret = Object.create(null);
  50542. extend(ret, parentVal);
  50543. if (childVal) { extend(ret, childVal); }
  50544. return ret
  50545. };
  50546. strats.provide = mergeDataOrFn;
  50547. /**
  50548. * Default strategy.
  50549. */
  50550. var defaultStrat = function (parentVal, childVal) {
  50551. return childVal === undefined
  50552. ? parentVal
  50553. : childVal
  50554. };
  50555. /**
  50556. * Validate component names
  50557. */
  50558. function checkComponents (options) {
  50559. for (var key in options.components) {
  50560. validateComponentName(key);
  50561. }
  50562. }
  50563. function validateComponentName (name) {
  50564. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  50565. warn(
  50566. 'Invalid component name: "' + name + '". Component names ' +
  50567. 'should conform to valid custom element name in html5 specification.'
  50568. );
  50569. }
  50570. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  50571. warn(
  50572. 'Do not use built-in or reserved HTML elements as component ' +
  50573. 'id: ' + name
  50574. );
  50575. }
  50576. }
  50577. /**
  50578. * Ensure all props option syntax are normalized into the
  50579. * Object-based format.
  50580. */
  50581. function normalizeProps (options, vm) {
  50582. var props = options.props;
  50583. if (!props) { return }
  50584. var res = {};
  50585. var i, val, name;
  50586. if (Array.isArray(props)) {
  50587. i = props.length;
  50588. while (i--) {
  50589. val = props[i];
  50590. if (typeof val === 'string') {
  50591. name = camelize(val);
  50592. res[name] = { type: null };
  50593. } else {
  50594. warn('props must be strings when using array syntax.');
  50595. }
  50596. }
  50597. } else if (isPlainObject(props)) {
  50598. for (var key in props) {
  50599. val = props[key];
  50600. name = camelize(key);
  50601. res[name] = isPlainObject(val)
  50602. ? val
  50603. : { type: val };
  50604. }
  50605. } else {
  50606. warn(
  50607. "Invalid value for option \"props\": expected an Array or an Object, " +
  50608. "but got " + (toRawType(props)) + ".",
  50609. vm
  50610. );
  50611. }
  50612. options.props = res;
  50613. }
  50614. /**
  50615. * Normalize all injections into Object-based format
  50616. */
  50617. function normalizeInject (options, vm) {
  50618. var inject = options.inject;
  50619. if (!inject) { return }
  50620. var normalized = options.inject = {};
  50621. if (Array.isArray(inject)) {
  50622. for (var i = 0; i < inject.length; i++) {
  50623. normalized[inject[i]] = { from: inject[i] };
  50624. }
  50625. } else if (isPlainObject(inject)) {
  50626. for (var key in inject) {
  50627. var val = inject[key];
  50628. normalized[key] = isPlainObject(val)
  50629. ? extend({ from: key }, val)
  50630. : { from: val };
  50631. }
  50632. } else {
  50633. warn(
  50634. "Invalid value for option \"inject\": expected an Array or an Object, " +
  50635. "but got " + (toRawType(inject)) + ".",
  50636. vm
  50637. );
  50638. }
  50639. }
  50640. /**
  50641. * Normalize raw function directives into object format.
  50642. */
  50643. function normalizeDirectives (options) {
  50644. var dirs = options.directives;
  50645. if (dirs) {
  50646. for (var key in dirs) {
  50647. var def$$1 = dirs[key];
  50648. if (typeof def$$1 === 'function') {
  50649. dirs[key] = { bind: def$$1, update: def$$1 };
  50650. }
  50651. }
  50652. }
  50653. }
  50654. function assertObjectType (name, value, vm) {
  50655. if (!isPlainObject(value)) {
  50656. warn(
  50657. "Invalid value for option \"" + name + "\": expected an Object, " +
  50658. "but got " + (toRawType(value)) + ".",
  50659. vm
  50660. );
  50661. }
  50662. }
  50663. /**
  50664. * Merge two option objects into a new one.
  50665. * Core utility used in both instantiation and inheritance.
  50666. */
  50667. function mergeOptions (
  50668. parent,
  50669. child,
  50670. vm
  50671. ) {
  50672. {
  50673. checkComponents(child);
  50674. }
  50675. if (typeof child === 'function') {
  50676. child = child.options;
  50677. }
  50678. normalizeProps(child, vm);
  50679. normalizeInject(child, vm);
  50680. normalizeDirectives(child);
  50681. // Apply extends and mixins on the child options,
  50682. // but only if it is a raw options object that isn't
  50683. // the result of another mergeOptions call.
  50684. // Only merged options has the _base property.
  50685. if (!child._base) {
  50686. if (child.extends) {
  50687. parent = mergeOptions(parent, child.extends, vm);
  50688. }
  50689. if (child.mixins) {
  50690. for (var i = 0, l = child.mixins.length; i < l; i++) {
  50691. parent = mergeOptions(parent, child.mixins[i], vm);
  50692. }
  50693. }
  50694. }
  50695. var options = {};
  50696. var key;
  50697. for (key in parent) {
  50698. mergeField(key);
  50699. }
  50700. for (key in child) {
  50701. if (!hasOwn(parent, key)) {
  50702. mergeField(key);
  50703. }
  50704. }
  50705. function mergeField (key) {
  50706. var strat = strats[key] || defaultStrat;
  50707. options[key] = strat(parent[key], child[key], vm, key);
  50708. }
  50709. return options
  50710. }
  50711. /**
  50712. * Resolve an asset.
  50713. * This function is used because child instances need access
  50714. * to assets defined in its ancestor chain.
  50715. */
  50716. function resolveAsset (
  50717. options,
  50718. type,
  50719. id,
  50720. warnMissing
  50721. ) {
  50722. /* istanbul ignore if */
  50723. if (typeof id !== 'string') {
  50724. return
  50725. }
  50726. var assets = options[type];
  50727. // check local registration variations first
  50728. if (hasOwn(assets, id)) { return assets[id] }
  50729. var camelizedId = camelize(id);
  50730. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  50731. var PascalCaseId = capitalize(camelizedId);
  50732. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  50733. // fallback to prototype chain
  50734. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  50735. if (warnMissing && !res) {
  50736. warn(
  50737. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  50738. options
  50739. );
  50740. }
  50741. return res
  50742. }
  50743. /* */
  50744. function validateProp (
  50745. key,
  50746. propOptions,
  50747. propsData,
  50748. vm
  50749. ) {
  50750. var prop = propOptions[key];
  50751. var absent = !hasOwn(propsData, key);
  50752. var value = propsData[key];
  50753. // boolean casting
  50754. var booleanIndex = getTypeIndex(Boolean, prop.type);
  50755. if (booleanIndex > -1) {
  50756. if (absent && !hasOwn(prop, 'default')) {
  50757. value = false;
  50758. } else if (value === '' || value === hyphenate(key)) {
  50759. // only cast empty string / same name to boolean if
  50760. // boolean has higher priority
  50761. var stringIndex = getTypeIndex(String, prop.type);
  50762. if (stringIndex < 0 || booleanIndex < stringIndex) {
  50763. value = true;
  50764. }
  50765. }
  50766. }
  50767. // check default value
  50768. if (value === undefined) {
  50769. value = getPropDefaultValue(vm, prop, key);
  50770. // since the default value is a fresh copy,
  50771. // make sure to observe it.
  50772. var prevShouldObserve = shouldObserve;
  50773. toggleObserving(true);
  50774. observe(value);
  50775. toggleObserving(prevShouldObserve);
  50776. }
  50777. {
  50778. assertProp(prop, key, value, vm, absent);
  50779. }
  50780. return value
  50781. }
  50782. /**
  50783. * Get the default value of a prop.
  50784. */
  50785. function getPropDefaultValue (vm, prop, key) {
  50786. // no default, return undefined
  50787. if (!hasOwn(prop, 'default')) {
  50788. return undefined
  50789. }
  50790. var def = prop.default;
  50791. // warn against non-factory defaults for Object & Array
  50792. if (isObject(def)) {
  50793. warn(
  50794. 'Invalid default value for prop "' + key + '": ' +
  50795. 'Props with type Object/Array must use a factory function ' +
  50796. 'to return the default value.',
  50797. vm
  50798. );
  50799. }
  50800. // the raw prop value was also undefined from previous render,
  50801. // return previous default value to avoid unnecessary watcher trigger
  50802. if (vm && vm.$options.propsData &&
  50803. vm.$options.propsData[key] === undefined &&
  50804. vm._props[key] !== undefined
  50805. ) {
  50806. return vm._props[key]
  50807. }
  50808. // call factory function for non-Function types
  50809. // a value is Function if its prototype is function even across different execution context
  50810. return typeof def === 'function' && getType(prop.type) !== 'Function'
  50811. ? def.call(vm)
  50812. : def
  50813. }
  50814. /**
  50815. * Assert whether a prop is valid.
  50816. */
  50817. function assertProp (
  50818. prop,
  50819. name,
  50820. value,
  50821. vm,
  50822. absent
  50823. ) {
  50824. if (prop.required && absent) {
  50825. warn(
  50826. 'Missing required prop: "' + name + '"',
  50827. vm
  50828. );
  50829. return
  50830. }
  50831. if (value == null && !prop.required) {
  50832. return
  50833. }
  50834. var type = prop.type;
  50835. var valid = !type || type === true;
  50836. var expectedTypes = [];
  50837. if (type) {
  50838. if (!Array.isArray(type)) {
  50839. type = [type];
  50840. }
  50841. for (var i = 0; i < type.length && !valid; i++) {
  50842. var assertedType = assertType(value, type[i]);
  50843. expectedTypes.push(assertedType.expectedType || '');
  50844. valid = assertedType.valid;
  50845. }
  50846. }
  50847. if (!valid) {
  50848. warn(
  50849. getInvalidTypeMessage(name, value, expectedTypes),
  50850. vm
  50851. );
  50852. return
  50853. }
  50854. var validator = prop.validator;
  50855. if (validator) {
  50856. if (!validator(value)) {
  50857. warn(
  50858. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  50859. vm
  50860. );
  50861. }
  50862. }
  50863. }
  50864. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  50865. function assertType (value, type) {
  50866. var valid;
  50867. var expectedType = getType(type);
  50868. if (simpleCheckRE.test(expectedType)) {
  50869. var t = typeof value;
  50870. valid = t === expectedType.toLowerCase();
  50871. // for primitive wrapper objects
  50872. if (!valid && t === 'object') {
  50873. valid = value instanceof type;
  50874. }
  50875. } else if (expectedType === 'Object') {
  50876. valid = isPlainObject(value);
  50877. } else if (expectedType === 'Array') {
  50878. valid = Array.isArray(value);
  50879. } else {
  50880. valid = value instanceof type;
  50881. }
  50882. return {
  50883. valid: valid,
  50884. expectedType: expectedType
  50885. }
  50886. }
  50887. /**
  50888. * Use function string name to check built-in types,
  50889. * because a simple equality check will fail when running
  50890. * across different vms / iframes.
  50891. */
  50892. function getType (fn) {
  50893. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  50894. return match ? match[1] : ''
  50895. }
  50896. function isSameType (a, b) {
  50897. return getType(a) === getType(b)
  50898. }
  50899. function getTypeIndex (type, expectedTypes) {
  50900. if (!Array.isArray(expectedTypes)) {
  50901. return isSameType(expectedTypes, type) ? 0 : -1
  50902. }
  50903. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  50904. if (isSameType(expectedTypes[i], type)) {
  50905. return i
  50906. }
  50907. }
  50908. return -1
  50909. }
  50910. function getInvalidTypeMessage (name, value, expectedTypes) {
  50911. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  50912. " Expected " + (expectedTypes.map(capitalize).join(', '));
  50913. var expectedType = expectedTypes[0];
  50914. var receivedType = toRawType(value);
  50915. var expectedValue = styleValue(value, expectedType);
  50916. var receivedValue = styleValue(value, receivedType);
  50917. // check if we need to specify expected value
  50918. if (expectedTypes.length === 1 &&
  50919. isExplicable(expectedType) &&
  50920. !isBoolean(expectedType, receivedType)) {
  50921. message += " with value " + expectedValue;
  50922. }
  50923. message += ", got " + receivedType + " ";
  50924. // check if we need to specify received value
  50925. if (isExplicable(receivedType)) {
  50926. message += "with value " + receivedValue + ".";
  50927. }
  50928. return message
  50929. }
  50930. function styleValue (value, type) {
  50931. if (type === 'String') {
  50932. return ("\"" + value + "\"")
  50933. } else if (type === 'Number') {
  50934. return ("" + (Number(value)))
  50935. } else {
  50936. return ("" + value)
  50937. }
  50938. }
  50939. function isExplicable (value) {
  50940. var explicitTypes = ['string', 'number', 'boolean'];
  50941. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  50942. }
  50943. function isBoolean () {
  50944. var args = [], len = arguments.length;
  50945. while ( len-- ) args[ len ] = arguments[ len ];
  50946. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  50947. }
  50948. /* */
  50949. function handleError (err, vm, info) {
  50950. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  50951. // See: https://github.com/vuejs/vuex/issues/1505
  50952. pushTarget();
  50953. try {
  50954. if (vm) {
  50955. var cur = vm;
  50956. while ((cur = cur.$parent)) {
  50957. var hooks = cur.$options.errorCaptured;
  50958. if (hooks) {
  50959. for (var i = 0; i < hooks.length; i++) {
  50960. try {
  50961. var capture = hooks[i].call(cur, err, vm, info) === false;
  50962. if (capture) { return }
  50963. } catch (e) {
  50964. globalHandleError(e, cur, 'errorCaptured hook');
  50965. }
  50966. }
  50967. }
  50968. }
  50969. }
  50970. globalHandleError(err, vm, info);
  50971. } finally {
  50972. popTarget();
  50973. }
  50974. }
  50975. function invokeWithErrorHandling (
  50976. handler,
  50977. context,
  50978. args,
  50979. vm,
  50980. info
  50981. ) {
  50982. var res;
  50983. try {
  50984. res = args ? handler.apply(context, args) : handler.call(context);
  50985. if (res && !res._isVue && isPromise(res) && !res._handled) {
  50986. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  50987. // issue #9511
  50988. // avoid catch triggering multiple times when nested calls
  50989. res._handled = true;
  50990. }
  50991. } catch (e) {
  50992. handleError(e, vm, info);
  50993. }
  50994. return res
  50995. }
  50996. function globalHandleError (err, vm, info) {
  50997. if (config.errorHandler) {
  50998. try {
  50999. return config.errorHandler.call(null, err, vm, info)
  51000. } catch (e) {
  51001. // if the user intentionally throws the original error in the handler,
  51002. // do not log it twice
  51003. if (e !== err) {
  51004. logError(e, null, 'config.errorHandler');
  51005. }
  51006. }
  51007. }
  51008. logError(err, vm, info);
  51009. }
  51010. function logError (err, vm, info) {
  51011. {
  51012. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  51013. }
  51014. /* istanbul ignore else */
  51015. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  51016. console.error(err);
  51017. } else {
  51018. throw err
  51019. }
  51020. }
  51021. /* */
  51022. var isUsingMicroTask = false;
  51023. var callbacks = [];
  51024. var pending = false;
  51025. function flushCallbacks () {
  51026. pending = false;
  51027. var copies = callbacks.slice(0);
  51028. callbacks.length = 0;
  51029. for (var i = 0; i < copies.length; i++) {
  51030. copies[i]();
  51031. }
  51032. }
  51033. // Here we have async deferring wrappers using microtasks.
  51034. // In 2.5 we used (macro) tasks (in combination with microtasks).
  51035. // However, it has subtle problems when state is changed right before repaint
  51036. // (e.g. #6813, out-in transitions).
  51037. // Also, using (macro) tasks in event handler would cause some weird behaviors
  51038. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  51039. // So we now use microtasks everywhere, again.
  51040. // A major drawback of this tradeoff is that there are some scenarios
  51041. // where microtasks have too high a priority and fire in between supposedly
  51042. // sequential events (e.g. #4521, #6690, which have workarounds)
  51043. // or even between bubbling of the same event (#6566).
  51044. var timerFunc;
  51045. // The nextTick behavior leverages the microtask queue, which can be accessed
  51046. // via either native Promise.then or MutationObserver.
  51047. // MutationObserver has wider support, however it is seriously bugged in
  51048. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  51049. // completely stops working after triggering a few times... so, if native
  51050. // Promise is available, we will use it:
  51051. /* istanbul ignore next, $flow-disable-line */
  51052. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  51053. var p = Promise.resolve();
  51054. timerFunc = function () {
  51055. p.then(flushCallbacks);
  51056. // In problematic UIWebViews, Promise.then doesn't completely break, but
  51057. // it can get stuck in a weird state where callbacks are pushed into the
  51058. // microtask queue but the queue isn't being flushed, until the browser
  51059. // needs to do some other work, e.g. handle a timer. Therefore we can
  51060. // "force" the microtask queue to be flushed by adding an empty timer.
  51061. if (isIOS) { setTimeout(noop); }
  51062. };
  51063. isUsingMicroTask = true;
  51064. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  51065. isNative(MutationObserver) ||
  51066. // PhantomJS and iOS 7.x
  51067. MutationObserver.toString() === '[object MutationObserverConstructor]'
  51068. )) {
  51069. // Use MutationObserver where native Promise is not available,
  51070. // e.g. PhantomJS, iOS7, Android 4.4
  51071. // (#6466 MutationObserver is unreliable in IE11)
  51072. var counter = 1;
  51073. var observer = new MutationObserver(flushCallbacks);
  51074. var textNode = document.createTextNode(String(counter));
  51075. observer.observe(textNode, {
  51076. characterData: true
  51077. });
  51078. timerFunc = function () {
  51079. counter = (counter + 1) % 2;
  51080. textNode.data = String(counter);
  51081. };
  51082. isUsingMicroTask = true;
  51083. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  51084. // Fallback to setImmediate.
  51085. // Technically it leverages the (macro) task queue,
  51086. // but it is still a better choice than setTimeout.
  51087. timerFunc = function () {
  51088. setImmediate(flushCallbacks);
  51089. };
  51090. } else {
  51091. // Fallback to setTimeout.
  51092. timerFunc = function () {
  51093. setTimeout(flushCallbacks, 0);
  51094. };
  51095. }
  51096. function nextTick (cb, ctx) {
  51097. var _resolve;
  51098. callbacks.push(function () {
  51099. if (cb) {
  51100. try {
  51101. cb.call(ctx);
  51102. } catch (e) {
  51103. handleError(e, ctx, 'nextTick');
  51104. }
  51105. } else if (_resolve) {
  51106. _resolve(ctx);
  51107. }
  51108. });
  51109. if (!pending) {
  51110. pending = true;
  51111. timerFunc();
  51112. }
  51113. // $flow-disable-line
  51114. if (!cb && typeof Promise !== 'undefined') {
  51115. return new Promise(function (resolve) {
  51116. _resolve = resolve;
  51117. })
  51118. }
  51119. }
  51120. /* */
  51121. var mark;
  51122. var measure;
  51123. {
  51124. var perf = inBrowser && window.performance;
  51125. /* istanbul ignore if */
  51126. if (
  51127. perf &&
  51128. perf.mark &&
  51129. perf.measure &&
  51130. perf.clearMarks &&
  51131. perf.clearMeasures
  51132. ) {
  51133. mark = function (tag) { return perf.mark(tag); };
  51134. measure = function (name, startTag, endTag) {
  51135. perf.measure(name, startTag, endTag);
  51136. perf.clearMarks(startTag);
  51137. perf.clearMarks(endTag);
  51138. // perf.clearMeasures(name)
  51139. };
  51140. }
  51141. }
  51142. /* not type checking this file because flow doesn't play well with Proxy */
  51143. var initProxy;
  51144. {
  51145. var allowedGlobals = makeMap(
  51146. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  51147. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  51148. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  51149. 'require' // for Webpack/Browserify
  51150. );
  51151. var warnNonPresent = function (target, key) {
  51152. warn(
  51153. "Property or method \"" + key + "\" is not defined on the instance but " +
  51154. 'referenced during render. Make sure that this property is reactive, ' +
  51155. 'either in the data option, or for class-based components, by ' +
  51156. 'initializing the property. ' +
  51157. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  51158. target
  51159. );
  51160. };
  51161. var warnReservedPrefix = function (target, key) {
  51162. warn(
  51163. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  51164. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  51165. 'prevent conflicts with Vue internals. ' +
  51166. 'See: https://vuejs.org/v2/api/#data',
  51167. target
  51168. );
  51169. };
  51170. var hasProxy =
  51171. typeof Proxy !== 'undefined' && isNative(Proxy);
  51172. if (hasProxy) {
  51173. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  51174. config.keyCodes = new Proxy(config.keyCodes, {
  51175. set: function set (target, key, value) {
  51176. if (isBuiltInModifier(key)) {
  51177. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  51178. return false
  51179. } else {
  51180. target[key] = value;
  51181. return true
  51182. }
  51183. }
  51184. });
  51185. }
  51186. var hasHandler = {
  51187. has: function has (target, key) {
  51188. var has = key in target;
  51189. var isAllowed = allowedGlobals(key) ||
  51190. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  51191. if (!has && !isAllowed) {
  51192. if (key in target.$data) { warnReservedPrefix(target, key); }
  51193. else { warnNonPresent(target, key); }
  51194. }
  51195. return has || !isAllowed
  51196. }
  51197. };
  51198. var getHandler = {
  51199. get: function get (target, key) {
  51200. if (typeof key === 'string' && !(key in target)) {
  51201. if (key in target.$data) { warnReservedPrefix(target, key); }
  51202. else { warnNonPresent(target, key); }
  51203. }
  51204. return target[key]
  51205. }
  51206. };
  51207. initProxy = function initProxy (vm) {
  51208. if (hasProxy) {
  51209. // determine which proxy handler to use
  51210. var options = vm.$options;
  51211. var handlers = options.render && options.render._withStripped
  51212. ? getHandler
  51213. : hasHandler;
  51214. vm._renderProxy = new Proxy(vm, handlers);
  51215. } else {
  51216. vm._renderProxy = vm;
  51217. }
  51218. };
  51219. }
  51220. /* */
  51221. var seenObjects = new _Set();
  51222. /**
  51223. * Recursively traverse an object to evoke all converted
  51224. * getters, so that every nested property inside the object
  51225. * is collected as a "deep" dependency.
  51226. */
  51227. function traverse (val) {
  51228. _traverse(val, seenObjects);
  51229. seenObjects.clear();
  51230. }
  51231. function _traverse (val, seen) {
  51232. var i, keys;
  51233. var isA = Array.isArray(val);
  51234. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  51235. return
  51236. }
  51237. if (val.__ob__) {
  51238. var depId = val.__ob__.dep.id;
  51239. if (seen.has(depId)) {
  51240. return
  51241. }
  51242. seen.add(depId);
  51243. }
  51244. if (isA) {
  51245. i = val.length;
  51246. while (i--) { _traverse(val[i], seen); }
  51247. } else {
  51248. keys = Object.keys(val);
  51249. i = keys.length;
  51250. while (i--) { _traverse(val[keys[i]], seen); }
  51251. }
  51252. }
  51253. /* */
  51254. var normalizeEvent = cached(function (name) {
  51255. var passive = name.charAt(0) === '&';
  51256. name = passive ? name.slice(1) : name;
  51257. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  51258. name = once$$1 ? name.slice(1) : name;
  51259. var capture = name.charAt(0) === '!';
  51260. name = capture ? name.slice(1) : name;
  51261. return {
  51262. name: name,
  51263. once: once$$1,
  51264. capture: capture,
  51265. passive: passive
  51266. }
  51267. });
  51268. function createFnInvoker (fns, vm) {
  51269. function invoker () {
  51270. var arguments$1 = arguments;
  51271. var fns = invoker.fns;
  51272. if (Array.isArray(fns)) {
  51273. var cloned = fns.slice();
  51274. for (var i = 0; i < cloned.length; i++) {
  51275. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  51276. }
  51277. } else {
  51278. // return handler return value for single handlers
  51279. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  51280. }
  51281. }
  51282. invoker.fns = fns;
  51283. return invoker
  51284. }
  51285. function updateListeners (
  51286. on,
  51287. oldOn,
  51288. add,
  51289. remove$$1,
  51290. createOnceHandler,
  51291. vm
  51292. ) {
  51293. var name, def$$1, cur, old, event;
  51294. for (name in on) {
  51295. def$$1 = cur = on[name];
  51296. old = oldOn[name];
  51297. event = normalizeEvent(name);
  51298. if (isUndef(cur)) {
  51299. warn(
  51300. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  51301. vm
  51302. );
  51303. } else if (isUndef(old)) {
  51304. if (isUndef(cur.fns)) {
  51305. cur = on[name] = createFnInvoker(cur, vm);
  51306. }
  51307. if (isTrue(event.once)) {
  51308. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  51309. }
  51310. add(event.name, cur, event.capture, event.passive, event.params);
  51311. } else if (cur !== old) {
  51312. old.fns = cur;
  51313. on[name] = old;
  51314. }
  51315. }
  51316. for (name in oldOn) {
  51317. if (isUndef(on[name])) {
  51318. event = normalizeEvent(name);
  51319. remove$$1(event.name, oldOn[name], event.capture);
  51320. }
  51321. }
  51322. }
  51323. /* */
  51324. function mergeVNodeHook (def, hookKey, hook) {
  51325. if (def instanceof VNode) {
  51326. def = def.data.hook || (def.data.hook = {});
  51327. }
  51328. var invoker;
  51329. var oldHook = def[hookKey];
  51330. function wrappedHook () {
  51331. hook.apply(this, arguments);
  51332. // important: remove merged hook to ensure it's called only once
  51333. // and prevent memory leak
  51334. remove(invoker.fns, wrappedHook);
  51335. }
  51336. if (isUndef(oldHook)) {
  51337. // no existing hook
  51338. invoker = createFnInvoker([wrappedHook]);
  51339. } else {
  51340. /* istanbul ignore if */
  51341. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  51342. // already a merged invoker
  51343. invoker = oldHook;
  51344. invoker.fns.push(wrappedHook);
  51345. } else {
  51346. // existing plain hook
  51347. invoker = createFnInvoker([oldHook, wrappedHook]);
  51348. }
  51349. }
  51350. invoker.merged = true;
  51351. def[hookKey] = invoker;
  51352. }
  51353. /* */
  51354. function extractPropsFromVNodeData (
  51355. data,
  51356. Ctor,
  51357. tag
  51358. ) {
  51359. // we are only extracting raw values here.
  51360. // validation and default values are handled in the child
  51361. // component itself.
  51362. var propOptions = Ctor.options.props;
  51363. if (isUndef(propOptions)) {
  51364. return
  51365. }
  51366. var res = {};
  51367. var attrs = data.attrs;
  51368. var props = data.props;
  51369. if (isDef(attrs) || isDef(props)) {
  51370. for (var key in propOptions) {
  51371. var altKey = hyphenate(key);
  51372. {
  51373. var keyInLowerCase = key.toLowerCase();
  51374. if (
  51375. key !== keyInLowerCase &&
  51376. attrs && hasOwn(attrs, keyInLowerCase)
  51377. ) {
  51378. tip(
  51379. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  51380. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  51381. " \"" + key + "\". " +
  51382. "Note that HTML attributes are case-insensitive and camelCased " +
  51383. "props need to use their kebab-case equivalents when using in-DOM " +
  51384. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  51385. );
  51386. }
  51387. }
  51388. checkProp(res, props, key, altKey, true) ||
  51389. checkProp(res, attrs, key, altKey, false);
  51390. }
  51391. }
  51392. return res
  51393. }
  51394. function checkProp (
  51395. res,
  51396. hash,
  51397. key,
  51398. altKey,
  51399. preserve
  51400. ) {
  51401. if (isDef(hash)) {
  51402. if (hasOwn(hash, key)) {
  51403. res[key] = hash[key];
  51404. if (!preserve) {
  51405. delete hash[key];
  51406. }
  51407. return true
  51408. } else if (hasOwn(hash, altKey)) {
  51409. res[key] = hash[altKey];
  51410. if (!preserve) {
  51411. delete hash[altKey];
  51412. }
  51413. return true
  51414. }
  51415. }
  51416. return false
  51417. }
  51418. /* */
  51419. // The template compiler attempts to minimize the need for normalization by
  51420. // statically analyzing the template at compile time.
  51421. //
  51422. // For plain HTML markup, normalization can be completely skipped because the
  51423. // generated render function is guaranteed to return Array<VNode>. There are
  51424. // two cases where extra normalization is needed:
  51425. // 1. When the children contains components - because a functional component
  51426. // may return an Array instead of a single root. In this case, just a simple
  51427. // normalization is needed - if any child is an Array, we flatten the whole
  51428. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  51429. // because functional components already normalize their own children.
  51430. function simpleNormalizeChildren (children) {
  51431. for (var i = 0; i < children.length; i++) {
  51432. if (Array.isArray(children[i])) {
  51433. return Array.prototype.concat.apply([], children)
  51434. }
  51435. }
  51436. return children
  51437. }
  51438. // 2. When the children contains constructs that always generated nested Arrays,
  51439. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  51440. // with hand-written render functions / JSX. In such cases a full normalization
  51441. // is needed to cater to all possible types of children values.
  51442. function normalizeChildren (children) {
  51443. return isPrimitive(children)
  51444. ? [createTextVNode(children)]
  51445. : Array.isArray(children)
  51446. ? normalizeArrayChildren(children)
  51447. : undefined
  51448. }
  51449. function isTextNode (node) {
  51450. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  51451. }
  51452. function normalizeArrayChildren (children, nestedIndex) {
  51453. var res = [];
  51454. var i, c, lastIndex, last;
  51455. for (i = 0; i < children.length; i++) {
  51456. c = children[i];
  51457. if (isUndef(c) || typeof c === 'boolean') { continue }
  51458. lastIndex = res.length - 1;
  51459. last = res[lastIndex];
  51460. // nested
  51461. if (Array.isArray(c)) {
  51462. if (c.length > 0) {
  51463. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  51464. // merge adjacent text nodes
  51465. if (isTextNode(c[0]) && isTextNode(last)) {
  51466. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  51467. c.shift();
  51468. }
  51469. res.push.apply(res, c);
  51470. }
  51471. } else if (isPrimitive(c)) {
  51472. if (isTextNode(last)) {
  51473. // merge adjacent text nodes
  51474. // this is necessary for SSR hydration because text nodes are
  51475. // essentially merged when rendered to HTML strings
  51476. res[lastIndex] = createTextVNode(last.text + c);
  51477. } else if (c !== '') {
  51478. // convert primitive to vnode
  51479. res.push(createTextVNode(c));
  51480. }
  51481. } else {
  51482. if (isTextNode(c) && isTextNode(last)) {
  51483. // merge adjacent text nodes
  51484. res[lastIndex] = createTextVNode(last.text + c.text);
  51485. } else {
  51486. // default key for nested array children (likely generated by v-for)
  51487. if (isTrue(children._isVList) &&
  51488. isDef(c.tag) &&
  51489. isUndef(c.key) &&
  51490. isDef(nestedIndex)) {
  51491. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  51492. }
  51493. res.push(c);
  51494. }
  51495. }
  51496. }
  51497. return res
  51498. }
  51499. /* */
  51500. function initProvide (vm) {
  51501. var provide = vm.$options.provide;
  51502. if (provide) {
  51503. vm._provided = typeof provide === 'function'
  51504. ? provide.call(vm)
  51505. : provide;
  51506. }
  51507. }
  51508. function initInjections (vm) {
  51509. var result = resolveInject(vm.$options.inject, vm);
  51510. if (result) {
  51511. toggleObserving(false);
  51512. Object.keys(result).forEach(function (key) {
  51513. /* istanbul ignore else */
  51514. {
  51515. defineReactive$$1(vm, key, result[key], function () {
  51516. warn(
  51517. "Avoid mutating an injected value directly since the changes will be " +
  51518. "overwritten whenever the provided component re-renders. " +
  51519. "injection being mutated: \"" + key + "\"",
  51520. vm
  51521. );
  51522. });
  51523. }
  51524. });
  51525. toggleObserving(true);
  51526. }
  51527. }
  51528. function resolveInject (inject, vm) {
  51529. if (inject) {
  51530. // inject is :any because flow is not smart enough to figure out cached
  51531. var result = Object.create(null);
  51532. var keys = hasSymbol
  51533. ? Reflect.ownKeys(inject)
  51534. : Object.keys(inject);
  51535. for (var i = 0; i < keys.length; i++) {
  51536. var key = keys[i];
  51537. // #6574 in case the inject object is observed...
  51538. if (key === '__ob__') { continue }
  51539. var provideKey = inject[key].from;
  51540. var source = vm;
  51541. while (source) {
  51542. if (source._provided && hasOwn(source._provided, provideKey)) {
  51543. result[key] = source._provided[provideKey];
  51544. break
  51545. }
  51546. source = source.$parent;
  51547. }
  51548. if (!source) {
  51549. if ('default' in inject[key]) {
  51550. var provideDefault = inject[key].default;
  51551. result[key] = typeof provideDefault === 'function'
  51552. ? provideDefault.call(vm)
  51553. : provideDefault;
  51554. } else {
  51555. warn(("Injection \"" + key + "\" not found"), vm);
  51556. }
  51557. }
  51558. }
  51559. return result
  51560. }
  51561. }
  51562. /* */
  51563. /**
  51564. * Runtime helper for resolving raw children VNodes into a slot object.
  51565. */
  51566. function resolveSlots (
  51567. children,
  51568. context
  51569. ) {
  51570. if (!children || !children.length) {
  51571. return {}
  51572. }
  51573. var slots = {};
  51574. for (var i = 0, l = children.length; i < l; i++) {
  51575. var child = children[i];
  51576. var data = child.data;
  51577. // remove slot attribute if the node is resolved as a Vue slot node
  51578. if (data && data.attrs && data.attrs.slot) {
  51579. delete data.attrs.slot;
  51580. }
  51581. // named slots should only be respected if the vnode was rendered in the
  51582. // same context.
  51583. if ((child.context === context || child.fnContext === context) &&
  51584. data && data.slot != null
  51585. ) {
  51586. var name = data.slot;
  51587. var slot = (slots[name] || (slots[name] = []));
  51588. if (child.tag === 'template') {
  51589. slot.push.apply(slot, child.children || []);
  51590. } else {
  51591. slot.push(child);
  51592. }
  51593. } else {
  51594. (slots.default || (slots.default = [])).push(child);
  51595. }
  51596. }
  51597. // ignore slots that contains only whitespace
  51598. for (var name$1 in slots) {
  51599. if (slots[name$1].every(isWhitespace)) {
  51600. delete slots[name$1];
  51601. }
  51602. }
  51603. return slots
  51604. }
  51605. function isWhitespace (node) {
  51606. return (node.isComment && !node.asyncFactory) || node.text === ' '
  51607. }
  51608. /* */
  51609. function normalizeScopedSlots (
  51610. slots,
  51611. normalSlots,
  51612. prevSlots
  51613. ) {
  51614. var res;
  51615. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  51616. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  51617. var key = slots && slots.$key;
  51618. if (!slots) {
  51619. res = {};
  51620. } else if (slots._normalized) {
  51621. // fast path 1: child component re-render only, parent did not change
  51622. return slots._normalized
  51623. } else if (
  51624. isStable &&
  51625. prevSlots &&
  51626. prevSlots !== emptyObject &&
  51627. key === prevSlots.$key &&
  51628. !hasNormalSlots &&
  51629. !prevSlots.$hasNormal
  51630. ) {
  51631. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  51632. // only need to normalize once
  51633. return prevSlots
  51634. } else {
  51635. res = {};
  51636. for (var key$1 in slots) {
  51637. if (slots[key$1] && key$1[0] !== '$') {
  51638. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  51639. }
  51640. }
  51641. }
  51642. // expose normal slots on scopedSlots
  51643. for (var key$2 in normalSlots) {
  51644. if (!(key$2 in res)) {
  51645. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  51646. }
  51647. }
  51648. // avoriaz seems to mock a non-extensible $scopedSlots object
  51649. // and when that is passed down this would cause an error
  51650. if (slots && Object.isExtensible(slots)) {
  51651. (slots)._normalized = res;
  51652. }
  51653. def(res, '$stable', isStable);
  51654. def(res, '$key', key);
  51655. def(res, '$hasNormal', hasNormalSlots);
  51656. return res
  51657. }
  51658. function normalizeScopedSlot(normalSlots, key, fn) {
  51659. var normalized = function () {
  51660. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  51661. res = res && typeof res === 'object' && !Array.isArray(res)
  51662. ? [res] // single vnode
  51663. : normalizeChildren(res);
  51664. return res && (
  51665. res.length === 0 ||
  51666. (res.length === 1 && res[0].isComment) // #9658
  51667. ) ? undefined
  51668. : res
  51669. };
  51670. // this is a slot using the new v-slot syntax without scope. although it is
  51671. // compiled as a scoped slot, render fn users would expect it to be present
  51672. // on this.$slots because the usage is semantically a normal slot.
  51673. if (fn.proxy) {
  51674. Object.defineProperty(normalSlots, key, {
  51675. get: normalized,
  51676. enumerable: true,
  51677. configurable: true
  51678. });
  51679. }
  51680. return normalized
  51681. }
  51682. function proxyNormalSlot(slots, key) {
  51683. return function () { return slots[key]; }
  51684. }
  51685. /* */
  51686. /**
  51687. * Runtime helper for rendering v-for lists.
  51688. */
  51689. function renderList (
  51690. val,
  51691. render
  51692. ) {
  51693. var ret, i, l, keys, key;
  51694. if (Array.isArray(val) || typeof val === 'string') {
  51695. ret = new Array(val.length);
  51696. for (i = 0, l = val.length; i < l; i++) {
  51697. ret[i] = render(val[i], i);
  51698. }
  51699. } else if (typeof val === 'number') {
  51700. ret = new Array(val);
  51701. for (i = 0; i < val; i++) {
  51702. ret[i] = render(i + 1, i);
  51703. }
  51704. } else if (isObject(val)) {
  51705. if (hasSymbol && val[Symbol.iterator]) {
  51706. ret = [];
  51707. var iterator = val[Symbol.iterator]();
  51708. var result = iterator.next();
  51709. while (!result.done) {
  51710. ret.push(render(result.value, ret.length));
  51711. result = iterator.next();
  51712. }
  51713. } else {
  51714. keys = Object.keys(val);
  51715. ret = new Array(keys.length);
  51716. for (i = 0, l = keys.length; i < l; i++) {
  51717. key = keys[i];
  51718. ret[i] = render(val[key], key, i);
  51719. }
  51720. }
  51721. }
  51722. if (!isDef(ret)) {
  51723. ret = [];
  51724. }
  51725. (ret)._isVList = true;
  51726. return ret
  51727. }
  51728. /* */
  51729. /**
  51730. * Runtime helper for rendering <slot>
  51731. */
  51732. function renderSlot (
  51733. name,
  51734. fallback,
  51735. props,
  51736. bindObject
  51737. ) {
  51738. var scopedSlotFn = this.$scopedSlots[name];
  51739. var nodes;
  51740. if (scopedSlotFn) { // scoped slot
  51741. props = props || {};
  51742. if (bindObject) {
  51743. if (!isObject(bindObject)) {
  51744. warn(
  51745. 'slot v-bind without argument expects an Object',
  51746. this
  51747. );
  51748. }
  51749. props = extend(extend({}, bindObject), props);
  51750. }
  51751. nodes = scopedSlotFn(props) || fallback;
  51752. } else {
  51753. nodes = this.$slots[name] || fallback;
  51754. }
  51755. var target = props && props.slot;
  51756. if (target) {
  51757. return this.$createElement('template', { slot: target }, nodes)
  51758. } else {
  51759. return nodes
  51760. }
  51761. }
  51762. /* */
  51763. /**
  51764. * Runtime helper for resolving filters
  51765. */
  51766. function resolveFilter (id) {
  51767. return resolveAsset(this.$options, 'filters', id, true) || identity
  51768. }
  51769. /* */
  51770. function isKeyNotMatch (expect, actual) {
  51771. if (Array.isArray(expect)) {
  51772. return expect.indexOf(actual) === -1
  51773. } else {
  51774. return expect !== actual
  51775. }
  51776. }
  51777. /**
  51778. * Runtime helper for checking keyCodes from config.
  51779. * exposed as Vue.prototype._k
  51780. * passing in eventKeyName as last argument separately for backwards compat
  51781. */
  51782. function checkKeyCodes (
  51783. eventKeyCode,
  51784. key,
  51785. builtInKeyCode,
  51786. eventKeyName,
  51787. builtInKeyName
  51788. ) {
  51789. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  51790. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  51791. return isKeyNotMatch(builtInKeyName, eventKeyName)
  51792. } else if (mappedKeyCode) {
  51793. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  51794. } else if (eventKeyName) {
  51795. return hyphenate(eventKeyName) !== key
  51796. }
  51797. }
  51798. /* */
  51799. /**
  51800. * Runtime helper for merging v-bind="object" into a VNode's data.
  51801. */
  51802. function bindObjectProps (
  51803. data,
  51804. tag,
  51805. value,
  51806. asProp,
  51807. isSync
  51808. ) {
  51809. if (value) {
  51810. if (!isObject(value)) {
  51811. warn(
  51812. 'v-bind without argument expects an Object or Array value',
  51813. this
  51814. );
  51815. } else {
  51816. if (Array.isArray(value)) {
  51817. value = toObject(value);
  51818. }
  51819. var hash;
  51820. var loop = function ( key ) {
  51821. if (
  51822. key === 'class' ||
  51823. key === 'style' ||
  51824. isReservedAttribute(key)
  51825. ) {
  51826. hash = data;
  51827. } else {
  51828. var type = data.attrs && data.attrs.type;
  51829. hash = asProp || config.mustUseProp(tag, type, key)
  51830. ? data.domProps || (data.domProps = {})
  51831. : data.attrs || (data.attrs = {});
  51832. }
  51833. var camelizedKey = camelize(key);
  51834. var hyphenatedKey = hyphenate(key);
  51835. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  51836. hash[key] = value[key];
  51837. if (isSync) {
  51838. var on = data.on || (data.on = {});
  51839. on[("update:" + key)] = function ($event) {
  51840. value[key] = $event;
  51841. };
  51842. }
  51843. }
  51844. };
  51845. for (var key in value) loop( key );
  51846. }
  51847. }
  51848. return data
  51849. }
  51850. /* */
  51851. /**
  51852. * Runtime helper for rendering static trees.
  51853. */
  51854. function renderStatic (
  51855. index,
  51856. isInFor
  51857. ) {
  51858. var cached = this._staticTrees || (this._staticTrees = []);
  51859. var tree = cached[index];
  51860. // if has already-rendered static tree and not inside v-for,
  51861. // we can reuse the same tree.
  51862. if (tree && !isInFor) {
  51863. return tree
  51864. }
  51865. // otherwise, render a fresh tree.
  51866. tree = cached[index] = this.$options.staticRenderFns[index].call(
  51867. this._renderProxy,
  51868. null,
  51869. this // for render fns generated for functional component templates
  51870. );
  51871. markStatic(tree, ("__static__" + index), false);
  51872. return tree
  51873. }
  51874. /**
  51875. * Runtime helper for v-once.
  51876. * Effectively it means marking the node as static with a unique key.
  51877. */
  51878. function markOnce (
  51879. tree,
  51880. index,
  51881. key
  51882. ) {
  51883. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  51884. return tree
  51885. }
  51886. function markStatic (
  51887. tree,
  51888. key,
  51889. isOnce
  51890. ) {
  51891. if (Array.isArray(tree)) {
  51892. for (var i = 0; i < tree.length; i++) {
  51893. if (tree[i] && typeof tree[i] !== 'string') {
  51894. markStaticNode(tree[i], (key + "_" + i), isOnce);
  51895. }
  51896. }
  51897. } else {
  51898. markStaticNode(tree, key, isOnce);
  51899. }
  51900. }
  51901. function markStaticNode (node, key, isOnce) {
  51902. node.isStatic = true;
  51903. node.key = key;
  51904. node.isOnce = isOnce;
  51905. }
  51906. /* */
  51907. function bindObjectListeners (data, value) {
  51908. if (value) {
  51909. if (!isPlainObject(value)) {
  51910. warn(
  51911. 'v-on without argument expects an Object value',
  51912. this
  51913. );
  51914. } else {
  51915. var on = data.on = data.on ? extend({}, data.on) : {};
  51916. for (var key in value) {
  51917. var existing = on[key];
  51918. var ours = value[key];
  51919. on[key] = existing ? [].concat(existing, ours) : ours;
  51920. }
  51921. }
  51922. }
  51923. return data
  51924. }
  51925. /* */
  51926. function resolveScopedSlots (
  51927. fns, // see flow/vnode
  51928. res,
  51929. // the following are added in 2.6
  51930. hasDynamicKeys,
  51931. contentHashKey
  51932. ) {
  51933. res = res || { $stable: !hasDynamicKeys };
  51934. for (var i = 0; i < fns.length; i++) {
  51935. var slot = fns[i];
  51936. if (Array.isArray(slot)) {
  51937. resolveScopedSlots(slot, res, hasDynamicKeys);
  51938. } else if (slot) {
  51939. // marker for reverse proxying v-slot without scope on this.$slots
  51940. if (slot.proxy) {
  51941. slot.fn.proxy = true;
  51942. }
  51943. res[slot.key] = slot.fn;
  51944. }
  51945. }
  51946. if (contentHashKey) {
  51947. (res).$key = contentHashKey;
  51948. }
  51949. return res
  51950. }
  51951. /* */
  51952. function bindDynamicKeys (baseObj, values) {
  51953. for (var i = 0; i < values.length; i += 2) {
  51954. var key = values[i];
  51955. if (typeof key === 'string' && key) {
  51956. baseObj[values[i]] = values[i + 1];
  51957. } else if (key !== '' && key !== null) {
  51958. // null is a special value for explicitly removing a binding
  51959. warn(
  51960. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  51961. this
  51962. );
  51963. }
  51964. }
  51965. return baseObj
  51966. }
  51967. // helper to dynamically append modifier runtime markers to event names.
  51968. // ensure only append when value is already string, otherwise it will be cast
  51969. // to string and cause the type check to miss.
  51970. function prependModifier (value, symbol) {
  51971. return typeof value === 'string' ? symbol + value : value
  51972. }
  51973. /* */
  51974. function installRenderHelpers (target) {
  51975. target._o = markOnce;
  51976. target._n = toNumber;
  51977. target._s = toString;
  51978. target._l = renderList;
  51979. target._t = renderSlot;
  51980. target._q = looseEqual;
  51981. target._i = looseIndexOf;
  51982. target._m = renderStatic;
  51983. target._f = resolveFilter;
  51984. target._k = checkKeyCodes;
  51985. target._b = bindObjectProps;
  51986. target._v = createTextVNode;
  51987. target._e = createEmptyVNode;
  51988. target._u = resolveScopedSlots;
  51989. target._g = bindObjectListeners;
  51990. target._d = bindDynamicKeys;
  51991. target._p = prependModifier;
  51992. }
  51993. /* */
  51994. function FunctionalRenderContext (
  51995. data,
  51996. props,
  51997. children,
  51998. parent,
  51999. Ctor
  52000. ) {
  52001. var this$1 = this;
  52002. var options = Ctor.options;
  52003. // ensure the createElement function in functional components
  52004. // gets a unique context - this is necessary for correct named slot check
  52005. var contextVm;
  52006. if (hasOwn(parent, '_uid')) {
  52007. contextVm = Object.create(parent);
  52008. // $flow-disable-line
  52009. contextVm._original = parent;
  52010. } else {
  52011. // the context vm passed in is a functional context as well.
  52012. // in this case we want to make sure we are able to get a hold to the
  52013. // real context instance.
  52014. contextVm = parent;
  52015. // $flow-disable-line
  52016. parent = parent._original;
  52017. }
  52018. var isCompiled = isTrue(options._compiled);
  52019. var needNormalization = !isCompiled;
  52020. this.data = data;
  52021. this.props = props;
  52022. this.children = children;
  52023. this.parent = parent;
  52024. this.listeners = data.on || emptyObject;
  52025. this.injections = resolveInject(options.inject, parent);
  52026. this.slots = function () {
  52027. if (!this$1.$slots) {
  52028. normalizeScopedSlots(
  52029. data.scopedSlots,
  52030. this$1.$slots = resolveSlots(children, parent)
  52031. );
  52032. }
  52033. return this$1.$slots
  52034. };
  52035. Object.defineProperty(this, 'scopedSlots', ({
  52036. enumerable: true,
  52037. get: function get () {
  52038. return normalizeScopedSlots(data.scopedSlots, this.slots())
  52039. }
  52040. }));
  52041. // support for compiled functional template
  52042. if (isCompiled) {
  52043. // exposing $options for renderStatic()
  52044. this.$options = options;
  52045. // pre-resolve slots for renderSlot()
  52046. this.$slots = this.slots();
  52047. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  52048. }
  52049. if (options._scopeId) {
  52050. this._c = function (a, b, c, d) {
  52051. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  52052. if (vnode && !Array.isArray(vnode)) {
  52053. vnode.fnScopeId = options._scopeId;
  52054. vnode.fnContext = parent;
  52055. }
  52056. return vnode
  52057. };
  52058. } else {
  52059. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  52060. }
  52061. }
  52062. installRenderHelpers(FunctionalRenderContext.prototype);
  52063. function createFunctionalComponent (
  52064. Ctor,
  52065. propsData,
  52066. data,
  52067. contextVm,
  52068. children
  52069. ) {
  52070. var options = Ctor.options;
  52071. var props = {};
  52072. var propOptions = options.props;
  52073. if (isDef(propOptions)) {
  52074. for (var key in propOptions) {
  52075. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  52076. }
  52077. } else {
  52078. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  52079. if (isDef(data.props)) { mergeProps(props, data.props); }
  52080. }
  52081. var renderContext = new FunctionalRenderContext(
  52082. data,
  52083. props,
  52084. children,
  52085. contextVm,
  52086. Ctor
  52087. );
  52088. var vnode = options.render.call(null, renderContext._c, renderContext);
  52089. if (vnode instanceof VNode) {
  52090. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  52091. } else if (Array.isArray(vnode)) {
  52092. var vnodes = normalizeChildren(vnode) || [];
  52093. var res = new Array(vnodes.length);
  52094. for (var i = 0; i < vnodes.length; i++) {
  52095. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  52096. }
  52097. return res
  52098. }
  52099. }
  52100. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  52101. // #7817 clone node before setting fnContext, otherwise if the node is reused
  52102. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  52103. // that should not be matched to match.
  52104. var clone = cloneVNode(vnode);
  52105. clone.fnContext = contextVm;
  52106. clone.fnOptions = options;
  52107. {
  52108. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  52109. }
  52110. if (data.slot) {
  52111. (clone.data || (clone.data = {})).slot = data.slot;
  52112. }
  52113. return clone
  52114. }
  52115. function mergeProps (to, from) {
  52116. for (var key in from) {
  52117. to[camelize(key)] = from[key];
  52118. }
  52119. }
  52120. /* */
  52121. /* */
  52122. /* */
  52123. /* */
  52124. // inline hooks to be invoked on component VNodes during patch
  52125. var componentVNodeHooks = {
  52126. init: function init (vnode, hydrating) {
  52127. if (
  52128. vnode.componentInstance &&
  52129. !vnode.componentInstance._isDestroyed &&
  52130. vnode.data.keepAlive
  52131. ) {
  52132. // kept-alive components, treat as a patch
  52133. var mountedNode = vnode; // work around flow
  52134. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  52135. } else {
  52136. var child = vnode.componentInstance = createComponentInstanceForVnode(
  52137. vnode,
  52138. activeInstance
  52139. );
  52140. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  52141. }
  52142. },
  52143. prepatch: function prepatch (oldVnode, vnode) {
  52144. var options = vnode.componentOptions;
  52145. var child = vnode.componentInstance = oldVnode.componentInstance;
  52146. updateChildComponent(
  52147. child,
  52148. options.propsData, // updated props
  52149. options.listeners, // updated listeners
  52150. vnode, // new parent vnode
  52151. options.children // new children
  52152. );
  52153. },
  52154. insert: function insert (vnode) {
  52155. var context = vnode.context;
  52156. var componentInstance = vnode.componentInstance;
  52157. if (!componentInstance._isMounted) {
  52158. componentInstance._isMounted = true;
  52159. callHook(componentInstance, 'mounted');
  52160. }
  52161. if (vnode.data.keepAlive) {
  52162. if (context._isMounted) {
  52163. // vue-router#1212
  52164. // During updates, a kept-alive component's child components may
  52165. // change, so directly walking the tree here may call activated hooks
  52166. // on incorrect children. Instead we push them into a queue which will
  52167. // be processed after the whole patch process ended.
  52168. queueActivatedComponent(componentInstance);
  52169. } else {
  52170. activateChildComponent(componentInstance, true /* direct */);
  52171. }
  52172. }
  52173. },
  52174. destroy: function destroy (vnode) {
  52175. var componentInstance = vnode.componentInstance;
  52176. if (!componentInstance._isDestroyed) {
  52177. if (!vnode.data.keepAlive) {
  52178. componentInstance.$destroy();
  52179. } else {
  52180. deactivateChildComponent(componentInstance, true /* direct */);
  52181. }
  52182. }
  52183. }
  52184. };
  52185. var hooksToMerge = Object.keys(componentVNodeHooks);
  52186. function createComponent (
  52187. Ctor,
  52188. data,
  52189. context,
  52190. children,
  52191. tag
  52192. ) {
  52193. if (isUndef(Ctor)) {
  52194. return
  52195. }
  52196. var baseCtor = context.$options._base;
  52197. // plain options object: turn it into a constructor
  52198. if (isObject(Ctor)) {
  52199. Ctor = baseCtor.extend(Ctor);
  52200. }
  52201. // if at this stage it's not a constructor or an async component factory,
  52202. // reject.
  52203. if (typeof Ctor !== 'function') {
  52204. {
  52205. warn(("Invalid Component definition: " + (String(Ctor))), context);
  52206. }
  52207. return
  52208. }
  52209. // async component
  52210. var asyncFactory;
  52211. if (isUndef(Ctor.cid)) {
  52212. asyncFactory = Ctor;
  52213. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  52214. if (Ctor === undefined) {
  52215. // return a placeholder node for async component, which is rendered
  52216. // as a comment node but preserves all the raw information for the node.
  52217. // the information will be used for async server-rendering and hydration.
  52218. return createAsyncPlaceholder(
  52219. asyncFactory,
  52220. data,
  52221. context,
  52222. children,
  52223. tag
  52224. )
  52225. }
  52226. }
  52227. data = data || {};
  52228. // resolve constructor options in case global mixins are applied after
  52229. // component constructor creation
  52230. resolveConstructorOptions(Ctor);
  52231. // transform component v-model data into props & events
  52232. if (isDef(data.model)) {
  52233. transformModel(Ctor.options, data);
  52234. }
  52235. // extract props
  52236. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  52237. // functional component
  52238. if (isTrue(Ctor.options.functional)) {
  52239. return createFunctionalComponent(Ctor, propsData, data, context, children)
  52240. }
  52241. // extract listeners, since these needs to be treated as
  52242. // child component listeners instead of DOM listeners
  52243. var listeners = data.on;
  52244. // replace with listeners with .native modifier
  52245. // so it gets processed during parent component patch.
  52246. data.on = data.nativeOn;
  52247. if (isTrue(Ctor.options.abstract)) {
  52248. // abstract components do not keep anything
  52249. // other than props & listeners & slot
  52250. // work around flow
  52251. var slot = data.slot;
  52252. data = {};
  52253. if (slot) {
  52254. data.slot = slot;
  52255. }
  52256. }
  52257. // install component management hooks onto the placeholder node
  52258. installComponentHooks(data);
  52259. // return a placeholder vnode
  52260. var name = Ctor.options.name || tag;
  52261. var vnode = new VNode(
  52262. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  52263. data, undefined, undefined, undefined, context,
  52264. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  52265. asyncFactory
  52266. );
  52267. return vnode
  52268. }
  52269. function createComponentInstanceForVnode (
  52270. vnode, // we know it's MountedComponentVNode but flow doesn't
  52271. parent // activeInstance in lifecycle state
  52272. ) {
  52273. var options = {
  52274. _isComponent: true,
  52275. _parentVnode: vnode,
  52276. parent: parent
  52277. };
  52278. // check inline-template render functions
  52279. var inlineTemplate = vnode.data.inlineTemplate;
  52280. if (isDef(inlineTemplate)) {
  52281. options.render = inlineTemplate.render;
  52282. options.staticRenderFns = inlineTemplate.staticRenderFns;
  52283. }
  52284. return new vnode.componentOptions.Ctor(options)
  52285. }
  52286. function installComponentHooks (data) {
  52287. var hooks = data.hook || (data.hook = {});
  52288. for (var i = 0; i < hooksToMerge.length; i++) {
  52289. var key = hooksToMerge[i];
  52290. var existing = hooks[key];
  52291. var toMerge = componentVNodeHooks[key];
  52292. if (existing !== toMerge && !(existing && existing._merged)) {
  52293. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  52294. }
  52295. }
  52296. }
  52297. function mergeHook$1 (f1, f2) {
  52298. var merged = function (a, b) {
  52299. // flow complains about extra args which is why we use any
  52300. f1(a, b);
  52301. f2(a, b);
  52302. };
  52303. merged._merged = true;
  52304. return merged
  52305. }
  52306. // transform component v-model info (value and callback) into
  52307. // prop and event handler respectively.
  52308. function transformModel (options, data) {
  52309. var prop = (options.model && options.model.prop) || 'value';
  52310. var event = (options.model && options.model.event) || 'input'
  52311. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  52312. var on = data.on || (data.on = {});
  52313. var existing = on[event];
  52314. var callback = data.model.callback;
  52315. if (isDef(existing)) {
  52316. if (
  52317. Array.isArray(existing)
  52318. ? existing.indexOf(callback) === -1
  52319. : existing !== callback
  52320. ) {
  52321. on[event] = [callback].concat(existing);
  52322. }
  52323. } else {
  52324. on[event] = callback;
  52325. }
  52326. }
  52327. /* */
  52328. var SIMPLE_NORMALIZE = 1;
  52329. var ALWAYS_NORMALIZE = 2;
  52330. // wrapper function for providing a more flexible interface
  52331. // without getting yelled at by flow
  52332. function createElement (
  52333. context,
  52334. tag,
  52335. data,
  52336. children,
  52337. normalizationType,
  52338. alwaysNormalize
  52339. ) {
  52340. if (Array.isArray(data) || isPrimitive(data)) {
  52341. normalizationType = children;
  52342. children = data;
  52343. data = undefined;
  52344. }
  52345. if (isTrue(alwaysNormalize)) {
  52346. normalizationType = ALWAYS_NORMALIZE;
  52347. }
  52348. return _createElement(context, tag, data, children, normalizationType)
  52349. }
  52350. function _createElement (
  52351. context,
  52352. tag,
  52353. data,
  52354. children,
  52355. normalizationType
  52356. ) {
  52357. if (isDef(data) && isDef((data).__ob__)) {
  52358. warn(
  52359. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  52360. 'Always create fresh vnode data objects in each render!',
  52361. context
  52362. );
  52363. return createEmptyVNode()
  52364. }
  52365. // object syntax in v-bind
  52366. if (isDef(data) && isDef(data.is)) {
  52367. tag = data.is;
  52368. }
  52369. if (!tag) {
  52370. // in case of component :is set to falsy value
  52371. return createEmptyVNode()
  52372. }
  52373. // warn against non-primitive key
  52374. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  52375. ) {
  52376. {
  52377. warn(
  52378. 'Avoid using non-primitive value as key, ' +
  52379. 'use string/number value instead.',
  52380. context
  52381. );
  52382. }
  52383. }
  52384. // support single function children as default scoped slot
  52385. if (Array.isArray(children) &&
  52386. typeof children[0] === 'function'
  52387. ) {
  52388. data = data || {};
  52389. data.scopedSlots = { default: children[0] };
  52390. children.length = 0;
  52391. }
  52392. if (normalizationType === ALWAYS_NORMALIZE) {
  52393. children = normalizeChildren(children);
  52394. } else if (normalizationType === SIMPLE_NORMALIZE) {
  52395. children = simpleNormalizeChildren(children);
  52396. }
  52397. var vnode, ns;
  52398. if (typeof tag === 'string') {
  52399. var Ctor;
  52400. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  52401. if (config.isReservedTag(tag)) {
  52402. // platform built-in elements
  52403. if (isDef(data) && isDef(data.nativeOn)) {
  52404. warn(
  52405. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  52406. context
  52407. );
  52408. }
  52409. vnode = new VNode(
  52410. config.parsePlatformTagName(tag), data, children,
  52411. undefined, undefined, context
  52412. );
  52413. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  52414. // component
  52415. vnode = createComponent(Ctor, data, context, children, tag);
  52416. } else {
  52417. // unknown or unlisted namespaced elements
  52418. // check at runtime because it may get assigned a namespace when its
  52419. // parent normalizes children
  52420. vnode = new VNode(
  52421. tag, data, children,
  52422. undefined, undefined, context
  52423. );
  52424. }
  52425. } else {
  52426. // direct component options / constructor
  52427. vnode = createComponent(tag, data, context, children);
  52428. }
  52429. if (Array.isArray(vnode)) {
  52430. return vnode
  52431. } else if (isDef(vnode)) {
  52432. if (isDef(ns)) { applyNS(vnode, ns); }
  52433. if (isDef(data)) { registerDeepBindings(data); }
  52434. return vnode
  52435. } else {
  52436. return createEmptyVNode()
  52437. }
  52438. }
  52439. function applyNS (vnode, ns, force) {
  52440. vnode.ns = ns;
  52441. if (vnode.tag === 'foreignObject') {
  52442. // use default namespace inside foreignObject
  52443. ns = undefined;
  52444. force = true;
  52445. }
  52446. if (isDef(vnode.children)) {
  52447. for (var i = 0, l = vnode.children.length; i < l; i++) {
  52448. var child = vnode.children[i];
  52449. if (isDef(child.tag) && (
  52450. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  52451. applyNS(child, ns, force);
  52452. }
  52453. }
  52454. }
  52455. }
  52456. // ref #5318
  52457. // necessary to ensure parent re-render when deep bindings like :style and
  52458. // :class are used on slot nodes
  52459. function registerDeepBindings (data) {
  52460. if (isObject(data.style)) {
  52461. traverse(data.style);
  52462. }
  52463. if (isObject(data.class)) {
  52464. traverse(data.class);
  52465. }
  52466. }
  52467. /* */
  52468. function initRender (vm) {
  52469. vm._vnode = null; // the root of the child tree
  52470. vm._staticTrees = null; // v-once cached trees
  52471. var options = vm.$options;
  52472. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  52473. var renderContext = parentVnode && parentVnode.context;
  52474. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  52475. vm.$scopedSlots = emptyObject;
  52476. // bind the createElement fn to this instance
  52477. // so that we get proper render context inside it.
  52478. // args order: tag, data, children, normalizationType, alwaysNormalize
  52479. // internal version is used by render functions compiled from templates
  52480. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  52481. // normalization is always applied for the public version, used in
  52482. // user-written render functions.
  52483. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  52484. // $attrs & $listeners are exposed for easier HOC creation.
  52485. // they need to be reactive so that HOCs using them are always updated
  52486. var parentData = parentVnode && parentVnode.data;
  52487. /* istanbul ignore else */
  52488. {
  52489. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  52490. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  52491. }, true);
  52492. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  52493. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  52494. }, true);
  52495. }
  52496. }
  52497. var currentRenderingInstance = null;
  52498. function renderMixin (Vue) {
  52499. // install runtime convenience helpers
  52500. installRenderHelpers(Vue.prototype);
  52501. Vue.prototype.$nextTick = function (fn) {
  52502. return nextTick(fn, this)
  52503. };
  52504. Vue.prototype._render = function () {
  52505. var vm = this;
  52506. var ref = vm.$options;
  52507. var render = ref.render;
  52508. var _parentVnode = ref._parentVnode;
  52509. if (_parentVnode) {
  52510. vm.$scopedSlots = normalizeScopedSlots(
  52511. _parentVnode.data.scopedSlots,
  52512. vm.$slots,
  52513. vm.$scopedSlots
  52514. );
  52515. }
  52516. // set parent vnode. this allows render functions to have access
  52517. // to the data on the placeholder node.
  52518. vm.$vnode = _parentVnode;
  52519. // render self
  52520. var vnode;
  52521. try {
  52522. // There's no need to maintain a stack because all render fns are called
  52523. // separately from one another. Nested component's render fns are called
  52524. // when parent component is patched.
  52525. currentRenderingInstance = vm;
  52526. vnode = render.call(vm._renderProxy, vm.$createElement);
  52527. } catch (e) {
  52528. handleError(e, vm, "render");
  52529. // return error render result,
  52530. // or previous vnode to prevent render error causing blank component
  52531. /* istanbul ignore else */
  52532. if (vm.$options.renderError) {
  52533. try {
  52534. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  52535. } catch (e) {
  52536. handleError(e, vm, "renderError");
  52537. vnode = vm._vnode;
  52538. }
  52539. } else {
  52540. vnode = vm._vnode;
  52541. }
  52542. } finally {
  52543. currentRenderingInstance = null;
  52544. }
  52545. // if the returned array contains only a single node, allow it
  52546. if (Array.isArray(vnode) && vnode.length === 1) {
  52547. vnode = vnode[0];
  52548. }
  52549. // return empty vnode in case the render function errored out
  52550. if (!(vnode instanceof VNode)) {
  52551. if (Array.isArray(vnode)) {
  52552. warn(
  52553. 'Multiple root nodes returned from render function. Render function ' +
  52554. 'should return a single root node.',
  52555. vm
  52556. );
  52557. }
  52558. vnode = createEmptyVNode();
  52559. }
  52560. // set parent
  52561. vnode.parent = _parentVnode;
  52562. return vnode
  52563. };
  52564. }
  52565. /* */
  52566. function ensureCtor (comp, base) {
  52567. if (
  52568. comp.__esModule ||
  52569. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  52570. ) {
  52571. comp = comp.default;
  52572. }
  52573. return isObject(comp)
  52574. ? base.extend(comp)
  52575. : comp
  52576. }
  52577. function createAsyncPlaceholder (
  52578. factory,
  52579. data,
  52580. context,
  52581. children,
  52582. tag
  52583. ) {
  52584. var node = createEmptyVNode();
  52585. node.asyncFactory = factory;
  52586. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  52587. return node
  52588. }
  52589. function resolveAsyncComponent (
  52590. factory,
  52591. baseCtor
  52592. ) {
  52593. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  52594. return factory.errorComp
  52595. }
  52596. if (isDef(factory.resolved)) {
  52597. return factory.resolved
  52598. }
  52599. var owner = currentRenderingInstance;
  52600. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  52601. // already pending
  52602. factory.owners.push(owner);
  52603. }
  52604. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  52605. return factory.loadingComp
  52606. }
  52607. if (owner && !isDef(factory.owners)) {
  52608. var owners = factory.owners = [owner];
  52609. var sync = true;
  52610. var timerLoading = null;
  52611. var timerTimeout = null
  52612. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  52613. var forceRender = function (renderCompleted) {
  52614. for (var i = 0, l = owners.length; i < l; i++) {
  52615. (owners[i]).$forceUpdate();
  52616. }
  52617. if (renderCompleted) {
  52618. owners.length = 0;
  52619. if (timerLoading !== null) {
  52620. clearTimeout(timerLoading);
  52621. timerLoading = null;
  52622. }
  52623. if (timerTimeout !== null) {
  52624. clearTimeout(timerTimeout);
  52625. timerTimeout = null;
  52626. }
  52627. }
  52628. };
  52629. var resolve = once(function (res) {
  52630. // cache resolved
  52631. factory.resolved = ensureCtor(res, baseCtor);
  52632. // invoke callbacks only if this is not a synchronous resolve
  52633. // (async resolves are shimmed as synchronous during SSR)
  52634. if (!sync) {
  52635. forceRender(true);
  52636. } else {
  52637. owners.length = 0;
  52638. }
  52639. });
  52640. var reject = once(function (reason) {
  52641. warn(
  52642. "Failed to resolve async component: " + (String(factory)) +
  52643. (reason ? ("\nReason: " + reason) : '')
  52644. );
  52645. if (isDef(factory.errorComp)) {
  52646. factory.error = true;
  52647. forceRender(true);
  52648. }
  52649. });
  52650. var res = factory(resolve, reject);
  52651. if (isObject(res)) {
  52652. if (isPromise(res)) {
  52653. // () => Promise
  52654. if (isUndef(factory.resolved)) {
  52655. res.then(resolve, reject);
  52656. }
  52657. } else if (isPromise(res.component)) {
  52658. res.component.then(resolve, reject);
  52659. if (isDef(res.error)) {
  52660. factory.errorComp = ensureCtor(res.error, baseCtor);
  52661. }
  52662. if (isDef(res.loading)) {
  52663. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  52664. if (res.delay === 0) {
  52665. factory.loading = true;
  52666. } else {
  52667. timerLoading = setTimeout(function () {
  52668. timerLoading = null;
  52669. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  52670. factory.loading = true;
  52671. forceRender(false);
  52672. }
  52673. }, res.delay || 200);
  52674. }
  52675. }
  52676. if (isDef(res.timeout)) {
  52677. timerTimeout = setTimeout(function () {
  52678. timerTimeout = null;
  52679. if (isUndef(factory.resolved)) {
  52680. reject(
  52681. "timeout (" + (res.timeout) + "ms)"
  52682. );
  52683. }
  52684. }, res.timeout);
  52685. }
  52686. }
  52687. }
  52688. sync = false;
  52689. // return in case resolved synchronously
  52690. return factory.loading
  52691. ? factory.loadingComp
  52692. : factory.resolved
  52693. }
  52694. }
  52695. /* */
  52696. function isAsyncPlaceholder (node) {
  52697. return node.isComment && node.asyncFactory
  52698. }
  52699. /* */
  52700. function getFirstComponentChild (children) {
  52701. if (Array.isArray(children)) {
  52702. for (var i = 0; i < children.length; i++) {
  52703. var c = children[i];
  52704. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  52705. return c
  52706. }
  52707. }
  52708. }
  52709. }
  52710. /* */
  52711. /* */
  52712. function initEvents (vm) {
  52713. vm._events = Object.create(null);
  52714. vm._hasHookEvent = false;
  52715. // init parent attached events
  52716. var listeners = vm.$options._parentListeners;
  52717. if (listeners) {
  52718. updateComponentListeners(vm, listeners);
  52719. }
  52720. }
  52721. var target;
  52722. function add (event, fn) {
  52723. target.$on(event, fn);
  52724. }
  52725. function remove$1 (event, fn) {
  52726. target.$off(event, fn);
  52727. }
  52728. function createOnceHandler (event, fn) {
  52729. var _target = target;
  52730. return function onceHandler () {
  52731. var res = fn.apply(null, arguments);
  52732. if (res !== null) {
  52733. _target.$off(event, onceHandler);
  52734. }
  52735. }
  52736. }
  52737. function updateComponentListeners (
  52738. vm,
  52739. listeners,
  52740. oldListeners
  52741. ) {
  52742. target = vm;
  52743. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  52744. target = undefined;
  52745. }
  52746. function eventsMixin (Vue) {
  52747. var hookRE = /^hook:/;
  52748. Vue.prototype.$on = function (event, fn) {
  52749. var vm = this;
  52750. if (Array.isArray(event)) {
  52751. for (var i = 0, l = event.length; i < l; i++) {
  52752. vm.$on(event[i], fn);
  52753. }
  52754. } else {
  52755. (vm._events[event] || (vm._events[event] = [])).push(fn);
  52756. // optimize hook:event cost by using a boolean flag marked at registration
  52757. // instead of a hash lookup
  52758. if (hookRE.test(event)) {
  52759. vm._hasHookEvent = true;
  52760. }
  52761. }
  52762. return vm
  52763. };
  52764. Vue.prototype.$once = function (event, fn) {
  52765. var vm = this;
  52766. function on () {
  52767. vm.$off(event, on);
  52768. fn.apply(vm, arguments);
  52769. }
  52770. on.fn = fn;
  52771. vm.$on(event, on);
  52772. return vm
  52773. };
  52774. Vue.prototype.$off = function (event, fn) {
  52775. var vm = this;
  52776. // all
  52777. if (!arguments.length) {
  52778. vm._events = Object.create(null);
  52779. return vm
  52780. }
  52781. // array of events
  52782. if (Array.isArray(event)) {
  52783. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  52784. vm.$off(event[i$1], fn);
  52785. }
  52786. return vm
  52787. }
  52788. // specific event
  52789. var cbs = vm._events[event];
  52790. if (!cbs) {
  52791. return vm
  52792. }
  52793. if (!fn) {
  52794. vm._events[event] = null;
  52795. return vm
  52796. }
  52797. // specific handler
  52798. var cb;
  52799. var i = cbs.length;
  52800. while (i--) {
  52801. cb = cbs[i];
  52802. if (cb === fn || cb.fn === fn) {
  52803. cbs.splice(i, 1);
  52804. break
  52805. }
  52806. }
  52807. return vm
  52808. };
  52809. Vue.prototype.$emit = function (event) {
  52810. var vm = this;
  52811. {
  52812. var lowerCaseEvent = event.toLowerCase();
  52813. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  52814. tip(
  52815. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  52816. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  52817. "Note that HTML attributes are case-insensitive and you cannot use " +
  52818. "v-on to listen to camelCase events when using in-DOM templates. " +
  52819. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  52820. );
  52821. }
  52822. }
  52823. var cbs = vm._events[event];
  52824. if (cbs) {
  52825. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  52826. var args = toArray(arguments, 1);
  52827. var info = "event handler for \"" + event + "\"";
  52828. for (var i = 0, l = cbs.length; i < l; i++) {
  52829. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  52830. }
  52831. }
  52832. return vm
  52833. };
  52834. }
  52835. /* */
  52836. var activeInstance = null;
  52837. var isUpdatingChildComponent = false;
  52838. function setActiveInstance(vm) {
  52839. var prevActiveInstance = activeInstance;
  52840. activeInstance = vm;
  52841. return function () {
  52842. activeInstance = prevActiveInstance;
  52843. }
  52844. }
  52845. function initLifecycle (vm) {
  52846. var options = vm.$options;
  52847. // locate first non-abstract parent
  52848. var parent = options.parent;
  52849. if (parent && !options.abstract) {
  52850. while (parent.$options.abstract && parent.$parent) {
  52851. parent = parent.$parent;
  52852. }
  52853. parent.$children.push(vm);
  52854. }
  52855. vm.$parent = parent;
  52856. vm.$root = parent ? parent.$root : vm;
  52857. vm.$children = [];
  52858. vm.$refs = {};
  52859. vm._watcher = null;
  52860. vm._inactive = null;
  52861. vm._directInactive = false;
  52862. vm._isMounted = false;
  52863. vm._isDestroyed = false;
  52864. vm._isBeingDestroyed = false;
  52865. }
  52866. function lifecycleMixin (Vue) {
  52867. Vue.prototype._update = function (vnode, hydrating) {
  52868. var vm = this;
  52869. var prevEl = vm.$el;
  52870. var prevVnode = vm._vnode;
  52871. var restoreActiveInstance = setActiveInstance(vm);
  52872. vm._vnode = vnode;
  52873. // Vue.prototype.__patch__ is injected in entry points
  52874. // based on the rendering backend used.
  52875. if (!prevVnode) {
  52876. // initial render
  52877. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  52878. } else {
  52879. // updates
  52880. vm.$el = vm.__patch__(prevVnode, vnode);
  52881. }
  52882. restoreActiveInstance();
  52883. // update __vue__ reference
  52884. if (prevEl) {
  52885. prevEl.__vue__ = null;
  52886. }
  52887. if (vm.$el) {
  52888. vm.$el.__vue__ = vm;
  52889. }
  52890. // if parent is an HOC, update its $el as well
  52891. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  52892. vm.$parent.$el = vm.$el;
  52893. }
  52894. // updated hook is called by the scheduler to ensure that children are
  52895. // updated in a parent's updated hook.
  52896. };
  52897. Vue.prototype.$forceUpdate = function () {
  52898. var vm = this;
  52899. if (vm._watcher) {
  52900. vm._watcher.update();
  52901. }
  52902. };
  52903. Vue.prototype.$destroy = function () {
  52904. var vm = this;
  52905. if (vm._isBeingDestroyed) {
  52906. return
  52907. }
  52908. callHook(vm, 'beforeDestroy');
  52909. vm._isBeingDestroyed = true;
  52910. // remove self from parent
  52911. var parent = vm.$parent;
  52912. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  52913. remove(parent.$children, vm);
  52914. }
  52915. // teardown watchers
  52916. if (vm._watcher) {
  52917. vm._watcher.teardown();
  52918. }
  52919. var i = vm._watchers.length;
  52920. while (i--) {
  52921. vm._watchers[i].teardown();
  52922. }
  52923. // remove reference from data ob
  52924. // frozen object may not have observer.
  52925. if (vm._data.__ob__) {
  52926. vm._data.__ob__.vmCount--;
  52927. }
  52928. // call the last hook...
  52929. vm._isDestroyed = true;
  52930. // invoke destroy hooks on current rendered tree
  52931. vm.__patch__(vm._vnode, null);
  52932. // fire destroyed hook
  52933. callHook(vm, 'destroyed');
  52934. // turn off all instance listeners.
  52935. vm.$off();
  52936. // remove __vue__ reference
  52937. if (vm.$el) {
  52938. vm.$el.__vue__ = null;
  52939. }
  52940. // release circular reference (#6759)
  52941. if (vm.$vnode) {
  52942. vm.$vnode.parent = null;
  52943. }
  52944. };
  52945. }
  52946. function mountComponent (
  52947. vm,
  52948. el,
  52949. hydrating
  52950. ) {
  52951. vm.$el = el;
  52952. if (!vm.$options.render) {
  52953. vm.$options.render = createEmptyVNode;
  52954. {
  52955. /* istanbul ignore if */
  52956. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  52957. vm.$options.el || el) {
  52958. warn(
  52959. 'You are using the runtime-only build of Vue where the template ' +
  52960. 'compiler is not available. Either pre-compile the templates into ' +
  52961. 'render functions, or use the compiler-included build.',
  52962. vm
  52963. );
  52964. } else {
  52965. warn(
  52966. 'Failed to mount component: template or render function not defined.',
  52967. vm
  52968. );
  52969. }
  52970. }
  52971. }
  52972. callHook(vm, 'beforeMount');
  52973. var updateComponent;
  52974. /* istanbul ignore if */
  52975. if (config.performance && mark) {
  52976. updateComponent = function () {
  52977. var name = vm._name;
  52978. var id = vm._uid;
  52979. var startTag = "vue-perf-start:" + id;
  52980. var endTag = "vue-perf-end:" + id;
  52981. mark(startTag);
  52982. var vnode = vm._render();
  52983. mark(endTag);
  52984. measure(("vue " + name + " render"), startTag, endTag);
  52985. mark(startTag);
  52986. vm._update(vnode, hydrating);
  52987. mark(endTag);
  52988. measure(("vue " + name + " patch"), startTag, endTag);
  52989. };
  52990. } else {
  52991. updateComponent = function () {
  52992. vm._update(vm._render(), hydrating);
  52993. };
  52994. }
  52995. // we set this to vm._watcher inside the watcher's constructor
  52996. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  52997. // component's mounted hook), which relies on vm._watcher being already defined
  52998. new Watcher(vm, updateComponent, noop, {
  52999. before: function before () {
  53000. if (vm._isMounted && !vm._isDestroyed) {
  53001. callHook(vm, 'beforeUpdate');
  53002. }
  53003. }
  53004. }, true /* isRenderWatcher */);
  53005. hydrating = false;
  53006. // manually mounted instance, call mounted on self
  53007. // mounted is called for render-created child components in its inserted hook
  53008. if (vm.$vnode == null) {
  53009. vm._isMounted = true;
  53010. callHook(vm, 'mounted');
  53011. }
  53012. return vm
  53013. }
  53014. function updateChildComponent (
  53015. vm,
  53016. propsData,
  53017. listeners,
  53018. parentVnode,
  53019. renderChildren
  53020. ) {
  53021. {
  53022. isUpdatingChildComponent = true;
  53023. }
  53024. // determine whether component has slot children
  53025. // we need to do this before overwriting $options._renderChildren.
  53026. // check if there are dynamic scopedSlots (hand-written or compiled but with
  53027. // dynamic slot names). Static scoped slots compiled from template has the
  53028. // "$stable" marker.
  53029. var newScopedSlots = parentVnode.data.scopedSlots;
  53030. var oldScopedSlots = vm.$scopedSlots;
  53031. var hasDynamicScopedSlot = !!(
  53032. (newScopedSlots && !newScopedSlots.$stable) ||
  53033. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  53034. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  53035. );
  53036. // Any static slot children from the parent may have changed during parent's
  53037. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  53038. // update is necessary to ensure correctness.
  53039. var needsForceUpdate = !!(
  53040. renderChildren || // has new static slots
  53041. vm.$options._renderChildren || // has old static slots
  53042. hasDynamicScopedSlot
  53043. );
  53044. vm.$options._parentVnode = parentVnode;
  53045. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  53046. if (vm._vnode) { // update child tree's parent
  53047. vm._vnode.parent = parentVnode;
  53048. }
  53049. vm.$options._renderChildren = renderChildren;
  53050. // update $attrs and $listeners hash
  53051. // these are also reactive so they may trigger child update if the child
  53052. // used them during render
  53053. vm.$attrs = parentVnode.data.attrs || emptyObject;
  53054. vm.$listeners = listeners || emptyObject;
  53055. // update props
  53056. if (propsData && vm.$options.props) {
  53057. toggleObserving(false);
  53058. var props = vm._props;
  53059. var propKeys = vm.$options._propKeys || [];
  53060. for (var i = 0; i < propKeys.length; i++) {
  53061. var key = propKeys[i];
  53062. var propOptions = vm.$options.props; // wtf flow?
  53063. props[key] = validateProp(key, propOptions, propsData, vm);
  53064. }
  53065. toggleObserving(true);
  53066. // keep a copy of raw propsData
  53067. vm.$options.propsData = propsData;
  53068. }
  53069. // update listeners
  53070. listeners = listeners || emptyObject;
  53071. var oldListeners = vm.$options._parentListeners;
  53072. vm.$options._parentListeners = listeners;
  53073. updateComponentListeners(vm, listeners, oldListeners);
  53074. // resolve slots + force update if has children
  53075. if (needsForceUpdate) {
  53076. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  53077. vm.$forceUpdate();
  53078. }
  53079. {
  53080. isUpdatingChildComponent = false;
  53081. }
  53082. }
  53083. function isInInactiveTree (vm) {
  53084. while (vm && (vm = vm.$parent)) {
  53085. if (vm._inactive) { return true }
  53086. }
  53087. return false
  53088. }
  53089. function activateChildComponent (vm, direct) {
  53090. if (direct) {
  53091. vm._directInactive = false;
  53092. if (isInInactiveTree(vm)) {
  53093. return
  53094. }
  53095. } else if (vm._directInactive) {
  53096. return
  53097. }
  53098. if (vm._inactive || vm._inactive === null) {
  53099. vm._inactive = false;
  53100. for (var i = 0; i < vm.$children.length; i++) {
  53101. activateChildComponent(vm.$children[i]);
  53102. }
  53103. callHook(vm, 'activated');
  53104. }
  53105. }
  53106. function deactivateChildComponent (vm, direct) {
  53107. if (direct) {
  53108. vm._directInactive = true;
  53109. if (isInInactiveTree(vm)) {
  53110. return
  53111. }
  53112. }
  53113. if (!vm._inactive) {
  53114. vm._inactive = true;
  53115. for (var i = 0; i < vm.$children.length; i++) {
  53116. deactivateChildComponent(vm.$children[i]);
  53117. }
  53118. callHook(vm, 'deactivated');
  53119. }
  53120. }
  53121. function callHook (vm, hook) {
  53122. // #7573 disable dep collection when invoking lifecycle hooks
  53123. pushTarget();
  53124. var handlers = vm.$options[hook];
  53125. var info = hook + " hook";
  53126. if (handlers) {
  53127. for (var i = 0, j = handlers.length; i < j; i++) {
  53128. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  53129. }
  53130. }
  53131. if (vm._hasHookEvent) {
  53132. vm.$emit('hook:' + hook);
  53133. }
  53134. popTarget();
  53135. }
  53136. /* */
  53137. var MAX_UPDATE_COUNT = 100;
  53138. var queue = [];
  53139. var activatedChildren = [];
  53140. var has = {};
  53141. var circular = {};
  53142. var waiting = false;
  53143. var flushing = false;
  53144. var index = 0;
  53145. /**
  53146. * Reset the scheduler's state.
  53147. */
  53148. function resetSchedulerState () {
  53149. index = queue.length = activatedChildren.length = 0;
  53150. has = {};
  53151. {
  53152. circular = {};
  53153. }
  53154. waiting = flushing = false;
  53155. }
  53156. // Async edge case #6566 requires saving the timestamp when event listeners are
  53157. // attached. However, calling performance.now() has a perf overhead especially
  53158. // if the page has thousands of event listeners. Instead, we take a timestamp
  53159. // every time the scheduler flushes and use that for all event listeners
  53160. // attached during that flush.
  53161. var currentFlushTimestamp = 0;
  53162. // Async edge case fix requires storing an event listener's attach timestamp.
  53163. var getNow = Date.now;
  53164. // Determine what event timestamp the browser is using. Annoyingly, the
  53165. // timestamp can either be hi-res (relative to page load) or low-res
  53166. // (relative to UNIX epoch), so in order to compare time we have to use the
  53167. // same timestamp type when saving the flush timestamp.
  53168. // All IE versions use low-res event timestamps, and have problematic clock
  53169. // implementations (#9632)
  53170. if (inBrowser && !isIE) {
  53171. var performance = window.performance;
  53172. if (
  53173. performance &&
  53174. typeof performance.now === 'function' &&
  53175. getNow() > document.createEvent('Event').timeStamp
  53176. ) {
  53177. // if the event timestamp, although evaluated AFTER the Date.now(), is
  53178. // smaller than it, it means the event is using a hi-res timestamp,
  53179. // and we need to use the hi-res version for event listener timestamps as
  53180. // well.
  53181. getNow = function () { return performance.now(); };
  53182. }
  53183. }
  53184. /**
  53185. * Flush both queues and run the watchers.
  53186. */
  53187. function flushSchedulerQueue () {
  53188. currentFlushTimestamp = getNow();
  53189. flushing = true;
  53190. var watcher, id;
  53191. // Sort queue before flush.
  53192. // This ensures that:
  53193. // 1. Components are updated from parent to child. (because parent is always
  53194. // created before the child)
  53195. // 2. A component's user watchers are run before its render watcher (because
  53196. // user watchers are created before the render watcher)
  53197. // 3. If a component is destroyed during a parent component's watcher run,
  53198. // its watchers can be skipped.
  53199. queue.sort(function (a, b) { return a.id - b.id; });
  53200. // do not cache length because more watchers might be pushed
  53201. // as we run existing watchers
  53202. for (index = 0; index < queue.length; index++) {
  53203. watcher = queue[index];
  53204. if (watcher.before) {
  53205. watcher.before();
  53206. }
  53207. id = watcher.id;
  53208. has[id] = null;
  53209. watcher.run();
  53210. // in dev build, check and stop circular updates.
  53211. if (has[id] != null) {
  53212. circular[id] = (circular[id] || 0) + 1;
  53213. if (circular[id] > MAX_UPDATE_COUNT) {
  53214. warn(
  53215. 'You may have an infinite update loop ' + (
  53216. watcher.user
  53217. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  53218. : "in a component render function."
  53219. ),
  53220. watcher.vm
  53221. );
  53222. break
  53223. }
  53224. }
  53225. }
  53226. // keep copies of post queues before resetting state
  53227. var activatedQueue = activatedChildren.slice();
  53228. var updatedQueue = queue.slice();
  53229. resetSchedulerState();
  53230. // call component updated and activated hooks
  53231. callActivatedHooks(activatedQueue);
  53232. callUpdatedHooks(updatedQueue);
  53233. // devtool hook
  53234. /* istanbul ignore if */
  53235. if (devtools && config.devtools) {
  53236. devtools.emit('flush');
  53237. }
  53238. }
  53239. function callUpdatedHooks (queue) {
  53240. var i = queue.length;
  53241. while (i--) {
  53242. var watcher = queue[i];
  53243. var vm = watcher.vm;
  53244. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  53245. callHook(vm, 'updated');
  53246. }
  53247. }
  53248. }
  53249. /**
  53250. * Queue a kept-alive component that was activated during patch.
  53251. * The queue will be processed after the entire tree has been patched.
  53252. */
  53253. function queueActivatedComponent (vm) {
  53254. // setting _inactive to false here so that a render function can
  53255. // rely on checking whether it's in an inactive tree (e.g. router-view)
  53256. vm._inactive = false;
  53257. activatedChildren.push(vm);
  53258. }
  53259. function callActivatedHooks (queue) {
  53260. for (var i = 0; i < queue.length; i++) {
  53261. queue[i]._inactive = true;
  53262. activateChildComponent(queue[i], true /* true */);
  53263. }
  53264. }
  53265. /**
  53266. * Push a watcher into the watcher queue.
  53267. * Jobs with duplicate IDs will be skipped unless it's
  53268. * pushed when the queue is being flushed.
  53269. */
  53270. function queueWatcher (watcher) {
  53271. var id = watcher.id;
  53272. if (has[id] == null) {
  53273. has[id] = true;
  53274. if (!flushing) {
  53275. queue.push(watcher);
  53276. } else {
  53277. // if already flushing, splice the watcher based on its id
  53278. // if already past its id, it will be run next immediately.
  53279. var i = queue.length - 1;
  53280. while (i > index && queue[i].id > watcher.id) {
  53281. i--;
  53282. }
  53283. queue.splice(i + 1, 0, watcher);
  53284. }
  53285. // queue the flush
  53286. if (!waiting) {
  53287. waiting = true;
  53288. if (!config.async) {
  53289. flushSchedulerQueue();
  53290. return
  53291. }
  53292. nextTick(flushSchedulerQueue);
  53293. }
  53294. }
  53295. }
  53296. /* */
  53297. var uid$2 = 0;
  53298. /**
  53299. * A watcher parses an expression, collects dependencies,
  53300. * and fires callback when the expression value changes.
  53301. * This is used for both the $watch() api and directives.
  53302. */
  53303. var Watcher = function Watcher (
  53304. vm,
  53305. expOrFn,
  53306. cb,
  53307. options,
  53308. isRenderWatcher
  53309. ) {
  53310. this.vm = vm;
  53311. if (isRenderWatcher) {
  53312. vm._watcher = this;
  53313. }
  53314. vm._watchers.push(this);
  53315. // options
  53316. if (options) {
  53317. this.deep = !!options.deep;
  53318. this.user = !!options.user;
  53319. this.lazy = !!options.lazy;
  53320. this.sync = !!options.sync;
  53321. this.before = options.before;
  53322. } else {
  53323. this.deep = this.user = this.lazy = this.sync = false;
  53324. }
  53325. this.cb = cb;
  53326. this.id = ++uid$2; // uid for batching
  53327. this.active = true;
  53328. this.dirty = this.lazy; // for lazy watchers
  53329. this.deps = [];
  53330. this.newDeps = [];
  53331. this.depIds = new _Set();
  53332. this.newDepIds = new _Set();
  53333. this.expression = expOrFn.toString();
  53334. // parse expression for getter
  53335. if (typeof expOrFn === 'function') {
  53336. this.getter = expOrFn;
  53337. } else {
  53338. this.getter = parsePath(expOrFn);
  53339. if (!this.getter) {
  53340. this.getter = noop;
  53341. warn(
  53342. "Failed watching path: \"" + expOrFn + "\" " +
  53343. 'Watcher only accepts simple dot-delimited paths. ' +
  53344. 'For full control, use a function instead.',
  53345. vm
  53346. );
  53347. }
  53348. }
  53349. this.value = this.lazy
  53350. ? undefined
  53351. : this.get();
  53352. };
  53353. /**
  53354. * Evaluate the getter, and re-collect dependencies.
  53355. */
  53356. Watcher.prototype.get = function get () {
  53357. pushTarget(this);
  53358. var value;
  53359. var vm = this.vm;
  53360. try {
  53361. value = this.getter.call(vm, vm);
  53362. } catch (e) {
  53363. if (this.user) {
  53364. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  53365. } else {
  53366. throw e
  53367. }
  53368. } finally {
  53369. // "touch" every property so they are all tracked as
  53370. // dependencies for deep watching
  53371. if (this.deep) {
  53372. traverse(value);
  53373. }
  53374. popTarget();
  53375. this.cleanupDeps();
  53376. }
  53377. return value
  53378. };
  53379. /**
  53380. * Add a dependency to this directive.
  53381. */
  53382. Watcher.prototype.addDep = function addDep (dep) {
  53383. var id = dep.id;
  53384. if (!this.newDepIds.has(id)) {
  53385. this.newDepIds.add(id);
  53386. this.newDeps.push(dep);
  53387. if (!this.depIds.has(id)) {
  53388. dep.addSub(this);
  53389. }
  53390. }
  53391. };
  53392. /**
  53393. * Clean up for dependency collection.
  53394. */
  53395. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  53396. var i = this.deps.length;
  53397. while (i--) {
  53398. var dep = this.deps[i];
  53399. if (!this.newDepIds.has(dep.id)) {
  53400. dep.removeSub(this);
  53401. }
  53402. }
  53403. var tmp = this.depIds;
  53404. this.depIds = this.newDepIds;
  53405. this.newDepIds = tmp;
  53406. this.newDepIds.clear();
  53407. tmp = this.deps;
  53408. this.deps = this.newDeps;
  53409. this.newDeps = tmp;
  53410. this.newDeps.length = 0;
  53411. };
  53412. /**
  53413. * Subscriber interface.
  53414. * Will be called when a dependency changes.
  53415. */
  53416. Watcher.prototype.update = function update () {
  53417. /* istanbul ignore else */
  53418. if (this.lazy) {
  53419. this.dirty = true;
  53420. } else if (this.sync) {
  53421. this.run();
  53422. } else {
  53423. queueWatcher(this);
  53424. }
  53425. };
  53426. /**
  53427. * Scheduler job interface.
  53428. * Will be called by the scheduler.
  53429. */
  53430. Watcher.prototype.run = function run () {
  53431. if (this.active) {
  53432. var value = this.get();
  53433. if (
  53434. value !== this.value ||
  53435. // Deep watchers and watchers on Object/Arrays should fire even
  53436. // when the value is the same, because the value may
  53437. // have mutated.
  53438. isObject(value) ||
  53439. this.deep
  53440. ) {
  53441. // set new value
  53442. var oldValue = this.value;
  53443. this.value = value;
  53444. if (this.user) {
  53445. try {
  53446. this.cb.call(this.vm, value, oldValue);
  53447. } catch (e) {
  53448. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  53449. }
  53450. } else {
  53451. this.cb.call(this.vm, value, oldValue);
  53452. }
  53453. }
  53454. }
  53455. };
  53456. /**
  53457. * Evaluate the value of the watcher.
  53458. * This only gets called for lazy watchers.
  53459. */
  53460. Watcher.prototype.evaluate = function evaluate () {
  53461. this.value = this.get();
  53462. this.dirty = false;
  53463. };
  53464. /**
  53465. * Depend on all deps collected by this watcher.
  53466. */
  53467. Watcher.prototype.depend = function depend () {
  53468. var i = this.deps.length;
  53469. while (i--) {
  53470. this.deps[i].depend();
  53471. }
  53472. };
  53473. /**
  53474. * Remove self from all dependencies' subscriber list.
  53475. */
  53476. Watcher.prototype.teardown = function teardown () {
  53477. if (this.active) {
  53478. // remove self from vm's watcher list
  53479. // this is a somewhat expensive operation so we skip it
  53480. // if the vm is being destroyed.
  53481. if (!this.vm._isBeingDestroyed) {
  53482. remove(this.vm._watchers, this);
  53483. }
  53484. var i = this.deps.length;
  53485. while (i--) {
  53486. this.deps[i].removeSub(this);
  53487. }
  53488. this.active = false;
  53489. }
  53490. };
  53491. /* */
  53492. var sharedPropertyDefinition = {
  53493. enumerable: true,
  53494. configurable: true,
  53495. get: noop,
  53496. set: noop
  53497. };
  53498. function proxy (target, sourceKey, key) {
  53499. sharedPropertyDefinition.get = function proxyGetter () {
  53500. return this[sourceKey][key]
  53501. };
  53502. sharedPropertyDefinition.set = function proxySetter (val) {
  53503. this[sourceKey][key] = val;
  53504. };
  53505. Object.defineProperty(target, key, sharedPropertyDefinition);
  53506. }
  53507. function initState (vm) {
  53508. vm._watchers = [];
  53509. var opts = vm.$options;
  53510. if (opts.props) { initProps(vm, opts.props); }
  53511. if (opts.methods) { initMethods(vm, opts.methods); }
  53512. if (opts.data) {
  53513. initData(vm);
  53514. } else {
  53515. observe(vm._data = {}, true /* asRootData */);
  53516. }
  53517. if (opts.computed) { initComputed(vm, opts.computed); }
  53518. if (opts.watch && opts.watch !== nativeWatch) {
  53519. initWatch(vm, opts.watch);
  53520. }
  53521. }
  53522. function initProps (vm, propsOptions) {
  53523. var propsData = vm.$options.propsData || {};
  53524. var props = vm._props = {};
  53525. // cache prop keys so that future props updates can iterate using Array
  53526. // instead of dynamic object key enumeration.
  53527. var keys = vm.$options._propKeys = [];
  53528. var isRoot = !vm.$parent;
  53529. // root instance props should be converted
  53530. if (!isRoot) {
  53531. toggleObserving(false);
  53532. }
  53533. var loop = function ( key ) {
  53534. keys.push(key);
  53535. var value = validateProp(key, propsOptions, propsData, vm);
  53536. /* istanbul ignore else */
  53537. {
  53538. var hyphenatedKey = hyphenate(key);
  53539. if (isReservedAttribute(hyphenatedKey) ||
  53540. config.isReservedAttr(hyphenatedKey)) {
  53541. warn(
  53542. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  53543. vm
  53544. );
  53545. }
  53546. defineReactive$$1(props, key, value, function () {
  53547. if (!isRoot && !isUpdatingChildComponent) {
  53548. warn(
  53549. "Avoid mutating a prop directly since the value will be " +
  53550. "overwritten whenever the parent component re-renders. " +
  53551. "Instead, use a data or computed property based on the prop's " +
  53552. "value. Prop being mutated: \"" + key + "\"",
  53553. vm
  53554. );
  53555. }
  53556. });
  53557. }
  53558. // static props are already proxied on the component's prototype
  53559. // during Vue.extend(). We only need to proxy props defined at
  53560. // instantiation here.
  53561. if (!(key in vm)) {
  53562. proxy(vm, "_props", key);
  53563. }
  53564. };
  53565. for (var key in propsOptions) loop( key );
  53566. toggleObserving(true);
  53567. }
  53568. function initData (vm) {
  53569. var data = vm.$options.data;
  53570. data = vm._data = typeof data === 'function'
  53571. ? getData(data, vm)
  53572. : data || {};
  53573. if (!isPlainObject(data)) {
  53574. data = {};
  53575. warn(
  53576. 'data functions should return an object:\n' +
  53577. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  53578. vm
  53579. );
  53580. }
  53581. // proxy data on instance
  53582. var keys = Object.keys(data);
  53583. var props = vm.$options.props;
  53584. var methods = vm.$options.methods;
  53585. var i = keys.length;
  53586. while (i--) {
  53587. var key = keys[i];
  53588. {
  53589. if (methods && hasOwn(methods, key)) {
  53590. warn(
  53591. ("Method \"" + key + "\" has already been defined as a data property."),
  53592. vm
  53593. );
  53594. }
  53595. }
  53596. if (props && hasOwn(props, key)) {
  53597. warn(
  53598. "The data property \"" + key + "\" is already declared as a prop. " +
  53599. "Use prop default value instead.",
  53600. vm
  53601. );
  53602. } else if (!isReserved(key)) {
  53603. proxy(vm, "_data", key);
  53604. }
  53605. }
  53606. // observe data
  53607. observe(data, true /* asRootData */);
  53608. }
  53609. function getData (data, vm) {
  53610. // #7573 disable dep collection when invoking data getters
  53611. pushTarget();
  53612. try {
  53613. return data.call(vm, vm)
  53614. } catch (e) {
  53615. handleError(e, vm, "data()");
  53616. return {}
  53617. } finally {
  53618. popTarget();
  53619. }
  53620. }
  53621. var computedWatcherOptions = { lazy: true };
  53622. function initComputed (vm, computed) {
  53623. // $flow-disable-line
  53624. var watchers = vm._computedWatchers = Object.create(null);
  53625. // computed properties are just getters during SSR
  53626. var isSSR = isServerRendering();
  53627. for (var key in computed) {
  53628. var userDef = computed[key];
  53629. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  53630. if (getter == null) {
  53631. warn(
  53632. ("Getter is missing for computed property \"" + key + "\"."),
  53633. vm
  53634. );
  53635. }
  53636. if (!isSSR) {
  53637. // create internal watcher for the computed property.
  53638. watchers[key] = new Watcher(
  53639. vm,
  53640. getter || noop,
  53641. noop,
  53642. computedWatcherOptions
  53643. );
  53644. }
  53645. // component-defined computed properties are already defined on the
  53646. // component prototype. We only need to define computed properties defined
  53647. // at instantiation here.
  53648. if (!(key in vm)) {
  53649. defineComputed(vm, key, userDef);
  53650. } else {
  53651. if (key in vm.$data) {
  53652. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  53653. } else if (vm.$options.props && key in vm.$options.props) {
  53654. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  53655. }
  53656. }
  53657. }
  53658. }
  53659. function defineComputed (
  53660. target,
  53661. key,
  53662. userDef
  53663. ) {
  53664. var shouldCache = !isServerRendering();
  53665. if (typeof userDef === 'function') {
  53666. sharedPropertyDefinition.get = shouldCache
  53667. ? createComputedGetter(key)
  53668. : createGetterInvoker(userDef);
  53669. sharedPropertyDefinition.set = noop;
  53670. } else {
  53671. sharedPropertyDefinition.get = userDef.get
  53672. ? shouldCache && userDef.cache !== false
  53673. ? createComputedGetter(key)
  53674. : createGetterInvoker(userDef.get)
  53675. : noop;
  53676. sharedPropertyDefinition.set = userDef.set || noop;
  53677. }
  53678. if (sharedPropertyDefinition.set === noop) {
  53679. sharedPropertyDefinition.set = function () {
  53680. warn(
  53681. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  53682. this
  53683. );
  53684. };
  53685. }
  53686. Object.defineProperty(target, key, sharedPropertyDefinition);
  53687. }
  53688. function createComputedGetter (key) {
  53689. return function computedGetter () {
  53690. var watcher = this._computedWatchers && this._computedWatchers[key];
  53691. if (watcher) {
  53692. if (watcher.dirty) {
  53693. watcher.evaluate();
  53694. }
  53695. if (Dep.target) {
  53696. watcher.depend();
  53697. }
  53698. return watcher.value
  53699. }
  53700. }
  53701. }
  53702. function createGetterInvoker(fn) {
  53703. return function computedGetter () {
  53704. return fn.call(this, this)
  53705. }
  53706. }
  53707. function initMethods (vm, methods) {
  53708. var props = vm.$options.props;
  53709. for (var key in methods) {
  53710. {
  53711. if (typeof methods[key] !== 'function') {
  53712. warn(
  53713. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  53714. "Did you reference the function correctly?",
  53715. vm
  53716. );
  53717. }
  53718. if (props && hasOwn(props, key)) {
  53719. warn(
  53720. ("Method \"" + key + "\" has already been defined as a prop."),
  53721. vm
  53722. );
  53723. }
  53724. if ((key in vm) && isReserved(key)) {
  53725. warn(
  53726. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  53727. "Avoid defining component methods that start with _ or $."
  53728. );
  53729. }
  53730. }
  53731. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  53732. }
  53733. }
  53734. function initWatch (vm, watch) {
  53735. for (var key in watch) {
  53736. var handler = watch[key];
  53737. if (Array.isArray(handler)) {
  53738. for (var i = 0; i < handler.length; i++) {
  53739. createWatcher(vm, key, handler[i]);
  53740. }
  53741. } else {
  53742. createWatcher(vm, key, handler);
  53743. }
  53744. }
  53745. }
  53746. function createWatcher (
  53747. vm,
  53748. expOrFn,
  53749. handler,
  53750. options
  53751. ) {
  53752. if (isPlainObject(handler)) {
  53753. options = handler;
  53754. handler = handler.handler;
  53755. }
  53756. if (typeof handler === 'string') {
  53757. handler = vm[handler];
  53758. }
  53759. return vm.$watch(expOrFn, handler, options)
  53760. }
  53761. function stateMixin (Vue) {
  53762. // flow somehow has problems with directly declared definition object
  53763. // when using Object.defineProperty, so we have to procedurally build up
  53764. // the object here.
  53765. var dataDef = {};
  53766. dataDef.get = function () { return this._data };
  53767. var propsDef = {};
  53768. propsDef.get = function () { return this._props };
  53769. {
  53770. dataDef.set = function () {
  53771. warn(
  53772. 'Avoid replacing instance root $data. ' +
  53773. 'Use nested data properties instead.',
  53774. this
  53775. );
  53776. };
  53777. propsDef.set = function () {
  53778. warn("$props is readonly.", this);
  53779. };
  53780. }
  53781. Object.defineProperty(Vue.prototype, '$data', dataDef);
  53782. Object.defineProperty(Vue.prototype, '$props', propsDef);
  53783. Vue.prototype.$set = set;
  53784. Vue.prototype.$delete = del;
  53785. Vue.prototype.$watch = function (
  53786. expOrFn,
  53787. cb,
  53788. options
  53789. ) {
  53790. var vm = this;
  53791. if (isPlainObject(cb)) {
  53792. return createWatcher(vm, expOrFn, cb, options)
  53793. }
  53794. options = options || {};
  53795. options.user = true;
  53796. var watcher = new Watcher(vm, expOrFn, cb, options);
  53797. if (options.immediate) {
  53798. try {
  53799. cb.call(vm, watcher.value);
  53800. } catch (error) {
  53801. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  53802. }
  53803. }
  53804. return function unwatchFn () {
  53805. watcher.teardown();
  53806. }
  53807. };
  53808. }
  53809. /* */
  53810. var uid$3 = 0;
  53811. function initMixin (Vue) {
  53812. Vue.prototype._init = function (options) {
  53813. var vm = this;
  53814. // a uid
  53815. vm._uid = uid$3++;
  53816. var startTag, endTag;
  53817. /* istanbul ignore if */
  53818. if (config.performance && mark) {
  53819. startTag = "vue-perf-start:" + (vm._uid);
  53820. endTag = "vue-perf-end:" + (vm._uid);
  53821. mark(startTag);
  53822. }
  53823. // a flag to avoid this being observed
  53824. vm._isVue = true;
  53825. // merge options
  53826. if (options && options._isComponent) {
  53827. // optimize internal component instantiation
  53828. // since dynamic options merging is pretty slow, and none of the
  53829. // internal component options needs special treatment.
  53830. initInternalComponent(vm, options);
  53831. } else {
  53832. vm.$options = mergeOptions(
  53833. resolveConstructorOptions(vm.constructor),
  53834. options || {},
  53835. vm
  53836. );
  53837. }
  53838. /* istanbul ignore else */
  53839. {
  53840. initProxy(vm);
  53841. }
  53842. // expose real self
  53843. vm._self = vm;
  53844. initLifecycle(vm);
  53845. initEvents(vm);
  53846. initRender(vm);
  53847. callHook(vm, 'beforeCreate');
  53848. initInjections(vm); // resolve injections before data/props
  53849. initState(vm);
  53850. initProvide(vm); // resolve provide after data/props
  53851. callHook(vm, 'created');
  53852. /* istanbul ignore if */
  53853. if (config.performance && mark) {
  53854. vm._name = formatComponentName(vm, false);
  53855. mark(endTag);
  53856. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  53857. }
  53858. if (vm.$options.el) {
  53859. vm.$mount(vm.$options.el);
  53860. }
  53861. };
  53862. }
  53863. function initInternalComponent (vm, options) {
  53864. var opts = vm.$options = Object.create(vm.constructor.options);
  53865. // doing this because it's faster than dynamic enumeration.
  53866. var parentVnode = options._parentVnode;
  53867. opts.parent = options.parent;
  53868. opts._parentVnode = parentVnode;
  53869. var vnodeComponentOptions = parentVnode.componentOptions;
  53870. opts.propsData = vnodeComponentOptions.propsData;
  53871. opts._parentListeners = vnodeComponentOptions.listeners;
  53872. opts._renderChildren = vnodeComponentOptions.children;
  53873. opts._componentTag = vnodeComponentOptions.tag;
  53874. if (options.render) {
  53875. opts.render = options.render;
  53876. opts.staticRenderFns = options.staticRenderFns;
  53877. }
  53878. }
  53879. function resolveConstructorOptions (Ctor) {
  53880. var options = Ctor.options;
  53881. if (Ctor.super) {
  53882. var superOptions = resolveConstructorOptions(Ctor.super);
  53883. var cachedSuperOptions = Ctor.superOptions;
  53884. if (superOptions !== cachedSuperOptions) {
  53885. // super option changed,
  53886. // need to resolve new options.
  53887. Ctor.superOptions = superOptions;
  53888. // check if there are any late-modified/attached options (#4976)
  53889. var modifiedOptions = resolveModifiedOptions(Ctor);
  53890. // update base extend options
  53891. if (modifiedOptions) {
  53892. extend(Ctor.extendOptions, modifiedOptions);
  53893. }
  53894. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  53895. if (options.name) {
  53896. options.components[options.name] = Ctor;
  53897. }
  53898. }
  53899. }
  53900. return options
  53901. }
  53902. function resolveModifiedOptions (Ctor) {
  53903. var modified;
  53904. var latest = Ctor.options;
  53905. var sealed = Ctor.sealedOptions;
  53906. for (var key in latest) {
  53907. if (latest[key] !== sealed[key]) {
  53908. if (!modified) { modified = {}; }
  53909. modified[key] = latest[key];
  53910. }
  53911. }
  53912. return modified
  53913. }
  53914. function Vue (options) {
  53915. if (!(this instanceof Vue)
  53916. ) {
  53917. warn('Vue is a constructor and should be called with the `new` keyword');
  53918. }
  53919. this._init(options);
  53920. }
  53921. initMixin(Vue);
  53922. stateMixin(Vue);
  53923. eventsMixin(Vue);
  53924. lifecycleMixin(Vue);
  53925. renderMixin(Vue);
  53926. /* */
  53927. function initUse (Vue) {
  53928. Vue.use = function (plugin) {
  53929. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  53930. if (installedPlugins.indexOf(plugin) > -1) {
  53931. return this
  53932. }
  53933. // additional parameters
  53934. var args = toArray(arguments, 1);
  53935. args.unshift(this);
  53936. if (typeof plugin.install === 'function') {
  53937. plugin.install.apply(plugin, args);
  53938. } else if (typeof plugin === 'function') {
  53939. plugin.apply(null, args);
  53940. }
  53941. installedPlugins.push(plugin);
  53942. return this
  53943. };
  53944. }
  53945. /* */
  53946. function initMixin$1 (Vue) {
  53947. Vue.mixin = function (mixin) {
  53948. this.options = mergeOptions(this.options, mixin);
  53949. return this
  53950. };
  53951. }
  53952. /* */
  53953. function initExtend (Vue) {
  53954. /**
  53955. * Each instance constructor, including Vue, has a unique
  53956. * cid. This enables us to create wrapped "child
  53957. * constructors" for prototypal inheritance and cache them.
  53958. */
  53959. Vue.cid = 0;
  53960. var cid = 1;
  53961. /**
  53962. * Class inheritance
  53963. */
  53964. Vue.extend = function (extendOptions) {
  53965. extendOptions = extendOptions || {};
  53966. var Super = this;
  53967. var SuperId = Super.cid;
  53968. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  53969. if (cachedCtors[SuperId]) {
  53970. return cachedCtors[SuperId]
  53971. }
  53972. var name = extendOptions.name || Super.options.name;
  53973. if (name) {
  53974. validateComponentName(name);
  53975. }
  53976. var Sub = function VueComponent (options) {
  53977. this._init(options);
  53978. };
  53979. Sub.prototype = Object.create(Super.prototype);
  53980. Sub.prototype.constructor = Sub;
  53981. Sub.cid = cid++;
  53982. Sub.options = mergeOptions(
  53983. Super.options,
  53984. extendOptions
  53985. );
  53986. Sub['super'] = Super;
  53987. // For props and computed properties, we define the proxy getters on
  53988. // the Vue instances at extension time, on the extended prototype. This
  53989. // avoids Object.defineProperty calls for each instance created.
  53990. if (Sub.options.props) {
  53991. initProps$1(Sub);
  53992. }
  53993. if (Sub.options.computed) {
  53994. initComputed$1(Sub);
  53995. }
  53996. // allow further extension/mixin/plugin usage
  53997. Sub.extend = Super.extend;
  53998. Sub.mixin = Super.mixin;
  53999. Sub.use = Super.use;
  54000. // create asset registers, so extended classes
  54001. // can have their private assets too.
  54002. ASSET_TYPES.forEach(function (type) {
  54003. Sub[type] = Super[type];
  54004. });
  54005. // enable recursive self-lookup
  54006. if (name) {
  54007. Sub.options.components[name] = Sub;
  54008. }
  54009. // keep a reference to the super options at extension time.
  54010. // later at instantiation we can check if Super's options have
  54011. // been updated.
  54012. Sub.superOptions = Super.options;
  54013. Sub.extendOptions = extendOptions;
  54014. Sub.sealedOptions = extend({}, Sub.options);
  54015. // cache constructor
  54016. cachedCtors[SuperId] = Sub;
  54017. return Sub
  54018. };
  54019. }
  54020. function initProps$1 (Comp) {
  54021. var props = Comp.options.props;
  54022. for (var key in props) {
  54023. proxy(Comp.prototype, "_props", key);
  54024. }
  54025. }
  54026. function initComputed$1 (Comp) {
  54027. var computed = Comp.options.computed;
  54028. for (var key in computed) {
  54029. defineComputed(Comp.prototype, key, computed[key]);
  54030. }
  54031. }
  54032. /* */
  54033. function initAssetRegisters (Vue) {
  54034. /**
  54035. * Create asset registration methods.
  54036. */
  54037. ASSET_TYPES.forEach(function (type) {
  54038. Vue[type] = function (
  54039. id,
  54040. definition
  54041. ) {
  54042. if (!definition) {
  54043. return this.options[type + 's'][id]
  54044. } else {
  54045. /* istanbul ignore if */
  54046. if (type === 'component') {
  54047. validateComponentName(id);
  54048. }
  54049. if (type === 'component' && isPlainObject(definition)) {
  54050. definition.name = definition.name || id;
  54051. definition = this.options._base.extend(definition);
  54052. }
  54053. if (type === 'directive' && typeof definition === 'function') {
  54054. definition = { bind: definition, update: definition };
  54055. }
  54056. this.options[type + 's'][id] = definition;
  54057. return definition
  54058. }
  54059. };
  54060. });
  54061. }
  54062. /* */
  54063. function getComponentName (opts) {
  54064. return opts && (opts.Ctor.options.name || opts.tag)
  54065. }
  54066. function matches (pattern, name) {
  54067. if (Array.isArray(pattern)) {
  54068. return pattern.indexOf(name) > -1
  54069. } else if (typeof pattern === 'string') {
  54070. return pattern.split(',').indexOf(name) > -1
  54071. } else if (isRegExp(pattern)) {
  54072. return pattern.test(name)
  54073. }
  54074. /* istanbul ignore next */
  54075. return false
  54076. }
  54077. function pruneCache (keepAliveInstance, filter) {
  54078. var cache = keepAliveInstance.cache;
  54079. var keys = keepAliveInstance.keys;
  54080. var _vnode = keepAliveInstance._vnode;
  54081. for (var key in cache) {
  54082. var cachedNode = cache[key];
  54083. if (cachedNode) {
  54084. var name = getComponentName(cachedNode.componentOptions);
  54085. if (name && !filter(name)) {
  54086. pruneCacheEntry(cache, key, keys, _vnode);
  54087. }
  54088. }
  54089. }
  54090. }
  54091. function pruneCacheEntry (
  54092. cache,
  54093. key,
  54094. keys,
  54095. current
  54096. ) {
  54097. var cached$$1 = cache[key];
  54098. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  54099. cached$$1.componentInstance.$destroy();
  54100. }
  54101. cache[key] = null;
  54102. remove(keys, key);
  54103. }
  54104. var patternTypes = [String, RegExp, Array];
  54105. var KeepAlive = {
  54106. name: 'keep-alive',
  54107. abstract: true,
  54108. props: {
  54109. include: patternTypes,
  54110. exclude: patternTypes,
  54111. max: [String, Number]
  54112. },
  54113. created: function created () {
  54114. this.cache = Object.create(null);
  54115. this.keys = [];
  54116. },
  54117. destroyed: function destroyed () {
  54118. for (var key in this.cache) {
  54119. pruneCacheEntry(this.cache, key, this.keys);
  54120. }
  54121. },
  54122. mounted: function mounted () {
  54123. var this$1 = this;
  54124. this.$watch('include', function (val) {
  54125. pruneCache(this$1, function (name) { return matches(val, name); });
  54126. });
  54127. this.$watch('exclude', function (val) {
  54128. pruneCache(this$1, function (name) { return !matches(val, name); });
  54129. });
  54130. },
  54131. render: function render () {
  54132. var slot = this.$slots.default;
  54133. var vnode = getFirstComponentChild(slot);
  54134. var componentOptions = vnode && vnode.componentOptions;
  54135. if (componentOptions) {
  54136. // check pattern
  54137. var name = getComponentName(componentOptions);
  54138. var ref = this;
  54139. var include = ref.include;
  54140. var exclude = ref.exclude;
  54141. if (
  54142. // not included
  54143. (include && (!name || !matches(include, name))) ||
  54144. // excluded
  54145. (exclude && name && matches(exclude, name))
  54146. ) {
  54147. return vnode
  54148. }
  54149. var ref$1 = this;
  54150. var cache = ref$1.cache;
  54151. var keys = ref$1.keys;
  54152. var key = vnode.key == null
  54153. // same constructor may get registered as different local components
  54154. // so cid alone is not enough (#3269)
  54155. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  54156. : vnode.key;
  54157. if (cache[key]) {
  54158. vnode.componentInstance = cache[key].componentInstance;
  54159. // make current key freshest
  54160. remove(keys, key);
  54161. keys.push(key);
  54162. } else {
  54163. cache[key] = vnode;
  54164. keys.push(key);
  54165. // prune oldest entry
  54166. if (this.max && keys.length > parseInt(this.max)) {
  54167. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  54168. }
  54169. }
  54170. vnode.data.keepAlive = true;
  54171. }
  54172. return vnode || (slot && slot[0])
  54173. }
  54174. };
  54175. var builtInComponents = {
  54176. KeepAlive: KeepAlive
  54177. };
  54178. /* */
  54179. function initGlobalAPI (Vue) {
  54180. // config
  54181. var configDef = {};
  54182. configDef.get = function () { return config; };
  54183. {
  54184. configDef.set = function () {
  54185. warn(
  54186. 'Do not replace the Vue.config object, set individual fields instead.'
  54187. );
  54188. };
  54189. }
  54190. Object.defineProperty(Vue, 'config', configDef);
  54191. // exposed util methods.
  54192. // NOTE: these are not considered part of the public API - avoid relying on
  54193. // them unless you are aware of the risk.
  54194. Vue.util = {
  54195. warn: warn,
  54196. extend: extend,
  54197. mergeOptions: mergeOptions,
  54198. defineReactive: defineReactive$$1
  54199. };
  54200. Vue.set = set;
  54201. Vue.delete = del;
  54202. Vue.nextTick = nextTick;
  54203. // 2.6 explicit observable API
  54204. Vue.observable = function (obj) {
  54205. observe(obj);
  54206. return obj
  54207. };
  54208. Vue.options = Object.create(null);
  54209. ASSET_TYPES.forEach(function (type) {
  54210. Vue.options[type + 's'] = Object.create(null);
  54211. });
  54212. // this is used to identify the "base" constructor to extend all plain-object
  54213. // components with in Weex's multi-instance scenarios.
  54214. Vue.options._base = Vue;
  54215. extend(Vue.options.components, builtInComponents);
  54216. initUse(Vue);
  54217. initMixin$1(Vue);
  54218. initExtend(Vue);
  54219. initAssetRegisters(Vue);
  54220. }
  54221. initGlobalAPI(Vue);
  54222. Object.defineProperty(Vue.prototype, '$isServer', {
  54223. get: isServerRendering
  54224. });
  54225. Object.defineProperty(Vue.prototype, '$ssrContext', {
  54226. get: function get () {
  54227. /* istanbul ignore next */
  54228. return this.$vnode && this.$vnode.ssrContext
  54229. }
  54230. });
  54231. // expose FunctionalRenderContext for ssr runtime helper installation
  54232. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  54233. value: FunctionalRenderContext
  54234. });
  54235. Vue.version = '2.6.11';
  54236. /* */
  54237. // these are reserved for web because they are directly compiled away
  54238. // during template compilation
  54239. var isReservedAttr = makeMap('style,class');
  54240. // attributes that should be using props for binding
  54241. var acceptValue = makeMap('input,textarea,option,select,progress');
  54242. var mustUseProp = function (tag, type, attr) {
  54243. return (
  54244. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  54245. (attr === 'selected' && tag === 'option') ||
  54246. (attr === 'checked' && tag === 'input') ||
  54247. (attr === 'muted' && tag === 'video')
  54248. )
  54249. };
  54250. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  54251. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  54252. var convertEnumeratedValue = function (key, value) {
  54253. return isFalsyAttrValue(value) || value === 'false'
  54254. ? 'false'
  54255. // allow arbitrary string value for contenteditable
  54256. : key === 'contenteditable' && isValidContentEditableValue(value)
  54257. ? value
  54258. : 'true'
  54259. };
  54260. var isBooleanAttr = makeMap(
  54261. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  54262. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  54263. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  54264. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  54265. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  54266. 'truespeed,typemustmatch,visible'
  54267. );
  54268. var xlinkNS = 'http://www.w3.org/1999/xlink';
  54269. var isXlink = function (name) {
  54270. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  54271. };
  54272. var getXlinkProp = function (name) {
  54273. return isXlink(name) ? name.slice(6, name.length) : ''
  54274. };
  54275. var isFalsyAttrValue = function (val) {
  54276. return val == null || val === false
  54277. };
  54278. /* */
  54279. function genClassForVnode (vnode) {
  54280. var data = vnode.data;
  54281. var parentNode = vnode;
  54282. var childNode = vnode;
  54283. while (isDef(childNode.componentInstance)) {
  54284. childNode = childNode.componentInstance._vnode;
  54285. if (childNode && childNode.data) {
  54286. data = mergeClassData(childNode.data, data);
  54287. }
  54288. }
  54289. while (isDef(parentNode = parentNode.parent)) {
  54290. if (parentNode && parentNode.data) {
  54291. data = mergeClassData(data, parentNode.data);
  54292. }
  54293. }
  54294. return renderClass(data.staticClass, data.class)
  54295. }
  54296. function mergeClassData (child, parent) {
  54297. return {
  54298. staticClass: concat(child.staticClass, parent.staticClass),
  54299. class: isDef(child.class)
  54300. ? [child.class, parent.class]
  54301. : parent.class
  54302. }
  54303. }
  54304. function renderClass (
  54305. staticClass,
  54306. dynamicClass
  54307. ) {
  54308. if (isDef(staticClass) || isDef(dynamicClass)) {
  54309. return concat(staticClass, stringifyClass(dynamicClass))
  54310. }
  54311. /* istanbul ignore next */
  54312. return ''
  54313. }
  54314. function concat (a, b) {
  54315. return a ? b ? (a + ' ' + b) : a : (b || '')
  54316. }
  54317. function stringifyClass (value) {
  54318. if (Array.isArray(value)) {
  54319. return stringifyArray(value)
  54320. }
  54321. if (isObject(value)) {
  54322. return stringifyObject(value)
  54323. }
  54324. if (typeof value === 'string') {
  54325. return value
  54326. }
  54327. /* istanbul ignore next */
  54328. return ''
  54329. }
  54330. function stringifyArray (value) {
  54331. var res = '';
  54332. var stringified;
  54333. for (var i = 0, l = value.length; i < l; i++) {
  54334. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  54335. if (res) { res += ' '; }
  54336. res += stringified;
  54337. }
  54338. }
  54339. return res
  54340. }
  54341. function stringifyObject (value) {
  54342. var res = '';
  54343. for (var key in value) {
  54344. if (value[key]) {
  54345. if (res) { res += ' '; }
  54346. res += key;
  54347. }
  54348. }
  54349. return res
  54350. }
  54351. /* */
  54352. var namespaceMap = {
  54353. svg: 'http://www.w3.org/2000/svg',
  54354. math: 'http://www.w3.org/1998/Math/MathML'
  54355. };
  54356. var isHTMLTag = makeMap(
  54357. 'html,body,base,head,link,meta,style,title,' +
  54358. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  54359. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  54360. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  54361. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  54362. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  54363. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  54364. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  54365. 'output,progress,select,textarea,' +
  54366. 'details,dialog,menu,menuitem,summary,' +
  54367. 'content,element,shadow,template,blockquote,iframe,tfoot'
  54368. );
  54369. // this map is intentionally selective, only covering SVG elements that may
  54370. // contain child elements.
  54371. var isSVG = makeMap(
  54372. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  54373. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  54374. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  54375. true
  54376. );
  54377. var isPreTag = function (tag) { return tag === 'pre'; };
  54378. var isReservedTag = function (tag) {
  54379. return isHTMLTag(tag) || isSVG(tag)
  54380. };
  54381. function getTagNamespace (tag) {
  54382. if (isSVG(tag)) {
  54383. return 'svg'
  54384. }
  54385. // basic support for MathML
  54386. // note it doesn't support other MathML elements being component roots
  54387. if (tag === 'math') {
  54388. return 'math'
  54389. }
  54390. }
  54391. var unknownElementCache = Object.create(null);
  54392. function isUnknownElement (tag) {
  54393. /* istanbul ignore if */
  54394. if (!inBrowser) {
  54395. return true
  54396. }
  54397. if (isReservedTag(tag)) {
  54398. return false
  54399. }
  54400. tag = tag.toLowerCase();
  54401. /* istanbul ignore if */
  54402. if (unknownElementCache[tag] != null) {
  54403. return unknownElementCache[tag]
  54404. }
  54405. var el = document.createElement(tag);
  54406. if (tag.indexOf('-') > -1) {
  54407. // http://stackoverflow.com/a/28210364/1070244
  54408. return (unknownElementCache[tag] = (
  54409. el.constructor === window.HTMLUnknownElement ||
  54410. el.constructor === window.HTMLElement
  54411. ))
  54412. } else {
  54413. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  54414. }
  54415. }
  54416. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  54417. /* */
  54418. /**
  54419. * Query an element selector if it's not an element already.
  54420. */
  54421. function query (el) {
  54422. if (typeof el === 'string') {
  54423. var selected = document.querySelector(el);
  54424. if (!selected) {
  54425. warn(
  54426. 'Cannot find element: ' + el
  54427. );
  54428. return document.createElement('div')
  54429. }
  54430. return selected
  54431. } else {
  54432. return el
  54433. }
  54434. }
  54435. /* */
  54436. function createElement$1 (tagName, vnode) {
  54437. var elm = document.createElement(tagName);
  54438. if (tagName !== 'select') {
  54439. return elm
  54440. }
  54441. // false or null will remove the attribute but undefined will not
  54442. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  54443. elm.setAttribute('multiple', 'multiple');
  54444. }
  54445. return elm
  54446. }
  54447. function createElementNS (namespace, tagName) {
  54448. return document.createElementNS(namespaceMap[namespace], tagName)
  54449. }
  54450. function createTextNode (text) {
  54451. return document.createTextNode(text)
  54452. }
  54453. function createComment (text) {
  54454. return document.createComment(text)
  54455. }
  54456. function insertBefore (parentNode, newNode, referenceNode) {
  54457. parentNode.insertBefore(newNode, referenceNode);
  54458. }
  54459. function removeChild (node, child) {
  54460. node.removeChild(child);
  54461. }
  54462. function appendChild (node, child) {
  54463. node.appendChild(child);
  54464. }
  54465. function parentNode (node) {
  54466. return node.parentNode
  54467. }
  54468. function nextSibling (node) {
  54469. return node.nextSibling
  54470. }
  54471. function tagName (node) {
  54472. return node.tagName
  54473. }
  54474. function setTextContent (node, text) {
  54475. node.textContent = text;
  54476. }
  54477. function setStyleScope (node, scopeId) {
  54478. node.setAttribute(scopeId, '');
  54479. }
  54480. var nodeOps = /*#__PURE__*/Object.freeze({
  54481. createElement: createElement$1,
  54482. createElementNS: createElementNS,
  54483. createTextNode: createTextNode,
  54484. createComment: createComment,
  54485. insertBefore: insertBefore,
  54486. removeChild: removeChild,
  54487. appendChild: appendChild,
  54488. parentNode: parentNode,
  54489. nextSibling: nextSibling,
  54490. tagName: tagName,
  54491. setTextContent: setTextContent,
  54492. setStyleScope: setStyleScope
  54493. });
  54494. /* */
  54495. var ref = {
  54496. create: function create (_, vnode) {
  54497. registerRef(vnode);
  54498. },
  54499. update: function update (oldVnode, vnode) {
  54500. if (oldVnode.data.ref !== vnode.data.ref) {
  54501. registerRef(oldVnode, true);
  54502. registerRef(vnode);
  54503. }
  54504. },
  54505. destroy: function destroy (vnode) {
  54506. registerRef(vnode, true);
  54507. }
  54508. };
  54509. function registerRef (vnode, isRemoval) {
  54510. var key = vnode.data.ref;
  54511. if (!isDef(key)) { return }
  54512. var vm = vnode.context;
  54513. var ref = vnode.componentInstance || vnode.elm;
  54514. var refs = vm.$refs;
  54515. if (isRemoval) {
  54516. if (Array.isArray(refs[key])) {
  54517. remove(refs[key], ref);
  54518. } else if (refs[key] === ref) {
  54519. refs[key] = undefined;
  54520. }
  54521. } else {
  54522. if (vnode.data.refInFor) {
  54523. if (!Array.isArray(refs[key])) {
  54524. refs[key] = [ref];
  54525. } else if (refs[key].indexOf(ref) < 0) {
  54526. // $flow-disable-line
  54527. refs[key].push(ref);
  54528. }
  54529. } else {
  54530. refs[key] = ref;
  54531. }
  54532. }
  54533. }
  54534. /**
  54535. * Virtual DOM patching algorithm based on Snabbdom by
  54536. * Simon Friis Vindum (@paldepind)
  54537. * Licensed under the MIT License
  54538. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  54539. *
  54540. * modified by Evan You (@yyx990803)
  54541. *
  54542. * Not type-checking this because this file is perf-critical and the cost
  54543. * of making flow understand it is not worth it.
  54544. */
  54545. var emptyNode = new VNode('', {}, []);
  54546. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  54547. function sameVnode (a, b) {
  54548. return (
  54549. a.key === b.key && (
  54550. (
  54551. a.tag === b.tag &&
  54552. a.isComment === b.isComment &&
  54553. isDef(a.data) === isDef(b.data) &&
  54554. sameInputType(a, b)
  54555. ) || (
  54556. isTrue(a.isAsyncPlaceholder) &&
  54557. a.asyncFactory === b.asyncFactory &&
  54558. isUndef(b.asyncFactory.error)
  54559. )
  54560. )
  54561. )
  54562. }
  54563. function sameInputType (a, b) {
  54564. if (a.tag !== 'input') { return true }
  54565. var i;
  54566. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  54567. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  54568. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  54569. }
  54570. function createKeyToOldIdx (children, beginIdx, endIdx) {
  54571. var i, key;
  54572. var map = {};
  54573. for (i = beginIdx; i <= endIdx; ++i) {
  54574. key = children[i].key;
  54575. if (isDef(key)) { map[key] = i; }
  54576. }
  54577. return map
  54578. }
  54579. function createPatchFunction (backend) {
  54580. var i, j;
  54581. var cbs = {};
  54582. var modules = backend.modules;
  54583. var nodeOps = backend.nodeOps;
  54584. for (i = 0; i < hooks.length; ++i) {
  54585. cbs[hooks[i]] = [];
  54586. for (j = 0; j < modules.length; ++j) {
  54587. if (isDef(modules[j][hooks[i]])) {
  54588. cbs[hooks[i]].push(modules[j][hooks[i]]);
  54589. }
  54590. }
  54591. }
  54592. function emptyNodeAt (elm) {
  54593. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  54594. }
  54595. function createRmCb (childElm, listeners) {
  54596. function remove$$1 () {
  54597. if (--remove$$1.listeners === 0) {
  54598. removeNode(childElm);
  54599. }
  54600. }
  54601. remove$$1.listeners = listeners;
  54602. return remove$$1
  54603. }
  54604. function removeNode (el) {
  54605. var parent = nodeOps.parentNode(el);
  54606. // element may have already been removed due to v-html / v-text
  54607. if (isDef(parent)) {
  54608. nodeOps.removeChild(parent, el);
  54609. }
  54610. }
  54611. function isUnknownElement$$1 (vnode, inVPre) {
  54612. return (
  54613. !inVPre &&
  54614. !vnode.ns &&
  54615. !(
  54616. config.ignoredElements.length &&
  54617. config.ignoredElements.some(function (ignore) {
  54618. return isRegExp(ignore)
  54619. ? ignore.test(vnode.tag)
  54620. : ignore === vnode.tag
  54621. })
  54622. ) &&
  54623. config.isUnknownElement(vnode.tag)
  54624. )
  54625. }
  54626. var creatingElmInVPre = 0;
  54627. function createElm (
  54628. vnode,
  54629. insertedVnodeQueue,
  54630. parentElm,
  54631. refElm,
  54632. nested,
  54633. ownerArray,
  54634. index
  54635. ) {
  54636. if (isDef(vnode.elm) && isDef(ownerArray)) {
  54637. // This vnode was used in a previous render!
  54638. // now it's used as a new node, overwriting its elm would cause
  54639. // potential patch errors down the road when it's used as an insertion
  54640. // reference node. Instead, we clone the node on-demand before creating
  54641. // associated DOM element for it.
  54642. vnode = ownerArray[index] = cloneVNode(vnode);
  54643. }
  54644. vnode.isRootInsert = !nested; // for transition enter check
  54645. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  54646. return
  54647. }
  54648. var data = vnode.data;
  54649. var children = vnode.children;
  54650. var tag = vnode.tag;
  54651. if (isDef(tag)) {
  54652. {
  54653. if (data && data.pre) {
  54654. creatingElmInVPre++;
  54655. }
  54656. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  54657. warn(
  54658. 'Unknown custom element: <' + tag + '> - did you ' +
  54659. 'register the component correctly? For recursive components, ' +
  54660. 'make sure to provide the "name" option.',
  54661. vnode.context
  54662. );
  54663. }
  54664. }
  54665. vnode.elm = vnode.ns
  54666. ? nodeOps.createElementNS(vnode.ns, tag)
  54667. : nodeOps.createElement(tag, vnode);
  54668. setScope(vnode);
  54669. /* istanbul ignore if */
  54670. {
  54671. createChildren(vnode, children, insertedVnodeQueue);
  54672. if (isDef(data)) {
  54673. invokeCreateHooks(vnode, insertedVnodeQueue);
  54674. }
  54675. insert(parentElm, vnode.elm, refElm);
  54676. }
  54677. if (data && data.pre) {
  54678. creatingElmInVPre--;
  54679. }
  54680. } else if (isTrue(vnode.isComment)) {
  54681. vnode.elm = nodeOps.createComment(vnode.text);
  54682. insert(parentElm, vnode.elm, refElm);
  54683. } else {
  54684. vnode.elm = nodeOps.createTextNode(vnode.text);
  54685. insert(parentElm, vnode.elm, refElm);
  54686. }
  54687. }
  54688. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  54689. var i = vnode.data;
  54690. if (isDef(i)) {
  54691. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  54692. if (isDef(i = i.hook) && isDef(i = i.init)) {
  54693. i(vnode, false /* hydrating */);
  54694. }
  54695. // after calling the init hook, if the vnode is a child component
  54696. // it should've created a child instance and mounted it. the child
  54697. // component also has set the placeholder vnode's elm.
  54698. // in that case we can just return the element and be done.
  54699. if (isDef(vnode.componentInstance)) {
  54700. initComponent(vnode, insertedVnodeQueue);
  54701. insert(parentElm, vnode.elm, refElm);
  54702. if (isTrue(isReactivated)) {
  54703. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  54704. }
  54705. return true
  54706. }
  54707. }
  54708. }
  54709. function initComponent (vnode, insertedVnodeQueue) {
  54710. if (isDef(vnode.data.pendingInsert)) {
  54711. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  54712. vnode.data.pendingInsert = null;
  54713. }
  54714. vnode.elm = vnode.componentInstance.$el;
  54715. if (isPatchable(vnode)) {
  54716. invokeCreateHooks(vnode, insertedVnodeQueue);
  54717. setScope(vnode);
  54718. } else {
  54719. // empty component root.
  54720. // skip all element-related modules except for ref (#3455)
  54721. registerRef(vnode);
  54722. // make sure to invoke the insert hook
  54723. insertedVnodeQueue.push(vnode);
  54724. }
  54725. }
  54726. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  54727. var i;
  54728. // hack for #4339: a reactivated component with inner transition
  54729. // does not trigger because the inner node's created hooks are not called
  54730. // again. It's not ideal to involve module-specific logic in here but
  54731. // there doesn't seem to be a better way to do it.
  54732. var innerNode = vnode;
  54733. while (innerNode.componentInstance) {
  54734. innerNode = innerNode.componentInstance._vnode;
  54735. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  54736. for (i = 0; i < cbs.activate.length; ++i) {
  54737. cbs.activate[i](emptyNode, innerNode);
  54738. }
  54739. insertedVnodeQueue.push(innerNode);
  54740. break
  54741. }
  54742. }
  54743. // unlike a newly created component,
  54744. // a reactivated keep-alive component doesn't insert itself
  54745. insert(parentElm, vnode.elm, refElm);
  54746. }
  54747. function insert (parent, elm, ref$$1) {
  54748. if (isDef(parent)) {
  54749. if (isDef(ref$$1)) {
  54750. if (nodeOps.parentNode(ref$$1) === parent) {
  54751. nodeOps.insertBefore(parent, elm, ref$$1);
  54752. }
  54753. } else {
  54754. nodeOps.appendChild(parent, elm);
  54755. }
  54756. }
  54757. }
  54758. function createChildren (vnode, children, insertedVnodeQueue) {
  54759. if (Array.isArray(children)) {
  54760. {
  54761. checkDuplicateKeys(children);
  54762. }
  54763. for (var i = 0; i < children.length; ++i) {
  54764. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  54765. }
  54766. } else if (isPrimitive(vnode.text)) {
  54767. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  54768. }
  54769. }
  54770. function isPatchable (vnode) {
  54771. while (vnode.componentInstance) {
  54772. vnode = vnode.componentInstance._vnode;
  54773. }
  54774. return isDef(vnode.tag)
  54775. }
  54776. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  54777. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  54778. cbs.create[i$1](emptyNode, vnode);
  54779. }
  54780. i = vnode.data.hook; // Reuse variable
  54781. if (isDef(i)) {
  54782. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  54783. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  54784. }
  54785. }
  54786. // set scope id attribute for scoped CSS.
  54787. // this is implemented as a special case to avoid the overhead
  54788. // of going through the normal attribute patching process.
  54789. function setScope (vnode) {
  54790. var i;
  54791. if (isDef(i = vnode.fnScopeId)) {
  54792. nodeOps.setStyleScope(vnode.elm, i);
  54793. } else {
  54794. var ancestor = vnode;
  54795. while (ancestor) {
  54796. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  54797. nodeOps.setStyleScope(vnode.elm, i);
  54798. }
  54799. ancestor = ancestor.parent;
  54800. }
  54801. }
  54802. // for slot content they should also get the scopeId from the host instance.
  54803. if (isDef(i = activeInstance) &&
  54804. i !== vnode.context &&
  54805. i !== vnode.fnContext &&
  54806. isDef(i = i.$options._scopeId)
  54807. ) {
  54808. nodeOps.setStyleScope(vnode.elm, i);
  54809. }
  54810. }
  54811. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  54812. for (; startIdx <= endIdx; ++startIdx) {
  54813. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  54814. }
  54815. }
  54816. function invokeDestroyHook (vnode) {
  54817. var i, j;
  54818. var data = vnode.data;
  54819. if (isDef(data)) {
  54820. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  54821. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  54822. }
  54823. if (isDef(i = vnode.children)) {
  54824. for (j = 0; j < vnode.children.length; ++j) {
  54825. invokeDestroyHook(vnode.children[j]);
  54826. }
  54827. }
  54828. }
  54829. function removeVnodes (vnodes, startIdx, endIdx) {
  54830. for (; startIdx <= endIdx; ++startIdx) {
  54831. var ch = vnodes[startIdx];
  54832. if (isDef(ch)) {
  54833. if (isDef(ch.tag)) {
  54834. removeAndInvokeRemoveHook(ch);
  54835. invokeDestroyHook(ch);
  54836. } else { // Text node
  54837. removeNode(ch.elm);
  54838. }
  54839. }
  54840. }
  54841. }
  54842. function removeAndInvokeRemoveHook (vnode, rm) {
  54843. if (isDef(rm) || isDef(vnode.data)) {
  54844. var i;
  54845. var listeners = cbs.remove.length + 1;
  54846. if (isDef(rm)) {
  54847. // we have a recursively passed down rm callback
  54848. // increase the listeners count
  54849. rm.listeners += listeners;
  54850. } else {
  54851. // directly removing
  54852. rm = createRmCb(vnode.elm, listeners);
  54853. }
  54854. // recursively invoke hooks on child component root node
  54855. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  54856. removeAndInvokeRemoveHook(i, rm);
  54857. }
  54858. for (i = 0; i < cbs.remove.length; ++i) {
  54859. cbs.remove[i](vnode, rm);
  54860. }
  54861. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  54862. i(vnode, rm);
  54863. } else {
  54864. rm();
  54865. }
  54866. } else {
  54867. removeNode(vnode.elm);
  54868. }
  54869. }
  54870. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  54871. var oldStartIdx = 0;
  54872. var newStartIdx = 0;
  54873. var oldEndIdx = oldCh.length - 1;
  54874. var oldStartVnode = oldCh[0];
  54875. var oldEndVnode = oldCh[oldEndIdx];
  54876. var newEndIdx = newCh.length - 1;
  54877. var newStartVnode = newCh[0];
  54878. var newEndVnode = newCh[newEndIdx];
  54879. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  54880. // removeOnly is a special flag used only by <transition-group>
  54881. // to ensure removed elements stay in correct relative positions
  54882. // during leaving transitions
  54883. var canMove = !removeOnly;
  54884. {
  54885. checkDuplicateKeys(newCh);
  54886. }
  54887. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  54888. if (isUndef(oldStartVnode)) {
  54889. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  54890. } else if (isUndef(oldEndVnode)) {
  54891. oldEndVnode = oldCh[--oldEndIdx];
  54892. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  54893. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  54894. oldStartVnode = oldCh[++oldStartIdx];
  54895. newStartVnode = newCh[++newStartIdx];
  54896. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  54897. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  54898. oldEndVnode = oldCh[--oldEndIdx];
  54899. newEndVnode = newCh[--newEndIdx];
  54900. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  54901. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  54902. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  54903. oldStartVnode = oldCh[++oldStartIdx];
  54904. newEndVnode = newCh[--newEndIdx];
  54905. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  54906. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  54907. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  54908. oldEndVnode = oldCh[--oldEndIdx];
  54909. newStartVnode = newCh[++newStartIdx];
  54910. } else {
  54911. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  54912. idxInOld = isDef(newStartVnode.key)
  54913. ? oldKeyToIdx[newStartVnode.key]
  54914. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  54915. if (isUndef(idxInOld)) { // New element
  54916. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  54917. } else {
  54918. vnodeToMove = oldCh[idxInOld];
  54919. if (sameVnode(vnodeToMove, newStartVnode)) {
  54920. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  54921. oldCh[idxInOld] = undefined;
  54922. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  54923. } else {
  54924. // same key but different element. treat as new element
  54925. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  54926. }
  54927. }
  54928. newStartVnode = newCh[++newStartIdx];
  54929. }
  54930. }
  54931. if (oldStartIdx > oldEndIdx) {
  54932. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  54933. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  54934. } else if (newStartIdx > newEndIdx) {
  54935. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  54936. }
  54937. }
  54938. function checkDuplicateKeys (children) {
  54939. var seenKeys = {};
  54940. for (var i = 0; i < children.length; i++) {
  54941. var vnode = children[i];
  54942. var key = vnode.key;
  54943. if (isDef(key)) {
  54944. if (seenKeys[key]) {
  54945. warn(
  54946. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  54947. vnode.context
  54948. );
  54949. } else {
  54950. seenKeys[key] = true;
  54951. }
  54952. }
  54953. }
  54954. }
  54955. function findIdxInOld (node, oldCh, start, end) {
  54956. for (var i = start; i < end; i++) {
  54957. var c = oldCh[i];
  54958. if (isDef(c) && sameVnode(node, c)) { return i }
  54959. }
  54960. }
  54961. function patchVnode (
  54962. oldVnode,
  54963. vnode,
  54964. insertedVnodeQueue,
  54965. ownerArray,
  54966. index,
  54967. removeOnly
  54968. ) {
  54969. if (oldVnode === vnode) {
  54970. return
  54971. }
  54972. if (isDef(vnode.elm) && isDef(ownerArray)) {
  54973. // clone reused vnode
  54974. vnode = ownerArray[index] = cloneVNode(vnode);
  54975. }
  54976. var elm = vnode.elm = oldVnode.elm;
  54977. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  54978. if (isDef(vnode.asyncFactory.resolved)) {
  54979. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  54980. } else {
  54981. vnode.isAsyncPlaceholder = true;
  54982. }
  54983. return
  54984. }
  54985. // reuse element for static trees.
  54986. // note we only do this if the vnode is cloned -
  54987. // if the new node is not cloned it means the render functions have been
  54988. // reset by the hot-reload-api and we need to do a proper re-render.
  54989. if (isTrue(vnode.isStatic) &&
  54990. isTrue(oldVnode.isStatic) &&
  54991. vnode.key === oldVnode.key &&
  54992. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  54993. ) {
  54994. vnode.componentInstance = oldVnode.componentInstance;
  54995. return
  54996. }
  54997. var i;
  54998. var data = vnode.data;
  54999. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  55000. i(oldVnode, vnode);
  55001. }
  55002. var oldCh = oldVnode.children;
  55003. var ch = vnode.children;
  55004. if (isDef(data) && isPatchable(vnode)) {
  55005. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  55006. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  55007. }
  55008. if (isUndef(vnode.text)) {
  55009. if (isDef(oldCh) && isDef(ch)) {
  55010. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  55011. } else if (isDef(ch)) {
  55012. {
  55013. checkDuplicateKeys(ch);
  55014. }
  55015. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  55016. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  55017. } else if (isDef(oldCh)) {
  55018. removeVnodes(oldCh, 0, oldCh.length - 1);
  55019. } else if (isDef(oldVnode.text)) {
  55020. nodeOps.setTextContent(elm, '');
  55021. }
  55022. } else if (oldVnode.text !== vnode.text) {
  55023. nodeOps.setTextContent(elm, vnode.text);
  55024. }
  55025. if (isDef(data)) {
  55026. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  55027. }
  55028. }
  55029. function invokeInsertHook (vnode, queue, initial) {
  55030. // delay insert hooks for component root nodes, invoke them after the
  55031. // element is really inserted
  55032. if (isTrue(initial) && isDef(vnode.parent)) {
  55033. vnode.parent.data.pendingInsert = queue;
  55034. } else {
  55035. for (var i = 0; i < queue.length; ++i) {
  55036. queue[i].data.hook.insert(queue[i]);
  55037. }
  55038. }
  55039. }
  55040. var hydrationBailed = false;
  55041. // list of modules that can skip create hook during hydration because they
  55042. // are already rendered on the client or has no need for initialization
  55043. // Note: style is excluded because it relies on initial clone for future
  55044. // deep updates (#7063).
  55045. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  55046. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  55047. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  55048. var i;
  55049. var tag = vnode.tag;
  55050. var data = vnode.data;
  55051. var children = vnode.children;
  55052. inVPre = inVPre || (data && data.pre);
  55053. vnode.elm = elm;
  55054. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  55055. vnode.isAsyncPlaceholder = true;
  55056. return true
  55057. }
  55058. // assert node match
  55059. {
  55060. if (!assertNodeMatch(elm, vnode, inVPre)) {
  55061. return false
  55062. }
  55063. }
  55064. if (isDef(data)) {
  55065. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  55066. if (isDef(i = vnode.componentInstance)) {
  55067. // child component. it should have hydrated its own tree.
  55068. initComponent(vnode, insertedVnodeQueue);
  55069. return true
  55070. }
  55071. }
  55072. if (isDef(tag)) {
  55073. if (isDef(children)) {
  55074. // empty element, allow client to pick up and populate children
  55075. if (!elm.hasChildNodes()) {
  55076. createChildren(vnode, children, insertedVnodeQueue);
  55077. } else {
  55078. // v-html and domProps: innerHTML
  55079. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  55080. if (i !== elm.innerHTML) {
  55081. /* istanbul ignore if */
  55082. if (typeof console !== 'undefined' &&
  55083. !hydrationBailed
  55084. ) {
  55085. hydrationBailed = true;
  55086. console.warn('Parent: ', elm);
  55087. console.warn('server innerHTML: ', i);
  55088. console.warn('client innerHTML: ', elm.innerHTML);
  55089. }
  55090. return false
  55091. }
  55092. } else {
  55093. // iterate and compare children lists
  55094. var childrenMatch = true;
  55095. var childNode = elm.firstChild;
  55096. for (var i$1 = 0; i$1 < children.length; i$1++) {
  55097. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  55098. childrenMatch = false;
  55099. break
  55100. }
  55101. childNode = childNode.nextSibling;
  55102. }
  55103. // if childNode is not null, it means the actual childNodes list is
  55104. // longer than the virtual children list.
  55105. if (!childrenMatch || childNode) {
  55106. /* istanbul ignore if */
  55107. if (typeof console !== 'undefined' &&
  55108. !hydrationBailed
  55109. ) {
  55110. hydrationBailed = true;
  55111. console.warn('Parent: ', elm);
  55112. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  55113. }
  55114. return false
  55115. }
  55116. }
  55117. }
  55118. }
  55119. if (isDef(data)) {
  55120. var fullInvoke = false;
  55121. for (var key in data) {
  55122. if (!isRenderedModule(key)) {
  55123. fullInvoke = true;
  55124. invokeCreateHooks(vnode, insertedVnodeQueue);
  55125. break
  55126. }
  55127. }
  55128. if (!fullInvoke && data['class']) {
  55129. // ensure collecting deps for deep class bindings for future updates
  55130. traverse(data['class']);
  55131. }
  55132. }
  55133. } else if (elm.data !== vnode.text) {
  55134. elm.data = vnode.text;
  55135. }
  55136. return true
  55137. }
  55138. function assertNodeMatch (node, vnode, inVPre) {
  55139. if (isDef(vnode.tag)) {
  55140. return vnode.tag.indexOf('vue-component') === 0 || (
  55141. !isUnknownElement$$1(vnode, inVPre) &&
  55142. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  55143. )
  55144. } else {
  55145. return node.nodeType === (vnode.isComment ? 8 : 3)
  55146. }
  55147. }
  55148. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  55149. if (isUndef(vnode)) {
  55150. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  55151. return
  55152. }
  55153. var isInitialPatch = false;
  55154. var insertedVnodeQueue = [];
  55155. if (isUndef(oldVnode)) {
  55156. // empty mount (likely as component), create new root element
  55157. isInitialPatch = true;
  55158. createElm(vnode, insertedVnodeQueue);
  55159. } else {
  55160. var isRealElement = isDef(oldVnode.nodeType);
  55161. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  55162. // patch existing root node
  55163. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  55164. } else {
  55165. if (isRealElement) {
  55166. // mounting to a real element
  55167. // check if this is server-rendered content and if we can perform
  55168. // a successful hydration.
  55169. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  55170. oldVnode.removeAttribute(SSR_ATTR);
  55171. hydrating = true;
  55172. }
  55173. if (isTrue(hydrating)) {
  55174. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  55175. invokeInsertHook(vnode, insertedVnodeQueue, true);
  55176. return oldVnode
  55177. } else {
  55178. warn(
  55179. 'The client-side rendered virtual DOM tree is not matching ' +
  55180. 'server-rendered content. This is likely caused by incorrect ' +
  55181. 'HTML markup, for example nesting block-level elements inside ' +
  55182. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  55183. 'full client-side render.'
  55184. );
  55185. }
  55186. }
  55187. // either not server-rendered, or hydration failed.
  55188. // create an empty node and replace it
  55189. oldVnode = emptyNodeAt(oldVnode);
  55190. }
  55191. // replacing existing element
  55192. var oldElm = oldVnode.elm;
  55193. var parentElm = nodeOps.parentNode(oldElm);
  55194. // create new node
  55195. createElm(
  55196. vnode,
  55197. insertedVnodeQueue,
  55198. // extremely rare edge case: do not insert if old element is in a
  55199. // leaving transition. Only happens when combining transition +
  55200. // keep-alive + HOCs. (#4590)
  55201. oldElm._leaveCb ? null : parentElm,
  55202. nodeOps.nextSibling(oldElm)
  55203. );
  55204. // update parent placeholder node element, recursively
  55205. if (isDef(vnode.parent)) {
  55206. var ancestor = vnode.parent;
  55207. var patchable = isPatchable(vnode);
  55208. while (ancestor) {
  55209. for (var i = 0; i < cbs.destroy.length; ++i) {
  55210. cbs.destroy[i](ancestor);
  55211. }
  55212. ancestor.elm = vnode.elm;
  55213. if (patchable) {
  55214. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  55215. cbs.create[i$1](emptyNode, ancestor);
  55216. }
  55217. // #6513
  55218. // invoke insert hooks that may have been merged by create hooks.
  55219. // e.g. for directives that uses the "inserted" hook.
  55220. var insert = ancestor.data.hook.insert;
  55221. if (insert.merged) {
  55222. // start at index 1 to avoid re-invoking component mounted hook
  55223. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  55224. insert.fns[i$2]();
  55225. }
  55226. }
  55227. } else {
  55228. registerRef(ancestor);
  55229. }
  55230. ancestor = ancestor.parent;
  55231. }
  55232. }
  55233. // destroy old node
  55234. if (isDef(parentElm)) {
  55235. removeVnodes([oldVnode], 0, 0);
  55236. } else if (isDef(oldVnode.tag)) {
  55237. invokeDestroyHook(oldVnode);
  55238. }
  55239. }
  55240. }
  55241. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  55242. return vnode.elm
  55243. }
  55244. }
  55245. /* */
  55246. var directives = {
  55247. create: updateDirectives,
  55248. update: updateDirectives,
  55249. destroy: function unbindDirectives (vnode) {
  55250. updateDirectives(vnode, emptyNode);
  55251. }
  55252. };
  55253. function updateDirectives (oldVnode, vnode) {
  55254. if (oldVnode.data.directives || vnode.data.directives) {
  55255. _update(oldVnode, vnode);
  55256. }
  55257. }
  55258. function _update (oldVnode, vnode) {
  55259. var isCreate = oldVnode === emptyNode;
  55260. var isDestroy = vnode === emptyNode;
  55261. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  55262. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  55263. var dirsWithInsert = [];
  55264. var dirsWithPostpatch = [];
  55265. var key, oldDir, dir;
  55266. for (key in newDirs) {
  55267. oldDir = oldDirs[key];
  55268. dir = newDirs[key];
  55269. if (!oldDir) {
  55270. // new directive, bind
  55271. callHook$1(dir, 'bind', vnode, oldVnode);
  55272. if (dir.def && dir.def.inserted) {
  55273. dirsWithInsert.push(dir);
  55274. }
  55275. } else {
  55276. // existing directive, update
  55277. dir.oldValue = oldDir.value;
  55278. dir.oldArg = oldDir.arg;
  55279. callHook$1(dir, 'update', vnode, oldVnode);
  55280. if (dir.def && dir.def.componentUpdated) {
  55281. dirsWithPostpatch.push(dir);
  55282. }
  55283. }
  55284. }
  55285. if (dirsWithInsert.length) {
  55286. var callInsert = function () {
  55287. for (var i = 0; i < dirsWithInsert.length; i++) {
  55288. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  55289. }
  55290. };
  55291. if (isCreate) {
  55292. mergeVNodeHook(vnode, 'insert', callInsert);
  55293. } else {
  55294. callInsert();
  55295. }
  55296. }
  55297. if (dirsWithPostpatch.length) {
  55298. mergeVNodeHook(vnode, 'postpatch', function () {
  55299. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  55300. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  55301. }
  55302. });
  55303. }
  55304. if (!isCreate) {
  55305. for (key in oldDirs) {
  55306. if (!newDirs[key]) {
  55307. // no longer present, unbind
  55308. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  55309. }
  55310. }
  55311. }
  55312. }
  55313. var emptyModifiers = Object.create(null);
  55314. function normalizeDirectives$1 (
  55315. dirs,
  55316. vm
  55317. ) {
  55318. var res = Object.create(null);
  55319. if (!dirs) {
  55320. // $flow-disable-line
  55321. return res
  55322. }
  55323. var i, dir;
  55324. for (i = 0; i < dirs.length; i++) {
  55325. dir = dirs[i];
  55326. if (!dir.modifiers) {
  55327. // $flow-disable-line
  55328. dir.modifiers = emptyModifiers;
  55329. }
  55330. res[getRawDirName(dir)] = dir;
  55331. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  55332. }
  55333. // $flow-disable-line
  55334. return res
  55335. }
  55336. function getRawDirName (dir) {
  55337. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  55338. }
  55339. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  55340. var fn = dir.def && dir.def[hook];
  55341. if (fn) {
  55342. try {
  55343. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  55344. } catch (e) {
  55345. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  55346. }
  55347. }
  55348. }
  55349. var baseModules = [
  55350. ref,
  55351. directives
  55352. ];
  55353. /* */
  55354. function updateAttrs (oldVnode, vnode) {
  55355. var opts = vnode.componentOptions;
  55356. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  55357. return
  55358. }
  55359. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  55360. return
  55361. }
  55362. var key, cur, old;
  55363. var elm = vnode.elm;
  55364. var oldAttrs = oldVnode.data.attrs || {};
  55365. var attrs = vnode.data.attrs || {};
  55366. // clone observed objects, as the user probably wants to mutate it
  55367. if (isDef(attrs.__ob__)) {
  55368. attrs = vnode.data.attrs = extend({}, attrs);
  55369. }
  55370. for (key in attrs) {
  55371. cur = attrs[key];
  55372. old = oldAttrs[key];
  55373. if (old !== cur) {
  55374. setAttr(elm, key, cur);
  55375. }
  55376. }
  55377. // #4391: in IE9, setting type can reset value for input[type=radio]
  55378. // #6666: IE/Edge forces progress value down to 1 before setting a max
  55379. /* istanbul ignore if */
  55380. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  55381. setAttr(elm, 'value', attrs.value);
  55382. }
  55383. for (key in oldAttrs) {
  55384. if (isUndef(attrs[key])) {
  55385. if (isXlink(key)) {
  55386. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  55387. } else if (!isEnumeratedAttr(key)) {
  55388. elm.removeAttribute(key);
  55389. }
  55390. }
  55391. }
  55392. }
  55393. function setAttr (el, key, value) {
  55394. if (el.tagName.indexOf('-') > -1) {
  55395. baseSetAttr(el, key, value);
  55396. } else if (isBooleanAttr(key)) {
  55397. // set attribute for blank value
  55398. // e.g. <option disabled>Select one</option>
  55399. if (isFalsyAttrValue(value)) {
  55400. el.removeAttribute(key);
  55401. } else {
  55402. // technically allowfullscreen is a boolean attribute for <iframe>,
  55403. // but Flash expects a value of "true" when used on <embed> tag
  55404. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  55405. ? 'true'
  55406. : key;
  55407. el.setAttribute(key, value);
  55408. }
  55409. } else if (isEnumeratedAttr(key)) {
  55410. el.setAttribute(key, convertEnumeratedValue(key, value));
  55411. } else if (isXlink(key)) {
  55412. if (isFalsyAttrValue(value)) {
  55413. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  55414. } else {
  55415. el.setAttributeNS(xlinkNS, key, value);
  55416. }
  55417. } else {
  55418. baseSetAttr(el, key, value);
  55419. }
  55420. }
  55421. function baseSetAttr (el, key, value) {
  55422. if (isFalsyAttrValue(value)) {
  55423. el.removeAttribute(key);
  55424. } else {
  55425. // #7138: IE10 & 11 fires input event when setting placeholder on
  55426. // <textarea>... block the first input event and remove the blocker
  55427. // immediately.
  55428. /* istanbul ignore if */
  55429. if (
  55430. isIE && !isIE9 &&
  55431. el.tagName === 'TEXTAREA' &&
  55432. key === 'placeholder' && value !== '' && !el.__ieph
  55433. ) {
  55434. var blocker = function (e) {
  55435. e.stopImmediatePropagation();
  55436. el.removeEventListener('input', blocker);
  55437. };
  55438. el.addEventListener('input', blocker);
  55439. // $flow-disable-line
  55440. el.__ieph = true; /* IE placeholder patched */
  55441. }
  55442. el.setAttribute(key, value);
  55443. }
  55444. }
  55445. var attrs = {
  55446. create: updateAttrs,
  55447. update: updateAttrs
  55448. };
  55449. /* */
  55450. function updateClass (oldVnode, vnode) {
  55451. var el = vnode.elm;
  55452. var data = vnode.data;
  55453. var oldData = oldVnode.data;
  55454. if (
  55455. isUndef(data.staticClass) &&
  55456. isUndef(data.class) && (
  55457. isUndef(oldData) || (
  55458. isUndef(oldData.staticClass) &&
  55459. isUndef(oldData.class)
  55460. )
  55461. )
  55462. ) {
  55463. return
  55464. }
  55465. var cls = genClassForVnode(vnode);
  55466. // handle transition classes
  55467. var transitionClass = el._transitionClasses;
  55468. if (isDef(transitionClass)) {
  55469. cls = concat(cls, stringifyClass(transitionClass));
  55470. }
  55471. // set the class
  55472. if (cls !== el._prevClass) {
  55473. el.setAttribute('class', cls);
  55474. el._prevClass = cls;
  55475. }
  55476. }
  55477. var klass = {
  55478. create: updateClass,
  55479. update: updateClass
  55480. };
  55481. /* */
  55482. var validDivisionCharRE = /[\w).+\-_$\]]/;
  55483. function parseFilters (exp) {
  55484. var inSingle = false;
  55485. var inDouble = false;
  55486. var inTemplateString = false;
  55487. var inRegex = false;
  55488. var curly = 0;
  55489. var square = 0;
  55490. var paren = 0;
  55491. var lastFilterIndex = 0;
  55492. var c, prev, i, expression, filters;
  55493. for (i = 0; i < exp.length; i++) {
  55494. prev = c;
  55495. c = exp.charCodeAt(i);
  55496. if (inSingle) {
  55497. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  55498. } else if (inDouble) {
  55499. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  55500. } else if (inTemplateString) {
  55501. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  55502. } else if (inRegex) {
  55503. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  55504. } else if (
  55505. c === 0x7C && // pipe
  55506. exp.charCodeAt(i + 1) !== 0x7C &&
  55507. exp.charCodeAt(i - 1) !== 0x7C &&
  55508. !curly && !square && !paren
  55509. ) {
  55510. if (expression === undefined) {
  55511. // first filter, end of expression
  55512. lastFilterIndex = i + 1;
  55513. expression = exp.slice(0, i).trim();
  55514. } else {
  55515. pushFilter();
  55516. }
  55517. } else {
  55518. switch (c) {
  55519. case 0x22: inDouble = true; break // "
  55520. case 0x27: inSingle = true; break // '
  55521. case 0x60: inTemplateString = true; break // `
  55522. case 0x28: paren++; break // (
  55523. case 0x29: paren--; break // )
  55524. case 0x5B: square++; break // [
  55525. case 0x5D: square--; break // ]
  55526. case 0x7B: curly++; break // {
  55527. case 0x7D: curly--; break // }
  55528. }
  55529. if (c === 0x2f) { // /
  55530. var j = i - 1;
  55531. var p = (void 0);
  55532. // find first non-whitespace prev char
  55533. for (; j >= 0; j--) {
  55534. p = exp.charAt(j);
  55535. if (p !== ' ') { break }
  55536. }
  55537. if (!p || !validDivisionCharRE.test(p)) {
  55538. inRegex = true;
  55539. }
  55540. }
  55541. }
  55542. }
  55543. if (expression === undefined) {
  55544. expression = exp.slice(0, i).trim();
  55545. } else if (lastFilterIndex !== 0) {
  55546. pushFilter();
  55547. }
  55548. function pushFilter () {
  55549. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  55550. lastFilterIndex = i + 1;
  55551. }
  55552. if (filters) {
  55553. for (i = 0; i < filters.length; i++) {
  55554. expression = wrapFilter(expression, filters[i]);
  55555. }
  55556. }
  55557. return expression
  55558. }
  55559. function wrapFilter (exp, filter) {
  55560. var i = filter.indexOf('(');
  55561. if (i < 0) {
  55562. // _f: resolveFilter
  55563. return ("_f(\"" + filter + "\")(" + exp + ")")
  55564. } else {
  55565. var name = filter.slice(0, i);
  55566. var args = filter.slice(i + 1);
  55567. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  55568. }
  55569. }
  55570. /* */
  55571. /* eslint-disable no-unused-vars */
  55572. function baseWarn (msg, range) {
  55573. console.error(("[Vue compiler]: " + msg));
  55574. }
  55575. /* eslint-enable no-unused-vars */
  55576. function pluckModuleFunction (
  55577. modules,
  55578. key
  55579. ) {
  55580. return modules
  55581. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  55582. : []
  55583. }
  55584. function addProp (el, name, value, range, dynamic) {
  55585. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  55586. el.plain = false;
  55587. }
  55588. function addAttr (el, name, value, range, dynamic) {
  55589. var attrs = dynamic
  55590. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  55591. : (el.attrs || (el.attrs = []));
  55592. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  55593. el.plain = false;
  55594. }
  55595. // add a raw attr (use this in preTransforms)
  55596. function addRawAttr (el, name, value, range) {
  55597. el.attrsMap[name] = value;
  55598. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  55599. }
  55600. function addDirective (
  55601. el,
  55602. name,
  55603. rawName,
  55604. value,
  55605. arg,
  55606. isDynamicArg,
  55607. modifiers,
  55608. range
  55609. ) {
  55610. (el.directives || (el.directives = [])).push(rangeSetItem({
  55611. name: name,
  55612. rawName: rawName,
  55613. value: value,
  55614. arg: arg,
  55615. isDynamicArg: isDynamicArg,
  55616. modifiers: modifiers
  55617. }, range));
  55618. el.plain = false;
  55619. }
  55620. function prependModifierMarker (symbol, name, dynamic) {
  55621. return dynamic
  55622. ? ("_p(" + name + ",\"" + symbol + "\")")
  55623. : symbol + name // mark the event as captured
  55624. }
  55625. function addHandler (
  55626. el,
  55627. name,
  55628. value,
  55629. modifiers,
  55630. important,
  55631. warn,
  55632. range,
  55633. dynamic
  55634. ) {
  55635. modifiers = modifiers || emptyObject;
  55636. // warn prevent and passive modifier
  55637. /* istanbul ignore if */
  55638. if (
  55639. warn &&
  55640. modifiers.prevent && modifiers.passive
  55641. ) {
  55642. warn(
  55643. 'passive and prevent can\'t be used together. ' +
  55644. 'Passive handler can\'t prevent default event.',
  55645. range
  55646. );
  55647. }
  55648. // normalize click.right and click.middle since they don't actually fire
  55649. // this is technically browser-specific, but at least for now browsers are
  55650. // the only target envs that have right/middle clicks.
  55651. if (modifiers.right) {
  55652. if (dynamic) {
  55653. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  55654. } else if (name === 'click') {
  55655. name = 'contextmenu';
  55656. delete modifiers.right;
  55657. }
  55658. } else if (modifiers.middle) {
  55659. if (dynamic) {
  55660. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  55661. } else if (name === 'click') {
  55662. name = 'mouseup';
  55663. }
  55664. }
  55665. // check capture modifier
  55666. if (modifiers.capture) {
  55667. delete modifiers.capture;
  55668. name = prependModifierMarker('!', name, dynamic);
  55669. }
  55670. if (modifiers.once) {
  55671. delete modifiers.once;
  55672. name = prependModifierMarker('~', name, dynamic);
  55673. }
  55674. /* istanbul ignore if */
  55675. if (modifiers.passive) {
  55676. delete modifiers.passive;
  55677. name = prependModifierMarker('&', name, dynamic);
  55678. }
  55679. var events;
  55680. if (modifiers.native) {
  55681. delete modifiers.native;
  55682. events = el.nativeEvents || (el.nativeEvents = {});
  55683. } else {
  55684. events = el.events || (el.events = {});
  55685. }
  55686. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  55687. if (modifiers !== emptyObject) {
  55688. newHandler.modifiers = modifiers;
  55689. }
  55690. var handlers = events[name];
  55691. /* istanbul ignore if */
  55692. if (Array.isArray(handlers)) {
  55693. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  55694. } else if (handlers) {
  55695. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  55696. } else {
  55697. events[name] = newHandler;
  55698. }
  55699. el.plain = false;
  55700. }
  55701. function getRawBindingAttr (
  55702. el,
  55703. name
  55704. ) {
  55705. return el.rawAttrsMap[':' + name] ||
  55706. el.rawAttrsMap['v-bind:' + name] ||
  55707. el.rawAttrsMap[name]
  55708. }
  55709. function getBindingAttr (
  55710. el,
  55711. name,
  55712. getStatic
  55713. ) {
  55714. var dynamicValue =
  55715. getAndRemoveAttr(el, ':' + name) ||
  55716. getAndRemoveAttr(el, 'v-bind:' + name);
  55717. if (dynamicValue != null) {
  55718. return parseFilters(dynamicValue)
  55719. } else if (getStatic !== false) {
  55720. var staticValue = getAndRemoveAttr(el, name);
  55721. if (staticValue != null) {
  55722. return JSON.stringify(staticValue)
  55723. }
  55724. }
  55725. }
  55726. // note: this only removes the attr from the Array (attrsList) so that it
  55727. // doesn't get processed by processAttrs.
  55728. // By default it does NOT remove it from the map (attrsMap) because the map is
  55729. // needed during codegen.
  55730. function getAndRemoveAttr (
  55731. el,
  55732. name,
  55733. removeFromMap
  55734. ) {
  55735. var val;
  55736. if ((val = el.attrsMap[name]) != null) {
  55737. var list = el.attrsList;
  55738. for (var i = 0, l = list.length; i < l; i++) {
  55739. if (list[i].name === name) {
  55740. list.splice(i, 1);
  55741. break
  55742. }
  55743. }
  55744. }
  55745. if (removeFromMap) {
  55746. delete el.attrsMap[name];
  55747. }
  55748. return val
  55749. }
  55750. function getAndRemoveAttrByRegex (
  55751. el,
  55752. name
  55753. ) {
  55754. var list = el.attrsList;
  55755. for (var i = 0, l = list.length; i < l; i++) {
  55756. var attr = list[i];
  55757. if (name.test(attr.name)) {
  55758. list.splice(i, 1);
  55759. return attr
  55760. }
  55761. }
  55762. }
  55763. function rangeSetItem (
  55764. item,
  55765. range
  55766. ) {
  55767. if (range) {
  55768. if (range.start != null) {
  55769. item.start = range.start;
  55770. }
  55771. if (range.end != null) {
  55772. item.end = range.end;
  55773. }
  55774. }
  55775. return item
  55776. }
  55777. /* */
  55778. /**
  55779. * Cross-platform code generation for component v-model
  55780. */
  55781. function genComponentModel (
  55782. el,
  55783. value,
  55784. modifiers
  55785. ) {
  55786. var ref = modifiers || {};
  55787. var number = ref.number;
  55788. var trim = ref.trim;
  55789. var baseValueExpression = '$$v';
  55790. var valueExpression = baseValueExpression;
  55791. if (trim) {
  55792. valueExpression =
  55793. "(typeof " + baseValueExpression + " === 'string'" +
  55794. "? " + baseValueExpression + ".trim()" +
  55795. ": " + baseValueExpression + ")";
  55796. }
  55797. if (number) {
  55798. valueExpression = "_n(" + valueExpression + ")";
  55799. }
  55800. var assignment = genAssignmentCode(value, valueExpression);
  55801. el.model = {
  55802. value: ("(" + value + ")"),
  55803. expression: JSON.stringify(value),
  55804. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  55805. };
  55806. }
  55807. /**
  55808. * Cross-platform codegen helper for generating v-model value assignment code.
  55809. */
  55810. function genAssignmentCode (
  55811. value,
  55812. assignment
  55813. ) {
  55814. var res = parseModel(value);
  55815. if (res.key === null) {
  55816. return (value + "=" + assignment)
  55817. } else {
  55818. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  55819. }
  55820. }
  55821. /**
  55822. * Parse a v-model expression into a base path and a final key segment.
  55823. * Handles both dot-path and possible square brackets.
  55824. *
  55825. * Possible cases:
  55826. *
  55827. * - test
  55828. * - test[key]
  55829. * - test[test1[key]]
  55830. * - test["a"][key]
  55831. * - xxx.test[a[a].test1[key]]
  55832. * - test.xxx.a["asa"][test1[key]]
  55833. *
  55834. */
  55835. var len, str, chr, index$1, expressionPos, expressionEndPos;
  55836. function parseModel (val) {
  55837. // Fix https://github.com/vuejs/vue/pull/7730
  55838. // allow v-model="obj.val " (trailing whitespace)
  55839. val = val.trim();
  55840. len = val.length;
  55841. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  55842. index$1 = val.lastIndexOf('.');
  55843. if (index$1 > -1) {
  55844. return {
  55845. exp: val.slice(0, index$1),
  55846. key: '"' + val.slice(index$1 + 1) + '"'
  55847. }
  55848. } else {
  55849. return {
  55850. exp: val,
  55851. key: null
  55852. }
  55853. }
  55854. }
  55855. str = val;
  55856. index$1 = expressionPos = expressionEndPos = 0;
  55857. while (!eof()) {
  55858. chr = next();
  55859. /* istanbul ignore if */
  55860. if (isStringStart(chr)) {
  55861. parseString(chr);
  55862. } else if (chr === 0x5B) {
  55863. parseBracket(chr);
  55864. }
  55865. }
  55866. return {
  55867. exp: val.slice(0, expressionPos),
  55868. key: val.slice(expressionPos + 1, expressionEndPos)
  55869. }
  55870. }
  55871. function next () {
  55872. return str.charCodeAt(++index$1)
  55873. }
  55874. function eof () {
  55875. return index$1 >= len
  55876. }
  55877. function isStringStart (chr) {
  55878. return chr === 0x22 || chr === 0x27
  55879. }
  55880. function parseBracket (chr) {
  55881. var inBracket = 1;
  55882. expressionPos = index$1;
  55883. while (!eof()) {
  55884. chr = next();
  55885. if (isStringStart(chr)) {
  55886. parseString(chr);
  55887. continue
  55888. }
  55889. if (chr === 0x5B) { inBracket++; }
  55890. if (chr === 0x5D) { inBracket--; }
  55891. if (inBracket === 0) {
  55892. expressionEndPos = index$1;
  55893. break
  55894. }
  55895. }
  55896. }
  55897. function parseString (chr) {
  55898. var stringQuote = chr;
  55899. while (!eof()) {
  55900. chr = next();
  55901. if (chr === stringQuote) {
  55902. break
  55903. }
  55904. }
  55905. }
  55906. /* */
  55907. var warn$1;
  55908. // in some cases, the event used has to be determined at runtime
  55909. // so we used some reserved tokens during compile.
  55910. var RANGE_TOKEN = '__r';
  55911. var CHECKBOX_RADIO_TOKEN = '__c';
  55912. function model (
  55913. el,
  55914. dir,
  55915. _warn
  55916. ) {
  55917. warn$1 = _warn;
  55918. var value = dir.value;
  55919. var modifiers = dir.modifiers;
  55920. var tag = el.tag;
  55921. var type = el.attrsMap.type;
  55922. {
  55923. // inputs with type="file" are read only and setting the input's
  55924. // value will throw an error.
  55925. if (tag === 'input' && type === 'file') {
  55926. warn$1(
  55927. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  55928. "File inputs are read only. Use a v-on:change listener instead.",
  55929. el.rawAttrsMap['v-model']
  55930. );
  55931. }
  55932. }
  55933. if (el.component) {
  55934. genComponentModel(el, value, modifiers);
  55935. // component v-model doesn't need extra runtime
  55936. return false
  55937. } else if (tag === 'select') {
  55938. genSelect(el, value, modifiers);
  55939. } else if (tag === 'input' && type === 'checkbox') {
  55940. genCheckboxModel(el, value, modifiers);
  55941. } else if (tag === 'input' && type === 'radio') {
  55942. genRadioModel(el, value, modifiers);
  55943. } else if (tag === 'input' || tag === 'textarea') {
  55944. genDefaultModel(el, value, modifiers);
  55945. } else if (!config.isReservedTag(tag)) {
  55946. genComponentModel(el, value, modifiers);
  55947. // component v-model doesn't need extra runtime
  55948. return false
  55949. } else {
  55950. warn$1(
  55951. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  55952. "v-model is not supported on this element type. " +
  55953. 'If you are working with contenteditable, it\'s recommended to ' +
  55954. 'wrap a library dedicated for that purpose inside a custom component.',
  55955. el.rawAttrsMap['v-model']
  55956. );
  55957. }
  55958. // ensure runtime directive metadata
  55959. return true
  55960. }
  55961. function genCheckboxModel (
  55962. el,
  55963. value,
  55964. modifiers
  55965. ) {
  55966. var number = modifiers && modifiers.number;
  55967. var valueBinding = getBindingAttr(el, 'value') || 'null';
  55968. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  55969. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  55970. addProp(el, 'checked',
  55971. "Array.isArray(" + value + ")" +
  55972. "?_i(" + value + "," + valueBinding + ")>-1" + (
  55973. trueValueBinding === 'true'
  55974. ? (":(" + value + ")")
  55975. : (":_q(" + value + "," + trueValueBinding + ")")
  55976. )
  55977. );
  55978. addHandler(el, 'change',
  55979. "var $$a=" + value + "," +
  55980. '$$el=$event.target,' +
  55981. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  55982. 'if(Array.isArray($$a)){' +
  55983. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  55984. '$$i=_i($$a,$$v);' +
  55985. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  55986. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  55987. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  55988. null, true
  55989. );
  55990. }
  55991. function genRadioModel (
  55992. el,
  55993. value,
  55994. modifiers
  55995. ) {
  55996. var number = modifiers && modifiers.number;
  55997. var valueBinding = getBindingAttr(el, 'value') || 'null';
  55998. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  55999. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  56000. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  56001. }
  56002. function genSelect (
  56003. el,
  56004. value,
  56005. modifiers
  56006. ) {
  56007. var number = modifiers && modifiers.number;
  56008. var selectedVal = "Array.prototype.filter" +
  56009. ".call($event.target.options,function(o){return o.selected})" +
  56010. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  56011. "return " + (number ? '_n(val)' : 'val') + "})";
  56012. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  56013. var code = "var $$selectedVal = " + selectedVal + ";";
  56014. code = code + " " + (genAssignmentCode(value, assignment));
  56015. addHandler(el, 'change', code, null, true);
  56016. }
  56017. function genDefaultModel (
  56018. el,
  56019. value,
  56020. modifiers
  56021. ) {
  56022. var type = el.attrsMap.type;
  56023. // warn if v-bind:value conflicts with v-model
  56024. // except for inputs with v-bind:type
  56025. {
  56026. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  56027. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  56028. if (value$1 && !typeBinding) {
  56029. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  56030. warn$1(
  56031. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  56032. 'because the latter already expands to a value binding internally',
  56033. el.rawAttrsMap[binding]
  56034. );
  56035. }
  56036. }
  56037. var ref = modifiers || {};
  56038. var lazy = ref.lazy;
  56039. var number = ref.number;
  56040. var trim = ref.trim;
  56041. var needCompositionGuard = !lazy && type !== 'range';
  56042. var event = lazy
  56043. ? 'change'
  56044. : type === 'range'
  56045. ? RANGE_TOKEN
  56046. : 'input';
  56047. var valueExpression = '$event.target.value';
  56048. if (trim) {
  56049. valueExpression = "$event.target.value.trim()";
  56050. }
  56051. if (number) {
  56052. valueExpression = "_n(" + valueExpression + ")";
  56053. }
  56054. var code = genAssignmentCode(value, valueExpression);
  56055. if (needCompositionGuard) {
  56056. code = "if($event.target.composing)return;" + code;
  56057. }
  56058. addProp(el, 'value', ("(" + value + ")"));
  56059. addHandler(el, event, code, null, true);
  56060. if (trim || number) {
  56061. addHandler(el, 'blur', '$forceUpdate()');
  56062. }
  56063. }
  56064. /* */
  56065. // normalize v-model event tokens that can only be determined at runtime.
  56066. // it's important to place the event as the first in the array because
  56067. // the whole point is ensuring the v-model callback gets called before
  56068. // user-attached handlers.
  56069. function normalizeEvents (on) {
  56070. /* istanbul ignore if */
  56071. if (isDef(on[RANGE_TOKEN])) {
  56072. // IE input[type=range] only supports `change` event
  56073. var event = isIE ? 'change' : 'input';
  56074. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  56075. delete on[RANGE_TOKEN];
  56076. }
  56077. // This was originally intended to fix #4521 but no longer necessary
  56078. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  56079. /* istanbul ignore if */
  56080. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  56081. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  56082. delete on[CHECKBOX_RADIO_TOKEN];
  56083. }
  56084. }
  56085. var target$1;
  56086. function createOnceHandler$1 (event, handler, capture) {
  56087. var _target = target$1; // save current target element in closure
  56088. return function onceHandler () {
  56089. var res = handler.apply(null, arguments);
  56090. if (res !== null) {
  56091. remove$2(event, onceHandler, capture, _target);
  56092. }
  56093. }
  56094. }
  56095. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  56096. // implementation and does not fire microtasks in between event propagation, so
  56097. // safe to exclude.
  56098. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  56099. function add$1 (
  56100. name,
  56101. handler,
  56102. capture,
  56103. passive
  56104. ) {
  56105. // async edge case #6566: inner click event triggers patch, event handler
  56106. // attached to outer element during patch, and triggered again. This
  56107. // happens because browsers fire microtask ticks between event propagation.
  56108. // the solution is simple: we save the timestamp when a handler is attached,
  56109. // and the handler would only fire if the event passed to it was fired
  56110. // AFTER it was attached.
  56111. if (useMicrotaskFix) {
  56112. var attachedTimestamp = currentFlushTimestamp;
  56113. var original = handler;
  56114. handler = original._wrapper = function (e) {
  56115. if (
  56116. // no bubbling, should always fire.
  56117. // this is just a safety net in case event.timeStamp is unreliable in
  56118. // certain weird environments...
  56119. e.target === e.currentTarget ||
  56120. // event is fired after handler attachment
  56121. e.timeStamp >= attachedTimestamp ||
  56122. // bail for environments that have buggy event.timeStamp implementations
  56123. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  56124. // #9681 QtWebEngine event.timeStamp is negative value
  56125. e.timeStamp <= 0 ||
  56126. // #9448 bail if event is fired in another document in a multi-page
  56127. // electron/nw.js app, since event.timeStamp will be using a different
  56128. // starting reference
  56129. e.target.ownerDocument !== document
  56130. ) {
  56131. return original.apply(this, arguments)
  56132. }
  56133. };
  56134. }
  56135. target$1.addEventListener(
  56136. name,
  56137. handler,
  56138. supportsPassive
  56139. ? { capture: capture, passive: passive }
  56140. : capture
  56141. );
  56142. }
  56143. function remove$2 (
  56144. name,
  56145. handler,
  56146. capture,
  56147. _target
  56148. ) {
  56149. (_target || target$1).removeEventListener(
  56150. name,
  56151. handler._wrapper || handler,
  56152. capture
  56153. );
  56154. }
  56155. function updateDOMListeners (oldVnode, vnode) {
  56156. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  56157. return
  56158. }
  56159. var on = vnode.data.on || {};
  56160. var oldOn = oldVnode.data.on || {};
  56161. target$1 = vnode.elm;
  56162. normalizeEvents(on);
  56163. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  56164. target$1 = undefined;
  56165. }
  56166. var events = {
  56167. create: updateDOMListeners,
  56168. update: updateDOMListeners
  56169. };
  56170. /* */
  56171. var svgContainer;
  56172. function updateDOMProps (oldVnode, vnode) {
  56173. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  56174. return
  56175. }
  56176. var key, cur;
  56177. var elm = vnode.elm;
  56178. var oldProps = oldVnode.data.domProps || {};
  56179. var props = vnode.data.domProps || {};
  56180. // clone observed objects, as the user probably wants to mutate it
  56181. if (isDef(props.__ob__)) {
  56182. props = vnode.data.domProps = extend({}, props);
  56183. }
  56184. for (key in oldProps) {
  56185. if (!(key in props)) {
  56186. elm[key] = '';
  56187. }
  56188. }
  56189. for (key in props) {
  56190. cur = props[key];
  56191. // ignore children if the node has textContent or innerHTML,
  56192. // as these will throw away existing DOM nodes and cause removal errors
  56193. // on subsequent patches (#3360)
  56194. if (key === 'textContent' || key === 'innerHTML') {
  56195. if (vnode.children) { vnode.children.length = 0; }
  56196. if (cur === oldProps[key]) { continue }
  56197. // #6601 work around Chrome version <= 55 bug where single textNode
  56198. // replaced by innerHTML/textContent retains its parentNode property
  56199. if (elm.childNodes.length === 1) {
  56200. elm.removeChild(elm.childNodes[0]);
  56201. }
  56202. }
  56203. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  56204. // store value as _value as well since
  56205. // non-string values will be stringified
  56206. elm._value = cur;
  56207. // avoid resetting cursor position when value is the same
  56208. var strCur = isUndef(cur) ? '' : String(cur);
  56209. if (shouldUpdateValue(elm, strCur)) {
  56210. elm.value = strCur;
  56211. }
  56212. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  56213. // IE doesn't support innerHTML for SVG elements
  56214. svgContainer = svgContainer || document.createElement('div');
  56215. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  56216. var svg = svgContainer.firstChild;
  56217. while (elm.firstChild) {
  56218. elm.removeChild(elm.firstChild);
  56219. }
  56220. while (svg.firstChild) {
  56221. elm.appendChild(svg.firstChild);
  56222. }
  56223. } else if (
  56224. // skip the update if old and new VDOM state is the same.
  56225. // `value` is handled separately because the DOM value may be temporarily
  56226. // out of sync with VDOM state due to focus, composition and modifiers.
  56227. // This #4521 by skipping the unnecesarry `checked` update.
  56228. cur !== oldProps[key]
  56229. ) {
  56230. // some property updates can throw
  56231. // e.g. `value` on <progress> w/ non-finite value
  56232. try {
  56233. elm[key] = cur;
  56234. } catch (e) {}
  56235. }
  56236. }
  56237. }
  56238. // check platforms/web/util/attrs.js acceptValue
  56239. function shouldUpdateValue (elm, checkVal) {
  56240. return (!elm.composing && (
  56241. elm.tagName === 'OPTION' ||
  56242. isNotInFocusAndDirty(elm, checkVal) ||
  56243. isDirtyWithModifiers(elm, checkVal)
  56244. ))
  56245. }
  56246. function isNotInFocusAndDirty (elm, checkVal) {
  56247. // return true when textbox (.number and .trim) loses focus and its value is
  56248. // not equal to the updated value
  56249. var notInFocus = true;
  56250. // #6157
  56251. // work around IE bug when accessing document.activeElement in an iframe
  56252. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  56253. return notInFocus && elm.value !== checkVal
  56254. }
  56255. function isDirtyWithModifiers (elm, newVal) {
  56256. var value = elm.value;
  56257. var modifiers = elm._vModifiers; // injected by v-model runtime
  56258. if (isDef(modifiers)) {
  56259. if (modifiers.number) {
  56260. return toNumber(value) !== toNumber(newVal)
  56261. }
  56262. if (modifiers.trim) {
  56263. return value.trim() !== newVal.trim()
  56264. }
  56265. }
  56266. return value !== newVal
  56267. }
  56268. var domProps = {
  56269. create: updateDOMProps,
  56270. update: updateDOMProps
  56271. };
  56272. /* */
  56273. var parseStyleText = cached(function (cssText) {
  56274. var res = {};
  56275. var listDelimiter = /;(?![^(]*\))/g;
  56276. var propertyDelimiter = /:(.+)/;
  56277. cssText.split(listDelimiter).forEach(function (item) {
  56278. if (item) {
  56279. var tmp = item.split(propertyDelimiter);
  56280. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  56281. }
  56282. });
  56283. return res
  56284. });
  56285. // merge static and dynamic style data on the same vnode
  56286. function normalizeStyleData (data) {
  56287. var style = normalizeStyleBinding(data.style);
  56288. // static style is pre-processed into an object during compilation
  56289. // and is always a fresh object, so it's safe to merge into it
  56290. return data.staticStyle
  56291. ? extend(data.staticStyle, style)
  56292. : style
  56293. }
  56294. // normalize possible array / string values into Object
  56295. function normalizeStyleBinding (bindingStyle) {
  56296. if (Array.isArray(bindingStyle)) {
  56297. return toObject(bindingStyle)
  56298. }
  56299. if (typeof bindingStyle === 'string') {
  56300. return parseStyleText(bindingStyle)
  56301. }
  56302. return bindingStyle
  56303. }
  56304. /**
  56305. * parent component style should be after child's
  56306. * so that parent component's style could override it
  56307. */
  56308. function getStyle (vnode, checkChild) {
  56309. var res = {};
  56310. var styleData;
  56311. if (checkChild) {
  56312. var childNode = vnode;
  56313. while (childNode.componentInstance) {
  56314. childNode = childNode.componentInstance._vnode;
  56315. if (
  56316. childNode && childNode.data &&
  56317. (styleData = normalizeStyleData(childNode.data))
  56318. ) {
  56319. extend(res, styleData);
  56320. }
  56321. }
  56322. }
  56323. if ((styleData = normalizeStyleData(vnode.data))) {
  56324. extend(res, styleData);
  56325. }
  56326. var parentNode = vnode;
  56327. while ((parentNode = parentNode.parent)) {
  56328. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  56329. extend(res, styleData);
  56330. }
  56331. }
  56332. return res
  56333. }
  56334. /* */
  56335. var cssVarRE = /^--/;
  56336. var importantRE = /\s*!important$/;
  56337. var setProp = function (el, name, val) {
  56338. /* istanbul ignore if */
  56339. if (cssVarRE.test(name)) {
  56340. el.style.setProperty(name, val);
  56341. } else if (importantRE.test(val)) {
  56342. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  56343. } else {
  56344. var normalizedName = normalize(name);
  56345. if (Array.isArray(val)) {
  56346. // Support values array created by autoprefixer, e.g.
  56347. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  56348. // Set them one by one, and the browser will only set those it can recognize
  56349. for (var i = 0, len = val.length; i < len; i++) {
  56350. el.style[normalizedName] = val[i];
  56351. }
  56352. } else {
  56353. el.style[normalizedName] = val;
  56354. }
  56355. }
  56356. };
  56357. var vendorNames = ['Webkit', 'Moz', 'ms'];
  56358. var emptyStyle;
  56359. var normalize = cached(function (prop) {
  56360. emptyStyle = emptyStyle || document.createElement('div').style;
  56361. prop = camelize(prop);
  56362. if (prop !== 'filter' && (prop in emptyStyle)) {
  56363. return prop
  56364. }
  56365. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  56366. for (var i = 0; i < vendorNames.length; i++) {
  56367. var name = vendorNames[i] + capName;
  56368. if (name in emptyStyle) {
  56369. return name
  56370. }
  56371. }
  56372. });
  56373. function updateStyle (oldVnode, vnode) {
  56374. var data = vnode.data;
  56375. var oldData = oldVnode.data;
  56376. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  56377. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  56378. ) {
  56379. return
  56380. }
  56381. var cur, name;
  56382. var el = vnode.elm;
  56383. var oldStaticStyle = oldData.staticStyle;
  56384. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  56385. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  56386. var oldStyle = oldStaticStyle || oldStyleBinding;
  56387. var style = normalizeStyleBinding(vnode.data.style) || {};
  56388. // store normalized style under a different key for next diff
  56389. // make sure to clone it if it's reactive, since the user likely wants
  56390. // to mutate it.
  56391. vnode.data.normalizedStyle = isDef(style.__ob__)
  56392. ? extend({}, style)
  56393. : style;
  56394. var newStyle = getStyle(vnode, true);
  56395. for (name in oldStyle) {
  56396. if (isUndef(newStyle[name])) {
  56397. setProp(el, name, '');
  56398. }
  56399. }
  56400. for (name in newStyle) {
  56401. cur = newStyle[name];
  56402. if (cur !== oldStyle[name]) {
  56403. // ie9 setting to null has no effect, must use empty string
  56404. setProp(el, name, cur == null ? '' : cur);
  56405. }
  56406. }
  56407. }
  56408. var style = {
  56409. create: updateStyle,
  56410. update: updateStyle
  56411. };
  56412. /* */
  56413. var whitespaceRE = /\s+/;
  56414. /**
  56415. * Add class with compatibility for SVG since classList is not supported on
  56416. * SVG elements in IE
  56417. */
  56418. function addClass (el, cls) {
  56419. /* istanbul ignore if */
  56420. if (!cls || !(cls = cls.trim())) {
  56421. return
  56422. }
  56423. /* istanbul ignore else */
  56424. if (el.classList) {
  56425. if (cls.indexOf(' ') > -1) {
  56426. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  56427. } else {
  56428. el.classList.add(cls);
  56429. }
  56430. } else {
  56431. var cur = " " + (el.getAttribute('class') || '') + " ";
  56432. if (cur.indexOf(' ' + cls + ' ') < 0) {
  56433. el.setAttribute('class', (cur + cls).trim());
  56434. }
  56435. }
  56436. }
  56437. /**
  56438. * Remove class with compatibility for SVG since classList is not supported on
  56439. * SVG elements in IE
  56440. */
  56441. function removeClass (el, cls) {
  56442. /* istanbul ignore if */
  56443. if (!cls || !(cls = cls.trim())) {
  56444. return
  56445. }
  56446. /* istanbul ignore else */
  56447. if (el.classList) {
  56448. if (cls.indexOf(' ') > -1) {
  56449. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  56450. } else {
  56451. el.classList.remove(cls);
  56452. }
  56453. if (!el.classList.length) {
  56454. el.removeAttribute('class');
  56455. }
  56456. } else {
  56457. var cur = " " + (el.getAttribute('class') || '') + " ";
  56458. var tar = ' ' + cls + ' ';
  56459. while (cur.indexOf(tar) >= 0) {
  56460. cur = cur.replace(tar, ' ');
  56461. }
  56462. cur = cur.trim();
  56463. if (cur) {
  56464. el.setAttribute('class', cur);
  56465. } else {
  56466. el.removeAttribute('class');
  56467. }
  56468. }
  56469. }
  56470. /* */
  56471. function resolveTransition (def$$1) {
  56472. if (!def$$1) {
  56473. return
  56474. }
  56475. /* istanbul ignore else */
  56476. if (typeof def$$1 === 'object') {
  56477. var res = {};
  56478. if (def$$1.css !== false) {
  56479. extend(res, autoCssTransition(def$$1.name || 'v'));
  56480. }
  56481. extend(res, def$$1);
  56482. return res
  56483. } else if (typeof def$$1 === 'string') {
  56484. return autoCssTransition(def$$1)
  56485. }
  56486. }
  56487. var autoCssTransition = cached(function (name) {
  56488. return {
  56489. enterClass: (name + "-enter"),
  56490. enterToClass: (name + "-enter-to"),
  56491. enterActiveClass: (name + "-enter-active"),
  56492. leaveClass: (name + "-leave"),
  56493. leaveToClass: (name + "-leave-to"),
  56494. leaveActiveClass: (name + "-leave-active")
  56495. }
  56496. });
  56497. var hasTransition = inBrowser && !isIE9;
  56498. var TRANSITION = 'transition';
  56499. var ANIMATION = 'animation';
  56500. // Transition property/event sniffing
  56501. var transitionProp = 'transition';
  56502. var transitionEndEvent = 'transitionend';
  56503. var animationProp = 'animation';
  56504. var animationEndEvent = 'animationend';
  56505. if (hasTransition) {
  56506. /* istanbul ignore if */
  56507. if (window.ontransitionend === undefined &&
  56508. window.onwebkittransitionend !== undefined
  56509. ) {
  56510. transitionProp = 'WebkitTransition';
  56511. transitionEndEvent = 'webkitTransitionEnd';
  56512. }
  56513. if (window.onanimationend === undefined &&
  56514. window.onwebkitanimationend !== undefined
  56515. ) {
  56516. animationProp = 'WebkitAnimation';
  56517. animationEndEvent = 'webkitAnimationEnd';
  56518. }
  56519. }
  56520. // binding to window is necessary to make hot reload work in IE in strict mode
  56521. var raf = inBrowser
  56522. ? window.requestAnimationFrame
  56523. ? window.requestAnimationFrame.bind(window)
  56524. : setTimeout
  56525. : /* istanbul ignore next */ function (fn) { return fn(); };
  56526. function nextFrame (fn) {
  56527. raf(function () {
  56528. raf(fn);
  56529. });
  56530. }
  56531. function addTransitionClass (el, cls) {
  56532. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  56533. if (transitionClasses.indexOf(cls) < 0) {
  56534. transitionClasses.push(cls);
  56535. addClass(el, cls);
  56536. }
  56537. }
  56538. function removeTransitionClass (el, cls) {
  56539. if (el._transitionClasses) {
  56540. remove(el._transitionClasses, cls);
  56541. }
  56542. removeClass(el, cls);
  56543. }
  56544. function whenTransitionEnds (
  56545. el,
  56546. expectedType,
  56547. cb
  56548. ) {
  56549. var ref = getTransitionInfo(el, expectedType);
  56550. var type = ref.type;
  56551. var timeout = ref.timeout;
  56552. var propCount = ref.propCount;
  56553. if (!type) { return cb() }
  56554. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  56555. var ended = 0;
  56556. var end = function () {
  56557. el.removeEventListener(event, onEnd);
  56558. cb();
  56559. };
  56560. var onEnd = function (e) {
  56561. if (e.target === el) {
  56562. if (++ended >= propCount) {
  56563. end();
  56564. }
  56565. }
  56566. };
  56567. setTimeout(function () {
  56568. if (ended < propCount) {
  56569. end();
  56570. }
  56571. }, timeout + 1);
  56572. el.addEventListener(event, onEnd);
  56573. }
  56574. var transformRE = /\b(transform|all)(,|$)/;
  56575. function getTransitionInfo (el, expectedType) {
  56576. var styles = window.getComputedStyle(el);
  56577. // JSDOM may return undefined for transition properties
  56578. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  56579. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  56580. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  56581. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  56582. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  56583. var animationTimeout = getTimeout(animationDelays, animationDurations);
  56584. var type;
  56585. var timeout = 0;
  56586. var propCount = 0;
  56587. /* istanbul ignore if */
  56588. if (expectedType === TRANSITION) {
  56589. if (transitionTimeout > 0) {
  56590. type = TRANSITION;
  56591. timeout = transitionTimeout;
  56592. propCount = transitionDurations.length;
  56593. }
  56594. } else if (expectedType === ANIMATION) {
  56595. if (animationTimeout > 0) {
  56596. type = ANIMATION;
  56597. timeout = animationTimeout;
  56598. propCount = animationDurations.length;
  56599. }
  56600. } else {
  56601. timeout = Math.max(transitionTimeout, animationTimeout);
  56602. type = timeout > 0
  56603. ? transitionTimeout > animationTimeout
  56604. ? TRANSITION
  56605. : ANIMATION
  56606. : null;
  56607. propCount = type
  56608. ? type === TRANSITION
  56609. ? transitionDurations.length
  56610. : animationDurations.length
  56611. : 0;
  56612. }
  56613. var hasTransform =
  56614. type === TRANSITION &&
  56615. transformRE.test(styles[transitionProp + 'Property']);
  56616. return {
  56617. type: type,
  56618. timeout: timeout,
  56619. propCount: propCount,
  56620. hasTransform: hasTransform
  56621. }
  56622. }
  56623. function getTimeout (delays, durations) {
  56624. /* istanbul ignore next */
  56625. while (delays.length < durations.length) {
  56626. delays = delays.concat(delays);
  56627. }
  56628. return Math.max.apply(null, durations.map(function (d, i) {
  56629. return toMs(d) + toMs(delays[i])
  56630. }))
  56631. }
  56632. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  56633. // in a locale-dependent way, using a comma instead of a dot.
  56634. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  56635. // as a floor function) causing unexpected behaviors
  56636. function toMs (s) {
  56637. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  56638. }
  56639. /* */
  56640. function enter (vnode, toggleDisplay) {
  56641. var el = vnode.elm;
  56642. // call leave callback now
  56643. if (isDef(el._leaveCb)) {
  56644. el._leaveCb.cancelled = true;
  56645. el._leaveCb();
  56646. }
  56647. var data = resolveTransition(vnode.data.transition);
  56648. if (isUndef(data)) {
  56649. return
  56650. }
  56651. /* istanbul ignore if */
  56652. if (isDef(el._enterCb) || el.nodeType !== 1) {
  56653. return
  56654. }
  56655. var css = data.css;
  56656. var type = data.type;
  56657. var enterClass = data.enterClass;
  56658. var enterToClass = data.enterToClass;
  56659. var enterActiveClass = data.enterActiveClass;
  56660. var appearClass = data.appearClass;
  56661. var appearToClass = data.appearToClass;
  56662. var appearActiveClass = data.appearActiveClass;
  56663. var beforeEnter = data.beforeEnter;
  56664. var enter = data.enter;
  56665. var afterEnter = data.afterEnter;
  56666. var enterCancelled = data.enterCancelled;
  56667. var beforeAppear = data.beforeAppear;
  56668. var appear = data.appear;
  56669. var afterAppear = data.afterAppear;
  56670. var appearCancelled = data.appearCancelled;
  56671. var duration = data.duration;
  56672. // activeInstance will always be the <transition> component managing this
  56673. // transition. One edge case to check is when the <transition> is placed
  56674. // as the root node of a child component. In that case we need to check
  56675. // <transition>'s parent for appear check.
  56676. var context = activeInstance;
  56677. var transitionNode = activeInstance.$vnode;
  56678. while (transitionNode && transitionNode.parent) {
  56679. context = transitionNode.context;
  56680. transitionNode = transitionNode.parent;
  56681. }
  56682. var isAppear = !context._isMounted || !vnode.isRootInsert;
  56683. if (isAppear && !appear && appear !== '') {
  56684. return
  56685. }
  56686. var startClass = isAppear && appearClass
  56687. ? appearClass
  56688. : enterClass;
  56689. var activeClass = isAppear && appearActiveClass
  56690. ? appearActiveClass
  56691. : enterActiveClass;
  56692. var toClass = isAppear && appearToClass
  56693. ? appearToClass
  56694. : enterToClass;
  56695. var beforeEnterHook = isAppear
  56696. ? (beforeAppear || beforeEnter)
  56697. : beforeEnter;
  56698. var enterHook = isAppear
  56699. ? (typeof appear === 'function' ? appear : enter)
  56700. : enter;
  56701. var afterEnterHook = isAppear
  56702. ? (afterAppear || afterEnter)
  56703. : afterEnter;
  56704. var enterCancelledHook = isAppear
  56705. ? (appearCancelled || enterCancelled)
  56706. : enterCancelled;
  56707. var explicitEnterDuration = toNumber(
  56708. isObject(duration)
  56709. ? duration.enter
  56710. : duration
  56711. );
  56712. if (explicitEnterDuration != null) {
  56713. checkDuration(explicitEnterDuration, 'enter', vnode);
  56714. }
  56715. var expectsCSS = css !== false && !isIE9;
  56716. var userWantsControl = getHookArgumentsLength(enterHook);
  56717. var cb = el._enterCb = once(function () {
  56718. if (expectsCSS) {
  56719. removeTransitionClass(el, toClass);
  56720. removeTransitionClass(el, activeClass);
  56721. }
  56722. if (cb.cancelled) {
  56723. if (expectsCSS) {
  56724. removeTransitionClass(el, startClass);
  56725. }
  56726. enterCancelledHook && enterCancelledHook(el);
  56727. } else {
  56728. afterEnterHook && afterEnterHook(el);
  56729. }
  56730. el._enterCb = null;
  56731. });
  56732. if (!vnode.data.show) {
  56733. // remove pending leave element on enter by injecting an insert hook
  56734. mergeVNodeHook(vnode, 'insert', function () {
  56735. var parent = el.parentNode;
  56736. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  56737. if (pendingNode &&
  56738. pendingNode.tag === vnode.tag &&
  56739. pendingNode.elm._leaveCb
  56740. ) {
  56741. pendingNode.elm._leaveCb();
  56742. }
  56743. enterHook && enterHook(el, cb);
  56744. });
  56745. }
  56746. // start enter transition
  56747. beforeEnterHook && beforeEnterHook(el);
  56748. if (expectsCSS) {
  56749. addTransitionClass(el, startClass);
  56750. addTransitionClass(el, activeClass);
  56751. nextFrame(function () {
  56752. removeTransitionClass(el, startClass);
  56753. if (!cb.cancelled) {
  56754. addTransitionClass(el, toClass);
  56755. if (!userWantsControl) {
  56756. if (isValidDuration(explicitEnterDuration)) {
  56757. setTimeout(cb, explicitEnterDuration);
  56758. } else {
  56759. whenTransitionEnds(el, type, cb);
  56760. }
  56761. }
  56762. }
  56763. });
  56764. }
  56765. if (vnode.data.show) {
  56766. toggleDisplay && toggleDisplay();
  56767. enterHook && enterHook(el, cb);
  56768. }
  56769. if (!expectsCSS && !userWantsControl) {
  56770. cb();
  56771. }
  56772. }
  56773. function leave (vnode, rm) {
  56774. var el = vnode.elm;
  56775. // call enter callback now
  56776. if (isDef(el._enterCb)) {
  56777. el._enterCb.cancelled = true;
  56778. el._enterCb();
  56779. }
  56780. var data = resolveTransition(vnode.data.transition);
  56781. if (isUndef(data) || el.nodeType !== 1) {
  56782. return rm()
  56783. }
  56784. /* istanbul ignore if */
  56785. if (isDef(el._leaveCb)) {
  56786. return
  56787. }
  56788. var css = data.css;
  56789. var type = data.type;
  56790. var leaveClass = data.leaveClass;
  56791. var leaveToClass = data.leaveToClass;
  56792. var leaveActiveClass = data.leaveActiveClass;
  56793. var beforeLeave = data.beforeLeave;
  56794. var leave = data.leave;
  56795. var afterLeave = data.afterLeave;
  56796. var leaveCancelled = data.leaveCancelled;
  56797. var delayLeave = data.delayLeave;
  56798. var duration = data.duration;
  56799. var expectsCSS = css !== false && !isIE9;
  56800. var userWantsControl = getHookArgumentsLength(leave);
  56801. var explicitLeaveDuration = toNumber(
  56802. isObject(duration)
  56803. ? duration.leave
  56804. : duration
  56805. );
  56806. if (isDef(explicitLeaveDuration)) {
  56807. checkDuration(explicitLeaveDuration, 'leave', vnode);
  56808. }
  56809. var cb = el._leaveCb = once(function () {
  56810. if (el.parentNode && el.parentNode._pending) {
  56811. el.parentNode._pending[vnode.key] = null;
  56812. }
  56813. if (expectsCSS) {
  56814. removeTransitionClass(el, leaveToClass);
  56815. removeTransitionClass(el, leaveActiveClass);
  56816. }
  56817. if (cb.cancelled) {
  56818. if (expectsCSS) {
  56819. removeTransitionClass(el, leaveClass);
  56820. }
  56821. leaveCancelled && leaveCancelled(el);
  56822. } else {
  56823. rm();
  56824. afterLeave && afterLeave(el);
  56825. }
  56826. el._leaveCb = null;
  56827. });
  56828. if (delayLeave) {
  56829. delayLeave(performLeave);
  56830. } else {
  56831. performLeave();
  56832. }
  56833. function performLeave () {
  56834. // the delayed leave may have already been cancelled
  56835. if (cb.cancelled) {
  56836. return
  56837. }
  56838. // record leaving element
  56839. if (!vnode.data.show && el.parentNode) {
  56840. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  56841. }
  56842. beforeLeave && beforeLeave(el);
  56843. if (expectsCSS) {
  56844. addTransitionClass(el, leaveClass);
  56845. addTransitionClass(el, leaveActiveClass);
  56846. nextFrame(function () {
  56847. removeTransitionClass(el, leaveClass);
  56848. if (!cb.cancelled) {
  56849. addTransitionClass(el, leaveToClass);
  56850. if (!userWantsControl) {
  56851. if (isValidDuration(explicitLeaveDuration)) {
  56852. setTimeout(cb, explicitLeaveDuration);
  56853. } else {
  56854. whenTransitionEnds(el, type, cb);
  56855. }
  56856. }
  56857. }
  56858. });
  56859. }
  56860. leave && leave(el, cb);
  56861. if (!expectsCSS && !userWantsControl) {
  56862. cb();
  56863. }
  56864. }
  56865. }
  56866. // only used in dev mode
  56867. function checkDuration (val, name, vnode) {
  56868. if (typeof val !== 'number') {
  56869. warn(
  56870. "<transition> explicit " + name + " duration is not a valid number - " +
  56871. "got " + (JSON.stringify(val)) + ".",
  56872. vnode.context
  56873. );
  56874. } else if (isNaN(val)) {
  56875. warn(
  56876. "<transition> explicit " + name + " duration is NaN - " +
  56877. 'the duration expression might be incorrect.',
  56878. vnode.context
  56879. );
  56880. }
  56881. }
  56882. function isValidDuration (val) {
  56883. return typeof val === 'number' && !isNaN(val)
  56884. }
  56885. /**
  56886. * Normalize a transition hook's argument length. The hook may be:
  56887. * - a merged hook (invoker) with the original in .fns
  56888. * - a wrapped component method (check ._length)
  56889. * - a plain function (.length)
  56890. */
  56891. function getHookArgumentsLength (fn) {
  56892. if (isUndef(fn)) {
  56893. return false
  56894. }
  56895. var invokerFns = fn.fns;
  56896. if (isDef(invokerFns)) {
  56897. // invoker
  56898. return getHookArgumentsLength(
  56899. Array.isArray(invokerFns)
  56900. ? invokerFns[0]
  56901. : invokerFns
  56902. )
  56903. } else {
  56904. return (fn._length || fn.length) > 1
  56905. }
  56906. }
  56907. function _enter (_, vnode) {
  56908. if (vnode.data.show !== true) {
  56909. enter(vnode);
  56910. }
  56911. }
  56912. var transition = inBrowser ? {
  56913. create: _enter,
  56914. activate: _enter,
  56915. remove: function remove$$1 (vnode, rm) {
  56916. /* istanbul ignore else */
  56917. if (vnode.data.show !== true) {
  56918. leave(vnode, rm);
  56919. } else {
  56920. rm();
  56921. }
  56922. }
  56923. } : {};
  56924. var platformModules = [
  56925. attrs,
  56926. klass,
  56927. events,
  56928. domProps,
  56929. style,
  56930. transition
  56931. ];
  56932. /* */
  56933. // the directive module should be applied last, after all
  56934. // built-in modules have been applied.
  56935. var modules = platformModules.concat(baseModules);
  56936. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  56937. /**
  56938. * Not type checking this file because flow doesn't like attaching
  56939. * properties to Elements.
  56940. */
  56941. /* istanbul ignore if */
  56942. if (isIE9) {
  56943. // http://www.matts411.com/post/internet-explorer-9-oninput/
  56944. document.addEventListener('selectionchange', function () {
  56945. var el = document.activeElement;
  56946. if (el && el.vmodel) {
  56947. trigger(el, 'input');
  56948. }
  56949. });
  56950. }
  56951. var directive = {
  56952. inserted: function inserted (el, binding, vnode, oldVnode) {
  56953. if (vnode.tag === 'select') {
  56954. // #6903
  56955. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  56956. mergeVNodeHook(vnode, 'postpatch', function () {
  56957. directive.componentUpdated(el, binding, vnode);
  56958. });
  56959. } else {
  56960. setSelected(el, binding, vnode.context);
  56961. }
  56962. el._vOptions = [].map.call(el.options, getValue);
  56963. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  56964. el._vModifiers = binding.modifiers;
  56965. if (!binding.modifiers.lazy) {
  56966. el.addEventListener('compositionstart', onCompositionStart);
  56967. el.addEventListener('compositionend', onCompositionEnd);
  56968. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  56969. // switching focus before confirming composition choice
  56970. // this also fixes the issue where some browsers e.g. iOS Chrome
  56971. // fires "change" instead of "input" on autocomplete.
  56972. el.addEventListener('change', onCompositionEnd);
  56973. /* istanbul ignore if */
  56974. if (isIE9) {
  56975. el.vmodel = true;
  56976. }
  56977. }
  56978. }
  56979. },
  56980. componentUpdated: function componentUpdated (el, binding, vnode) {
  56981. if (vnode.tag === 'select') {
  56982. setSelected(el, binding, vnode.context);
  56983. // in case the options rendered by v-for have changed,
  56984. // it's possible that the value is out-of-sync with the rendered options.
  56985. // detect such cases and filter out values that no longer has a matching
  56986. // option in the DOM.
  56987. var prevOptions = el._vOptions;
  56988. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  56989. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  56990. // trigger change event if
  56991. // no matching option found for at least one value
  56992. var needReset = el.multiple
  56993. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  56994. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  56995. if (needReset) {
  56996. trigger(el, 'change');
  56997. }
  56998. }
  56999. }
  57000. }
  57001. };
  57002. function setSelected (el, binding, vm) {
  57003. actuallySetSelected(el, binding, vm);
  57004. /* istanbul ignore if */
  57005. if (isIE || isEdge) {
  57006. setTimeout(function () {
  57007. actuallySetSelected(el, binding, vm);
  57008. }, 0);
  57009. }
  57010. }
  57011. function actuallySetSelected (el, binding, vm) {
  57012. var value = binding.value;
  57013. var isMultiple = el.multiple;
  57014. if (isMultiple && !Array.isArray(value)) {
  57015. warn(
  57016. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  57017. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  57018. vm
  57019. );
  57020. return
  57021. }
  57022. var selected, option;
  57023. for (var i = 0, l = el.options.length; i < l; i++) {
  57024. option = el.options[i];
  57025. if (isMultiple) {
  57026. selected = looseIndexOf(value, getValue(option)) > -1;
  57027. if (option.selected !== selected) {
  57028. option.selected = selected;
  57029. }
  57030. } else {
  57031. if (looseEqual(getValue(option), value)) {
  57032. if (el.selectedIndex !== i) {
  57033. el.selectedIndex = i;
  57034. }
  57035. return
  57036. }
  57037. }
  57038. }
  57039. if (!isMultiple) {
  57040. el.selectedIndex = -1;
  57041. }
  57042. }
  57043. function hasNoMatchingOption (value, options) {
  57044. return options.every(function (o) { return !looseEqual(o, value); })
  57045. }
  57046. function getValue (option) {
  57047. return '_value' in option
  57048. ? option._value
  57049. : option.value
  57050. }
  57051. function onCompositionStart (e) {
  57052. e.target.composing = true;
  57053. }
  57054. function onCompositionEnd (e) {
  57055. // prevent triggering an input event for no reason
  57056. if (!e.target.composing) { return }
  57057. e.target.composing = false;
  57058. trigger(e.target, 'input');
  57059. }
  57060. function trigger (el, type) {
  57061. var e = document.createEvent('HTMLEvents');
  57062. e.initEvent(type, true, true);
  57063. el.dispatchEvent(e);
  57064. }
  57065. /* */
  57066. // recursively search for possible transition defined inside the component root
  57067. function locateNode (vnode) {
  57068. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  57069. ? locateNode(vnode.componentInstance._vnode)
  57070. : vnode
  57071. }
  57072. var show = {
  57073. bind: function bind (el, ref, vnode) {
  57074. var value = ref.value;
  57075. vnode = locateNode(vnode);
  57076. var transition$$1 = vnode.data && vnode.data.transition;
  57077. var originalDisplay = el.__vOriginalDisplay =
  57078. el.style.display === 'none' ? '' : el.style.display;
  57079. if (value && transition$$1) {
  57080. vnode.data.show = true;
  57081. enter(vnode, function () {
  57082. el.style.display = originalDisplay;
  57083. });
  57084. } else {
  57085. el.style.display = value ? originalDisplay : 'none';
  57086. }
  57087. },
  57088. update: function update (el, ref, vnode) {
  57089. var value = ref.value;
  57090. var oldValue = ref.oldValue;
  57091. /* istanbul ignore if */
  57092. if (!value === !oldValue) { return }
  57093. vnode = locateNode(vnode);
  57094. var transition$$1 = vnode.data && vnode.data.transition;
  57095. if (transition$$1) {
  57096. vnode.data.show = true;
  57097. if (value) {
  57098. enter(vnode, function () {
  57099. el.style.display = el.__vOriginalDisplay;
  57100. });
  57101. } else {
  57102. leave(vnode, function () {
  57103. el.style.display = 'none';
  57104. });
  57105. }
  57106. } else {
  57107. el.style.display = value ? el.__vOriginalDisplay : 'none';
  57108. }
  57109. },
  57110. unbind: function unbind (
  57111. el,
  57112. binding,
  57113. vnode,
  57114. oldVnode,
  57115. isDestroy
  57116. ) {
  57117. if (!isDestroy) {
  57118. el.style.display = el.__vOriginalDisplay;
  57119. }
  57120. }
  57121. };
  57122. var platformDirectives = {
  57123. model: directive,
  57124. show: show
  57125. };
  57126. /* */
  57127. var transitionProps = {
  57128. name: String,
  57129. appear: Boolean,
  57130. css: Boolean,
  57131. mode: String,
  57132. type: String,
  57133. enterClass: String,
  57134. leaveClass: String,
  57135. enterToClass: String,
  57136. leaveToClass: String,
  57137. enterActiveClass: String,
  57138. leaveActiveClass: String,
  57139. appearClass: String,
  57140. appearActiveClass: String,
  57141. appearToClass: String,
  57142. duration: [Number, String, Object]
  57143. };
  57144. // in case the child is also an abstract component, e.g. <keep-alive>
  57145. // we want to recursively retrieve the real component to be rendered
  57146. function getRealChild (vnode) {
  57147. var compOptions = vnode && vnode.componentOptions;
  57148. if (compOptions && compOptions.Ctor.options.abstract) {
  57149. return getRealChild(getFirstComponentChild(compOptions.children))
  57150. } else {
  57151. return vnode
  57152. }
  57153. }
  57154. function extractTransitionData (comp) {
  57155. var data = {};
  57156. var options = comp.$options;
  57157. // props
  57158. for (var key in options.propsData) {
  57159. data[key] = comp[key];
  57160. }
  57161. // events.
  57162. // extract listeners and pass them directly to the transition methods
  57163. var listeners = options._parentListeners;
  57164. for (var key$1 in listeners) {
  57165. data[camelize(key$1)] = listeners[key$1];
  57166. }
  57167. return data
  57168. }
  57169. function placeholder (h, rawChild) {
  57170. if (/\d-keep-alive$/.test(rawChild.tag)) {
  57171. return h('keep-alive', {
  57172. props: rawChild.componentOptions.propsData
  57173. })
  57174. }
  57175. }
  57176. function hasParentTransition (vnode) {
  57177. while ((vnode = vnode.parent)) {
  57178. if (vnode.data.transition) {
  57179. return true
  57180. }
  57181. }
  57182. }
  57183. function isSameChild (child, oldChild) {
  57184. return oldChild.key === child.key && oldChild.tag === child.tag
  57185. }
  57186. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  57187. var isVShowDirective = function (d) { return d.name === 'show'; };
  57188. var Transition = {
  57189. name: 'transition',
  57190. props: transitionProps,
  57191. abstract: true,
  57192. render: function render (h) {
  57193. var this$1 = this;
  57194. var children = this.$slots.default;
  57195. if (!children) {
  57196. return
  57197. }
  57198. // filter out text nodes (possible whitespaces)
  57199. children = children.filter(isNotTextNode);
  57200. /* istanbul ignore if */
  57201. if (!children.length) {
  57202. return
  57203. }
  57204. // warn multiple elements
  57205. if (children.length > 1) {
  57206. warn(
  57207. '<transition> can only be used on a single element. Use ' +
  57208. '<transition-group> for lists.',
  57209. this.$parent
  57210. );
  57211. }
  57212. var mode = this.mode;
  57213. // warn invalid mode
  57214. if (mode && mode !== 'in-out' && mode !== 'out-in'
  57215. ) {
  57216. warn(
  57217. 'invalid <transition> mode: ' + mode,
  57218. this.$parent
  57219. );
  57220. }
  57221. var rawChild = children[0];
  57222. // if this is a component root node and the component's
  57223. // parent container node also has transition, skip.
  57224. if (hasParentTransition(this.$vnode)) {
  57225. return rawChild
  57226. }
  57227. // apply transition data to child
  57228. // use getRealChild() to ignore abstract components e.g. keep-alive
  57229. var child = getRealChild(rawChild);
  57230. /* istanbul ignore if */
  57231. if (!child) {
  57232. return rawChild
  57233. }
  57234. if (this._leaving) {
  57235. return placeholder(h, rawChild)
  57236. }
  57237. // ensure a key that is unique to the vnode type and to this transition
  57238. // component instance. This key will be used to remove pending leaving nodes
  57239. // during entering.
  57240. var id = "__transition-" + (this._uid) + "-";
  57241. child.key = child.key == null
  57242. ? child.isComment
  57243. ? id + 'comment'
  57244. : id + child.tag
  57245. : isPrimitive(child.key)
  57246. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  57247. : child.key;
  57248. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  57249. var oldRawChild = this._vnode;
  57250. var oldChild = getRealChild(oldRawChild);
  57251. // mark v-show
  57252. // so that the transition module can hand over the control to the directive
  57253. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  57254. child.data.show = true;
  57255. }
  57256. if (
  57257. oldChild &&
  57258. oldChild.data &&
  57259. !isSameChild(child, oldChild) &&
  57260. !isAsyncPlaceholder(oldChild) &&
  57261. // #6687 component root is a comment node
  57262. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  57263. ) {
  57264. // replace old child transition data with fresh one
  57265. // important for dynamic transitions!
  57266. var oldData = oldChild.data.transition = extend({}, data);
  57267. // handle transition mode
  57268. if (mode === 'out-in') {
  57269. // return placeholder node and queue update when leave finishes
  57270. this._leaving = true;
  57271. mergeVNodeHook(oldData, 'afterLeave', function () {
  57272. this$1._leaving = false;
  57273. this$1.$forceUpdate();
  57274. });
  57275. return placeholder(h, rawChild)
  57276. } else if (mode === 'in-out') {
  57277. if (isAsyncPlaceholder(child)) {
  57278. return oldRawChild
  57279. }
  57280. var delayedLeave;
  57281. var performLeave = function () { delayedLeave(); };
  57282. mergeVNodeHook(data, 'afterEnter', performLeave);
  57283. mergeVNodeHook(data, 'enterCancelled', performLeave);
  57284. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  57285. }
  57286. }
  57287. return rawChild
  57288. }
  57289. };
  57290. /* */
  57291. var props = extend({
  57292. tag: String,
  57293. moveClass: String
  57294. }, transitionProps);
  57295. delete props.mode;
  57296. var TransitionGroup = {
  57297. props: props,
  57298. beforeMount: function beforeMount () {
  57299. var this$1 = this;
  57300. var update = this._update;
  57301. this._update = function (vnode, hydrating) {
  57302. var restoreActiveInstance = setActiveInstance(this$1);
  57303. // force removing pass
  57304. this$1.__patch__(
  57305. this$1._vnode,
  57306. this$1.kept,
  57307. false, // hydrating
  57308. true // removeOnly (!important, avoids unnecessary moves)
  57309. );
  57310. this$1._vnode = this$1.kept;
  57311. restoreActiveInstance();
  57312. update.call(this$1, vnode, hydrating);
  57313. };
  57314. },
  57315. render: function render (h) {
  57316. var tag = this.tag || this.$vnode.data.tag || 'span';
  57317. var map = Object.create(null);
  57318. var prevChildren = this.prevChildren = this.children;
  57319. var rawChildren = this.$slots.default || [];
  57320. var children = this.children = [];
  57321. var transitionData = extractTransitionData(this);
  57322. for (var i = 0; i < rawChildren.length; i++) {
  57323. var c = rawChildren[i];
  57324. if (c.tag) {
  57325. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  57326. children.push(c);
  57327. map[c.key] = c
  57328. ;(c.data || (c.data = {})).transition = transitionData;
  57329. } else {
  57330. var opts = c.componentOptions;
  57331. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  57332. warn(("<transition-group> children must be keyed: <" + name + ">"));
  57333. }
  57334. }
  57335. }
  57336. if (prevChildren) {
  57337. var kept = [];
  57338. var removed = [];
  57339. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  57340. var c$1 = prevChildren[i$1];
  57341. c$1.data.transition = transitionData;
  57342. c$1.data.pos = c$1.elm.getBoundingClientRect();
  57343. if (map[c$1.key]) {
  57344. kept.push(c$1);
  57345. } else {
  57346. removed.push(c$1);
  57347. }
  57348. }
  57349. this.kept = h(tag, null, kept);
  57350. this.removed = removed;
  57351. }
  57352. return h(tag, null, children)
  57353. },
  57354. updated: function updated () {
  57355. var children = this.prevChildren;
  57356. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  57357. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  57358. return
  57359. }
  57360. // we divide the work into three loops to avoid mixing DOM reads and writes
  57361. // in each iteration - which helps prevent layout thrashing.
  57362. children.forEach(callPendingCbs);
  57363. children.forEach(recordPosition);
  57364. children.forEach(applyTranslation);
  57365. // force reflow to put everything in position
  57366. // assign to this to avoid being removed in tree-shaking
  57367. // $flow-disable-line
  57368. this._reflow = document.body.offsetHeight;
  57369. children.forEach(function (c) {
  57370. if (c.data.moved) {
  57371. var el = c.elm;
  57372. var s = el.style;
  57373. addTransitionClass(el, moveClass);
  57374. s.transform = s.WebkitTransform = s.transitionDuration = '';
  57375. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  57376. if (e && e.target !== el) {
  57377. return
  57378. }
  57379. if (!e || /transform$/.test(e.propertyName)) {
  57380. el.removeEventListener(transitionEndEvent, cb);
  57381. el._moveCb = null;
  57382. removeTransitionClass(el, moveClass);
  57383. }
  57384. });
  57385. }
  57386. });
  57387. },
  57388. methods: {
  57389. hasMove: function hasMove (el, moveClass) {
  57390. /* istanbul ignore if */
  57391. if (!hasTransition) {
  57392. return false
  57393. }
  57394. /* istanbul ignore if */
  57395. if (this._hasMove) {
  57396. return this._hasMove
  57397. }
  57398. // Detect whether an element with the move class applied has
  57399. // CSS transitions. Since the element may be inside an entering
  57400. // transition at this very moment, we make a clone of it and remove
  57401. // all other transition classes applied to ensure only the move class
  57402. // is applied.
  57403. var clone = el.cloneNode();
  57404. if (el._transitionClasses) {
  57405. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  57406. }
  57407. addClass(clone, moveClass);
  57408. clone.style.display = 'none';
  57409. this.$el.appendChild(clone);
  57410. var info = getTransitionInfo(clone);
  57411. this.$el.removeChild(clone);
  57412. return (this._hasMove = info.hasTransform)
  57413. }
  57414. }
  57415. };
  57416. function callPendingCbs (c) {
  57417. /* istanbul ignore if */
  57418. if (c.elm._moveCb) {
  57419. c.elm._moveCb();
  57420. }
  57421. /* istanbul ignore if */
  57422. if (c.elm._enterCb) {
  57423. c.elm._enterCb();
  57424. }
  57425. }
  57426. function recordPosition (c) {
  57427. c.data.newPos = c.elm.getBoundingClientRect();
  57428. }
  57429. function applyTranslation (c) {
  57430. var oldPos = c.data.pos;
  57431. var newPos = c.data.newPos;
  57432. var dx = oldPos.left - newPos.left;
  57433. var dy = oldPos.top - newPos.top;
  57434. if (dx || dy) {
  57435. c.data.moved = true;
  57436. var s = c.elm.style;
  57437. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  57438. s.transitionDuration = '0s';
  57439. }
  57440. }
  57441. var platformComponents = {
  57442. Transition: Transition,
  57443. TransitionGroup: TransitionGroup
  57444. };
  57445. /* */
  57446. // install platform specific utils
  57447. Vue.config.mustUseProp = mustUseProp;
  57448. Vue.config.isReservedTag = isReservedTag;
  57449. Vue.config.isReservedAttr = isReservedAttr;
  57450. Vue.config.getTagNamespace = getTagNamespace;
  57451. Vue.config.isUnknownElement = isUnknownElement;
  57452. // install platform runtime directives & components
  57453. extend(Vue.options.directives, platformDirectives);
  57454. extend(Vue.options.components, platformComponents);
  57455. // install platform patch function
  57456. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  57457. // public mount method
  57458. Vue.prototype.$mount = function (
  57459. el,
  57460. hydrating
  57461. ) {
  57462. el = el && inBrowser ? query(el) : undefined;
  57463. return mountComponent(this, el, hydrating)
  57464. };
  57465. // devtools global hook
  57466. /* istanbul ignore next */
  57467. if (inBrowser) {
  57468. setTimeout(function () {
  57469. if (config.devtools) {
  57470. if (devtools) {
  57471. devtools.emit('init', Vue);
  57472. } else {
  57473. console[console.info ? 'info' : 'log'](
  57474. 'Download the Vue Devtools extension for a better development experience:\n' +
  57475. 'https://github.com/vuejs/vue-devtools'
  57476. );
  57477. }
  57478. }
  57479. if (config.productionTip !== false &&
  57480. typeof console !== 'undefined'
  57481. ) {
  57482. console[console.info ? 'info' : 'log'](
  57483. "You are running Vue in development mode.\n" +
  57484. "Make sure to turn on production mode when deploying for production.\n" +
  57485. "See more tips at https://vuejs.org/guide/deployment.html"
  57486. );
  57487. }
  57488. }, 0);
  57489. }
  57490. /* */
  57491. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  57492. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  57493. var buildRegex = cached(function (delimiters) {
  57494. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  57495. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  57496. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  57497. });
  57498. function parseText (
  57499. text,
  57500. delimiters
  57501. ) {
  57502. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  57503. if (!tagRE.test(text)) {
  57504. return
  57505. }
  57506. var tokens = [];
  57507. var rawTokens = [];
  57508. var lastIndex = tagRE.lastIndex = 0;
  57509. var match, index, tokenValue;
  57510. while ((match = tagRE.exec(text))) {
  57511. index = match.index;
  57512. // push text token
  57513. if (index > lastIndex) {
  57514. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  57515. tokens.push(JSON.stringify(tokenValue));
  57516. }
  57517. // tag token
  57518. var exp = parseFilters(match[1].trim());
  57519. tokens.push(("_s(" + exp + ")"));
  57520. rawTokens.push({ '@binding': exp });
  57521. lastIndex = index + match[0].length;
  57522. }
  57523. if (lastIndex < text.length) {
  57524. rawTokens.push(tokenValue = text.slice(lastIndex));
  57525. tokens.push(JSON.stringify(tokenValue));
  57526. }
  57527. return {
  57528. expression: tokens.join('+'),
  57529. tokens: rawTokens
  57530. }
  57531. }
  57532. /* */
  57533. function transformNode (el, options) {
  57534. var warn = options.warn || baseWarn;
  57535. var staticClass = getAndRemoveAttr(el, 'class');
  57536. if (staticClass) {
  57537. var res = parseText(staticClass, options.delimiters);
  57538. if (res) {
  57539. warn(
  57540. "class=\"" + staticClass + "\": " +
  57541. 'Interpolation inside attributes has been removed. ' +
  57542. 'Use v-bind or the colon shorthand instead. For example, ' +
  57543. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  57544. el.rawAttrsMap['class']
  57545. );
  57546. }
  57547. }
  57548. if (staticClass) {
  57549. el.staticClass = JSON.stringify(staticClass);
  57550. }
  57551. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  57552. if (classBinding) {
  57553. el.classBinding = classBinding;
  57554. }
  57555. }
  57556. function genData (el) {
  57557. var data = '';
  57558. if (el.staticClass) {
  57559. data += "staticClass:" + (el.staticClass) + ",";
  57560. }
  57561. if (el.classBinding) {
  57562. data += "class:" + (el.classBinding) + ",";
  57563. }
  57564. return data
  57565. }
  57566. var klass$1 = {
  57567. staticKeys: ['staticClass'],
  57568. transformNode: transformNode,
  57569. genData: genData
  57570. };
  57571. /* */
  57572. function transformNode$1 (el, options) {
  57573. var warn = options.warn || baseWarn;
  57574. var staticStyle = getAndRemoveAttr(el, 'style');
  57575. if (staticStyle) {
  57576. /* istanbul ignore if */
  57577. {
  57578. var res = parseText(staticStyle, options.delimiters);
  57579. if (res) {
  57580. warn(
  57581. "style=\"" + staticStyle + "\": " +
  57582. 'Interpolation inside attributes has been removed. ' +
  57583. 'Use v-bind or the colon shorthand instead. For example, ' +
  57584. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  57585. el.rawAttrsMap['style']
  57586. );
  57587. }
  57588. }
  57589. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  57590. }
  57591. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  57592. if (styleBinding) {
  57593. el.styleBinding = styleBinding;
  57594. }
  57595. }
  57596. function genData$1 (el) {
  57597. var data = '';
  57598. if (el.staticStyle) {
  57599. data += "staticStyle:" + (el.staticStyle) + ",";
  57600. }
  57601. if (el.styleBinding) {
  57602. data += "style:(" + (el.styleBinding) + "),";
  57603. }
  57604. return data
  57605. }
  57606. var style$1 = {
  57607. staticKeys: ['staticStyle'],
  57608. transformNode: transformNode$1,
  57609. genData: genData$1
  57610. };
  57611. /* */
  57612. var decoder;
  57613. var he = {
  57614. decode: function decode (html) {
  57615. decoder = decoder || document.createElement('div');
  57616. decoder.innerHTML = html;
  57617. return decoder.textContent
  57618. }
  57619. };
  57620. /* */
  57621. var isUnaryTag = makeMap(
  57622. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  57623. 'link,meta,param,source,track,wbr'
  57624. );
  57625. // Elements that you can, intentionally, leave open
  57626. // (and which close themselves)
  57627. var canBeLeftOpenTag = makeMap(
  57628. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  57629. );
  57630. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  57631. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  57632. var isNonPhrasingTag = makeMap(
  57633. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  57634. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  57635. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  57636. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  57637. 'title,tr,track'
  57638. );
  57639. /**
  57640. * Not type-checking this file because it's mostly vendor code.
  57641. */
  57642. // Regular Expressions for parsing tags and attributes
  57643. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  57644. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  57645. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  57646. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  57647. var startTagOpen = new RegExp(("^<" + qnameCapture));
  57648. var startTagClose = /^\s*(\/?)>/;
  57649. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  57650. var doctype = /^<!DOCTYPE [^>]+>/i;
  57651. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  57652. var comment = /^<!\--/;
  57653. var conditionalComment = /^<!\[/;
  57654. // Special Elements (can contain anything)
  57655. var isPlainTextElement = makeMap('script,style,textarea', true);
  57656. var reCache = {};
  57657. var decodingMap = {
  57658. '&lt;': '<',
  57659. '&gt;': '>',
  57660. '&quot;': '"',
  57661. '&amp;': '&',
  57662. '&#10;': '\n',
  57663. '&#9;': '\t',
  57664. '&#39;': "'"
  57665. };
  57666. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  57667. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  57668. // #5992
  57669. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  57670. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  57671. function decodeAttr (value, shouldDecodeNewlines) {
  57672. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  57673. return value.replace(re, function (match) { return decodingMap[match]; })
  57674. }
  57675. function parseHTML (html, options) {
  57676. var stack = [];
  57677. var expectHTML = options.expectHTML;
  57678. var isUnaryTag$$1 = options.isUnaryTag || no;
  57679. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  57680. var index = 0;
  57681. var last, lastTag;
  57682. while (html) {
  57683. last = html;
  57684. // Make sure we're not in a plaintext content element like script/style
  57685. if (!lastTag || !isPlainTextElement(lastTag)) {
  57686. var textEnd = html.indexOf('<');
  57687. if (textEnd === 0) {
  57688. // Comment:
  57689. if (comment.test(html)) {
  57690. var commentEnd = html.indexOf('-->');
  57691. if (commentEnd >= 0) {
  57692. if (options.shouldKeepComment) {
  57693. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  57694. }
  57695. advance(commentEnd + 3);
  57696. continue
  57697. }
  57698. }
  57699. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  57700. if (conditionalComment.test(html)) {
  57701. var conditionalEnd = html.indexOf(']>');
  57702. if (conditionalEnd >= 0) {
  57703. advance(conditionalEnd + 2);
  57704. continue
  57705. }
  57706. }
  57707. // Doctype:
  57708. var doctypeMatch = html.match(doctype);
  57709. if (doctypeMatch) {
  57710. advance(doctypeMatch[0].length);
  57711. continue
  57712. }
  57713. // End tag:
  57714. var endTagMatch = html.match(endTag);
  57715. if (endTagMatch) {
  57716. var curIndex = index;
  57717. advance(endTagMatch[0].length);
  57718. parseEndTag(endTagMatch[1], curIndex, index);
  57719. continue
  57720. }
  57721. // Start tag:
  57722. var startTagMatch = parseStartTag();
  57723. if (startTagMatch) {
  57724. handleStartTag(startTagMatch);
  57725. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  57726. advance(1);
  57727. }
  57728. continue
  57729. }
  57730. }
  57731. var text = (void 0), rest = (void 0), next = (void 0);
  57732. if (textEnd >= 0) {
  57733. rest = html.slice(textEnd);
  57734. while (
  57735. !endTag.test(rest) &&
  57736. !startTagOpen.test(rest) &&
  57737. !comment.test(rest) &&
  57738. !conditionalComment.test(rest)
  57739. ) {
  57740. // < in plain text, be forgiving and treat it as text
  57741. next = rest.indexOf('<', 1);
  57742. if (next < 0) { break }
  57743. textEnd += next;
  57744. rest = html.slice(textEnd);
  57745. }
  57746. text = html.substring(0, textEnd);
  57747. }
  57748. if (textEnd < 0) {
  57749. text = html;
  57750. }
  57751. if (text) {
  57752. advance(text.length);
  57753. }
  57754. if (options.chars && text) {
  57755. options.chars(text, index - text.length, index);
  57756. }
  57757. } else {
  57758. var endTagLength = 0;
  57759. var stackedTag = lastTag.toLowerCase();
  57760. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  57761. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  57762. endTagLength = endTag.length;
  57763. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  57764. text = text
  57765. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  57766. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  57767. }
  57768. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  57769. text = text.slice(1);
  57770. }
  57771. if (options.chars) {
  57772. options.chars(text);
  57773. }
  57774. return ''
  57775. });
  57776. index += html.length - rest$1.length;
  57777. html = rest$1;
  57778. parseEndTag(stackedTag, index - endTagLength, index);
  57779. }
  57780. if (html === last) {
  57781. options.chars && options.chars(html);
  57782. if (!stack.length && options.warn) {
  57783. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  57784. }
  57785. break
  57786. }
  57787. }
  57788. // Clean up any remaining tags
  57789. parseEndTag();
  57790. function advance (n) {
  57791. index += n;
  57792. html = html.substring(n);
  57793. }
  57794. function parseStartTag () {
  57795. var start = html.match(startTagOpen);
  57796. if (start) {
  57797. var match = {
  57798. tagName: start[1],
  57799. attrs: [],
  57800. start: index
  57801. };
  57802. advance(start[0].length);
  57803. var end, attr;
  57804. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  57805. attr.start = index;
  57806. advance(attr[0].length);
  57807. attr.end = index;
  57808. match.attrs.push(attr);
  57809. }
  57810. if (end) {
  57811. match.unarySlash = end[1];
  57812. advance(end[0].length);
  57813. match.end = index;
  57814. return match
  57815. }
  57816. }
  57817. }
  57818. function handleStartTag (match) {
  57819. var tagName = match.tagName;
  57820. var unarySlash = match.unarySlash;
  57821. if (expectHTML) {
  57822. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  57823. parseEndTag(lastTag);
  57824. }
  57825. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  57826. parseEndTag(tagName);
  57827. }
  57828. }
  57829. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  57830. var l = match.attrs.length;
  57831. var attrs = new Array(l);
  57832. for (var i = 0; i < l; i++) {
  57833. var args = match.attrs[i];
  57834. var value = args[3] || args[4] || args[5] || '';
  57835. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  57836. ? options.shouldDecodeNewlinesForHref
  57837. : options.shouldDecodeNewlines;
  57838. attrs[i] = {
  57839. name: args[1],
  57840. value: decodeAttr(value, shouldDecodeNewlines)
  57841. };
  57842. if (options.outputSourceRange) {
  57843. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  57844. attrs[i].end = args.end;
  57845. }
  57846. }
  57847. if (!unary) {
  57848. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  57849. lastTag = tagName;
  57850. }
  57851. if (options.start) {
  57852. options.start(tagName, attrs, unary, match.start, match.end);
  57853. }
  57854. }
  57855. function parseEndTag (tagName, start, end) {
  57856. var pos, lowerCasedTagName;
  57857. if (start == null) { start = index; }
  57858. if (end == null) { end = index; }
  57859. // Find the closest opened tag of the same type
  57860. if (tagName) {
  57861. lowerCasedTagName = tagName.toLowerCase();
  57862. for (pos = stack.length - 1; pos >= 0; pos--) {
  57863. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  57864. break
  57865. }
  57866. }
  57867. } else {
  57868. // If no tag name is provided, clean shop
  57869. pos = 0;
  57870. }
  57871. if (pos >= 0) {
  57872. // Close all the open elements, up the stack
  57873. for (var i = stack.length - 1; i >= pos; i--) {
  57874. if (i > pos || !tagName &&
  57875. options.warn
  57876. ) {
  57877. options.warn(
  57878. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  57879. { start: stack[i].start, end: stack[i].end }
  57880. );
  57881. }
  57882. if (options.end) {
  57883. options.end(stack[i].tag, start, end);
  57884. }
  57885. }
  57886. // Remove the open elements from the stack
  57887. stack.length = pos;
  57888. lastTag = pos && stack[pos - 1].tag;
  57889. } else if (lowerCasedTagName === 'br') {
  57890. if (options.start) {
  57891. options.start(tagName, [], true, start, end);
  57892. }
  57893. } else if (lowerCasedTagName === 'p') {
  57894. if (options.start) {
  57895. options.start(tagName, [], false, start, end);
  57896. }
  57897. if (options.end) {
  57898. options.end(tagName, start, end);
  57899. }
  57900. }
  57901. }
  57902. }
  57903. /* */
  57904. var onRE = /^@|^v-on:/;
  57905. var dirRE = /^v-|^@|^:|^#/;
  57906. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  57907. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  57908. var stripParensRE = /^\(|\)$/g;
  57909. var dynamicArgRE = /^\[.*\]$/;
  57910. var argRE = /:(.*)$/;
  57911. var bindRE = /^:|^\.|^v-bind:/;
  57912. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  57913. var slotRE = /^v-slot(:|$)|^#/;
  57914. var lineBreakRE = /[\r\n]/;
  57915. var whitespaceRE$1 = /\s+/g;
  57916. var invalidAttributeRE = /[\s"'<>\/=]/;
  57917. var decodeHTMLCached = cached(he.decode);
  57918. var emptySlotScopeToken = "_empty_";
  57919. // configurable state
  57920. var warn$2;
  57921. var delimiters;
  57922. var transforms;
  57923. var preTransforms;
  57924. var postTransforms;
  57925. var platformIsPreTag;
  57926. var platformMustUseProp;
  57927. var platformGetTagNamespace;
  57928. var maybeComponent;
  57929. function createASTElement (
  57930. tag,
  57931. attrs,
  57932. parent
  57933. ) {
  57934. return {
  57935. type: 1,
  57936. tag: tag,
  57937. attrsList: attrs,
  57938. attrsMap: makeAttrsMap(attrs),
  57939. rawAttrsMap: {},
  57940. parent: parent,
  57941. children: []
  57942. }
  57943. }
  57944. /**
  57945. * Convert HTML string to AST.
  57946. */
  57947. function parse (
  57948. template,
  57949. options
  57950. ) {
  57951. warn$2 = options.warn || baseWarn;
  57952. platformIsPreTag = options.isPreTag || no;
  57953. platformMustUseProp = options.mustUseProp || no;
  57954. platformGetTagNamespace = options.getTagNamespace || no;
  57955. var isReservedTag = options.isReservedTag || no;
  57956. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  57957. transforms = pluckModuleFunction(options.modules, 'transformNode');
  57958. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  57959. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  57960. delimiters = options.delimiters;
  57961. var stack = [];
  57962. var preserveWhitespace = options.preserveWhitespace !== false;
  57963. var whitespaceOption = options.whitespace;
  57964. var root;
  57965. var currentParent;
  57966. var inVPre = false;
  57967. var inPre = false;
  57968. var warned = false;
  57969. function warnOnce (msg, range) {
  57970. if (!warned) {
  57971. warned = true;
  57972. warn$2(msg, range);
  57973. }
  57974. }
  57975. function closeElement (element) {
  57976. trimEndingWhitespace(element);
  57977. if (!inVPre && !element.processed) {
  57978. element = processElement(element, options);
  57979. }
  57980. // tree management
  57981. if (!stack.length && element !== root) {
  57982. // allow root elements with v-if, v-else-if and v-else
  57983. if (root.if && (element.elseif || element.else)) {
  57984. {
  57985. checkRootConstraints(element);
  57986. }
  57987. addIfCondition(root, {
  57988. exp: element.elseif,
  57989. block: element
  57990. });
  57991. } else {
  57992. warnOnce(
  57993. "Component template should contain exactly one root element. " +
  57994. "If you are using v-if on multiple elements, " +
  57995. "use v-else-if to chain them instead.",
  57996. { start: element.start }
  57997. );
  57998. }
  57999. }
  58000. if (currentParent && !element.forbidden) {
  58001. if (element.elseif || element.else) {
  58002. processIfConditions(element, currentParent);
  58003. } else {
  58004. if (element.slotScope) {
  58005. // scoped slot
  58006. // keep it in the children list so that v-else(-if) conditions can
  58007. // find it as the prev node.
  58008. var name = element.slotTarget || '"default"'
  58009. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  58010. }
  58011. currentParent.children.push(element);
  58012. element.parent = currentParent;
  58013. }
  58014. }
  58015. // final children cleanup
  58016. // filter out scoped slots
  58017. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  58018. // remove trailing whitespace node again
  58019. trimEndingWhitespace(element);
  58020. // check pre state
  58021. if (element.pre) {
  58022. inVPre = false;
  58023. }
  58024. if (platformIsPreTag(element.tag)) {
  58025. inPre = false;
  58026. }
  58027. // apply post-transforms
  58028. for (var i = 0; i < postTransforms.length; i++) {
  58029. postTransforms[i](element, options);
  58030. }
  58031. }
  58032. function trimEndingWhitespace (el) {
  58033. // remove trailing whitespace node
  58034. if (!inPre) {
  58035. var lastNode;
  58036. while (
  58037. (lastNode = el.children[el.children.length - 1]) &&
  58038. lastNode.type === 3 &&
  58039. lastNode.text === ' '
  58040. ) {
  58041. el.children.pop();
  58042. }
  58043. }
  58044. }
  58045. function checkRootConstraints (el) {
  58046. if (el.tag === 'slot' || el.tag === 'template') {
  58047. warnOnce(
  58048. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  58049. 'contain multiple nodes.',
  58050. { start: el.start }
  58051. );
  58052. }
  58053. if (el.attrsMap.hasOwnProperty('v-for')) {
  58054. warnOnce(
  58055. 'Cannot use v-for on stateful component root element because ' +
  58056. 'it renders multiple elements.',
  58057. el.rawAttrsMap['v-for']
  58058. );
  58059. }
  58060. }
  58061. parseHTML(template, {
  58062. warn: warn$2,
  58063. expectHTML: options.expectHTML,
  58064. isUnaryTag: options.isUnaryTag,
  58065. canBeLeftOpenTag: options.canBeLeftOpenTag,
  58066. shouldDecodeNewlines: options.shouldDecodeNewlines,
  58067. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  58068. shouldKeepComment: options.comments,
  58069. outputSourceRange: options.outputSourceRange,
  58070. start: function start (tag, attrs, unary, start$1, end) {
  58071. // check namespace.
  58072. // inherit parent ns if there is one
  58073. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  58074. // handle IE svg bug
  58075. /* istanbul ignore if */
  58076. if (isIE && ns === 'svg') {
  58077. attrs = guardIESVGBug(attrs);
  58078. }
  58079. var element = createASTElement(tag, attrs, currentParent);
  58080. if (ns) {
  58081. element.ns = ns;
  58082. }
  58083. {
  58084. if (options.outputSourceRange) {
  58085. element.start = start$1;
  58086. element.end = end;
  58087. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  58088. cumulated[attr.name] = attr;
  58089. return cumulated
  58090. }, {});
  58091. }
  58092. attrs.forEach(function (attr) {
  58093. if (invalidAttributeRE.test(attr.name)) {
  58094. warn$2(
  58095. "Invalid dynamic argument expression: attribute names cannot contain " +
  58096. "spaces, quotes, <, >, / or =.",
  58097. {
  58098. start: attr.start + attr.name.indexOf("["),
  58099. end: attr.start + attr.name.length
  58100. }
  58101. );
  58102. }
  58103. });
  58104. }
  58105. if (isForbiddenTag(element) && !isServerRendering()) {
  58106. element.forbidden = true;
  58107. warn$2(
  58108. 'Templates should only be responsible for mapping the state to the ' +
  58109. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  58110. "<" + tag + ">" + ', as they will not be parsed.',
  58111. { start: element.start }
  58112. );
  58113. }
  58114. // apply pre-transforms
  58115. for (var i = 0; i < preTransforms.length; i++) {
  58116. element = preTransforms[i](element, options) || element;
  58117. }
  58118. if (!inVPre) {
  58119. processPre(element);
  58120. if (element.pre) {
  58121. inVPre = true;
  58122. }
  58123. }
  58124. if (platformIsPreTag(element.tag)) {
  58125. inPre = true;
  58126. }
  58127. if (inVPre) {
  58128. processRawAttrs(element);
  58129. } else if (!element.processed) {
  58130. // structural directives
  58131. processFor(element);
  58132. processIf(element);
  58133. processOnce(element);
  58134. }
  58135. if (!root) {
  58136. root = element;
  58137. {
  58138. checkRootConstraints(root);
  58139. }
  58140. }
  58141. if (!unary) {
  58142. currentParent = element;
  58143. stack.push(element);
  58144. } else {
  58145. closeElement(element);
  58146. }
  58147. },
  58148. end: function end (tag, start, end$1) {
  58149. var element = stack[stack.length - 1];
  58150. // pop stack
  58151. stack.length -= 1;
  58152. currentParent = stack[stack.length - 1];
  58153. if (options.outputSourceRange) {
  58154. element.end = end$1;
  58155. }
  58156. closeElement(element);
  58157. },
  58158. chars: function chars (text, start, end) {
  58159. if (!currentParent) {
  58160. {
  58161. if (text === template) {
  58162. warnOnce(
  58163. 'Component template requires a root element, rather than just text.',
  58164. { start: start }
  58165. );
  58166. } else if ((text = text.trim())) {
  58167. warnOnce(
  58168. ("text \"" + text + "\" outside root element will be ignored."),
  58169. { start: start }
  58170. );
  58171. }
  58172. }
  58173. return
  58174. }
  58175. // IE textarea placeholder bug
  58176. /* istanbul ignore if */
  58177. if (isIE &&
  58178. currentParent.tag === 'textarea' &&
  58179. currentParent.attrsMap.placeholder === text
  58180. ) {
  58181. return
  58182. }
  58183. var children = currentParent.children;
  58184. if (inPre || text.trim()) {
  58185. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  58186. } else if (!children.length) {
  58187. // remove the whitespace-only node right after an opening tag
  58188. text = '';
  58189. } else if (whitespaceOption) {
  58190. if (whitespaceOption === 'condense') {
  58191. // in condense mode, remove the whitespace node if it contains
  58192. // line break, otherwise condense to a single space
  58193. text = lineBreakRE.test(text) ? '' : ' ';
  58194. } else {
  58195. text = ' ';
  58196. }
  58197. } else {
  58198. text = preserveWhitespace ? ' ' : '';
  58199. }
  58200. if (text) {
  58201. if (!inPre && whitespaceOption === 'condense') {
  58202. // condense consecutive whitespaces into single space
  58203. text = text.replace(whitespaceRE$1, ' ');
  58204. }
  58205. var res;
  58206. var child;
  58207. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  58208. child = {
  58209. type: 2,
  58210. expression: res.expression,
  58211. tokens: res.tokens,
  58212. text: text
  58213. };
  58214. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  58215. child = {
  58216. type: 3,
  58217. text: text
  58218. };
  58219. }
  58220. if (child) {
  58221. if (options.outputSourceRange) {
  58222. child.start = start;
  58223. child.end = end;
  58224. }
  58225. children.push(child);
  58226. }
  58227. }
  58228. },
  58229. comment: function comment (text, start, end) {
  58230. // adding anyting as a sibling to the root node is forbidden
  58231. // comments should still be allowed, but ignored
  58232. if (currentParent) {
  58233. var child = {
  58234. type: 3,
  58235. text: text,
  58236. isComment: true
  58237. };
  58238. if (options.outputSourceRange) {
  58239. child.start = start;
  58240. child.end = end;
  58241. }
  58242. currentParent.children.push(child);
  58243. }
  58244. }
  58245. });
  58246. return root
  58247. }
  58248. function processPre (el) {
  58249. if (getAndRemoveAttr(el, 'v-pre') != null) {
  58250. el.pre = true;
  58251. }
  58252. }
  58253. function processRawAttrs (el) {
  58254. var list = el.attrsList;
  58255. var len = list.length;
  58256. if (len) {
  58257. var attrs = el.attrs = new Array(len);
  58258. for (var i = 0; i < len; i++) {
  58259. attrs[i] = {
  58260. name: list[i].name,
  58261. value: JSON.stringify(list[i].value)
  58262. };
  58263. if (list[i].start != null) {
  58264. attrs[i].start = list[i].start;
  58265. attrs[i].end = list[i].end;
  58266. }
  58267. }
  58268. } else if (!el.pre) {
  58269. // non root node in pre blocks with no attributes
  58270. el.plain = true;
  58271. }
  58272. }
  58273. function processElement (
  58274. element,
  58275. options
  58276. ) {
  58277. processKey(element);
  58278. // determine whether this is a plain element after
  58279. // removing structural attributes
  58280. element.plain = (
  58281. !element.key &&
  58282. !element.scopedSlots &&
  58283. !element.attrsList.length
  58284. );
  58285. processRef(element);
  58286. processSlotContent(element);
  58287. processSlotOutlet(element);
  58288. processComponent(element);
  58289. for (var i = 0; i < transforms.length; i++) {
  58290. element = transforms[i](element, options) || element;
  58291. }
  58292. processAttrs(element);
  58293. return element
  58294. }
  58295. function processKey (el) {
  58296. var exp = getBindingAttr(el, 'key');
  58297. if (exp) {
  58298. {
  58299. if (el.tag === 'template') {
  58300. warn$2(
  58301. "<template> cannot be keyed. Place the key on real elements instead.",
  58302. getRawBindingAttr(el, 'key')
  58303. );
  58304. }
  58305. if (el.for) {
  58306. var iterator = el.iterator2 || el.iterator1;
  58307. var parent = el.parent;
  58308. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  58309. warn$2(
  58310. "Do not use v-for index as key on <transition-group> children, " +
  58311. "this is the same as not using keys.",
  58312. getRawBindingAttr(el, 'key'),
  58313. true /* tip */
  58314. );
  58315. }
  58316. }
  58317. }
  58318. el.key = exp;
  58319. }
  58320. }
  58321. function processRef (el) {
  58322. var ref = getBindingAttr(el, 'ref');
  58323. if (ref) {
  58324. el.ref = ref;
  58325. el.refInFor = checkInFor(el);
  58326. }
  58327. }
  58328. function processFor (el) {
  58329. var exp;
  58330. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  58331. var res = parseFor(exp);
  58332. if (res) {
  58333. extend(el, res);
  58334. } else {
  58335. warn$2(
  58336. ("Invalid v-for expression: " + exp),
  58337. el.rawAttrsMap['v-for']
  58338. );
  58339. }
  58340. }
  58341. }
  58342. function parseFor (exp) {
  58343. var inMatch = exp.match(forAliasRE);
  58344. if (!inMatch) { return }
  58345. var res = {};
  58346. res.for = inMatch[2].trim();
  58347. var alias = inMatch[1].trim().replace(stripParensRE, '');
  58348. var iteratorMatch = alias.match(forIteratorRE);
  58349. if (iteratorMatch) {
  58350. res.alias = alias.replace(forIteratorRE, '').trim();
  58351. res.iterator1 = iteratorMatch[1].trim();
  58352. if (iteratorMatch[2]) {
  58353. res.iterator2 = iteratorMatch[2].trim();
  58354. }
  58355. } else {
  58356. res.alias = alias;
  58357. }
  58358. return res
  58359. }
  58360. function processIf (el) {
  58361. var exp = getAndRemoveAttr(el, 'v-if');
  58362. if (exp) {
  58363. el.if = exp;
  58364. addIfCondition(el, {
  58365. exp: exp,
  58366. block: el
  58367. });
  58368. } else {
  58369. if (getAndRemoveAttr(el, 'v-else') != null) {
  58370. el.else = true;
  58371. }
  58372. var elseif = getAndRemoveAttr(el, 'v-else-if');
  58373. if (elseif) {
  58374. el.elseif = elseif;
  58375. }
  58376. }
  58377. }
  58378. function processIfConditions (el, parent) {
  58379. var prev = findPrevElement(parent.children);
  58380. if (prev && prev.if) {
  58381. addIfCondition(prev, {
  58382. exp: el.elseif,
  58383. block: el
  58384. });
  58385. } else {
  58386. warn$2(
  58387. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  58388. "used on element <" + (el.tag) + "> without corresponding v-if.",
  58389. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  58390. );
  58391. }
  58392. }
  58393. function findPrevElement (children) {
  58394. var i = children.length;
  58395. while (i--) {
  58396. if (children[i].type === 1) {
  58397. return children[i]
  58398. } else {
  58399. if (children[i].text !== ' ') {
  58400. warn$2(
  58401. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  58402. "will be ignored.",
  58403. children[i]
  58404. );
  58405. }
  58406. children.pop();
  58407. }
  58408. }
  58409. }
  58410. function addIfCondition (el, condition) {
  58411. if (!el.ifConditions) {
  58412. el.ifConditions = [];
  58413. }
  58414. el.ifConditions.push(condition);
  58415. }
  58416. function processOnce (el) {
  58417. var once$$1 = getAndRemoveAttr(el, 'v-once');
  58418. if (once$$1 != null) {
  58419. el.once = true;
  58420. }
  58421. }
  58422. // handle content being passed to a component as slot,
  58423. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  58424. function processSlotContent (el) {
  58425. var slotScope;
  58426. if (el.tag === 'template') {
  58427. slotScope = getAndRemoveAttr(el, 'scope');
  58428. /* istanbul ignore if */
  58429. if (slotScope) {
  58430. warn$2(
  58431. "the \"scope\" attribute for scoped slots have been deprecated and " +
  58432. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  58433. "can also be used on plain elements in addition to <template> to " +
  58434. "denote scoped slots.",
  58435. el.rawAttrsMap['scope'],
  58436. true
  58437. );
  58438. }
  58439. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  58440. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  58441. /* istanbul ignore if */
  58442. if (el.attrsMap['v-for']) {
  58443. warn$2(
  58444. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  58445. "(v-for takes higher priority). Use a wrapper <template> for the " +
  58446. "scoped slot to make it clearer.",
  58447. el.rawAttrsMap['slot-scope'],
  58448. true
  58449. );
  58450. }
  58451. el.slotScope = slotScope;
  58452. }
  58453. // slot="xxx"
  58454. var slotTarget = getBindingAttr(el, 'slot');
  58455. if (slotTarget) {
  58456. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  58457. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  58458. // preserve slot as an attribute for native shadow DOM compat
  58459. // only for non-scoped slots.
  58460. if (el.tag !== 'template' && !el.slotScope) {
  58461. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  58462. }
  58463. }
  58464. // 2.6 v-slot syntax
  58465. {
  58466. if (el.tag === 'template') {
  58467. // v-slot on <template>
  58468. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  58469. if (slotBinding) {
  58470. {
  58471. if (el.slotTarget || el.slotScope) {
  58472. warn$2(
  58473. "Unexpected mixed usage of different slot syntaxes.",
  58474. el
  58475. );
  58476. }
  58477. if (el.parent && !maybeComponent(el.parent)) {
  58478. warn$2(
  58479. "<template v-slot> can only appear at the root level inside " +
  58480. "the receiving component",
  58481. el
  58482. );
  58483. }
  58484. }
  58485. var ref = getSlotName(slotBinding);
  58486. var name = ref.name;
  58487. var dynamic = ref.dynamic;
  58488. el.slotTarget = name;
  58489. el.slotTargetDynamic = dynamic;
  58490. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  58491. }
  58492. } else {
  58493. // v-slot on component, denotes default slot
  58494. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  58495. if (slotBinding$1) {
  58496. {
  58497. if (!maybeComponent(el)) {
  58498. warn$2(
  58499. "v-slot can only be used on components or <template>.",
  58500. slotBinding$1
  58501. );
  58502. }
  58503. if (el.slotScope || el.slotTarget) {
  58504. warn$2(
  58505. "Unexpected mixed usage of different slot syntaxes.",
  58506. el
  58507. );
  58508. }
  58509. if (el.scopedSlots) {
  58510. warn$2(
  58511. "To avoid scope ambiguity, the default slot should also use " +
  58512. "<template> syntax when there are other named slots.",
  58513. slotBinding$1
  58514. );
  58515. }
  58516. }
  58517. // add the component's children to its default slot
  58518. var slots = el.scopedSlots || (el.scopedSlots = {});
  58519. var ref$1 = getSlotName(slotBinding$1);
  58520. var name$1 = ref$1.name;
  58521. var dynamic$1 = ref$1.dynamic;
  58522. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  58523. slotContainer.slotTarget = name$1;
  58524. slotContainer.slotTargetDynamic = dynamic$1;
  58525. slotContainer.children = el.children.filter(function (c) {
  58526. if (!c.slotScope) {
  58527. c.parent = slotContainer;
  58528. return true
  58529. }
  58530. });
  58531. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  58532. // remove children as they are returned from scopedSlots now
  58533. el.children = [];
  58534. // mark el non-plain so data gets generated
  58535. el.plain = false;
  58536. }
  58537. }
  58538. }
  58539. }
  58540. function getSlotName (binding) {
  58541. var name = binding.name.replace(slotRE, '');
  58542. if (!name) {
  58543. if (binding.name[0] !== '#') {
  58544. name = 'default';
  58545. } else {
  58546. warn$2(
  58547. "v-slot shorthand syntax requires a slot name.",
  58548. binding
  58549. );
  58550. }
  58551. }
  58552. return dynamicArgRE.test(name)
  58553. // dynamic [name]
  58554. ? { name: name.slice(1, -1), dynamic: true }
  58555. // static name
  58556. : { name: ("\"" + name + "\""), dynamic: false }
  58557. }
  58558. // handle <slot/> outlets
  58559. function processSlotOutlet (el) {
  58560. if (el.tag === 'slot') {
  58561. el.slotName = getBindingAttr(el, 'name');
  58562. if (el.key) {
  58563. warn$2(
  58564. "`key` does not work on <slot> because slots are abstract outlets " +
  58565. "and can possibly expand into multiple elements. " +
  58566. "Use the key on a wrapping element instead.",
  58567. getRawBindingAttr(el, 'key')
  58568. );
  58569. }
  58570. }
  58571. }
  58572. function processComponent (el) {
  58573. var binding;
  58574. if ((binding = getBindingAttr(el, 'is'))) {
  58575. el.component = binding;
  58576. }
  58577. if (getAndRemoveAttr(el, 'inline-template') != null) {
  58578. el.inlineTemplate = true;
  58579. }
  58580. }
  58581. function processAttrs (el) {
  58582. var list = el.attrsList;
  58583. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  58584. for (i = 0, l = list.length; i < l; i++) {
  58585. name = rawName = list[i].name;
  58586. value = list[i].value;
  58587. if (dirRE.test(name)) {
  58588. // mark element as dynamic
  58589. el.hasBindings = true;
  58590. // modifiers
  58591. modifiers = parseModifiers(name.replace(dirRE, ''));
  58592. // support .foo shorthand syntax for the .prop modifier
  58593. if (modifiers) {
  58594. name = name.replace(modifierRE, '');
  58595. }
  58596. if (bindRE.test(name)) { // v-bind
  58597. name = name.replace(bindRE, '');
  58598. value = parseFilters(value);
  58599. isDynamic = dynamicArgRE.test(name);
  58600. if (isDynamic) {
  58601. name = name.slice(1, -1);
  58602. }
  58603. if (
  58604. value.trim().length === 0
  58605. ) {
  58606. warn$2(
  58607. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  58608. );
  58609. }
  58610. if (modifiers) {
  58611. if (modifiers.prop && !isDynamic) {
  58612. name = camelize(name);
  58613. if (name === 'innerHtml') { name = 'innerHTML'; }
  58614. }
  58615. if (modifiers.camel && !isDynamic) {
  58616. name = camelize(name);
  58617. }
  58618. if (modifiers.sync) {
  58619. syncGen = genAssignmentCode(value, "$event");
  58620. if (!isDynamic) {
  58621. addHandler(
  58622. el,
  58623. ("update:" + (camelize(name))),
  58624. syncGen,
  58625. null,
  58626. false,
  58627. warn$2,
  58628. list[i]
  58629. );
  58630. if (hyphenate(name) !== camelize(name)) {
  58631. addHandler(
  58632. el,
  58633. ("update:" + (hyphenate(name))),
  58634. syncGen,
  58635. null,
  58636. false,
  58637. warn$2,
  58638. list[i]
  58639. );
  58640. }
  58641. } else {
  58642. // handler w/ dynamic event name
  58643. addHandler(
  58644. el,
  58645. ("\"update:\"+(" + name + ")"),
  58646. syncGen,
  58647. null,
  58648. false,
  58649. warn$2,
  58650. list[i],
  58651. true // dynamic
  58652. );
  58653. }
  58654. }
  58655. }
  58656. if ((modifiers && modifiers.prop) || (
  58657. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  58658. )) {
  58659. addProp(el, name, value, list[i], isDynamic);
  58660. } else {
  58661. addAttr(el, name, value, list[i], isDynamic);
  58662. }
  58663. } else if (onRE.test(name)) { // v-on
  58664. name = name.replace(onRE, '');
  58665. isDynamic = dynamicArgRE.test(name);
  58666. if (isDynamic) {
  58667. name = name.slice(1, -1);
  58668. }
  58669. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  58670. } else { // normal directives
  58671. name = name.replace(dirRE, '');
  58672. // parse arg
  58673. var argMatch = name.match(argRE);
  58674. var arg = argMatch && argMatch[1];
  58675. isDynamic = false;
  58676. if (arg) {
  58677. name = name.slice(0, -(arg.length + 1));
  58678. if (dynamicArgRE.test(arg)) {
  58679. arg = arg.slice(1, -1);
  58680. isDynamic = true;
  58681. }
  58682. }
  58683. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  58684. if (name === 'model') {
  58685. checkForAliasModel(el, value);
  58686. }
  58687. }
  58688. } else {
  58689. // literal attribute
  58690. {
  58691. var res = parseText(value, delimiters);
  58692. if (res) {
  58693. warn$2(
  58694. name + "=\"" + value + "\": " +
  58695. 'Interpolation inside attributes has been removed. ' +
  58696. 'Use v-bind or the colon shorthand instead. For example, ' +
  58697. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  58698. list[i]
  58699. );
  58700. }
  58701. }
  58702. addAttr(el, name, JSON.stringify(value), list[i]);
  58703. // #6887 firefox doesn't update muted state if set via attribute
  58704. // even immediately after element creation
  58705. if (!el.component &&
  58706. name === 'muted' &&
  58707. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  58708. addProp(el, name, 'true', list[i]);
  58709. }
  58710. }
  58711. }
  58712. }
  58713. function checkInFor (el) {
  58714. var parent = el;
  58715. while (parent) {
  58716. if (parent.for !== undefined) {
  58717. return true
  58718. }
  58719. parent = parent.parent;
  58720. }
  58721. return false
  58722. }
  58723. function parseModifiers (name) {
  58724. var match = name.match(modifierRE);
  58725. if (match) {
  58726. var ret = {};
  58727. match.forEach(function (m) { ret[m.slice(1)] = true; });
  58728. return ret
  58729. }
  58730. }
  58731. function makeAttrsMap (attrs) {
  58732. var map = {};
  58733. for (var i = 0, l = attrs.length; i < l; i++) {
  58734. if (
  58735. map[attrs[i].name] && !isIE && !isEdge
  58736. ) {
  58737. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  58738. }
  58739. map[attrs[i].name] = attrs[i].value;
  58740. }
  58741. return map
  58742. }
  58743. // for script (e.g. type="x/template") or style, do not decode content
  58744. function isTextTag (el) {
  58745. return el.tag === 'script' || el.tag === 'style'
  58746. }
  58747. function isForbiddenTag (el) {
  58748. return (
  58749. el.tag === 'style' ||
  58750. (el.tag === 'script' && (
  58751. !el.attrsMap.type ||
  58752. el.attrsMap.type === 'text/javascript'
  58753. ))
  58754. )
  58755. }
  58756. var ieNSBug = /^xmlns:NS\d+/;
  58757. var ieNSPrefix = /^NS\d+:/;
  58758. /* istanbul ignore next */
  58759. function guardIESVGBug (attrs) {
  58760. var res = [];
  58761. for (var i = 0; i < attrs.length; i++) {
  58762. var attr = attrs[i];
  58763. if (!ieNSBug.test(attr.name)) {
  58764. attr.name = attr.name.replace(ieNSPrefix, '');
  58765. res.push(attr);
  58766. }
  58767. }
  58768. return res
  58769. }
  58770. function checkForAliasModel (el, value) {
  58771. var _el = el;
  58772. while (_el) {
  58773. if (_el.for && _el.alias === value) {
  58774. warn$2(
  58775. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  58776. "You are binding v-model directly to a v-for iteration alias. " +
  58777. "This will not be able to modify the v-for source array because " +
  58778. "writing to the alias is like modifying a function local variable. " +
  58779. "Consider using an array of objects and use v-model on an object property instead.",
  58780. el.rawAttrsMap['v-model']
  58781. );
  58782. }
  58783. _el = _el.parent;
  58784. }
  58785. }
  58786. /* */
  58787. function preTransformNode (el, options) {
  58788. if (el.tag === 'input') {
  58789. var map = el.attrsMap;
  58790. if (!map['v-model']) {
  58791. return
  58792. }
  58793. var typeBinding;
  58794. if (map[':type'] || map['v-bind:type']) {
  58795. typeBinding = getBindingAttr(el, 'type');
  58796. }
  58797. if (!map.type && !typeBinding && map['v-bind']) {
  58798. typeBinding = "(" + (map['v-bind']) + ").type";
  58799. }
  58800. if (typeBinding) {
  58801. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  58802. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  58803. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  58804. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  58805. // 1. checkbox
  58806. var branch0 = cloneASTElement(el);
  58807. // process for on the main node
  58808. processFor(branch0);
  58809. addRawAttr(branch0, 'type', 'checkbox');
  58810. processElement(branch0, options);
  58811. branch0.processed = true; // prevent it from double-processed
  58812. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  58813. addIfCondition(branch0, {
  58814. exp: branch0.if,
  58815. block: branch0
  58816. });
  58817. // 2. add radio else-if condition
  58818. var branch1 = cloneASTElement(el);
  58819. getAndRemoveAttr(branch1, 'v-for', true);
  58820. addRawAttr(branch1, 'type', 'radio');
  58821. processElement(branch1, options);
  58822. addIfCondition(branch0, {
  58823. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  58824. block: branch1
  58825. });
  58826. // 3. other
  58827. var branch2 = cloneASTElement(el);
  58828. getAndRemoveAttr(branch2, 'v-for', true);
  58829. addRawAttr(branch2, ':type', typeBinding);
  58830. processElement(branch2, options);
  58831. addIfCondition(branch0, {
  58832. exp: ifCondition,
  58833. block: branch2
  58834. });
  58835. if (hasElse) {
  58836. branch0.else = true;
  58837. } else if (elseIfCondition) {
  58838. branch0.elseif = elseIfCondition;
  58839. }
  58840. return branch0
  58841. }
  58842. }
  58843. }
  58844. function cloneASTElement (el) {
  58845. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  58846. }
  58847. var model$1 = {
  58848. preTransformNode: preTransformNode
  58849. };
  58850. var modules$1 = [
  58851. klass$1,
  58852. style$1,
  58853. model$1
  58854. ];
  58855. /* */
  58856. function text (el, dir) {
  58857. if (dir.value) {
  58858. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  58859. }
  58860. }
  58861. /* */
  58862. function html (el, dir) {
  58863. if (dir.value) {
  58864. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  58865. }
  58866. }
  58867. var directives$1 = {
  58868. model: model,
  58869. text: text,
  58870. html: html
  58871. };
  58872. /* */
  58873. var baseOptions = {
  58874. expectHTML: true,
  58875. modules: modules$1,
  58876. directives: directives$1,
  58877. isPreTag: isPreTag,
  58878. isUnaryTag: isUnaryTag,
  58879. mustUseProp: mustUseProp,
  58880. canBeLeftOpenTag: canBeLeftOpenTag,
  58881. isReservedTag: isReservedTag,
  58882. getTagNamespace: getTagNamespace,
  58883. staticKeys: genStaticKeys(modules$1)
  58884. };
  58885. /* */
  58886. var isStaticKey;
  58887. var isPlatformReservedTag;
  58888. var genStaticKeysCached = cached(genStaticKeys$1);
  58889. /**
  58890. * Goal of the optimizer: walk the generated template AST tree
  58891. * and detect sub-trees that are purely static, i.e. parts of
  58892. * the DOM that never needs to change.
  58893. *
  58894. * Once we detect these sub-trees, we can:
  58895. *
  58896. * 1. Hoist them into constants, so that we no longer need to
  58897. * create fresh nodes for them on each re-render;
  58898. * 2. Completely skip them in the patching process.
  58899. */
  58900. function optimize (root, options) {
  58901. if (!root) { return }
  58902. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  58903. isPlatformReservedTag = options.isReservedTag || no;
  58904. // first pass: mark all non-static nodes.
  58905. markStatic$1(root);
  58906. // second pass: mark static roots.
  58907. markStaticRoots(root, false);
  58908. }
  58909. function genStaticKeys$1 (keys) {
  58910. return makeMap(
  58911. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  58912. (keys ? ',' + keys : '')
  58913. )
  58914. }
  58915. function markStatic$1 (node) {
  58916. node.static = isStatic(node);
  58917. if (node.type === 1) {
  58918. // do not make component slot content static. this avoids
  58919. // 1. components not able to mutate slot nodes
  58920. // 2. static slot content fails for hot-reloading
  58921. if (
  58922. !isPlatformReservedTag(node.tag) &&
  58923. node.tag !== 'slot' &&
  58924. node.attrsMap['inline-template'] == null
  58925. ) {
  58926. return
  58927. }
  58928. for (var i = 0, l = node.children.length; i < l; i++) {
  58929. var child = node.children[i];
  58930. markStatic$1(child);
  58931. if (!child.static) {
  58932. node.static = false;
  58933. }
  58934. }
  58935. if (node.ifConditions) {
  58936. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  58937. var block = node.ifConditions[i$1].block;
  58938. markStatic$1(block);
  58939. if (!block.static) {
  58940. node.static = false;
  58941. }
  58942. }
  58943. }
  58944. }
  58945. }
  58946. function markStaticRoots (node, isInFor) {
  58947. if (node.type === 1) {
  58948. if (node.static || node.once) {
  58949. node.staticInFor = isInFor;
  58950. }
  58951. // For a node to qualify as a static root, it should have children that
  58952. // are not just static text. Otherwise the cost of hoisting out will
  58953. // outweigh the benefits and it's better off to just always render it fresh.
  58954. if (node.static && node.children.length && !(
  58955. node.children.length === 1 &&
  58956. node.children[0].type === 3
  58957. )) {
  58958. node.staticRoot = true;
  58959. return
  58960. } else {
  58961. node.staticRoot = false;
  58962. }
  58963. if (node.children) {
  58964. for (var i = 0, l = node.children.length; i < l; i++) {
  58965. markStaticRoots(node.children[i], isInFor || !!node.for);
  58966. }
  58967. }
  58968. if (node.ifConditions) {
  58969. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  58970. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  58971. }
  58972. }
  58973. }
  58974. }
  58975. function isStatic (node) {
  58976. if (node.type === 2) { // expression
  58977. return false
  58978. }
  58979. if (node.type === 3) { // text
  58980. return true
  58981. }
  58982. return !!(node.pre || (
  58983. !node.hasBindings && // no dynamic bindings
  58984. !node.if && !node.for && // not v-if or v-for or v-else
  58985. !isBuiltInTag(node.tag) && // not a built-in
  58986. isPlatformReservedTag(node.tag) && // not a component
  58987. !isDirectChildOfTemplateFor(node) &&
  58988. Object.keys(node).every(isStaticKey)
  58989. ))
  58990. }
  58991. function isDirectChildOfTemplateFor (node) {
  58992. while (node.parent) {
  58993. node = node.parent;
  58994. if (node.tag !== 'template') {
  58995. return false
  58996. }
  58997. if (node.for) {
  58998. return true
  58999. }
  59000. }
  59001. return false
  59002. }
  59003. /* */
  59004. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  59005. var fnInvokeRE = /\([^)]*?\);*$/;
  59006. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  59007. // KeyboardEvent.keyCode aliases
  59008. var keyCodes = {
  59009. esc: 27,
  59010. tab: 9,
  59011. enter: 13,
  59012. space: 32,
  59013. up: 38,
  59014. left: 37,
  59015. right: 39,
  59016. down: 40,
  59017. 'delete': [8, 46]
  59018. };
  59019. // KeyboardEvent.key aliases
  59020. var keyNames = {
  59021. // #7880: IE11 and Edge use `Esc` for Escape key name.
  59022. esc: ['Esc', 'Escape'],
  59023. tab: 'Tab',
  59024. enter: 'Enter',
  59025. // #9112: IE11 uses `Spacebar` for Space key name.
  59026. space: [' ', 'Spacebar'],
  59027. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  59028. up: ['Up', 'ArrowUp'],
  59029. left: ['Left', 'ArrowLeft'],
  59030. right: ['Right', 'ArrowRight'],
  59031. down: ['Down', 'ArrowDown'],
  59032. // #9112: IE11 uses `Del` for Delete key name.
  59033. 'delete': ['Backspace', 'Delete', 'Del']
  59034. };
  59035. // #4868: modifiers that prevent the execution of the listener
  59036. // need to explicitly return null so that we can determine whether to remove
  59037. // the listener for .once
  59038. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  59039. var modifierCode = {
  59040. stop: '$event.stopPropagation();',
  59041. prevent: '$event.preventDefault();',
  59042. self: genGuard("$event.target !== $event.currentTarget"),
  59043. ctrl: genGuard("!$event.ctrlKey"),
  59044. shift: genGuard("!$event.shiftKey"),
  59045. alt: genGuard("!$event.altKey"),
  59046. meta: genGuard("!$event.metaKey"),
  59047. left: genGuard("'button' in $event && $event.button !== 0"),
  59048. middle: genGuard("'button' in $event && $event.button !== 1"),
  59049. right: genGuard("'button' in $event && $event.button !== 2")
  59050. };
  59051. function genHandlers (
  59052. events,
  59053. isNative
  59054. ) {
  59055. var prefix = isNative ? 'nativeOn:' : 'on:';
  59056. var staticHandlers = "";
  59057. var dynamicHandlers = "";
  59058. for (var name in events) {
  59059. var handlerCode = genHandler(events[name]);
  59060. if (events[name] && events[name].dynamic) {
  59061. dynamicHandlers += name + "," + handlerCode + ",";
  59062. } else {
  59063. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  59064. }
  59065. }
  59066. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  59067. if (dynamicHandlers) {
  59068. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  59069. } else {
  59070. return prefix + staticHandlers
  59071. }
  59072. }
  59073. function genHandler (handler) {
  59074. if (!handler) {
  59075. return 'function(){}'
  59076. }
  59077. if (Array.isArray(handler)) {
  59078. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  59079. }
  59080. var isMethodPath = simplePathRE.test(handler.value);
  59081. var isFunctionExpression = fnExpRE.test(handler.value);
  59082. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  59083. if (!handler.modifiers) {
  59084. if (isMethodPath || isFunctionExpression) {
  59085. return handler.value
  59086. }
  59087. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  59088. } else {
  59089. var code = '';
  59090. var genModifierCode = '';
  59091. var keys = [];
  59092. for (var key in handler.modifiers) {
  59093. if (modifierCode[key]) {
  59094. genModifierCode += modifierCode[key];
  59095. // left/right
  59096. if (keyCodes[key]) {
  59097. keys.push(key);
  59098. }
  59099. } else if (key === 'exact') {
  59100. var modifiers = (handler.modifiers);
  59101. genModifierCode += genGuard(
  59102. ['ctrl', 'shift', 'alt', 'meta']
  59103. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  59104. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  59105. .join('||')
  59106. );
  59107. } else {
  59108. keys.push(key);
  59109. }
  59110. }
  59111. if (keys.length) {
  59112. code += genKeyFilter(keys);
  59113. }
  59114. // Make sure modifiers like prevent and stop get executed after key filtering
  59115. if (genModifierCode) {
  59116. code += genModifierCode;
  59117. }
  59118. var handlerCode = isMethodPath
  59119. ? ("return " + (handler.value) + "($event)")
  59120. : isFunctionExpression
  59121. ? ("return (" + (handler.value) + ")($event)")
  59122. : isFunctionInvocation
  59123. ? ("return " + (handler.value))
  59124. : handler.value;
  59125. return ("function($event){" + code + handlerCode + "}")
  59126. }
  59127. }
  59128. function genKeyFilter (keys) {
  59129. return (
  59130. // make sure the key filters only apply to KeyboardEvents
  59131. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  59132. // key events that do not have keyCode property...
  59133. "if(!$event.type.indexOf('key')&&" +
  59134. (keys.map(genFilterCode).join('&&')) + ")return null;"
  59135. )
  59136. }
  59137. function genFilterCode (key) {
  59138. var keyVal = parseInt(key, 10);
  59139. if (keyVal) {
  59140. return ("$event.keyCode!==" + keyVal)
  59141. }
  59142. var keyCode = keyCodes[key];
  59143. var keyName = keyNames[key];
  59144. return (
  59145. "_k($event.keyCode," +
  59146. (JSON.stringify(key)) + "," +
  59147. (JSON.stringify(keyCode)) + "," +
  59148. "$event.key," +
  59149. "" + (JSON.stringify(keyName)) +
  59150. ")"
  59151. )
  59152. }
  59153. /* */
  59154. function on (el, dir) {
  59155. if (dir.modifiers) {
  59156. warn("v-on without argument does not support modifiers.");
  59157. }
  59158. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  59159. }
  59160. /* */
  59161. function bind$1 (el, dir) {
  59162. el.wrapData = function (code) {
  59163. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  59164. };
  59165. }
  59166. /* */
  59167. var baseDirectives = {
  59168. on: on,
  59169. bind: bind$1,
  59170. cloak: noop
  59171. };
  59172. /* */
  59173. var CodegenState = function CodegenState (options) {
  59174. this.options = options;
  59175. this.warn = options.warn || baseWarn;
  59176. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  59177. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  59178. this.directives = extend(extend({}, baseDirectives), options.directives);
  59179. var isReservedTag = options.isReservedTag || no;
  59180. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  59181. this.onceId = 0;
  59182. this.staticRenderFns = [];
  59183. this.pre = false;
  59184. };
  59185. function generate (
  59186. ast,
  59187. options
  59188. ) {
  59189. var state = new CodegenState(options);
  59190. var code = ast ? genElement(ast, state) : '_c("div")';
  59191. return {
  59192. render: ("with(this){return " + code + "}"),
  59193. staticRenderFns: state.staticRenderFns
  59194. }
  59195. }
  59196. function genElement (el, state) {
  59197. if (el.parent) {
  59198. el.pre = el.pre || el.parent.pre;
  59199. }
  59200. if (el.staticRoot && !el.staticProcessed) {
  59201. return genStatic(el, state)
  59202. } else if (el.once && !el.onceProcessed) {
  59203. return genOnce(el, state)
  59204. } else if (el.for && !el.forProcessed) {
  59205. return genFor(el, state)
  59206. } else if (el.if && !el.ifProcessed) {
  59207. return genIf(el, state)
  59208. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  59209. return genChildren(el, state) || 'void 0'
  59210. } else if (el.tag === 'slot') {
  59211. return genSlot(el, state)
  59212. } else {
  59213. // component or element
  59214. var code;
  59215. if (el.component) {
  59216. code = genComponent(el.component, el, state);
  59217. } else {
  59218. var data;
  59219. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  59220. data = genData$2(el, state);
  59221. }
  59222. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  59223. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  59224. }
  59225. // module transforms
  59226. for (var i = 0; i < state.transforms.length; i++) {
  59227. code = state.transforms[i](el, code);
  59228. }
  59229. return code
  59230. }
  59231. }
  59232. // hoist static sub-trees out
  59233. function genStatic (el, state) {
  59234. el.staticProcessed = true;
  59235. // Some elements (templates) need to behave differently inside of a v-pre
  59236. // node. All pre nodes are static roots, so we can use this as a location to
  59237. // wrap a state change and reset it upon exiting the pre node.
  59238. var originalPreState = state.pre;
  59239. if (el.pre) {
  59240. state.pre = el.pre;
  59241. }
  59242. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  59243. state.pre = originalPreState;
  59244. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  59245. }
  59246. // v-once
  59247. function genOnce (el, state) {
  59248. el.onceProcessed = true;
  59249. if (el.if && !el.ifProcessed) {
  59250. return genIf(el, state)
  59251. } else if (el.staticInFor) {
  59252. var key = '';
  59253. var parent = el.parent;
  59254. while (parent) {
  59255. if (parent.for) {
  59256. key = parent.key;
  59257. break
  59258. }
  59259. parent = parent.parent;
  59260. }
  59261. if (!key) {
  59262. state.warn(
  59263. "v-once can only be used inside v-for that is keyed. ",
  59264. el.rawAttrsMap['v-once']
  59265. );
  59266. return genElement(el, state)
  59267. }
  59268. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  59269. } else {
  59270. return genStatic(el, state)
  59271. }
  59272. }
  59273. function genIf (
  59274. el,
  59275. state,
  59276. altGen,
  59277. altEmpty
  59278. ) {
  59279. el.ifProcessed = true; // avoid recursion
  59280. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  59281. }
  59282. function genIfConditions (
  59283. conditions,
  59284. state,
  59285. altGen,
  59286. altEmpty
  59287. ) {
  59288. if (!conditions.length) {
  59289. return altEmpty || '_e()'
  59290. }
  59291. var condition = conditions.shift();
  59292. if (condition.exp) {
  59293. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  59294. } else {
  59295. return ("" + (genTernaryExp(condition.block)))
  59296. }
  59297. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  59298. function genTernaryExp (el) {
  59299. return altGen
  59300. ? altGen(el, state)
  59301. : el.once
  59302. ? genOnce(el, state)
  59303. : genElement(el, state)
  59304. }
  59305. }
  59306. function genFor (
  59307. el,
  59308. state,
  59309. altGen,
  59310. altHelper
  59311. ) {
  59312. var exp = el.for;
  59313. var alias = el.alias;
  59314. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  59315. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  59316. if (state.maybeComponent(el) &&
  59317. el.tag !== 'slot' &&
  59318. el.tag !== 'template' &&
  59319. !el.key
  59320. ) {
  59321. state.warn(
  59322. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  59323. "v-for should have explicit keys. " +
  59324. "See https://vuejs.org/guide/list.html#key for more info.",
  59325. el.rawAttrsMap['v-for'],
  59326. true /* tip */
  59327. );
  59328. }
  59329. el.forProcessed = true; // avoid recursion
  59330. return (altHelper || '_l') + "((" + exp + ")," +
  59331. "function(" + alias + iterator1 + iterator2 + "){" +
  59332. "return " + ((altGen || genElement)(el, state)) +
  59333. '})'
  59334. }
  59335. function genData$2 (el, state) {
  59336. var data = '{';
  59337. // directives first.
  59338. // directives may mutate the el's other properties before they are generated.
  59339. var dirs = genDirectives(el, state);
  59340. if (dirs) { data += dirs + ','; }
  59341. // key
  59342. if (el.key) {
  59343. data += "key:" + (el.key) + ",";
  59344. }
  59345. // ref
  59346. if (el.ref) {
  59347. data += "ref:" + (el.ref) + ",";
  59348. }
  59349. if (el.refInFor) {
  59350. data += "refInFor:true,";
  59351. }
  59352. // pre
  59353. if (el.pre) {
  59354. data += "pre:true,";
  59355. }
  59356. // record original tag name for components using "is" attribute
  59357. if (el.component) {
  59358. data += "tag:\"" + (el.tag) + "\",";
  59359. }
  59360. // module data generation functions
  59361. for (var i = 0; i < state.dataGenFns.length; i++) {
  59362. data += state.dataGenFns[i](el);
  59363. }
  59364. // attributes
  59365. if (el.attrs) {
  59366. data += "attrs:" + (genProps(el.attrs)) + ",";
  59367. }
  59368. // DOM props
  59369. if (el.props) {
  59370. data += "domProps:" + (genProps(el.props)) + ",";
  59371. }
  59372. // event handlers
  59373. if (el.events) {
  59374. data += (genHandlers(el.events, false)) + ",";
  59375. }
  59376. if (el.nativeEvents) {
  59377. data += (genHandlers(el.nativeEvents, true)) + ",";
  59378. }
  59379. // slot target
  59380. // only for non-scoped slots
  59381. if (el.slotTarget && !el.slotScope) {
  59382. data += "slot:" + (el.slotTarget) + ",";
  59383. }
  59384. // scoped slots
  59385. if (el.scopedSlots) {
  59386. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  59387. }
  59388. // component v-model
  59389. if (el.model) {
  59390. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  59391. }
  59392. // inline-template
  59393. if (el.inlineTemplate) {
  59394. var inlineTemplate = genInlineTemplate(el, state);
  59395. if (inlineTemplate) {
  59396. data += inlineTemplate + ",";
  59397. }
  59398. }
  59399. data = data.replace(/,$/, '') + '}';
  59400. // v-bind dynamic argument wrap
  59401. // v-bind with dynamic arguments must be applied using the same v-bind object
  59402. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  59403. if (el.dynamicAttrs) {
  59404. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  59405. }
  59406. // v-bind data wrap
  59407. if (el.wrapData) {
  59408. data = el.wrapData(data);
  59409. }
  59410. // v-on data wrap
  59411. if (el.wrapListeners) {
  59412. data = el.wrapListeners(data);
  59413. }
  59414. return data
  59415. }
  59416. function genDirectives (el, state) {
  59417. var dirs = el.directives;
  59418. if (!dirs) { return }
  59419. var res = 'directives:[';
  59420. var hasRuntime = false;
  59421. var i, l, dir, needRuntime;
  59422. for (i = 0, l = dirs.length; i < l; i++) {
  59423. dir = dirs[i];
  59424. needRuntime = true;
  59425. var gen = state.directives[dir.name];
  59426. if (gen) {
  59427. // compile-time directive that manipulates AST.
  59428. // returns true if it also needs a runtime counterpart.
  59429. needRuntime = !!gen(el, dir, state.warn);
  59430. }
  59431. if (needRuntime) {
  59432. hasRuntime = true;
  59433. 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))) : '') + "},";
  59434. }
  59435. }
  59436. if (hasRuntime) {
  59437. return res.slice(0, -1) + ']'
  59438. }
  59439. }
  59440. function genInlineTemplate (el, state) {
  59441. var ast = el.children[0];
  59442. if (el.children.length !== 1 || ast.type !== 1) {
  59443. state.warn(
  59444. 'Inline-template components must have exactly one child element.',
  59445. { start: el.start }
  59446. );
  59447. }
  59448. if (ast && ast.type === 1) {
  59449. var inlineRenderFns = generate(ast, state.options);
  59450. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  59451. }
  59452. }
  59453. function genScopedSlots (
  59454. el,
  59455. slots,
  59456. state
  59457. ) {
  59458. // by default scoped slots are considered "stable", this allows child
  59459. // components with only scoped slots to skip forced updates from parent.
  59460. // but in some cases we have to bail-out of this optimization
  59461. // for example if the slot contains dynamic names, has v-if or v-for on them...
  59462. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  59463. var slot = slots[key];
  59464. return (
  59465. slot.slotTargetDynamic ||
  59466. slot.if ||
  59467. slot.for ||
  59468. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  59469. )
  59470. });
  59471. // #9534: if a component with scoped slots is inside a conditional branch,
  59472. // it's possible for the same component to be reused but with different
  59473. // compiled slot content. To avoid that, we generate a unique key based on
  59474. // the generated code of all the slot contents.
  59475. var needsKey = !!el.if;
  59476. // OR when it is inside another scoped slot or v-for (the reactivity may be
  59477. // disconnected due to the intermediate scope variable)
  59478. // #9438, #9506
  59479. // TODO: this can be further optimized by properly analyzing in-scope bindings
  59480. // and skip force updating ones that do not actually use scope variables.
  59481. if (!needsForceUpdate) {
  59482. var parent = el.parent;
  59483. while (parent) {
  59484. if (
  59485. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  59486. parent.for
  59487. ) {
  59488. needsForceUpdate = true;
  59489. break
  59490. }
  59491. if (parent.if) {
  59492. needsKey = true;
  59493. }
  59494. parent = parent.parent;
  59495. }
  59496. }
  59497. var generatedSlots = Object.keys(slots)
  59498. .map(function (key) { return genScopedSlot(slots[key], state); })
  59499. .join(',');
  59500. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  59501. }
  59502. function hash(str) {
  59503. var hash = 5381;
  59504. var i = str.length;
  59505. while(i) {
  59506. hash = (hash * 33) ^ str.charCodeAt(--i);
  59507. }
  59508. return hash >>> 0
  59509. }
  59510. function containsSlotChild (el) {
  59511. if (el.type === 1) {
  59512. if (el.tag === 'slot') {
  59513. return true
  59514. }
  59515. return el.children.some(containsSlotChild)
  59516. }
  59517. return false
  59518. }
  59519. function genScopedSlot (
  59520. el,
  59521. state
  59522. ) {
  59523. var isLegacySyntax = el.attrsMap['slot-scope'];
  59524. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  59525. return genIf(el, state, genScopedSlot, "null")
  59526. }
  59527. if (el.for && !el.forProcessed) {
  59528. return genFor(el, state, genScopedSlot)
  59529. }
  59530. var slotScope = el.slotScope === emptySlotScopeToken
  59531. ? ""
  59532. : String(el.slotScope);
  59533. var fn = "function(" + slotScope + "){" +
  59534. "return " + (el.tag === 'template'
  59535. ? el.if && isLegacySyntax
  59536. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  59537. : genChildren(el, state) || 'undefined'
  59538. : genElement(el, state)) + "}";
  59539. // reverse proxy v-slot without scope on this.$slots
  59540. var reverseProxy = slotScope ? "" : ",proxy:true";
  59541. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  59542. }
  59543. function genChildren (
  59544. el,
  59545. state,
  59546. checkSkip,
  59547. altGenElement,
  59548. altGenNode
  59549. ) {
  59550. var children = el.children;
  59551. if (children.length) {
  59552. var el$1 = children[0];
  59553. // optimize single v-for
  59554. if (children.length === 1 &&
  59555. el$1.for &&
  59556. el$1.tag !== 'template' &&
  59557. el$1.tag !== 'slot'
  59558. ) {
  59559. var normalizationType = checkSkip
  59560. ? state.maybeComponent(el$1) ? ",1" : ",0"
  59561. : "";
  59562. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  59563. }
  59564. var normalizationType$1 = checkSkip
  59565. ? getNormalizationType(children, state.maybeComponent)
  59566. : 0;
  59567. var gen = altGenNode || genNode;
  59568. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  59569. }
  59570. }
  59571. // determine the normalization needed for the children array.
  59572. // 0: no normalization needed
  59573. // 1: simple normalization needed (possible 1-level deep nested array)
  59574. // 2: full normalization needed
  59575. function getNormalizationType (
  59576. children,
  59577. maybeComponent
  59578. ) {
  59579. var res = 0;
  59580. for (var i = 0; i < children.length; i++) {
  59581. var el = children[i];
  59582. if (el.type !== 1) {
  59583. continue
  59584. }
  59585. if (needsNormalization(el) ||
  59586. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  59587. res = 2;
  59588. break
  59589. }
  59590. if (maybeComponent(el) ||
  59591. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  59592. res = 1;
  59593. }
  59594. }
  59595. return res
  59596. }
  59597. function needsNormalization (el) {
  59598. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  59599. }
  59600. function genNode (node, state) {
  59601. if (node.type === 1) {
  59602. return genElement(node, state)
  59603. } else if (node.type === 3 && node.isComment) {
  59604. return genComment(node)
  59605. } else {
  59606. return genText(node)
  59607. }
  59608. }
  59609. function genText (text) {
  59610. return ("_v(" + (text.type === 2
  59611. ? text.expression // no need for () because already wrapped in _s()
  59612. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  59613. }
  59614. function genComment (comment) {
  59615. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  59616. }
  59617. function genSlot (el, state) {
  59618. var slotName = el.slotName || '"default"';
  59619. var children = genChildren(el, state);
  59620. var res = "_t(" + slotName + (children ? ("," + children) : '');
  59621. var attrs = el.attrs || el.dynamicAttrs
  59622. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  59623. // slot props are camelized
  59624. name: camelize(attr.name),
  59625. value: attr.value,
  59626. dynamic: attr.dynamic
  59627. }); }))
  59628. : null;
  59629. var bind$$1 = el.attrsMap['v-bind'];
  59630. if ((attrs || bind$$1) && !children) {
  59631. res += ",null";
  59632. }
  59633. if (attrs) {
  59634. res += "," + attrs;
  59635. }
  59636. if (bind$$1) {
  59637. res += (attrs ? '' : ',null') + "," + bind$$1;
  59638. }
  59639. return res + ')'
  59640. }
  59641. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  59642. function genComponent (
  59643. componentName,
  59644. el,
  59645. state
  59646. ) {
  59647. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  59648. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  59649. }
  59650. function genProps (props) {
  59651. var staticProps = "";
  59652. var dynamicProps = "";
  59653. for (var i = 0; i < props.length; i++) {
  59654. var prop = props[i];
  59655. var value = transformSpecialNewlines(prop.value);
  59656. if (prop.dynamic) {
  59657. dynamicProps += (prop.name) + "," + value + ",";
  59658. } else {
  59659. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  59660. }
  59661. }
  59662. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  59663. if (dynamicProps) {
  59664. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  59665. } else {
  59666. return staticProps
  59667. }
  59668. }
  59669. // #3895, #4268
  59670. function transformSpecialNewlines (text) {
  59671. return text
  59672. .replace(/\u2028/g, '\\u2028')
  59673. .replace(/\u2029/g, '\\u2029')
  59674. }
  59675. /* */
  59676. // these keywords should not appear inside expressions, but operators like
  59677. // typeof, instanceof and in are allowed
  59678. var prohibitedKeywordRE = new RegExp('\\b' + (
  59679. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  59680. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  59681. 'extends,finally,continue,debugger,function,arguments'
  59682. ).split(',').join('\\b|\\b') + '\\b');
  59683. // these unary operators should not be used as property/method names
  59684. var unaryOperatorsRE = new RegExp('\\b' + (
  59685. 'delete,typeof,void'
  59686. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  59687. // strip strings in expressions
  59688. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  59689. // detect problematic expressions in a template
  59690. function detectErrors (ast, warn) {
  59691. if (ast) {
  59692. checkNode(ast, warn);
  59693. }
  59694. }
  59695. function checkNode (node, warn) {
  59696. if (node.type === 1) {
  59697. for (var name in node.attrsMap) {
  59698. if (dirRE.test(name)) {
  59699. var value = node.attrsMap[name];
  59700. if (value) {
  59701. var range = node.rawAttrsMap[name];
  59702. if (name === 'v-for') {
  59703. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  59704. } else if (name === 'v-slot' || name[0] === '#') {
  59705. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  59706. } else if (onRE.test(name)) {
  59707. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  59708. } else {
  59709. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  59710. }
  59711. }
  59712. }
  59713. }
  59714. if (node.children) {
  59715. for (var i = 0; i < node.children.length; i++) {
  59716. checkNode(node.children[i], warn);
  59717. }
  59718. }
  59719. } else if (node.type === 2) {
  59720. checkExpression(node.expression, node.text, warn, node);
  59721. }
  59722. }
  59723. function checkEvent (exp, text, warn, range) {
  59724. var stripped = exp.replace(stripStringRE, '');
  59725. var keywordMatch = stripped.match(unaryOperatorsRE);
  59726. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  59727. warn(
  59728. "avoid using JavaScript unary operator as property name: " +
  59729. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  59730. range
  59731. );
  59732. }
  59733. checkExpression(exp, text, warn, range);
  59734. }
  59735. function checkFor (node, text, warn, range) {
  59736. checkExpression(node.for || '', text, warn, range);
  59737. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  59738. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  59739. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  59740. }
  59741. function checkIdentifier (
  59742. ident,
  59743. type,
  59744. text,
  59745. warn,
  59746. range
  59747. ) {
  59748. if (typeof ident === 'string') {
  59749. try {
  59750. new Function(("var " + ident + "=_"));
  59751. } catch (e) {
  59752. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  59753. }
  59754. }
  59755. }
  59756. function checkExpression (exp, text, warn, range) {
  59757. try {
  59758. new Function(("return " + exp));
  59759. } catch (e) {
  59760. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  59761. if (keywordMatch) {
  59762. warn(
  59763. "avoid using JavaScript keyword as property name: " +
  59764. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  59765. range
  59766. );
  59767. } else {
  59768. warn(
  59769. "invalid expression: " + (e.message) + " in\n\n" +
  59770. " " + exp + "\n\n" +
  59771. " Raw expression: " + (text.trim()) + "\n",
  59772. range
  59773. );
  59774. }
  59775. }
  59776. }
  59777. function checkFunctionParameterExpression (exp, text, warn, range) {
  59778. try {
  59779. new Function(exp, '');
  59780. } catch (e) {
  59781. warn(
  59782. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  59783. " " + exp + "\n\n" +
  59784. " Raw expression: " + (text.trim()) + "\n",
  59785. range
  59786. );
  59787. }
  59788. }
  59789. /* */
  59790. var range = 2;
  59791. function generateCodeFrame (
  59792. source,
  59793. start,
  59794. end
  59795. ) {
  59796. if ( start === void 0 ) start = 0;
  59797. if ( end === void 0 ) end = source.length;
  59798. var lines = source.split(/\r?\n/);
  59799. var count = 0;
  59800. var res = [];
  59801. for (var i = 0; i < lines.length; i++) {
  59802. count += lines[i].length + 1;
  59803. if (count >= start) {
  59804. for (var j = i - range; j <= i + range || end > count; j++) {
  59805. if (j < 0 || j >= lines.length) { continue }
  59806. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  59807. var lineLength = lines[j].length;
  59808. if (j === i) {
  59809. // push underline
  59810. var pad = start - (count - lineLength) + 1;
  59811. var length = end > count ? lineLength - pad : end - start;
  59812. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  59813. } else if (j > i) {
  59814. if (end > count) {
  59815. var length$1 = Math.min(end - count, lineLength);
  59816. res.push(" | " + repeat$1("^", length$1));
  59817. }
  59818. count += lineLength + 1;
  59819. }
  59820. }
  59821. break
  59822. }
  59823. }
  59824. return res.join('\n')
  59825. }
  59826. function repeat$1 (str, n) {
  59827. var result = '';
  59828. if (n > 0) {
  59829. while (true) { // eslint-disable-line
  59830. if (n & 1) { result += str; }
  59831. n >>>= 1;
  59832. if (n <= 0) { break }
  59833. str += str;
  59834. }
  59835. }
  59836. return result
  59837. }
  59838. /* */
  59839. function createFunction (code, errors) {
  59840. try {
  59841. return new Function(code)
  59842. } catch (err) {
  59843. errors.push({ err: err, code: code });
  59844. return noop
  59845. }
  59846. }
  59847. function createCompileToFunctionFn (compile) {
  59848. var cache = Object.create(null);
  59849. return function compileToFunctions (
  59850. template,
  59851. options,
  59852. vm
  59853. ) {
  59854. options = extend({}, options);
  59855. var warn$$1 = options.warn || warn;
  59856. delete options.warn;
  59857. /* istanbul ignore if */
  59858. {
  59859. // detect possible CSP restriction
  59860. try {
  59861. new Function('return 1');
  59862. } catch (e) {
  59863. if (e.toString().match(/unsafe-eval|CSP/)) {
  59864. warn$$1(
  59865. 'It seems you are using the standalone build of Vue.js in an ' +
  59866. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  59867. 'The template compiler cannot work in this environment. Consider ' +
  59868. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  59869. 'templates into render functions.'
  59870. );
  59871. }
  59872. }
  59873. }
  59874. // check cache
  59875. var key = options.delimiters
  59876. ? String(options.delimiters) + template
  59877. : template;
  59878. if (cache[key]) {
  59879. return cache[key]
  59880. }
  59881. // compile
  59882. var compiled = compile(template, options);
  59883. // check compilation errors/tips
  59884. {
  59885. if (compiled.errors && compiled.errors.length) {
  59886. if (options.outputSourceRange) {
  59887. compiled.errors.forEach(function (e) {
  59888. warn$$1(
  59889. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  59890. generateCodeFrame(template, e.start, e.end),
  59891. vm
  59892. );
  59893. });
  59894. } else {
  59895. warn$$1(
  59896. "Error compiling template:\n\n" + template + "\n\n" +
  59897. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  59898. vm
  59899. );
  59900. }
  59901. }
  59902. if (compiled.tips && compiled.tips.length) {
  59903. if (options.outputSourceRange) {
  59904. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  59905. } else {
  59906. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  59907. }
  59908. }
  59909. }
  59910. // turn code into functions
  59911. var res = {};
  59912. var fnGenErrors = [];
  59913. res.render = createFunction(compiled.render, fnGenErrors);
  59914. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  59915. return createFunction(code, fnGenErrors)
  59916. });
  59917. // check function generation errors.
  59918. // this should only happen if there is a bug in the compiler itself.
  59919. // mostly for codegen development use
  59920. /* istanbul ignore if */
  59921. {
  59922. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  59923. warn$$1(
  59924. "Failed to generate render function:\n\n" +
  59925. fnGenErrors.map(function (ref) {
  59926. var err = ref.err;
  59927. var code = ref.code;
  59928. return ((err.toString()) + " in\n\n" + code + "\n");
  59929. }).join('\n'),
  59930. vm
  59931. );
  59932. }
  59933. }
  59934. return (cache[key] = res)
  59935. }
  59936. }
  59937. /* */
  59938. function createCompilerCreator (baseCompile) {
  59939. return function createCompiler (baseOptions) {
  59940. function compile (
  59941. template,
  59942. options
  59943. ) {
  59944. var finalOptions = Object.create(baseOptions);
  59945. var errors = [];
  59946. var tips = [];
  59947. var warn = function (msg, range, tip) {
  59948. (tip ? tips : errors).push(msg);
  59949. };
  59950. if (options) {
  59951. if (options.outputSourceRange) {
  59952. // $flow-disable-line
  59953. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  59954. warn = function (msg, range, tip) {
  59955. var data = { msg: msg };
  59956. if (range) {
  59957. if (range.start != null) {
  59958. data.start = range.start + leadingSpaceLength;
  59959. }
  59960. if (range.end != null) {
  59961. data.end = range.end + leadingSpaceLength;
  59962. }
  59963. }
  59964. (tip ? tips : errors).push(data);
  59965. };
  59966. }
  59967. // merge custom modules
  59968. if (options.modules) {
  59969. finalOptions.modules =
  59970. (baseOptions.modules || []).concat(options.modules);
  59971. }
  59972. // merge custom directives
  59973. if (options.directives) {
  59974. finalOptions.directives = extend(
  59975. Object.create(baseOptions.directives || null),
  59976. options.directives
  59977. );
  59978. }
  59979. // copy other options
  59980. for (var key in options) {
  59981. if (key !== 'modules' && key !== 'directives') {
  59982. finalOptions[key] = options[key];
  59983. }
  59984. }
  59985. }
  59986. finalOptions.warn = warn;
  59987. var compiled = baseCompile(template.trim(), finalOptions);
  59988. {
  59989. detectErrors(compiled.ast, warn);
  59990. }
  59991. compiled.errors = errors;
  59992. compiled.tips = tips;
  59993. return compiled
  59994. }
  59995. return {
  59996. compile: compile,
  59997. compileToFunctions: createCompileToFunctionFn(compile)
  59998. }
  59999. }
  60000. }
  60001. /* */
  60002. // `createCompilerCreator` allows creating compilers that use alternative
  60003. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  60004. // Here we just export a default compiler using the default parts.
  60005. var createCompiler = createCompilerCreator(function baseCompile (
  60006. template,
  60007. options
  60008. ) {
  60009. var ast = parse(template.trim(), options);
  60010. if (options.optimize !== false) {
  60011. optimize(ast, options);
  60012. }
  60013. var code = generate(ast, options);
  60014. return {
  60015. ast: ast,
  60016. render: code.render,
  60017. staticRenderFns: code.staticRenderFns
  60018. }
  60019. });
  60020. /* */
  60021. var ref$1 = createCompiler(baseOptions);
  60022. var compile = ref$1.compile;
  60023. var compileToFunctions = ref$1.compileToFunctions;
  60024. /* */
  60025. // check whether current browser encodes a char inside attribute values
  60026. var div;
  60027. function getShouldDecode (href) {
  60028. div = div || document.createElement('div');
  60029. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  60030. return div.innerHTML.indexOf('&#10;') > 0
  60031. }
  60032. // #3663: IE encodes newlines inside attribute values while other browsers don't
  60033. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  60034. // #6828: chrome encodes content in a[href]
  60035. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  60036. /* */
  60037. var idToTemplate = cached(function (id) {
  60038. var el = query(id);
  60039. return el && el.innerHTML
  60040. });
  60041. var mount = Vue.prototype.$mount;
  60042. Vue.prototype.$mount = function (
  60043. el,
  60044. hydrating
  60045. ) {
  60046. el = el && query(el);
  60047. /* istanbul ignore if */
  60048. if (el === document.body || el === document.documentElement) {
  60049. warn(
  60050. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  60051. );
  60052. return this
  60053. }
  60054. var options = this.$options;
  60055. // resolve template/el and convert to render function
  60056. if (!options.render) {
  60057. var template = options.template;
  60058. if (template) {
  60059. if (typeof template === 'string') {
  60060. if (template.charAt(0) === '#') {
  60061. template = idToTemplate(template);
  60062. /* istanbul ignore if */
  60063. if (!template) {
  60064. warn(
  60065. ("Template element not found or is empty: " + (options.template)),
  60066. this
  60067. );
  60068. }
  60069. }
  60070. } else if (template.nodeType) {
  60071. template = template.innerHTML;
  60072. } else {
  60073. {
  60074. warn('invalid template option:' + template, this);
  60075. }
  60076. return this
  60077. }
  60078. } else if (el) {
  60079. template = getOuterHTML(el);
  60080. }
  60081. if (template) {
  60082. /* istanbul ignore if */
  60083. if (config.performance && mark) {
  60084. mark('compile');
  60085. }
  60086. var ref = compileToFunctions(template, {
  60087. outputSourceRange: "development" !== 'production',
  60088. shouldDecodeNewlines: shouldDecodeNewlines,
  60089. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  60090. delimiters: options.delimiters,
  60091. comments: options.comments
  60092. }, this);
  60093. var render = ref.render;
  60094. var staticRenderFns = ref.staticRenderFns;
  60095. options.render = render;
  60096. options.staticRenderFns = staticRenderFns;
  60097. /* istanbul ignore if */
  60098. if (config.performance && mark) {
  60099. mark('compile end');
  60100. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  60101. }
  60102. }
  60103. }
  60104. return mount.call(this, el, hydrating)
  60105. };
  60106. /**
  60107. * Get outerHTML of elements, taking care
  60108. * of SVG elements in IE as well.
  60109. */
  60110. function getOuterHTML (el) {
  60111. if (el.outerHTML) {
  60112. return el.outerHTML
  60113. } else {
  60114. var container = document.createElement('div');
  60115. container.appendChild(el.cloneNode(true));
  60116. return container.innerHTML
  60117. }
  60118. }
  60119. Vue.compile = compileToFunctions;
  60120. module.exports = Vue;
  60121. /* 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))
  60122. /***/ }),
  60123. /***/ "./node_modules/vue/dist/vue.common.js":
  60124. /*!*********************************************!*\
  60125. !*** ./node_modules/vue/dist/vue.common.js ***!
  60126. \*********************************************/
  60127. /*! no static exports found */
  60128. /***/ (function(module, exports, __webpack_require__) {
  60129. if (false) {} else {
  60130. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  60131. }
  60132. /***/ }),
  60133. /***/ "./node_modules/webpack/buildin/global.js":
  60134. /*!***********************************!*\
  60135. !*** (webpack)/buildin/global.js ***!
  60136. \***********************************/
  60137. /*! no static exports found */
  60138. /***/ (function(module, exports) {
  60139. var g;
  60140. // This works in non-strict mode
  60141. g = (function() {
  60142. return this;
  60143. })();
  60144. try {
  60145. // This works if eval is allowed (see CSP)
  60146. g = g || new Function("return this")();
  60147. } catch (e) {
  60148. // This works if the window reference is available
  60149. if (typeof window === "object") g = window;
  60150. }
  60151. // g can still be undefined, but nothing to do about it...
  60152. // We return undefined, instead of nothing here, so it's
  60153. // easier to handle this case. if(!global) { ...}
  60154. module.exports = g;
  60155. /***/ }),
  60156. /***/ "./node_modules/webpack/buildin/module.js":
  60157. /*!***********************************!*\
  60158. !*** (webpack)/buildin/module.js ***!
  60159. \***********************************/
  60160. /*! no static exports found */
  60161. /***/ (function(module, exports) {
  60162. module.exports = function(module) {
  60163. if (!module.webpackPolyfill) {
  60164. module.deprecate = function() {};
  60165. module.paths = [];
  60166. // module.parent = undefined by default
  60167. if (!module.children) module.children = [];
  60168. Object.defineProperty(module, "loaded", {
  60169. enumerable: true,
  60170. get: function() {
  60171. return module.l;
  60172. }
  60173. });
  60174. Object.defineProperty(module, "id", {
  60175. enumerable: true,
  60176. get: function() {
  60177. return module.i;
  60178. }
  60179. });
  60180. module.webpackPolyfill = 1;
  60181. }
  60182. return module;
  60183. };
  60184. /***/ }),
  60185. /***/ "./resources/js/app.js":
  60186. /*!*****************************!*\
  60187. !*** ./resources/js/app.js ***!
  60188. \*****************************/
  60189. /*! no exports provided */
  60190. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60191. "use strict";
  60192. __webpack_require__.r(__webpack_exports__);
  60193. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  60194. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
  60195. /* harmony import */ var vue_router__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vue-router */ "./node_modules/vue-router/dist/vue-router.esm.js");
  60196. /* harmony import */ var _views_App__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./views/App */ "./resources/js/views/App.vue");
  60197. /* harmony import */ var _views_Dashboard__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./views/Dashboard */ "./resources/js/views/Dashboard.vue");
  60198. /* harmony import */ var _views_WorkOrder__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./views/WorkOrder */ "./resources/js/views/WorkOrder.vue");
  60199. /* harmony import */ var _views_Login__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./views/Login */ "./resources/js/views/Login.vue");
  60200. /* harmony import */ var _views_Welcome__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./views/Welcome */ "./resources/js/views/Welcome.vue");
  60201. /**
  60202. * First we will load all of this project's JavaScript dependencies which
  60203. * includes Vue and other libraries. It is a great starting point when
  60204. * building robust, powerful web applications using Vue and Laravel.
  60205. */
  60206. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  60207. window.Clipboard = __webpack_require__(/*! clipboard */ "./node_modules/clipboard/dist/clipboard.js");
  60208. __webpack_require__(/*! ./notify.min.js */ "./resources/js/notify.min.js");
  60209. vue__WEBPACK_IMPORTED_MODULE_0___default.a.use(vue_router__WEBPACK_IMPORTED_MODULE_1__["default"]);
  60210. var router = new vue_router__WEBPACK_IMPORTED_MODULE_1__["default"]({
  60211. mode: 'history',
  60212. routes: [{
  60213. path: '/',
  60214. name: 'home',
  60215. component: _views_Welcome__WEBPACK_IMPORTED_MODULE_6__["default"]
  60216. }, {
  60217. path: '/login',
  60218. name: 'login',
  60219. component: _views_Login__WEBPACK_IMPORTED_MODULE_5__["default"]
  60220. }, {
  60221. path: '/dashboard',
  60222. name: 'dashboard',
  60223. component: _views_Dashboard__WEBPACK_IMPORTED_MODULE_3__["default"]
  60224. }, {
  60225. path: '/workorders/:id',
  60226. name: 'workorders',
  60227. component: _views_WorkOrder__WEBPACK_IMPORTED_MODULE_4__["default"],
  60228. props: true
  60229. }]
  60230. });
  60231. var app = new vue__WEBPACK_IMPORTED_MODULE_0___default.a({
  60232. el: '#app',
  60233. components: {
  60234. App: _views_App__WEBPACK_IMPORTED_MODULE_2__["default"]
  60235. },
  60236. router: router
  60237. });
  60238. $(function () {
  60239. $('[data-toggle="tooltip"]').tooltip();
  60240. });
  60241. var clipboard = new Clipboard('.btn-clip');
  60242. clipboard.on('success', function (e) {
  60243. $('#' + e.trigger.getAttribute('id')).notify('Copied to Clipboard', {
  60244. position: "right",
  60245. className: 'success'
  60246. });
  60247. e.clearSelection();
  60248. });
  60249. /***/ }),
  60250. /***/ "./resources/js/bootstrap.js":
  60251. /*!***********************************!*\
  60252. !*** ./resources/js/bootstrap.js ***!
  60253. \***********************************/
  60254. /*! no exports provided */
  60255. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60256. "use strict";
  60257. __webpack_require__.r(__webpack_exports__);
  60258. /* harmony import */ var laravel_echo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! laravel-echo */ "./node_modules/laravel-echo/dist/echo.js");
  60259. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  60260. /**
  60261. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  60262. * for JavaScript based Bootstrap features such as modals and tabs. This
  60263. * code may be modified to fit the specific needs of your application.
  60264. */
  60265. try {
  60266. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  60267. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  60268. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  60269. } catch (e) {}
  60270. /**
  60271. * We'll load the axios HTTP library which allows us to easily issue requests
  60272. * to our Laravel back-end. This library automatically handles sending the
  60273. * CSRF token as a header based on the value of the "XSRF" token cookie.
  60274. */
  60275. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  60276. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  60277. /**
  60278. * Echo exposes an expressive API for subscribing to channels and listening
  60279. * for events that are broadcast by Laravel. Echo and event broadcasting
  60280. * allows your team to easily build robust real-time web applications.
  60281. */
  60282. window.Pusher = __webpack_require__(/*! pusher-js */ "./node_modules/pusher-js/dist/web/pusher.js");
  60283. window.Echo = new laravel_echo__WEBPACK_IMPORTED_MODULE_0__["default"]({
  60284. broadcaster: 'pusher',
  60285. key: "upccrt",
  60286. wsHost: window.location.hostname,
  60287. wsPort: 6001,
  60288. disableStats: true
  60289. });
  60290. /***/ }),
  60291. /***/ "./resources/js/components/AssetInfo.vue":
  60292. /*!***********************************************!*\
  60293. !*** ./resources/js/components/AssetInfo.vue ***!
  60294. \***********************************************/
  60295. /*! exports provided: default */
  60296. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60297. "use strict";
  60298. __webpack_require__.r(__webpack_exports__);
  60299. /* harmony import */ var _AssetInfo_vue_vue_type_template_id_f949323a___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AssetInfo.vue?vue&type=template&id=f949323a& */ "./resources/js/components/AssetInfo.vue?vue&type=template&id=f949323a&");
  60300. /* 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&");
  60301. /* 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");
  60302. /* normalize component */
  60303. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60304. _AssetInfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60305. _AssetInfo_vue_vue_type_template_id_f949323a___WEBPACK_IMPORTED_MODULE_0__["render"],
  60306. _AssetInfo_vue_vue_type_template_id_f949323a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60307. false,
  60308. null,
  60309. null,
  60310. null
  60311. )
  60312. /* hot reload */
  60313. if (false) { var api; }
  60314. component.options.__file = "resources/js/components/AssetInfo.vue"
  60315. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60316. /***/ }),
  60317. /***/ "./resources/js/components/AssetInfo.vue?vue&type=script&lang=js&":
  60318. /*!************************************************************************!*\
  60319. !*** ./resources/js/components/AssetInfo.vue?vue&type=script&lang=js& ***!
  60320. \************************************************************************/
  60321. /*! exports provided: default */
  60322. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60323. "use strict";
  60324. __webpack_require__.r(__webpack_exports__);
  60325. /* 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&");
  60326. /* 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"]);
  60327. /***/ }),
  60328. /***/ "./resources/js/components/AssetInfo.vue?vue&type=template&id=f949323a&":
  60329. /*!******************************************************************************!*\
  60330. !*** ./resources/js/components/AssetInfo.vue?vue&type=template&id=f949323a& ***!
  60331. \******************************************************************************/
  60332. /*! exports provided: render, staticRenderFns */
  60333. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60334. "use strict";
  60335. __webpack_require__.r(__webpack_exports__);
  60336. /* 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_f949323a___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=f949323a& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AssetInfo.vue?vue&type=template&id=f949323a&");
  60337. /* 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_f949323a___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  60338. /* 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_f949323a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  60339. /***/ }),
  60340. /***/ "./resources/js/components/AssetInfoEditModal.vue":
  60341. /*!********************************************************!*\
  60342. !*** ./resources/js/components/AssetInfoEditModal.vue ***!
  60343. \********************************************************/
  60344. /*! exports provided: default */
  60345. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60346. "use strict";
  60347. __webpack_require__.r(__webpack_exports__);
  60348. /* harmony import */ var _AssetInfoEditModal_vue_vue_type_template_id_24c98bd0___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AssetInfoEditModal.vue?vue&type=template&id=24c98bd0& */ "./resources/js/components/AssetInfoEditModal.vue?vue&type=template&id=24c98bd0&");
  60349. /* harmony import */ var _AssetInfoEditModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AssetInfoEditModal.vue?vue&type=script&lang=js& */ "./resources/js/components/AssetInfoEditModal.vue?vue&type=script&lang=js&");
  60350. /* 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");
  60351. /* normalize component */
  60352. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60353. _AssetInfoEditModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60354. _AssetInfoEditModal_vue_vue_type_template_id_24c98bd0___WEBPACK_IMPORTED_MODULE_0__["render"],
  60355. _AssetInfoEditModal_vue_vue_type_template_id_24c98bd0___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60356. false,
  60357. null,
  60358. null,
  60359. null
  60360. )
  60361. /* hot reload */
  60362. if (false) { var api; }
  60363. component.options.__file = "resources/js/components/AssetInfoEditModal.vue"
  60364. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60365. /***/ }),
  60366. /***/ "./resources/js/components/AssetInfoEditModal.vue?vue&type=script&lang=js&":
  60367. /*!*********************************************************************************!*\
  60368. !*** ./resources/js/components/AssetInfoEditModal.vue?vue&type=script&lang=js& ***!
  60369. \*********************************************************************************/
  60370. /*! exports provided: default */
  60371. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60372. "use strict";
  60373. __webpack_require__.r(__webpack_exports__);
  60374. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_AssetInfoEditModal_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!./AssetInfoEditModal.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AssetInfoEditModal.vue?vue&type=script&lang=js&");
  60375. /* 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_AssetInfoEditModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  60376. /***/ }),
  60377. /***/ "./resources/js/components/AssetInfoEditModal.vue?vue&type=template&id=24c98bd0&":
  60378. /*!***************************************************************************************!*\
  60379. !*** ./resources/js/components/AssetInfoEditModal.vue?vue&type=template&id=24c98bd0& ***!
  60380. \***************************************************************************************/
  60381. /*! exports provided: render, staticRenderFns */
  60382. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60383. "use strict";
  60384. __webpack_require__.r(__webpack_exports__);
  60385. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_AssetInfoEditModal_vue_vue_type_template_id_24c98bd0___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!./AssetInfoEditModal.vue?vue&type=template&id=24c98bd0& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AssetInfoEditModal.vue?vue&type=template&id=24c98bd0&");
  60386. /* 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_AssetInfoEditModal_vue_vue_type_template_id_24c98bd0___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  60387. /* 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_AssetInfoEditModal_vue_vue_type_template_id_24c98bd0___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  60388. /***/ }),
  60389. /***/ "./resources/js/components/AutocompleteCustomDropdown.vue":
  60390. /*!****************************************************************!*\
  60391. !*** ./resources/js/components/AutocompleteCustomDropdown.vue ***!
  60392. \****************************************************************/
  60393. /*! exports provided: default */
  60394. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60395. "use strict";
  60396. __webpack_require__.r(__webpack_exports__);
  60397. /* harmony import */ var _AutocompleteCustomDropdown_vue_vue_type_template_id_5fcc8b56___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56& */ "./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56&");
  60398. /* harmony import */ var _AutocompleteCustomDropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AutocompleteCustomDropdown.vue?vue&type=script&lang=js& */ "./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js&");
  60399. /* 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");
  60400. /* normalize component */
  60401. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60402. _AutocompleteCustomDropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60403. _AutocompleteCustomDropdown_vue_vue_type_template_id_5fcc8b56___WEBPACK_IMPORTED_MODULE_0__["render"],
  60404. _AutocompleteCustomDropdown_vue_vue_type_template_id_5fcc8b56___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60405. false,
  60406. null,
  60407. null,
  60408. null
  60409. )
  60410. /* hot reload */
  60411. if (false) { var api; }
  60412. component.options.__file = "resources/js/components/AutocompleteCustomDropdown.vue"
  60413. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60414. /***/ }),
  60415. /***/ "./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js&":
  60416. /*!*****************************************************************************************!*\
  60417. !*** ./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js& ***!
  60418. \*****************************************************************************************/
  60419. /*! exports provided: default */
  60420. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60421. "use strict";
  60422. __webpack_require__.r(__webpack_exports__);
  60423. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_AutocompleteCustomDropdown_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!./AutocompleteCustomDropdown.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js&");
  60424. /* 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_AutocompleteCustomDropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  60425. /***/ }),
  60426. /***/ "./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56&":
  60427. /*!***********************************************************************************************!*\
  60428. !*** ./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56& ***!
  60429. \***********************************************************************************************/
  60430. /*! exports provided: render, staticRenderFns */
  60431. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60432. "use strict";
  60433. __webpack_require__.r(__webpack_exports__);
  60434. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_AutocompleteCustomDropdown_vue_vue_type_template_id_5fcc8b56___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!./AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56&");
  60435. /* 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_AutocompleteCustomDropdown_vue_vue_type_template_id_5fcc8b56___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  60436. /* 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_AutocompleteCustomDropdown_vue_vue_type_template_id_5fcc8b56___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  60437. /***/ }),
  60438. /***/ "./resources/js/components/CircleSpinner.vue":
  60439. /*!***************************************************!*\
  60440. !*** ./resources/js/components/CircleSpinner.vue ***!
  60441. \***************************************************/
  60442. /*! exports provided: default */
  60443. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60444. "use strict";
  60445. __webpack_require__.r(__webpack_exports__);
  60446. /* harmony import */ var _CircleSpinner_vue_vue_type_template_id_9a543b64_scoped_true___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true& */ "./resources/js/components/CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true&");
  60447. /* harmony import */ var _CircleSpinner_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./CircleSpinner.vue?vue&type=script&lang=js& */ "./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js&");
  60448. /* empty/unused harmony star reexport *//* harmony import */ var _CircleSpinner_vue_vue_type_style_index_0_id_9a543b64_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css& */ "./resources/js/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css&");
  60449. /* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");
  60450. /* normalize component */
  60451. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__["default"])(
  60452. _CircleSpinner_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60453. _CircleSpinner_vue_vue_type_template_id_9a543b64_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"],
  60454. _CircleSpinner_vue_vue_type_template_id_9a543b64_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60455. false,
  60456. null,
  60457. "9a543b64",
  60458. null
  60459. )
  60460. /* hot reload */
  60461. if (false) { var api; }
  60462. component.options.__file = "resources/js/components/CircleSpinner.vue"
  60463. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60464. /***/ }),
  60465. /***/ "./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js&":
  60466. /*!****************************************************************************!*\
  60467. !*** ./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js& ***!
  60468. \****************************************************************************/
  60469. /*! exports provided: default */
  60470. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60471. "use strict";
  60472. __webpack_require__.r(__webpack_exports__);
  60473. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_CircleSpinner_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!./CircleSpinner.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js&");
  60474. /* 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_CircleSpinner_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  60475. /***/ }),
  60476. /***/ "./resources/js/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css&":
  60477. /*!************************************************************************************************************!*\
  60478. !*** ./resources/js/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css& ***!
  60479. \************************************************************************************************************/
  60480. /*! no static exports found */
  60481. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60482. "use strict";
  60483. __webpack_require__.r(__webpack_exports__);
  60484. /* harmony import */ var _node_modules_style_loader_index_js_node_modules_css_loader_index_js_ref_6_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_2_node_modules_vue_loader_lib_index_js_vue_loader_options_CircleSpinner_vue_vue_type_style_index_0_id_9a543b64_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/style-loader!../../../node_modules/css-loader??ref--6-1!../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../node_modules/postcss-loader/src??ref--6-2!../../../node_modules/vue-loader/lib??vue-loader-options!./CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css& */ "./node_modules/style-loader/index.js!./node_modules/css-loader/index.js?!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css&");
  60485. /* harmony import */ var _node_modules_style_loader_index_js_node_modules_css_loader_index_js_ref_6_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_2_node_modules_vue_loader_lib_index_js_vue_loader_options_CircleSpinner_vue_vue_type_style_index_0_id_9a543b64_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_index_js_node_modules_css_loader_index_js_ref_6_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_2_node_modules_vue_loader_lib_index_js_vue_loader_options_CircleSpinner_vue_vue_type_style_index_0_id_9a543b64_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0__);
  60486. /* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _node_modules_style_loader_index_js_node_modules_css_loader_index_js_ref_6_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_2_node_modules_vue_loader_lib_index_js_vue_loader_options_CircleSpinner_vue_vue_type_style_index_0_id_9a543b64_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== 'default') (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _node_modules_style_loader_index_js_node_modules_css_loader_index_js_ref_6_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_2_node_modules_vue_loader_lib_index_js_vue_loader_options_CircleSpinner_vue_vue_type_style_index_0_id_9a543b64_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__));
  60487. /* harmony default export */ __webpack_exports__["default"] = (_node_modules_style_loader_index_js_node_modules_css_loader_index_js_ref_6_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_2_node_modules_vue_loader_lib_index_js_vue_loader_options_CircleSpinner_vue_vue_type_style_index_0_id_9a543b64_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0___default.a);
  60488. /***/ }),
  60489. /***/ "./resources/js/components/CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true&":
  60490. /*!**********************************************************************************************!*\
  60491. !*** ./resources/js/components/CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true& ***!
  60492. \**********************************************************************************************/
  60493. /*! exports provided: render, staticRenderFns */
  60494. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60495. "use strict";
  60496. __webpack_require__.r(__webpack_exports__);
  60497. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_CircleSpinner_vue_vue_type_template_id_9a543b64_scoped_true___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!./CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true&");
  60498. /* 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_CircleSpinner_vue_vue_type_template_id_9a543b64_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  60499. /* 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_CircleSpinner_vue_vue_type_template_id_9a543b64_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  60500. /***/ }),
  60501. /***/ "./resources/js/components/Credential.vue":
  60502. /*!************************************************!*\
  60503. !*** ./resources/js/components/Credential.vue ***!
  60504. \************************************************/
  60505. /*! exports provided: default */
  60506. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60507. "use strict";
  60508. __webpack_require__.r(__webpack_exports__);
  60509. /* harmony import */ var _Credential_vue_vue_type_template_id_58b8dcfc___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Credential.vue?vue&type=template&id=58b8dcfc& */ "./resources/js/components/Credential.vue?vue&type=template&id=58b8dcfc&");
  60510. /* 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&");
  60511. /* 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");
  60512. /* normalize component */
  60513. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60514. _Credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60515. _Credential_vue_vue_type_template_id_58b8dcfc___WEBPACK_IMPORTED_MODULE_0__["render"],
  60516. _Credential_vue_vue_type_template_id_58b8dcfc___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60517. false,
  60518. null,
  60519. null,
  60520. null
  60521. )
  60522. /* hot reload */
  60523. if (false) { var api; }
  60524. component.options.__file = "resources/js/components/Credential.vue"
  60525. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60526. /***/ }),
  60527. /***/ "./resources/js/components/Credential.vue?vue&type=script&lang=js&":
  60528. /*!*************************************************************************!*\
  60529. !*** ./resources/js/components/Credential.vue?vue&type=script&lang=js& ***!
  60530. \*************************************************************************/
  60531. /*! exports provided: default */
  60532. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60533. "use strict";
  60534. __webpack_require__.r(__webpack_exports__);
  60535. /* 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&");
  60536. /* 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"]);
  60537. /***/ }),
  60538. /***/ "./resources/js/components/Credential.vue?vue&type=template&id=58b8dcfc&":
  60539. /*!*******************************************************************************!*\
  60540. !*** ./resources/js/components/Credential.vue?vue&type=template&id=58b8dcfc& ***!
  60541. \*******************************************************************************/
  60542. /*! exports provided: render, staticRenderFns */
  60543. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60544. "use strict";
  60545. __webpack_require__.r(__webpack_exports__);
  60546. /* 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_58b8dcfc___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=58b8dcfc& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/Credential.vue?vue&type=template&id=58b8dcfc&");
  60547. /* 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_58b8dcfc___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  60548. /* 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_58b8dcfc___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  60549. /***/ }),
  60550. /***/ "./resources/js/components/CredentialFormModal.vue":
  60551. /*!*********************************************************!*\
  60552. !*** ./resources/js/components/CredentialFormModal.vue ***!
  60553. \*********************************************************/
  60554. /*! exports provided: default */
  60555. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60556. "use strict";
  60557. __webpack_require__.r(__webpack_exports__);
  60558. /* harmony import */ var _CredentialFormModal_vue_vue_type_template_id_3cdb3697___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./CredentialFormModal.vue?vue&type=template&id=3cdb3697& */ "./resources/js/components/CredentialFormModal.vue?vue&type=template&id=3cdb3697&");
  60559. /* harmony import */ var _CredentialFormModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./CredentialFormModal.vue?vue&type=script&lang=js& */ "./resources/js/components/CredentialFormModal.vue?vue&type=script&lang=js&");
  60560. /* 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");
  60561. /* normalize component */
  60562. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60563. _CredentialFormModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60564. _CredentialFormModal_vue_vue_type_template_id_3cdb3697___WEBPACK_IMPORTED_MODULE_0__["render"],
  60565. _CredentialFormModal_vue_vue_type_template_id_3cdb3697___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60566. false,
  60567. null,
  60568. null,
  60569. null
  60570. )
  60571. /* hot reload */
  60572. if (false) { var api; }
  60573. component.options.__file = "resources/js/components/CredentialFormModal.vue"
  60574. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60575. /***/ }),
  60576. /***/ "./resources/js/components/CredentialFormModal.vue?vue&type=script&lang=js&":
  60577. /*!**********************************************************************************!*\
  60578. !*** ./resources/js/components/CredentialFormModal.vue?vue&type=script&lang=js& ***!
  60579. \**********************************************************************************/
  60580. /*! exports provided: default */
  60581. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60582. "use strict";
  60583. __webpack_require__.r(__webpack_exports__);
  60584. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_CredentialFormModal_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!./CredentialFormModal.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CredentialFormModal.vue?vue&type=script&lang=js&");
  60585. /* 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_CredentialFormModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  60586. /***/ }),
  60587. /***/ "./resources/js/components/CredentialFormModal.vue?vue&type=template&id=3cdb3697&":
  60588. /*!****************************************************************************************!*\
  60589. !*** ./resources/js/components/CredentialFormModal.vue?vue&type=template&id=3cdb3697& ***!
  60590. \****************************************************************************************/
  60591. /*! exports provided: render, staticRenderFns */
  60592. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60593. "use strict";
  60594. __webpack_require__.r(__webpack_exports__);
  60595. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_CredentialFormModal_vue_vue_type_template_id_3cdb3697___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!./CredentialFormModal.vue?vue&type=template&id=3cdb3697& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CredentialFormModal.vue?vue&type=template&id=3cdb3697&");
  60596. /* 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_CredentialFormModal_vue_vue_type_template_id_3cdb3697___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  60597. /* 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_CredentialFormModal_vue_vue_type_template_id_3cdb3697___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  60598. /***/ }),
  60599. /***/ "./resources/js/components/CredentialList.vue":
  60600. /*!****************************************************!*\
  60601. !*** ./resources/js/components/CredentialList.vue ***!
  60602. \****************************************************/
  60603. /*! exports provided: default */
  60604. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60605. "use strict";
  60606. __webpack_require__.r(__webpack_exports__);
  60607. /* harmony import */ var _CredentialList_vue_vue_type_template_id_7264bb80___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./CredentialList.vue?vue&type=template&id=7264bb80& */ "./resources/js/components/CredentialList.vue?vue&type=template&id=7264bb80&");
  60608. /* harmony import */ var _CredentialList_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./CredentialList.vue?vue&type=script&lang=js& */ "./resources/js/components/CredentialList.vue?vue&type=script&lang=js&");
  60609. /* 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");
  60610. /* normalize component */
  60611. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60612. _CredentialList_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60613. _CredentialList_vue_vue_type_template_id_7264bb80___WEBPACK_IMPORTED_MODULE_0__["render"],
  60614. _CredentialList_vue_vue_type_template_id_7264bb80___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60615. false,
  60616. null,
  60617. null,
  60618. null
  60619. )
  60620. /* hot reload */
  60621. if (false) { var api; }
  60622. component.options.__file = "resources/js/components/CredentialList.vue"
  60623. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60624. /***/ }),
  60625. /***/ "./resources/js/components/CredentialList.vue?vue&type=script&lang=js&":
  60626. /*!*****************************************************************************!*\
  60627. !*** ./resources/js/components/CredentialList.vue?vue&type=script&lang=js& ***!
  60628. \*****************************************************************************/
  60629. /*! exports provided: default */
  60630. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60631. "use strict";
  60632. __webpack_require__.r(__webpack_exports__);
  60633. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_CredentialList_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!./CredentialList.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CredentialList.vue?vue&type=script&lang=js&");
  60634. /* 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_CredentialList_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  60635. /***/ }),
  60636. /***/ "./resources/js/components/CredentialList.vue?vue&type=template&id=7264bb80&":
  60637. /*!***********************************************************************************!*\
  60638. !*** ./resources/js/components/CredentialList.vue?vue&type=template&id=7264bb80& ***!
  60639. \***********************************************************************************/
  60640. /*! exports provided: render, staticRenderFns */
  60641. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60642. "use strict";
  60643. __webpack_require__.r(__webpack_exports__);
  60644. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_CredentialList_vue_vue_type_template_id_7264bb80___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!./CredentialList.vue?vue&type=template&id=7264bb80& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CredentialList.vue?vue&type=template&id=7264bb80&");
  60645. /* 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_CredentialList_vue_vue_type_template_id_7264bb80___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  60646. /* 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_CredentialList_vue_vue_type_template_id_7264bb80___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  60647. /***/ }),
  60648. /***/ "./resources/js/components/ErrorList.vue":
  60649. /*!***********************************************!*\
  60650. !*** ./resources/js/components/ErrorList.vue ***!
  60651. \***********************************************/
  60652. /*! exports provided: default */
  60653. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60654. "use strict";
  60655. __webpack_require__.r(__webpack_exports__);
  60656. /* harmony import */ var _ErrorList_vue_vue_type_template_id_48c089eb___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ErrorList.vue?vue&type=template&id=48c089eb& */ "./resources/js/components/ErrorList.vue?vue&type=template&id=48c089eb&");
  60657. /* 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&");
  60658. /* 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");
  60659. /* normalize component */
  60660. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60661. _ErrorList_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60662. _ErrorList_vue_vue_type_template_id_48c089eb___WEBPACK_IMPORTED_MODULE_0__["render"],
  60663. _ErrorList_vue_vue_type_template_id_48c089eb___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60664. false,
  60665. null,
  60666. null,
  60667. null
  60668. )
  60669. /* hot reload */
  60670. if (false) { var api; }
  60671. component.options.__file = "resources/js/components/ErrorList.vue"
  60672. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60673. /***/ }),
  60674. /***/ "./resources/js/components/ErrorList.vue?vue&type=script&lang=js&":
  60675. /*!************************************************************************!*\
  60676. !*** ./resources/js/components/ErrorList.vue?vue&type=script&lang=js& ***!
  60677. \************************************************************************/
  60678. /*! exports provided: default */
  60679. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60680. "use strict";
  60681. __webpack_require__.r(__webpack_exports__);
  60682. /* 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&");
  60683. /* 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"]);
  60684. /***/ }),
  60685. /***/ "./resources/js/components/ErrorList.vue?vue&type=template&id=48c089eb&":
  60686. /*!******************************************************************************!*\
  60687. !*** ./resources/js/components/ErrorList.vue?vue&type=template&id=48c089eb& ***!
  60688. \******************************************************************************/
  60689. /*! exports provided: render, staticRenderFns */
  60690. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60691. "use strict";
  60692. __webpack_require__.r(__webpack_exports__);
  60693. /* 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_48c089eb___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=48c089eb& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ErrorList.vue?vue&type=template&id=48c089eb&");
  60694. /* 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_48c089eb___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  60695. /* 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_48c089eb___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  60696. /***/ }),
  60697. /***/ "./resources/js/components/Modal.vue":
  60698. /*!*******************************************!*\
  60699. !*** ./resources/js/components/Modal.vue ***!
  60700. \*******************************************/
  60701. /*! exports provided: default */
  60702. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60703. "use strict";
  60704. __webpack_require__.r(__webpack_exports__);
  60705. /* harmony import */ var _Modal_vue_vue_type_template_id_53ab54d2___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Modal.vue?vue&type=template&id=53ab54d2& */ "./resources/js/components/Modal.vue?vue&type=template&id=53ab54d2&");
  60706. /* 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");
  60707. var script = {}
  60708. /* normalize component */
  60709. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(
  60710. script,
  60711. _Modal_vue_vue_type_template_id_53ab54d2___WEBPACK_IMPORTED_MODULE_0__["render"],
  60712. _Modal_vue_vue_type_template_id_53ab54d2___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60713. false,
  60714. null,
  60715. null,
  60716. null
  60717. )
  60718. /* hot reload */
  60719. if (false) { var api; }
  60720. component.options.__file = "resources/js/components/Modal.vue"
  60721. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60722. /***/ }),
  60723. /***/ "./resources/js/components/Modal.vue?vue&type=template&id=53ab54d2&":
  60724. /*!**************************************************************************!*\
  60725. !*** ./resources/js/components/Modal.vue?vue&type=template&id=53ab54d2& ***!
  60726. \**************************************************************************/
  60727. /*! exports provided: render, staticRenderFns */
  60728. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60729. "use strict";
  60730. __webpack_require__.r(__webpack_exports__);
  60731. /* 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_53ab54d2___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=53ab54d2& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/Modal.vue?vue&type=template&id=53ab54d2&");
  60732. /* 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_53ab54d2___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  60733. /* 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_53ab54d2___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  60734. /***/ }),
  60735. /***/ "./resources/js/components/NoteFormModal.vue":
  60736. /*!***************************************************!*\
  60737. !*** ./resources/js/components/NoteFormModal.vue ***!
  60738. \***************************************************/
  60739. /*! exports provided: default */
  60740. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60741. "use strict";
  60742. __webpack_require__.r(__webpack_exports__);
  60743. /* harmony import */ var _NoteFormModal_vue_vue_type_template_id_1391a09c___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./NoteFormModal.vue?vue&type=template&id=1391a09c& */ "./resources/js/components/NoteFormModal.vue?vue&type=template&id=1391a09c&");
  60744. /* harmony import */ var _NoteFormModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./NoteFormModal.vue?vue&type=script&lang=js& */ "./resources/js/components/NoteFormModal.vue?vue&type=script&lang=js&");
  60745. /* 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");
  60746. /* normalize component */
  60747. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60748. _NoteFormModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60749. _NoteFormModal_vue_vue_type_template_id_1391a09c___WEBPACK_IMPORTED_MODULE_0__["render"],
  60750. _NoteFormModal_vue_vue_type_template_id_1391a09c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60751. false,
  60752. null,
  60753. null,
  60754. null
  60755. )
  60756. /* hot reload */
  60757. if (false) { var api; }
  60758. component.options.__file = "resources/js/components/NoteFormModal.vue"
  60759. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60760. /***/ }),
  60761. /***/ "./resources/js/components/NoteFormModal.vue?vue&type=script&lang=js&":
  60762. /*!****************************************************************************!*\
  60763. !*** ./resources/js/components/NoteFormModal.vue?vue&type=script&lang=js& ***!
  60764. \****************************************************************************/
  60765. /*! exports provided: default */
  60766. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60767. "use strict";
  60768. __webpack_require__.r(__webpack_exports__);
  60769. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_NoteFormModal_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!./NoteFormModal.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/NoteFormModal.vue?vue&type=script&lang=js&");
  60770. /* 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_NoteFormModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  60771. /***/ }),
  60772. /***/ "./resources/js/components/NoteFormModal.vue?vue&type=template&id=1391a09c&":
  60773. /*!**********************************************************************************!*\
  60774. !*** ./resources/js/components/NoteFormModal.vue?vue&type=template&id=1391a09c& ***!
  60775. \**********************************************************************************/
  60776. /*! exports provided: render, staticRenderFns */
  60777. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60778. "use strict";
  60779. __webpack_require__.r(__webpack_exports__);
  60780. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_NoteFormModal_vue_vue_type_template_id_1391a09c___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!./NoteFormModal.vue?vue&type=template&id=1391a09c& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/NoteFormModal.vue?vue&type=template&id=1391a09c&");
  60781. /* 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_NoteFormModal_vue_vue_type_template_id_1391a09c___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  60782. /* 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_NoteFormModal_vue_vue_type_template_id_1391a09c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  60783. /***/ }),
  60784. /***/ "./resources/js/components/Notes.vue":
  60785. /*!*******************************************!*\
  60786. !*** ./resources/js/components/Notes.vue ***!
  60787. \*******************************************/
  60788. /*! exports provided: default */
  60789. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60790. "use strict";
  60791. __webpack_require__.r(__webpack_exports__);
  60792. /* harmony import */ var _Notes_vue_vue_type_template_id_3d897ee6___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Notes.vue?vue&type=template&id=3d897ee6& */ "./resources/js/components/Notes.vue?vue&type=template&id=3d897ee6&");
  60793. /* 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&");
  60794. /* 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");
  60795. /* normalize component */
  60796. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60797. _Notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60798. _Notes_vue_vue_type_template_id_3d897ee6___WEBPACK_IMPORTED_MODULE_0__["render"],
  60799. _Notes_vue_vue_type_template_id_3d897ee6___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60800. false,
  60801. null,
  60802. null,
  60803. null
  60804. )
  60805. /* hot reload */
  60806. if (false) { var api; }
  60807. component.options.__file = "resources/js/components/Notes.vue"
  60808. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60809. /***/ }),
  60810. /***/ "./resources/js/components/Notes.vue?vue&type=script&lang=js&":
  60811. /*!********************************************************************!*\
  60812. !*** ./resources/js/components/Notes.vue?vue&type=script&lang=js& ***!
  60813. \********************************************************************/
  60814. /*! exports provided: default */
  60815. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60816. "use strict";
  60817. __webpack_require__.r(__webpack_exports__);
  60818. /* 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&");
  60819. /* 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"]);
  60820. /***/ }),
  60821. /***/ "./resources/js/components/Notes.vue?vue&type=template&id=3d897ee6&":
  60822. /*!**************************************************************************!*\
  60823. !*** ./resources/js/components/Notes.vue?vue&type=template&id=3d897ee6& ***!
  60824. \**************************************************************************/
  60825. /*! exports provided: render, staticRenderFns */
  60826. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60827. "use strict";
  60828. __webpack_require__.r(__webpack_exports__);
  60829. /* 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_3d897ee6___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=3d897ee6& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/Notes.vue?vue&type=template&id=3d897ee6&");
  60830. /* 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_3d897ee6___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  60831. /* 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_3d897ee6___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  60832. /***/ }),
  60833. /***/ "./resources/js/components/WoInfoEditModal.vue":
  60834. /*!*****************************************************!*\
  60835. !*** ./resources/js/components/WoInfoEditModal.vue ***!
  60836. \*****************************************************/
  60837. /*! exports provided: default */
  60838. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60839. "use strict";
  60840. __webpack_require__.r(__webpack_exports__);
  60841. /* harmony import */ var _WoInfoEditModal_vue_vue_type_template_id_352dd7a2___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./WoInfoEditModal.vue?vue&type=template&id=352dd7a2& */ "./resources/js/components/WoInfoEditModal.vue?vue&type=template&id=352dd7a2&");
  60842. /* harmony import */ var _WoInfoEditModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./WoInfoEditModal.vue?vue&type=script&lang=js& */ "./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js&");
  60843. /* 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");
  60844. /* normalize component */
  60845. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60846. _WoInfoEditModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60847. _WoInfoEditModal_vue_vue_type_template_id_352dd7a2___WEBPACK_IMPORTED_MODULE_0__["render"],
  60848. _WoInfoEditModal_vue_vue_type_template_id_352dd7a2___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60849. false,
  60850. null,
  60851. null,
  60852. null
  60853. )
  60854. /* hot reload */
  60855. if (false) { var api; }
  60856. component.options.__file = "resources/js/components/WoInfoEditModal.vue"
  60857. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60858. /***/ }),
  60859. /***/ "./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js&":
  60860. /*!******************************************************************************!*\
  60861. !*** ./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js& ***!
  60862. \******************************************************************************/
  60863. /*! exports provided: default */
  60864. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60865. "use strict";
  60866. __webpack_require__.r(__webpack_exports__);
  60867. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_WoInfoEditModal_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!./WoInfoEditModal.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js&");
  60868. /* 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_WoInfoEditModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  60869. /***/ }),
  60870. /***/ "./resources/js/components/WoInfoEditModal.vue?vue&type=template&id=352dd7a2&":
  60871. /*!************************************************************************************!*\
  60872. !*** ./resources/js/components/WoInfoEditModal.vue?vue&type=template&id=352dd7a2& ***!
  60873. \************************************************************************************/
  60874. /*! exports provided: render, staticRenderFns */
  60875. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60876. "use strict";
  60877. __webpack_require__.r(__webpack_exports__);
  60878. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_WoInfoEditModal_vue_vue_type_template_id_352dd7a2___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!./WoInfoEditModal.vue?vue&type=template&id=352dd7a2& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WoInfoEditModal.vue?vue&type=template&id=352dd7a2&");
  60879. /* 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_WoInfoEditModal_vue_vue_type_template_id_352dd7a2___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  60880. /* 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_WoInfoEditModal_vue_vue_type_template_id_352dd7a2___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  60881. /***/ }),
  60882. /***/ "./resources/js/components/WorkOrderInfo.vue":
  60883. /*!***************************************************!*\
  60884. !*** ./resources/js/components/WorkOrderInfo.vue ***!
  60885. \***************************************************/
  60886. /*! exports provided: default */
  60887. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60888. "use strict";
  60889. __webpack_require__.r(__webpack_exports__);
  60890. /* harmony import */ var _WorkOrderInfo_vue_vue_type_template_id_50116330___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./WorkOrderInfo.vue?vue&type=template&id=50116330& */ "./resources/js/components/WorkOrderInfo.vue?vue&type=template&id=50116330&");
  60891. /* harmony import */ var _WorkOrderInfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./WorkOrderInfo.vue?vue&type=script&lang=js& */ "./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js&");
  60892. /* 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");
  60893. /* normalize component */
  60894. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60895. _WorkOrderInfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60896. _WorkOrderInfo_vue_vue_type_template_id_50116330___WEBPACK_IMPORTED_MODULE_0__["render"],
  60897. _WorkOrderInfo_vue_vue_type_template_id_50116330___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60898. false,
  60899. null,
  60900. null,
  60901. null
  60902. )
  60903. /* hot reload */
  60904. if (false) { var api; }
  60905. component.options.__file = "resources/js/components/WorkOrderInfo.vue"
  60906. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60907. /***/ }),
  60908. /***/ "./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js&":
  60909. /*!****************************************************************************!*\
  60910. !*** ./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js& ***!
  60911. \****************************************************************************/
  60912. /*! exports provided: default */
  60913. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60914. "use strict";
  60915. __webpack_require__.r(__webpack_exports__);
  60916. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_WorkOrderInfo_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!./WorkOrderInfo.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js&");
  60917. /* 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_WorkOrderInfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  60918. /***/ }),
  60919. /***/ "./resources/js/components/WorkOrderInfo.vue?vue&type=template&id=50116330&":
  60920. /*!**********************************************************************************!*\
  60921. !*** ./resources/js/components/WorkOrderInfo.vue?vue&type=template&id=50116330& ***!
  60922. \**********************************************************************************/
  60923. /*! exports provided: render, staticRenderFns */
  60924. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60925. "use strict";
  60926. __webpack_require__.r(__webpack_exports__);
  60927. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_WorkOrderInfo_vue_vue_type_template_id_50116330___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!./WorkOrderInfo.vue?vue&type=template&id=50116330& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WorkOrderInfo.vue?vue&type=template&id=50116330&");
  60928. /* 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_WorkOrderInfo_vue_vue_type_template_id_50116330___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  60929. /* 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_WorkOrderInfo_vue_vue_type_template_id_50116330___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  60930. /***/ }),
  60931. /***/ "./resources/js/mixins/dateMixin.js":
  60932. /*!******************************************!*\
  60933. !*** ./resources/js/mixins/dateMixin.js ***!
  60934. \******************************************/
  60935. /*! exports provided: default */
  60936. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60937. "use strict";
  60938. __webpack_require__.r(__webpack_exports__);
  60939. /* harmony default export */ __webpack_exports__["default"] = ({
  60940. methods: {
  60941. treatAsUTC: function treatAsUTC(date) {
  60942. var result = new Date(date);
  60943. result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
  60944. return result;
  60945. },
  60946. daysSinceToday: function daysSinceToday(date) {
  60947. var currentDate = new Date();
  60948. var millisecondsPerDay = 24 * 60 * 60 * 1000;
  60949. return (this.treatAsUTC(currentDate) - this.treatAsUTC(date)) / millisecondsPerDay;
  60950. },
  60951. getHRDate: function getHRDate(dateString) {
  60952. var date = new Date(dateString);
  60953. return date.toLocaleString('default', {
  60954. month: 'short',
  60955. day: 'numeric',
  60956. year: 'numeric',
  60957. hour: 'numeric',
  60958. minute: 'numeric'
  60959. });
  60960. },
  60961. isZero: function isZero(dateString) {
  60962. return dateString === '0000-00-00 00:00:00';
  60963. }
  60964. }
  60965. });
  60966. /***/ }),
  60967. /***/ "./resources/js/notify.min.js":
  60968. /*!************************************!*\
  60969. !*** ./resources/js/notify.min.js ***!
  60970. \************************************/
  60971. /*! no static exports found */
  60972. /***/ (function(module, exports, __webpack_require__) {
  60973. 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); }
  60974. (function (e) {
  60975. true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (e),
  60976. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  60977. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  60978. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
  60979. })(function (e) {
  60980. function A(t, n, i) {
  60981. typeof i == "string" && (i = {
  60982. className: i
  60983. }), 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);
  60984. }
  60985. var t = [].indexOf || function (e) {
  60986. for (var t = 0, n = this.length; t < n; t++) {
  60987. if (t in this && this[t] === e) return t;
  60988. }
  60989. return -1;
  60990. },
  60991. n = "notify",
  60992. r = n + "js",
  60993. i = n + "!blank",
  60994. s = {
  60995. t: "top",
  60996. m: "middle",
  60997. b: "bottom",
  60998. l: "left",
  60999. c: "center",
  61000. r: "right"
  61001. },
  61002. o = ["l", "c", "r"],
  61003. u = ["t", "m", "b"],
  61004. a = ["t", "b", "l", "r"],
  61005. f = {
  61006. t: "b",
  61007. m: null,
  61008. b: "t",
  61009. l: "r",
  61010. c: null,
  61011. r: "l"
  61012. },
  61013. l = function l(t) {
  61014. var n;
  61015. return n = [], e.each(t.split(/\W+/), function (e, t) {
  61016. var r;
  61017. r = t.toLowerCase().charAt(0);
  61018. if (s[r]) return n.push(r);
  61019. }), n;
  61020. },
  61021. c = {},
  61022. h = {
  61023. name: "core",
  61024. html: '<div class="' + r + '-wrapper">\n <div class="' + r + '-arrow"></div>\n <div class="' + r + '-container"></div>\n</div>',
  61025. 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}"
  61026. },
  61027. p = {
  61028. "border-radius": ["-webkit-", "-moz-"]
  61029. },
  61030. d = function d(e) {
  61031. return c[e];
  61032. },
  61033. v = function v(e) {
  61034. if (!e) throw "Missing Style name";
  61035. c[e] && delete c[e];
  61036. },
  61037. m = function m(t, i) {
  61038. if (!t) throw "Missing Style name";
  61039. if (!i) throw "Missing Style definition";
  61040. if (!i.html) throw "Missing Style HTML";
  61041. var s = c[t];
  61042. s && s.cssElem && (window.console && console.warn(n + ": overwriting style '" + t + "'"), c[t].cssElem.remove()), i.name = t, c[t] = i;
  61043. var o = "";
  61044. i.classes && e.each(i.classes, function (t, n) {
  61045. return o += "." + r + "-" + i.name + "-" + t + " {\n", e.each(n, function (t, n) {
  61046. return p[t] && e.each(p[t], function (e, r) {
  61047. return o += " " + r + t + ": " + n + ";\n";
  61048. }), o += " " + t + ": " + n + ";\n";
  61049. }), o += "}\n";
  61050. }), i.css && (o += "/* styles for " + i.name + " */\n" + i.css), o && (i.cssElem = g(o), i.cssElem.attr("id", "notify-" + i.name));
  61051. var u = {},
  61052. a = e(i.html);
  61053. y("html", a, u), y("text", a, u), i.fields = u;
  61054. },
  61055. g = function g(t) {
  61056. var n, r, i;
  61057. r = x("style"), r.attr("type", "text/css"), e("head").append(r);
  61058. try {
  61059. r.html(t);
  61060. } catch (s) {
  61061. r[0].styleSheet.cssText = t;
  61062. }
  61063. return r;
  61064. },
  61065. y = function y(t, n, r) {
  61066. var s;
  61067. return t !== "html" && (t = "text"), s = "data-notify-" + t, b(n, "[" + s + "]").each(function () {
  61068. var n;
  61069. n = e(this).attr(s), n || (n = i), r[n] = t;
  61070. });
  61071. },
  61072. b = function b(e, t) {
  61073. return e.is(t) ? e : e.find(t);
  61074. },
  61075. w = {
  61076. clickToHide: !0,
  61077. autoHide: !0,
  61078. autoHideDelay: 5e3,
  61079. arrowShow: !0,
  61080. arrowSize: 5,
  61081. breakNewLines: !0,
  61082. elementPosition: "bottom",
  61083. globalPosition: "top right",
  61084. style: "bootstrap",
  61085. className: "error",
  61086. showAnimation: "slideDown",
  61087. showDuration: 400,
  61088. hideAnimation: "slideUp",
  61089. hideDuration: 200,
  61090. gap: 5
  61091. },
  61092. E = function E(t, n) {
  61093. var r;
  61094. return r = function r() {}, r.prototype = t, e.extend(!0, new r(), n);
  61095. },
  61096. S = function S(t) {
  61097. return e.extend(w, t);
  61098. },
  61099. x = function x(t) {
  61100. return e("<" + t + "></" + t + ">");
  61101. },
  61102. T = {},
  61103. N = function N(t) {
  61104. var n;
  61105. return t.is("[type=radio]") && (n = t.parents("form:first").find("[type=radio]").filter(function (n, r) {
  61106. return e(r).attr("name") === t.attr("name");
  61107. }), t = n.first()), t;
  61108. },
  61109. C = function C(e, t, n) {
  61110. var r, i;
  61111. if (typeof n == "string") n = parseInt(n, 10);else if (typeof n != "number") return;
  61112. if (isNaN(n)) return;
  61113. 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;
  61114. },
  61115. k = function k(e, t, n) {
  61116. if (e === "l" || e === "t") return 0;
  61117. if (e === "c" || e === "m") return n / 2 - t / 2;
  61118. if (e === "r" || e === "b") return n - t;
  61119. throw "Invalid alignment";
  61120. },
  61121. L = function L(e) {
  61122. return L.e = L.e || x("div"), L.e.text(e).html();
  61123. };
  61124. A.prototype.loadHTML = function () {
  61125. var t;
  61126. t = this.getStyle(), this.userContainer = e(t.html), this.userFields = t.fields;
  61127. }, A.prototype.show = function (e, t) {
  61128. var n, r, i, s, o;
  61129. r = function (n) {
  61130. return function () {
  61131. !e && !n.elem && n.destroy();
  61132. if (t) return t();
  61133. };
  61134. }(this), o = this.container.parent().parents(":hidden").length > 0, i = this.container.add(this.arrow), n = [];
  61135. 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 {
  61136. if (!!o || !!e) return r();
  61137. s = this.options.hideAnimation, n.push(this.options.hideDuration);
  61138. }
  61139. return n.push(r), i[s].apply(i, n);
  61140. }, A.prototype.setGlobalPosition = function () {
  61141. var t = this.getPosition(),
  61142. n = t[0],
  61143. i = t[1],
  61144. o = s[n],
  61145. u = s[i],
  61146. a = n + "|" + i,
  61147. f = T[a];
  61148. if (!f || !document.body.contains(f[0])) {
  61149. f = T[a] = x("div");
  61150. var l = {};
  61151. 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);
  61152. }
  61153. return f.prepend(this.wrapper);
  61154. }, A.prototype.setElementPosition = function () {
  61155. 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;
  61156. 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"];
  61157. for (w = 0, S = B.length; w < S; w++) {
  61158. D = B[w], N = parseInt(this.elem.css("margin-" + D), 10), N && C(p, D, N);
  61159. }
  61160. b = Math.max(0, this.options.gap - (this.options.arrowShow ? i : 0)), C(p, A, b);
  61161. if (!this.options.arrowShow) this.arrow.hide();else {
  61162. 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";
  61163. for (E = 0, x = a.length; E < x; E++) {
  61164. D = a[E], P = s[D];
  61165. if (D === L) continue;
  61166. l = P === T ? n : "transparent", r["border-" + P] = i + "px solid " + l;
  61167. }
  61168. C(p, s[L], i), t.call(a, O) >= 0 && C(r, s[O], i * 2);
  61169. }
  61170. 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);
  61171. if (r) return this.arrow.removeAttr("style").css(r);
  61172. }, A.prototype.getPosition = function () {
  61173. var e, n, r, i, s, f, c, h;
  61174. h = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition), e = l(h), e.length === 0 && (e[0] = "b");
  61175. if (n = e[0], t.call(a, n) < 0) throw "Must be one of [" + a + "]";
  61176. 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";
  61177. return e.length === 2 && (e[2] = e[1]), e;
  61178. }, A.prototype.getStyle = function (e) {
  61179. var t;
  61180. e || (e = this.options.style), e || (e = "default"), t = c[e];
  61181. if (!t) throw "Missing style: " + e;
  61182. return t;
  61183. }, A.prototype.updateClasses = function () {
  61184. var t, n;
  61185. 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) {
  61186. return r + "-" + n.name + "-" + e;
  61187. }).join(" "), this.userContainer.attr("class", t);
  61188. }, A.prototype.run = function (t, n) {
  61189. var r, s, o, u, a;
  61190. e.isPlainObject(n) ? e.extend(this.options, n) : e.type(n) === "string" && (this.options.className = n);
  61191. if (this.container && !t) {
  61192. this.show(!1);
  61193. return;
  61194. }
  61195. if (!this.container && !t) return;
  61196. s = {}, e.isPlainObject(t) ? s = t : s[i] = t;
  61197. for (o in s) {
  61198. r = s[o], u = this.userFields[o];
  61199. if (!u) continue;
  61200. 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);
  61201. }
  61202. 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));
  61203. }, A.prototype.destroy = function () {
  61204. this.wrapper.data(r, null), this.wrapper.remove();
  61205. }, e[n] = function (t, r, i) {
  61206. return t && t.nodeName || t.jquery ? e(t)[n](r, i) : (i = r, r = t, new A(null, r, i)), t;
  61207. }, e.fn[n] = function (t, n) {
  61208. return e(this).each(function () {
  61209. var i = N(e(this)).data(r);
  61210. i && i.destroy();
  61211. var s = new A(e(this), t, n);
  61212. }), this;
  61213. }, e.extend(e[n], {
  61214. defaults: S,
  61215. addStyle: m,
  61216. removeStyle: v,
  61217. pluginOptions: w,
  61218. getStyle: d,
  61219. insertCSS: g
  61220. }), m("bootstrap", {
  61221. html: "<div>\n<span data-notify-text></span>\n</div>",
  61222. classes: {
  61223. base: {
  61224. "font-weight": "bold",
  61225. padding: "8px 15px 8px 14px",
  61226. "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
  61227. "background-color": "#fcf8e3",
  61228. border: "1px solid #fbeed5",
  61229. "border-radius": "4px",
  61230. "white-space": "nowrap",
  61231. "padding-left": "25px",
  61232. "background-repeat": "no-repeat",
  61233. "background-position": "3px 7px"
  61234. },
  61235. error: {
  61236. color: "#B94A48",
  61237. "background-color": "#F2DEDE",
  61238. "border-color": "#EED3D7",
  61239. "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=)"
  61240. },
  61241. success: {
  61242. color: "#468847",
  61243. "background-color": "#DFF0D8",
  61244. "border-color": "#D6E9C6",
  61245. "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==)"
  61246. },
  61247. info: {
  61248. color: "#3A87AD",
  61249. "background-color": "#D9EDF7",
  61250. "border-color": "#BCE8F1",
  61251. "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=)"
  61252. },
  61253. warn: {
  61254. color: "#C09853",
  61255. "background-color": "#FCF8E3",
  61256. "border-color": "#FBEED5",
  61257. "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)"
  61258. }
  61259. }
  61260. }), e(function () {
  61261. g(h.css).attr("id", "core-notify"), e(document).on("click", "." + r + "-hidable", function (t) {
  61262. e(this).trigger("notify-hide");
  61263. }), e(document).on("notify-hide", "." + r + "-wrapper", function (t) {
  61264. var n = e(this).data(r);
  61265. n && n.show(!1);
  61266. });
  61267. });
  61268. });
  61269. /***/ }),
  61270. /***/ "./resources/js/views/App.vue":
  61271. /*!************************************!*\
  61272. !*** ./resources/js/views/App.vue ***!
  61273. \************************************/
  61274. /*! exports provided: default */
  61275. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61276. "use strict";
  61277. __webpack_require__.r(__webpack_exports__);
  61278. /* harmony import */ var _App_vue_vue_type_template_id_91ac6b5c___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./App.vue?vue&type=template&id=91ac6b5c& */ "./resources/js/views/App.vue?vue&type=template&id=91ac6b5c&");
  61279. /* harmony import */ var _App_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./App.vue?vue&type=script&lang=js& */ "./resources/js/views/App.vue?vue&type=script&lang=js&");
  61280. /* 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");
  61281. /* normalize component */
  61282. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  61283. _App_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61284. _App_vue_vue_type_template_id_91ac6b5c___WEBPACK_IMPORTED_MODULE_0__["render"],
  61285. _App_vue_vue_type_template_id_91ac6b5c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61286. false,
  61287. null,
  61288. null,
  61289. null
  61290. )
  61291. /* hot reload */
  61292. if (false) { var api; }
  61293. component.options.__file = "resources/js/views/App.vue"
  61294. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61295. /***/ }),
  61296. /***/ "./resources/js/views/App.vue?vue&type=script&lang=js&":
  61297. /*!*************************************************************!*\
  61298. !*** ./resources/js/views/App.vue?vue&type=script&lang=js& ***!
  61299. \*************************************************************/
  61300. /*! exports provided: default */
  61301. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61302. "use strict";
  61303. __webpack_require__.r(__webpack_exports__);
  61304. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_App_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!./App.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/App.vue?vue&type=script&lang=js&");
  61305. /* 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_App_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  61306. /***/ }),
  61307. /***/ "./resources/js/views/App.vue?vue&type=template&id=91ac6b5c&":
  61308. /*!*******************************************************************!*\
  61309. !*** ./resources/js/views/App.vue?vue&type=template&id=91ac6b5c& ***!
  61310. \*******************************************************************/
  61311. /*! exports provided: render, staticRenderFns */
  61312. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61313. "use strict";
  61314. __webpack_require__.r(__webpack_exports__);
  61315. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_App_vue_vue_type_template_id_91ac6b5c___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!./App.vue?vue&type=template&id=91ac6b5c& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/App.vue?vue&type=template&id=91ac6b5c&");
  61316. /* 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_App_vue_vue_type_template_id_91ac6b5c___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  61317. /* 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_App_vue_vue_type_template_id_91ac6b5c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  61318. /***/ }),
  61319. /***/ "./resources/js/views/Dashboard.vue":
  61320. /*!******************************************!*\
  61321. !*** ./resources/js/views/Dashboard.vue ***!
  61322. \******************************************/
  61323. /*! exports provided: default */
  61324. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61325. "use strict";
  61326. __webpack_require__.r(__webpack_exports__);
  61327. /* harmony import */ var _Dashboard_vue_vue_type_template_id_1f79daf6___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Dashboard.vue?vue&type=template&id=1f79daf6& */ "./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6&");
  61328. /* harmony import */ var _Dashboard_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Dashboard.vue?vue&type=script&lang=js& */ "./resources/js/views/Dashboard.vue?vue&type=script&lang=js&");
  61329. /* 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");
  61330. /* normalize component */
  61331. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  61332. _Dashboard_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61333. _Dashboard_vue_vue_type_template_id_1f79daf6___WEBPACK_IMPORTED_MODULE_0__["render"],
  61334. _Dashboard_vue_vue_type_template_id_1f79daf6___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61335. false,
  61336. null,
  61337. null,
  61338. null
  61339. )
  61340. /* hot reload */
  61341. if (false) { var api; }
  61342. component.options.__file = "resources/js/views/Dashboard.vue"
  61343. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61344. /***/ }),
  61345. /***/ "./resources/js/views/Dashboard.vue?vue&type=script&lang=js&":
  61346. /*!*******************************************************************!*\
  61347. !*** ./resources/js/views/Dashboard.vue?vue&type=script&lang=js& ***!
  61348. \*******************************************************************/
  61349. /*! exports provided: default */
  61350. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61351. "use strict";
  61352. __webpack_require__.r(__webpack_exports__);
  61353. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Dashboard_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!./Dashboard.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Dashboard.vue?vue&type=script&lang=js&");
  61354. /* 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_Dashboard_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  61355. /***/ }),
  61356. /***/ "./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6&":
  61357. /*!*************************************************************************!*\
  61358. !*** ./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6& ***!
  61359. \*************************************************************************/
  61360. /*! exports provided: render, staticRenderFns */
  61361. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61362. "use strict";
  61363. __webpack_require__.r(__webpack_exports__);
  61364. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_Dashboard_vue_vue_type_template_id_1f79daf6___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!./Dashboard.vue?vue&type=template&id=1f79daf6& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6&");
  61365. /* 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_Dashboard_vue_vue_type_template_id_1f79daf6___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  61366. /* 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_Dashboard_vue_vue_type_template_id_1f79daf6___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  61367. /***/ }),
  61368. /***/ "./resources/js/views/Login.vue":
  61369. /*!**************************************!*\
  61370. !*** ./resources/js/views/Login.vue ***!
  61371. \**************************************/
  61372. /*! exports provided: default */
  61373. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61374. "use strict";
  61375. __webpack_require__.r(__webpack_exports__);
  61376. /* harmony import */ var _Login_vue_vue_type_template_id_12f5395a___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Login.vue?vue&type=template&id=12f5395a& */ "./resources/js/views/Login.vue?vue&type=template&id=12f5395a&");
  61377. /* harmony import */ var _Login_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Login.vue?vue&type=script&lang=js& */ "./resources/js/views/Login.vue?vue&type=script&lang=js&");
  61378. /* 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");
  61379. /* normalize component */
  61380. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  61381. _Login_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61382. _Login_vue_vue_type_template_id_12f5395a___WEBPACK_IMPORTED_MODULE_0__["render"],
  61383. _Login_vue_vue_type_template_id_12f5395a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61384. false,
  61385. null,
  61386. null,
  61387. null
  61388. )
  61389. /* hot reload */
  61390. if (false) { var api; }
  61391. component.options.__file = "resources/js/views/Login.vue"
  61392. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61393. /***/ }),
  61394. /***/ "./resources/js/views/Login.vue?vue&type=script&lang=js&":
  61395. /*!***************************************************************!*\
  61396. !*** ./resources/js/views/Login.vue?vue&type=script&lang=js& ***!
  61397. \***************************************************************/
  61398. /*! exports provided: default */
  61399. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61400. "use strict";
  61401. __webpack_require__.r(__webpack_exports__);
  61402. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Login_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!./Login.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Login.vue?vue&type=script&lang=js&");
  61403. /* 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_Login_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  61404. /***/ }),
  61405. /***/ "./resources/js/views/Login.vue?vue&type=template&id=12f5395a&":
  61406. /*!*********************************************************************!*\
  61407. !*** ./resources/js/views/Login.vue?vue&type=template&id=12f5395a& ***!
  61408. \*********************************************************************/
  61409. /*! exports provided: render, staticRenderFns */
  61410. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61411. "use strict";
  61412. __webpack_require__.r(__webpack_exports__);
  61413. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_Login_vue_vue_type_template_id_12f5395a___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!./Login.vue?vue&type=template&id=12f5395a& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Login.vue?vue&type=template&id=12f5395a&");
  61414. /* 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_Login_vue_vue_type_template_id_12f5395a___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  61415. /* 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_Login_vue_vue_type_template_id_12f5395a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  61416. /***/ }),
  61417. /***/ "./resources/js/views/Welcome.vue":
  61418. /*!****************************************!*\
  61419. !*** ./resources/js/views/Welcome.vue ***!
  61420. \****************************************/
  61421. /*! exports provided: default */
  61422. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61423. "use strict";
  61424. __webpack_require__.r(__webpack_exports__);
  61425. /* harmony import */ var _Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true& */ "./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true&");
  61426. /* harmony import */ var _Welcome_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Welcome.vue?vue&type=script&lang=js& */ "./resources/js/views/Welcome.vue?vue&type=script&lang=js&");
  61427. /* empty/unused harmony star reexport *//* harmony import */ var _Welcome_vue_vue_type_style_index_0_id_1ae8ae93_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css& */ "./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css&");
  61428. /* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");
  61429. /* normalize component */
  61430. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__["default"])(
  61431. _Welcome_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61432. _Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"],
  61433. _Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61434. false,
  61435. null,
  61436. "1ae8ae93",
  61437. null
  61438. )
  61439. /* hot reload */
  61440. if (false) { var api; }
  61441. component.options.__file = "resources/js/views/Welcome.vue"
  61442. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61443. /***/ }),
  61444. /***/ "./resources/js/views/Welcome.vue?vue&type=script&lang=js&":
  61445. /*!*****************************************************************!*\
  61446. !*** ./resources/js/views/Welcome.vue?vue&type=script&lang=js& ***!
  61447. \*****************************************************************/
  61448. /*! exports provided: default */
  61449. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61450. "use strict";
  61451. __webpack_require__.r(__webpack_exports__);
  61452. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Welcome_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!./Welcome.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.vue?vue&type=script&lang=js&");
  61453. /* 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_Welcome_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  61454. /***/ }),
  61455. /***/ "./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css&":
  61456. /*!*************************************************************************************************!*\
  61457. !*** ./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css& ***!
  61458. \*************************************************************************************************/
  61459. /*! no static exports found */
  61460. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61461. "use strict";
  61462. __webpack_require__.r(__webpack_exports__);
  61463. /* harmony import */ var _node_modules_style_loader_index_js_node_modules_css_loader_index_js_ref_6_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_2_node_modules_vue_loader_lib_index_js_vue_loader_options_Welcome_vue_vue_type_style_index_0_id_1ae8ae93_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/style-loader!../../../node_modules/css-loader??ref--6-1!../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../node_modules/postcss-loader/src??ref--6-2!../../../node_modules/vue-loader/lib??vue-loader-options!./Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css& */ "./node_modules/style-loader/index.js!./node_modules/css-loader/index.js?!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css&");
  61464. /* harmony import */ var _node_modules_style_loader_index_js_node_modules_css_loader_index_js_ref_6_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_2_node_modules_vue_loader_lib_index_js_vue_loader_options_Welcome_vue_vue_type_style_index_0_id_1ae8ae93_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_index_js_node_modules_css_loader_index_js_ref_6_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_2_node_modules_vue_loader_lib_index_js_vue_loader_options_Welcome_vue_vue_type_style_index_0_id_1ae8ae93_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0__);
  61465. /* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _node_modules_style_loader_index_js_node_modules_css_loader_index_js_ref_6_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_2_node_modules_vue_loader_lib_index_js_vue_loader_options_Welcome_vue_vue_type_style_index_0_id_1ae8ae93_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== 'default') (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _node_modules_style_loader_index_js_node_modules_css_loader_index_js_ref_6_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_2_node_modules_vue_loader_lib_index_js_vue_loader_options_Welcome_vue_vue_type_style_index_0_id_1ae8ae93_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__));
  61466. /* harmony default export */ __webpack_exports__["default"] = (_node_modules_style_loader_index_js_node_modules_css_loader_index_js_ref_6_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_2_node_modules_vue_loader_lib_index_js_vue_loader_options_Welcome_vue_vue_type_style_index_0_id_1ae8ae93_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0___default.a);
  61467. /***/ }),
  61468. /***/ "./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true&":
  61469. /*!***********************************************************************************!*\
  61470. !*** ./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true& ***!
  61471. \***********************************************************************************/
  61472. /*! exports provided: render, staticRenderFns */
  61473. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61474. "use strict";
  61475. __webpack_require__.r(__webpack_exports__);
  61476. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___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!./Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true&");
  61477. /* 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_Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  61478. /* 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_Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  61479. /***/ }),
  61480. /***/ "./resources/js/views/WorkOrder.vue":
  61481. /*!******************************************!*\
  61482. !*** ./resources/js/views/WorkOrder.vue ***!
  61483. \******************************************/
  61484. /*! exports provided: default */
  61485. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61486. "use strict";
  61487. __webpack_require__.r(__webpack_exports__);
  61488. /* harmony import */ var _WorkOrder_vue_vue_type_template_id_17837e2e___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./WorkOrder.vue?vue&type=template&id=17837e2e& */ "./resources/js/views/WorkOrder.vue?vue&type=template&id=17837e2e&");
  61489. /* harmony import */ var _WorkOrder_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./WorkOrder.vue?vue&type=script&lang=js& */ "./resources/js/views/WorkOrder.vue?vue&type=script&lang=js&");
  61490. /* 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");
  61491. /* normalize component */
  61492. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  61493. _WorkOrder_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61494. _WorkOrder_vue_vue_type_template_id_17837e2e___WEBPACK_IMPORTED_MODULE_0__["render"],
  61495. _WorkOrder_vue_vue_type_template_id_17837e2e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61496. false,
  61497. null,
  61498. null,
  61499. null
  61500. )
  61501. /* hot reload */
  61502. if (false) { var api; }
  61503. component.options.__file = "resources/js/views/WorkOrder.vue"
  61504. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61505. /***/ }),
  61506. /***/ "./resources/js/views/WorkOrder.vue?vue&type=script&lang=js&":
  61507. /*!*******************************************************************!*\
  61508. !*** ./resources/js/views/WorkOrder.vue?vue&type=script&lang=js& ***!
  61509. \*******************************************************************/
  61510. /*! exports provided: default */
  61511. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61512. "use strict";
  61513. __webpack_require__.r(__webpack_exports__);
  61514. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_WorkOrder_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!./WorkOrder.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/WorkOrder.vue?vue&type=script&lang=js&");
  61515. /* 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_WorkOrder_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  61516. /***/ }),
  61517. /***/ "./resources/js/views/WorkOrder.vue?vue&type=template&id=17837e2e&":
  61518. /*!*************************************************************************!*\
  61519. !*** ./resources/js/views/WorkOrder.vue?vue&type=template&id=17837e2e& ***!
  61520. \*************************************************************************/
  61521. /*! exports provided: render, staticRenderFns */
  61522. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61523. "use strict";
  61524. __webpack_require__.r(__webpack_exports__);
  61525. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_WorkOrder_vue_vue_type_template_id_17837e2e___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!./WorkOrder.vue?vue&type=template&id=17837e2e& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/WorkOrder.vue?vue&type=template&id=17837e2e&");
  61526. /* 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_WorkOrder_vue_vue_type_template_id_17837e2e___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  61527. /* 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_WorkOrder_vue_vue_type_template_id_17837e2e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  61528. /***/ }),
  61529. /***/ "./resources/sass/app.scss":
  61530. /*!*********************************!*\
  61531. !*** ./resources/sass/app.scss ***!
  61532. \*********************************/
  61533. /*! no static exports found */
  61534. /***/ (function(module, exports) {
  61535. // removed by extract-text-webpack-plugin
  61536. /***/ }),
  61537. /***/ 0:
  61538. /*!*************************************************************!*\
  61539. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  61540. \*************************************************************/
  61541. /*! no static exports found */
  61542. /***/ (function(module, exports, __webpack_require__) {
  61543. __webpack_require__(/*! /home/vagrant/upccrt/resources/js/app.js */"./resources/js/app.js");
  61544. module.exports = __webpack_require__(/*! /home/vagrant/upccrt/resources/sass/app.scss */"./resources/sass/app.scss");
  61545. /***/ })
  61546. /******/ });